Assessing, Exploiting, and Mitigating Syntactic Robustness Failures in LLM-Based Code Generation
Laboni Sarker, Mara Downing, Achintya Desai, Tevfik Bultan

TL;DR
This paper evaluates the syntactic robustness of LLM-based code generation when handling mathematical formulas, identifies vulnerabilities, and proposes a pre-processing mitigation to improve robustness from 54% to 74%.
Contribution
It formalizes syntactic robustness in LLM code generation, assesses its vulnerabilities, and introduces a reduction-based pre-processing method to enhance robustness.
Findings
LLMs are not inherently robust to syntactic variations in formulas.
Attack strategies can further weaken LLM robustness.
Pre-processing formulas improves robustness from 54% to 74%.
Abstract
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
