What You See Is Not Always What You Get: Evaluating GPT's Comprehension of Source Code
Not on the map. Why?
Abstract (arXiv)
Recent studies have demonstrated outstanding capabilities of large language models (LLMs) in software engineering tasks, including code generation and comprehension. While LLMs have shown significant potential in assisting with coding, LLMs are vulnerable to adversarial attacks. In this paper, we investigate the vulnerability of LLMs to imperceptible attacks. This class of attacks manipulate source code at the character level, which renders the changes invisible to human reviewers yet effective in misleading LLMs' behaviour. We devise these attacks into four distinct categories and analyse their impacts on code analysis and comprehension tasks. These four types of imperceptible character attacks include coding reordering, invisible coding characters, code deletions, and code homoglyphs. To assess the robustness of state-of-the-art LLMs, we present a systematic evaluation across multiple models using both perturbed and clean code snippets. Two evaluation metrics, model confidence using log probabilities of response and response correctness, are introduced. The results reveal that LLMs are susceptible to imperceptible coding perturbations, with varying degrees of degradation highlighted across different LLMs. Furthermore, we observe a consistent negative correlation between perturbation magnitude and model performance. These results highlight the urgent need for robust LLMs capable of manoeuvring behaviours under imperceptible adversarial conditions.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 15 of its 38 references that are in the map. First posted on arXiv 11 Dec 2024.
Builds on
15 of 38 references.
References · 15
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2024LLM Evaluators Recognize and Favor Their Own Generationscited by 651
- 2020BERT-ATTACK: Adversarial Attack Against BERT Using BERTcited by 488
- 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 417
- 2022Do Users Write More Insecure Code with AI Assistants?cited by 186
- 2021Bad Characters: Imperceptible NLP Attackscited by 69
- 2023Large Language Models for Code Analysis: Do LLMs Really Do Their Job?cited by 44
- 2024Large Language Model for Vulnerability Detection: Emerging Results and Future Directionscited by 44
- 2023ChatGPT and Software Testing Education: Promises & Perilscited by 40
- 2023Investigating and Designing for Trust in AI-powered Code Generation Toolscited by 34
- 2024How Beginning Programmers and Code LLMs (Mis)read Each Othercited by 31
- 2023A Critical Review of Large Language Model on Software Engineering: An Example from ChatGPT and Automated Program Repaircited by 29
3 more
- 2023How do humans perceive adversarial text? A reality check on the validity and naturalness of word-based adversarial attackscited by 18
- 2022On The Empirical Effectiveness of Unrealistic Adversarial Hardening Against Realistic Adversarial Attackscited by 15
- 2021Effective and Imperceptible Adversarial Textual Attack via Multi-objectivizationcited by 5
Built on by
Citing papers per year: 2025: 1.
1 paper.