On Code-Induced Reasoning in LLMs
Abdul Waheed, Zhen Wu, Carolyn Rose, Daphne Ippolito
Abstract
Code data has been shown to enhance the reasoning capabilities of large language models (LLMs), but it remains unclear which aspects of code are most responsible. We investigate this question with a systematic, data-centric framework. We construct parallel instruction datasets across ten programming languages and introduce controlled perturbations that selectively disrupt structural and semantic properties of code. We then fine-tune LLMs from five model families and eight scales on each variant and evaluate their performance on natural language, math, and code tasks. Across 3,331 experiments, our results show that LLMs are more vulnerable to structural perturbations than semantic ones, particularly on math and code tasks. Appropriate abstractions like pseudocode and flowcharts can be as effective as code, while encoding the same information with fewer tokens without adhering to original syntax can often retain or even improve performance. Notably, even corrupted code with misleading signals remains competitive when surface-level regularities persist. Finally, syntactic styles also shape task-specific gains, with Python favoring natural language reasoning and lower-level languages such as Java and Rust favoring math. Through our systematic framework, we provide a fine-grained analysis of how different aspects of code influence reasoning and inform the design of training data for enhancing LLM reasoning capabilities.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext b43a1f36-fe16-44b5-b496-a006e2fc5374Builds on9
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Measuring Massive Multitask Language UnderstandingDan Hendrycks, Collin Burns, Steven Basart, Andy Zou et al.ICLR 2021 · 7,905 citations
- Deduplicating Training Data Makes Language Models BetterKatherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang et al.ACL 2022 · 844 citations
- ZeRO-Offload: Democratizing Billion-Scale Model TrainingJie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase et al.USENIX ATC 2021 · 657 citations
- At Which Training Stage Does Code Data Help LLMs Reasoning?Yingwei Ma, Yue Liu, Yue Yu, Yuanliang Zhang et al.ICLR 2024 · 106 citations
Related papers
- When Do Program-of-Thought Works for Reasoning?Zhen Bi, Ningyu Zhang, Yinuo Jiang, Shumin Deng et al.AAAI 2024
- To Code or Not To Code? Exploring Impact of Code in Pre-trainingViraat Aryabumi, Yixuan Su, Raymond Ma, Adrien Morisot et al.ICLR 2025 · 3 citations
- Unveiling the Impact of Coding Data Instruction Fine-Tuning on Large Language Models ReasoningXinlu Zhang, Zhiyu Zoey Chen, Xi Ye, Xianjun Yang et al.AAAI 2025 · 40 citations
- Procedural Pretraining: Warming Up Language Models with Abstract DataLiangze Jiang, Zachary Shinnick, Anton Hengel, Hemanth Saratchandran et al.ICML 2026 · 6 citations
- What Really Improves Mathematical Reasoning: Structured Reasoning Signals Beyond Pure CodeYuze Zhao, Junpeng Fang, Lu Yu, Zhenya Huang et al.ICML 2026 · 1 citation
