Lune

ICLR2024Top-tier venue

At Which Training Stage Does Code Data Help LLMs Reasoning?

Yingwei Ma, Yue Liu, Yue Yu, Yuanliang Zhang, Yu Jiang, Changjian Wang, Shanshan Li

Abstract

Large Language Models (LLMs) have exhibited remarkable reasoning capabilities and become the foundation of language technologies. Inspired by the great success of code data in training LLMs, we naturally wonder at which training stage introducing code data can really help LLMs reasoning. To this end, this paper systematically explores the impact of code data on LLMs at different stages. Concretely, we introduce the code data at the pre-training stage, instruction-tuning stage, and both of them, respectively. Then, the reasoning capability of LLMs is comprehensively and fairly evaluated via six reasoning tasks in five domains. We critically analyze the experimental results and provide conclusions with insights. First, pre-training LLMs with the mixture of code and text can significantly enhance LLMs' general reasoning capability almost without negative transfer on other tasks. Besides, at the instruction-tuning stage, code data endows LLMs the task-specific reasoning capability. Moreover, the dynamic mixing strategy of code and text data assists LLMs to learn reasoning capability step-by-step during training. These insights deepen the understanding of LLMs regarding reasoning ability for their application, such as scientific question answering, legal support, etc. The source code and model parameters are released at the link: https://github.com/yingweima2022/CodeLLM.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

27 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Understanding Catastrophic Forgetting in Language Models via Implicit Inference cites Training language models to follow instructions with human feedback
  • Enhancing Reasoning Capabilities of LLMs via Principled Synthetic Logic Corpus cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Not All Tokens Are What You Need for Pretraining cites Language Models are Few-Shot Learners
  • Not All Tokens Are What You Need for Pretraining cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Not All Tokens Are What You Need for Pretraining cites Training language models to follow instructions with human feedback
  • Iteration Head: A Mechanistic Study of Chain-of-Thought cites Language Models are Few-Shot Learners
  • Iteration Head: A Mechanistic Study of Chain-of-Thought cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Chain-of-Thought Prompting Elicits Reasoning in Large Language Models cites Training language models to follow instructions with human feedback
  • Training language models to follow instructions with human feedback cites Language Models are Few-Shot Learners
  • GuardReasoner-VL: Safeguarding VLMs via Reinforced Reasoning cites Training language models to follow instructions with human feedback
  • Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering cites Language Models are Few-Shot Learners
  • Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question Answering cites Training language models to follow instructions with human feedback
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers27

  1. Understanding Catastrophic Forgetting in Language Models via Implicit InferenceSuhas Kotha, Jacob Mitchell Springer, Aditi RaghunathanICLR 2024 · 131 citations
  2. Not All Tokens Are What You Need for PretrainingZhenghao Lin, Zhibin Gou, Yeyun Gong, Xiao Liu et al.NeurIPS 2024 · 99 citations
  3. Enhancing Reasoning Capabilities of LLMs via Principled Synthetic Logic CorpusTerufumi Morishita, Gaku Morio, Atsuki Yamaguchi, Yasuhiro SogawaNeurIPS 2024 · 60 citations
  4. Iteration Head: A Mechanistic Study of Chain-of-ThoughtVivien Cabannes, Charles Arnal, Wassim Bouaziz, Xingyu Yang et al.NeurIPS 2024 · 44 citations
  5. GuardReasoner-VL: Safeguarding VLMs via Reinforced ReasoningYue Liu, Shengfang Zhai, Mingzhe Du, Yulin Chen et al.NeurIPS 2025 · 40 citations

Builds on8

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
  3. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  4. Learn to Explain: Multimodal Reasoning via Thought Chains for Science Question AnsweringPan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu et al.NeurIPS 2022 · 2,727 citations
  5. JEC-QA: A Legal-Domain Question Answering DatasetHaoxi Zhong, Chaojun Xiao, Cunchao Tu, Tianyang Zhang et al.AAAI 2020 · 212 citations

Related papers

  1. 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
  2. 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
  3. Front-Loading Reasoning: The Synergy between Pretraining and Post-Training DataSyeda Nahida Akter, Shrimai Prabhumoye, Eric Nyberg, Mostofa Patwary et al.ICLR 2026 · 27 citations
  4. On Code-Induced Reasoning in LLMsAbdul Waheed, Zhen Wu, Carolyn Rose, Daphne IppolitoICLR 2026 · 6 citations
  5. Code to Think, Think to Code: A Survey on Code-Enhanced Reasoning and Reasoning-Driven Code Intelligence in LLMsDayu Yang, Tianyang Liu, Daoan Zhang, Antoine Simoulin et al.EMNLP 2025 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines