Teaching Language Models to Think in Code
On the map: LLM reasoning → Reasoning for agents, planning and code
also in 1 more
Abstract (arXiv)
Tool-integrated reasoning (TIR) has emerged as a dominant paradigm for mathematical problem solving in language models, combining natural language (NL) reasoning with code execution. However, this interleaved setup has three key limitations: code often acts as a post-hoc verifier, intermediate NL computations are error-prone, and NL and code play overlapping rather than clearly distinct roles. We propose ThinC (Thinking in Code), a framework in which code itself serves as the reasoner rather than as a tool invoked by NL. A ThinC trajectory begins with a brief NL planning step, after which all reasoning unfolds through code blocks connected only by their execution outputs. We distill 12.2k code-centric trajectories from a teacher model and train ThinC-1.7B and ThinC-4B with supervised fine-tuning followed by reinforcement learning. ThinC-4B consistently outperforms every TIR baseline on five competition-level math benchmarks and even surpasses the much larger Qwen3-235B-A22B-Thinking. Further analysis shows that ThinC reasons through code: 99.2% of its final answers are grounded in interpreter output, and the model recovers reliably from code execution failures without intermediate NL reasoning. Our code and models will be released soon.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 19 of its 24 references that are in the map. First posted on arXiv 8 May 2026.
Builds on
19 of 24 references.
Closest ancestors · 6
Same direction, newest first
- 2026ASTER: Agentic Scaling with Tool-integrated Extended Reasoning1 Feb
- 2025Demystifying Reinforcement Learning in Agentic Reasoning13 Oct
- 2025Tool-Star: Empowering LLM-Brained Multi-Tool Reasoner via Reinforcement Learning22 May
- 2025ReTool: Reinforcement Learning for Strategic Tool Use in LLMs15 Apr
- 2025OpenCodeReasoning: Advancing Data Distillation for Competitive Coding2 Apr
- 2024OpenAI o1 System Card21 Dec
Other references · 13
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 8,851
- 2025Qwen3 Technical Reportcited by 8,195
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
- 2025DAPO: An Open-Source LLM Reinforcement Learning System at Scalecited by 2,678
- 2024HybridFlow: A Flexible and Efficient RLHF Frameworkcited by 1,980
- 2024LlamaFactory: Unified Efficient Fine-Tuning of 100+ Language Modelscited by 1,442
- 2025gpt-oss-120b & gpt-oss-20b Model Cardcited by 1,258
- 2022PAL: Program-aided Language Modelscited by 635
- 2025AIMO-2 Winning Solution: Building State-of-the-Art Mathematical Reasoning Models with OpenMathReasoning datasetcited by 165
- 2025Skywork Open Reasoner 1 Technical Reportcited by 161
- 2025Seed1.5-Thinking: Advancing Superb Reasoning Models with Reinforcement Learningcited by 159
- 2025rStar2-Agent: Agentic Reasoning Technical Reportcited by 54
1 more
- 2025Teaching Language Models to Reason with Toolscited by 5
Built on by
Citing papers per year: 2026: 1.
1 paper.
- 2026The Biomimetic Architecture of Software 4.0cited by 0
- 2026The Biomimetic Architecture of Software 4.01 Jun 2026
Similar, not cited
Close in wording, no citation either way
- 2026Think Multilingual, Not Harder: A Data-Efficient Framework for Teaching Reasoning Models to Code-Switch
- 2026Exploring Extrinsic and Intrinsic Properties for Effective Reasoning with Code Interpreter
- 2025CoRT: Code-integrated Reasoning within Thinking
- 2025To Code or not to Code? Adaptive Tool Integration for Math Language Models via Expectation-Maximization
- 2025Code-enabled language models can outperform reasoning models on diverse tasks
- 2026Is Code Better Than Language for Algorithmic Reasoning
- 2026What Really Improves Mathematical Reasoning: Structured Reasoning Signals Beyond Pure Code
- 2025Understanding Tool-Integrated Reasoning