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

Jen-Tse Huang (Johns Hopkins University) · Chaozheng Wang (Department of Computer Science and Engineering, The Chinese University of Hong Kong) · Man Ho Lam (The Chinese University of Hong Kong) · Michael R Lyu (CUHK)
chain-of-thought reasoningcode reasoningcritical reasoning capabilitycruxevaldistractibilitylarge reasoning modelslivecodebenchpathological self-reflectionperturbationsrationalizationreasoning collapsereasoning reliabilitystress-testing frameworktoken consumption

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. 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.