TL;DR
When Large Language Models (LLMs) are trained with reinforcement learning to use external tools—like code interpreters—they eventually hit a wall: their internal uncertainty keeps rising while their actual reasoning accuracy stalls out. The culprits are "hallucination loops" of broken, redundant tool calls that flood the model's context with noise. By stepping in early during training to pull the plug on trajectories that rack up too many errors, the authors boost accuracy by over 13% while teaching models to solve problems with a third fewer tool calls.
What Problem Does This Paper Address?
Give an LLM a Python interpreter, and suddenly it doesn't have to guess at gnarly algebra or complex logic—it can write code, run it, and check its work. This paradigm is called Tool-Integrated Reasoning (TIR), and right now, the best way to teach it is through Agentic Reinforcement Learning (Agentic RL): letting the model interact with an environment over multiple turns and rewarding it when it gets the right verifiable answer.
In standard, text-only RL, there is a well-known rule of thumb regarding policy entropy (a measure of how uncertain or exploratory the model's token choices are): as accuracy goes up, entropy smoothly decays as the model becomes more confident. Nobody really knew if this held true when external tools were in the loop.
When the authors peeked inside the black box of TIR training, they found something weird. Early in training, entropy and accuracy rise together—a healthy phase of exploring how tools work. Later on, however, entropy–performance decoupling sets in: accuracy hits a flat plateau (or even drops), yet policy entropy keeps climbing skyward.
Why is the model getting more uncertain without getting any smarter? Because it gets trapped in error-retry loops. A failed tool call yields zero useful information, increasing the model's uncertainty, which triggers more broken tool calls, polluting the context window and stalling learning.
Methods
To break this vicious cycle, the authors build EarlyTIR on top of a standard RLVR (Reinforcement Learning with Verifiable Rewards) setup using the DAPO algorithm and a sandboxed Python interpreter.
While existing methods like SimpleTIR wait until an entire rollout is finished and then throw away bad trajectories offline, EarlyTIR intervenes online, mid-rollout:
- Rule-Based Sandbox Monitoring: As the model generates a reasoning path, the execution sandbox watches for four objective failure modes: execution errors (non-zero exit codes/stderr), timeouts, empty returns, and redundant commands (repeating the exact previous call).
- Tolerance Threshold ($\tau$): You don't want to punish every mistake—models learn valuable error-recovery skills by fixing an occasional bug. Instead, EarlyTIR allows a small budget of mistakes (default $\tau = 2$).
- Truncate and Penalize: The moment cumulative invalid calls exceed $\tau$, generation is immediately halted. Rather than discarding the rollout, EarlyTIR assigns it a mild negative reward ($R_t = -0.2$) and keeps it as a negative training sample. This saves the context window from filling up with garbage and explicitly teaches the policy not to spiral.
Datasets
The authors introduce no new benchmarks, relying instead on established, strictly verifiable math and coding datasets:
- Mathematics: Supervised fine-tuning (for Qwen2.5 models) uses ReTool-SFT, and RL training uses DAPO-Math-17k. Evaluation spans AIME 2024, AIME 2025, HMMT 2025, and AMO-Bench.
- Coding: RL training uses the DeepCoder dataset, evaluated on HumanEval and LiveCodeBench (v6).
Key Insights and Ideas
- Not all exploration is good exploration: In Qwen2.5-32B-Instruct, invalid calls stayed low and entropy rose right alongside accuracy. In models where invalid calls surged, entropy decoupled from accuracy (with a massive Spearman correlation of $\rho = 0.93$ between invalid-call ratios and terminal entropy). High entropy late in TIR training isn't creative exploration—it's confusion.
- The "Goldilocks Zone" of tool turns: Across models, reasoning accuracy peaks between 3 and 6 tool-call turns. Under 2 turns usually means the model didn't decompose the problem enough; past 10 turns, over 75% of tool calls are invalid hallucinations, and accuracy craters.
- Penalties alone don't work—you have to cut the mic: In an ablation study (No-Truncat), applying the exact same $-0.2$ penalty without stopping the rollout early barely beat the baseline (+1.24 points on AIME24 vs. EarlyTIR's +12.50). Letting noisy error logs linger in the context window ruins the gradient signal.
Key Results
Tested across Qwen2.5 (7B, 32B) and Qwen3 (8B, 32B) model families, EarlyTIR suppresses invalid calls to near zero during training and raises the performance ceiling:
- Math: EarlyTIR-32B hits a 54.22% macro-average across the four math benchmarks—a +13.63 point boost over the base Qwen3-32B model and +10.05 points over the strong ReTool baseline (reaching 82.50% on AIME24 and 69.58% on AIME25).
- Coding: EarlyTIR-32B reaches 94.02% on HumanEval (+4.08 over base) and 47.27% on LiveCodeBench (+4.52 over base), outperforming DeepCoder.
- Inference Efficiency: EarlyTIR-32B solves problems using 33.7% fewer tool calls on average than ReTool (e.g., dropping from 4.84 to 2.88 calls on AIME24). When the authors tried forcing ReTool to use fewer tools via a system prompt, ReTool's accuracy dropped by 4.73 points, proving EarlyTIR genuinely learned sharper tool habits rather than a superficial shortcut.
Limitations and Future Work
- Task-Dependent Thresholds: The optimal error tolerance $\tau$ isn't universal. While $\tau = 2$ worked best overall, $\tau = 4$ slightly edged it out on the harder AIME25 benchmark (70.00% vs. 69.58%), suggesting harder tasks benefit from a slightly larger error-recovery buffer. Developing adaptive thresholds that scale automatically with task difficulty is left for future work.
- Rule-Based False-Positive Risks: The invalid-call detector relies on deterministic sandbox rules (like flagging empty stdout as invalid). While an audit of 50 trajectories showed 100% precision in their Python math/coding setup, the authors acknowledge potential false-positive risks that could require care in broader tool environments.
Summary updated