CodeCrash: Exposing LLM Fragility to Misleading Natural Language in Code Reasoning

Man Ho Lam, Chao-Zheng Wang, Jen-Tse Huang, Michael R. Lyu
4/1/2025
19 citations

No official code found. Best implementation: CUHK-ARISE/CodeCrash (18 stars).

Abstract

Large Language Models (LLMs) have recently demonstrated strong capabilities in code-related tasks, but their robustness in code reasoning under perturbations remains underexplored. We introduce CodeCrash, a stress-testing framework with 1,279 questions from CruxEval and LiveCodeBench, designed to evaluate reasoning reliability under structural perturbations and misleading natural language (NL) contexts.

Show full abstract

Through a systematic evaluation of 17 LLMs, we find that models often shortcut reasoning by over-relying on NL cues, leading to an average performance degradation of 23.2% in output prediction tasks. Even with Chain-of-Thought reasoning, models on average still have a 13.8% drop due to distractibility and rationalization, revealing a lack of critical reasoning capability to distinguish the actual code behaviors. While Large Reasoning Models with internal reasoning mechanisms improve robustness by fostering critical thinking, plausible yet incorrect hints can trigger pathological self-reflection, causing 2-3 times token consumption and even catastrophic cognitive dissonance in extreme cases for QwQ-32B. We refer to this phenomenon as Reasoning Collapse. CodeCrash provides a rigorous benchmark for evaluating robustness in code reasoning, guiding future research and development toward more reliable and resilient models.

View on arXivView PDF

Code Implementations(1)

[NeurIPS 2025] CodeCrash: Exposing LLM Fragility to Misleading Natural Language in Code Reasoning

182

Similar Papers

Cite this paper

@article{lam2025codecrash,
  title  = {CodeCrash: Exposing LLM Fragility to Misleading Natural Language in Code Reasoning},
  author = {Man Ho Lam and Chao-Zheng Wang and Jen-Tse Huang and Michael R. Lyu},
  year   = {2025},
  eprint = {2504.14119},
  archivePrefix = {arXiv},
  doi    = {10.52202/085713-4029},
  url    = {https://doi.org/10.52202/085713-4029},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2504.14119.svg)](https://codeofpaper.com/paper/2504.14119)

Discussion