TL;DR
THINC (Thinking in Code) is a training framework that shifts Large Language Model (LLM) reasoning from error-prone natural language to executable Python code. By restricting natural language to a brief initial planning step and forcing all subsequent reasoning to happen within code blocks, THINC-4B outperforms much larger models (like the 235B parameter Qwen3-Thinking) on competition-level math benchmarks.
What Problem Does This Paper Address?
While models like OpenAI’s o1 and DeepSeek-R1 have made massive strides in reasoning, they still struggle with precision. A single arithmetic slip in a long chain of natural language (NL) thought can invalidate an entire solution.
Existing "Tool-Integrated Reasoning" (TIR) approaches try to fix this by letting models use a code interpreter. However, the authors identify three structural flaws in current TIR methods:
- Post-hoc Verification: The model solves the problem in NL first and only uses code to "double-check" the answer, meaning the interpreter adds no new reasoning.
- Unreliable NL Computation: Errors made during NL steps are often hard-coded into the subsequent code blocks, leading to "garbage in, garbage out."
- Misallocated Roles: NL and code often do the same work redundantly, failing to leverage the unique strengths of symbolic execution.
Methods
The authors propose THINC, a framework where code is the primary reasoner rather than just a tool.
A THINC trajectory follows a strict format: a single brief NL "strategy" block, followed by multiple code blocks connected only by their execution outputs. This forces the model to maintain its state and logic entirely within the programming environment.
The training process involves three stages:
- Trajectory Distillation: The authors used a 3-shot prompt to elicit 12.2k code-centric trajectories from a teacher model (Qwen3.5-27B).
- Supervised Fine-Tuning (SFT): Training student models (1.7B and 4B) on this distilled data to establish the "code-centric" behavior.
- Reinforcement Learning (RL): Using Group Relative Policy Optimization (GRPO) with verifiable rewards (checking if the final answer is correct). They employed a three-stage RL curriculum that gradually increased context length and problem difficulty.
Datasets
- Training: Problems were drawn from Skywork-OR1 and OpenMathReasoning, resulting in the THINC-SFT dataset of 12.2k trajectories.
- Evaluation: The models were tested on five high-difficulty math benchmarks: AIME 2024, 2025, 2026, HMMT 2025 February, and BeyondAIME.
- OOD Generalization: The authors also evaluated on GPQA-Diamond, a graduate-level science benchmark, to test out-of-distribution performance.
Key Insights and Ideas
- Code as the Medium of Thought: By removing the NL "crutch" between code blocks, the model is forced to use variables and functions to represent mathematical objects directly. This eliminates the "silent propagation" of NL arithmetic errors.
- Groundedness is Key: A staggering 99.2% of THINC-4B’s final answers are found directly in the interpreter's output. In contrast, many TIR baselines still "hallucinate" final answers in NL, bypassing the tool they were supposed to use.
- Robustness to Failure: Surprisingly, THINC is more robust to code errors. While interleaved models often collapse if their first code attempt fails, THINC can recover and refine its logic across multiple code turns without needing to drop back into NL reasoning.
- Efficiency over Scale: THINC-4B, a relatively small model, outperformed the 235B parameter Qwen3-Thinking model on 4 out of 5 math benchmarks, suggesting that how a model thinks is as important as how many parameters it has.
Key Results
- State-of-the-Art Performance: THINC-4B achieved an average accuracy of 78.1% across the math benchmarks, surpassing all TIR baselines and the much larger Qwen3-235B-Thinking (75.2%).
- Significant Gains: THINC-1.7B reached 42.8% accuracy, beating its base model by over 10 percentage points.
- RL Impact: RL was crucial for performance; while SFT established the format, RL provided the "benchmark gains," adding nearly 30 points to the 4B model's score.
Limitations and Future Work
- Model Scale: The experiments were limited to 1.7B and 4B parameter models due to computational constraints. It remains to be seen how this format scales to 70B+ models.
- Domain Specificity: The evaluation focused heavily on competition-level mathematics. The authors suggest that extending this code-centric format to other tool-integrated domains (like web search or database querying) is a natural next step.
- NL Planning: While the brief NL planning step is helpful, the paper does not deeply explore the optimal length or content of this initial "thought" block.
Summary updated