mlsanityData to 14 Oct 2026

Are Large Language Models Robust in Understanding Code Against Semantics-Preserving Mutations?

arXiv 2505.10443 ↗First posted 15 May 2025cs.SE cs.AIcited by 7

Not on the map. Why?

Abstract (arXiv)

With the widespread adoption of vibe coding, understanding the reasoning and robustness of Large Language Models (LLMs) is critical for their reliable use in programming tasks. While recent studies assess LLMs' ability to predict program outputs, most focus on accuracy alone, without evaluating the underlying reasoning. Moreover, it has been observed on mathematical reasoning tasks that LLMs can arrive at correct answers through flawed logic, raising concerns about similar issues in code understanding. In this paper we assess whether state-of-the-art LLMs can reason about Python programs or are simply guessing. We apply five semantics-preserving code mutations: renaming variables, mirroring comparison expressions, swapping if-else branches, converting for loops to while, and loop unrolling. These mutations maintain program semantics while altering its syntax. We evaluated nine LLMs, including both open-source and closed-access models, and performed a human expert analysis using LiveCodeBench to assess whether correct predictions are based on sound reasoning. We also evaluated prediction stability across different code mutations on LiveCodeBench and CruxEval. While proprietary models achieve the strongest predictive accuracy and reasoning quality in the expert evaluation, our robustness analysis reveals substantial fragility under semantics-preserving transformations. Our findings show that LLMs trained for code produce correct predictions based on flawed reasoning in between 10% and 50% of cases. Furthermore, LLMs often change predictions in response to our code mutations, with performance drops reaching up to 70%, indicating that they do not yet exhibit stable, semantically grounded reasoning, even when initial accuracy is high.

Key facts. Cited by 7 papers in the map (data through 14 Oct 2026). Builds on 16 of its 30 references that are in the map. First posted on arXiv 15 May 2025.

Builds on

16 of 30 references.

References · 16

  1. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  2. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
  3. 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
  4. 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 300
  5. 2024CodeGemma: Open Code Models Based on Gemmacited by 150
  6. 2024Granite Code Models: A Family of Open Foundation Models for Code Intelligencecited by 117
  7. 2022ReCode: Robustness Evaluation of Code Generation Modelscited by 103
  8. 2023A Large-Scale Survey on the Usability of AI Programming Assistants: Successes and Challengescited by 75
  9. 2025Proof or Bluff? Evaluating LLMs on 2025 USA Math Olympiadcited by 74
  10. 2021Self-Supervised Bug Detection and Repaircited by 59
  11. 2020Semantic Robustness of Models of Source Codecited by 45
  12. 2024Logically Consistent Language Models via Neuro-Symbolic Integrationcited by 30
4 more
  1. 2023The Larger They Are, the Harder They Fail: Language Models do not Recognize Identifier Swaps in Pythoncited by 29
  2. 2024The Counterfeit Conundrum: Can Code Language Models Grasp the Nuances of Their Incorrect Generations?cited by 20
  3. 2023Poisoned ChatGPT Finds Work for Idle Hands: Exploring Developers' Coding Practices with Insecure Suggestions from Poisoned AI Modelscited by 17
  4. 2024Counterexample Guided Program Repair Using Zero-Shot Learning and MaxSAT-based Fault Localizationcited by 8

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 2; 2026: 5.

7 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025On Code-Induced Reasoning in LLMs
  2. 2026How Robustly do LLMs Understand Execution Semantics?
  3. 2026CodeEval: A pedagogical approach for targeted evaluation of code-trained Large Language Models
  4. 2025code_transformed: The Influence of Large Language Models on Code
  5. 2026Evaluating LLMs Code Reasoning Under Real-World Context
  6. 2024Assessing, Exploiting, and Mitigating Syntactic Robustness Failures in LLM-Based Code Generation
  7. 2025CodeCrash: Exposing LLM Fragility to Misleading Natural Language in Code Reasoning
  8. 2025Evaluating Code Reasoning Abilities of Large Language Models Under Real-World Settings