THINC: Why Your LLM Should Stop Talking and Start Coding

Teaching Language Models to Think in Code

Summary
Problem
Method
Results
Takeaways
Abstract

The paper introduces THINC (Thinking in Code), a training framework that shifts the paradigm of Tool-Integrated Reasoning (TIR) from "code-as-a-tool" to "code-as-a-reasoner." By distilling code-centric trajectories and applying RL with verifiable rewards, the 4B parameter model achieves state-of-the-art results on math benchmarks like AIME, surpassing even 235B dense models.

TL;DR

Researchers have developed THINC (Thinking in Code), a framework that forces Language Models to solve complex math problems almost exclusively through code. By restricting Natural Language (NL) to high-level planning and delegating all derivation to a Python interpreter, THINC-4B outperformed the massive Qwen3-235B model. It effectively eliminates arithmetic "hallucinations" and demonstrates unprecedented resilience to technical errors.

The Problem: The "Post-Hoc Verification" Trap

Current Tool-Integrated Reasoning (TIR) systems suffer from a personality crisis. When a model uses an interleaved NL and code approach, it often:

  1. Does the work twice: Explaining the logic in NL and then redundantly writing code to do the same.
  2. Lies to itself: Calculating an incorrect value in the NL thought process and "hard-coding" that mistake into the Python block.
  3. Laziness: Using code only to verify an answer it already guessed in text, rather than using code to discover the answer.

Structural limitations of interleaved TIR

Methodology: Code as the Primary Reasoner

The core insight of THINC is that code is a symbolic system perfectly aligned with mathematics. The researchers simplified the reasoning trajectory into a rigid pipeline:

  • t1 (Strategic Plan): A brief NL block to set the stage (e.g., "I will solve this via brute-force enumeration").
  • c1...cN (Reasoning Loop): A series of Python blocks connected only by execution outputs. There is no NL chatter between turns.

This architecture ensures that every intermediate value is verified by the interpreter. The model was trained in three stages: trajectory distillation from a teacher (Qwen3.5-27B), Supervised Fine-Tuning (SFT), and finally Reinforcement Learning using GRPO with verifiable rewards (checking the final answer against ground truth).

THINC vs Interleaved TIR

Performance: Small Model, Huge Brain

The results are a testimony to the power of specialized reasoning. THINC-4B didn't just beat its peers; it humiliated much larger models. On average, it achieved 78.1% accuracy on benchmarks like AIME and HMMT.

  • Efficiency: It requires fewer tool calls (6.1 vs 11.1 for ASTER) because it doesn't waste time "talking" about what it's going to do.
  • Grounding: A staggering 99.2% of its final answers were derived directly from code output. In contrast, many TIR baselines often "guess" the final answer in NL, skipping the interpreter's safety net.

AIME 2024 performance tracking

Robustness: The Recovery Power

One of the most striking findings is "Recovery@k." In typical models, if the first code block fails, the model enters a death spiral. THINC-4B, however, maintains high accuracy even after 3 consecutive code execution failures. Because it "thinks in code," it treats an error as just another variable to be debugged in the next block, rather than a narrative failure that requires an NL pivot.

Recovery under failure

Critical Insight & Future Outlook

THINC proves that for high-precision tasks, less English is more. By treating the Python interpreter as the engine of thought rather than a calculator, the model attains a level of "Inductive Bias" toward correctness that raw text-based Chain-of-Thought cannot match.

The limitation? It's currently restricted to math. The next frontier is whether this "code-as-reasoner" mindset can be applied to broader domains like chemistry, law, or strategic planning, where the "interpreter" might not be a Python shell, but a formal logic engine.

Find Similar Papers

Try Our Examples

  • Search for recent papers that use code-centric reasoning instead of interleaved natural language chain-of-thought for scientific or mathematical tasks.
  • Which paper first introduced the Group Relative Policy Optimization (GRPO) algorithm, and how does THINC's implementation of verifiable rewards differ from the original formulation?
  • Explore the application of the THINC framework to non-mathematical domains such as autonomous software engineering or complex multi-step logical reasoning in legal documents.
Contents
THINC: Why Your LLM Should Stop Talking and Start Coding
1. TL;DR
2. The Problem: The "Post-Hoc Verification" Trap
3. Methodology: Code as the Primary Reasoner
4. Performance: Small Model, Huge Brain
5. Robustness: The Recovery Power
6. Critical Insight & Future Outlook