mlsanityData to 7 Oct 2026

Assessing, Exploiting, and Mitigating Syntactic Robustness Failures in LLM-Based Code Generation

arXiv 2404.01535 ↗First posted 1 Apr 2024cs.SEcited by 6

Not on the map. Why?

Abstract (arXiv)

Rapid advances in the field of Large Language Models (LLMs) have made LLM-based code generation an important area for investigation. An LLM-based code generator takes a prompt as input and produces code that implements the requirements specified in the prompt. Many software requirements include mathematical formulas that specify the expected behavior of the code to be generated. Given a code generation prompt that contains a mathematical formula, a reasonable expectation is that, if the formula is syntactically modified without changing its semantics, the generated code for the modified prompt should be semantically equivalent. We formalize this concept as syntactic robustness and investigate the syntactic robustness of LLMs as code generators. Our experimental assessment demonstrates that LLMs are not syntactically robust for code generation prompts with formulas, especially for the ones that require mathematical reasoning. We investigate attack strategies that can further deteriorate the syntactic robustness of LLMs. Finally, to mitigate syntactic robustness failures in LLMs, we propose a pre-processing step that uses reductions to transform formulas in prompts to a simplified form. Our experimental results demonstrate that the syntactic robustness of LLM-based code generation improves significantly using our approach, improving syntactic robustness of LLMs from 54.05% to 74.42%.

Key facts. Cited by 6 papers in the map (data through 7 Oct 2026). First posted on arXiv 1 Apr 2024.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 1; 2025: 3; 2026: 2.

6 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Are Large Language Models Robust in Understanding Code Against Semantics-Preserving Mutations?
  2. 2026Poster: Rethinking Security in LLM Code Generation through Real-World Risk Scenarios
  3. 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generation
  4. 2026Enhancing Reliability in LLM-Based Secure Code Generation
  5. 2023L2CEval: Evaluating Language-to-Code Generation Capabilities of Large Language Models
  6. 2026An Empirical Evaluation of LLM-Generated Code Security Across Prompting Methods
  7. 2026How Robustly do LLMs Understand Execution Semantics?
  8. 2025Towards Advancing Code Generation with Large Language Models: A Research Roadmap