Abstract
Large Reasoning Models (LRMs) often struggle to efficiently integrate external tools like Code Interpreters, leading to redundant calculations and "overthinking." This paper introduces CoRT, a post-training framework that uses "Hint-Engineering" to teach models exactly when and how to use code. By training on just 30 highly curated examples and applying reinforcement learning, CoRT significantly boosts mathematical accuracy while slashing token usage by up to 50%.
Introduction
Large Reasoning Models, such as OpenAI-o1 or DeepSeek-R1, utilize extensive Chain-of-Thought (CoT) processes to tackle complex problems. However, these models are often inefficient and inaccurate when performing precise mathematical computations purely in natural language. While providing access to a Code Interpreter (CI) is a logical solution, it frequently creates a conflict between internal probabilistic reasoning and external deterministic output.
The authors identify two primary symptoms of this conflict:
- Delayed Code Computation: Models often attempt complex mathematics in text first, using code only for later verification.
- Code Result Distrust: Models frequently waste tokens manually verifying Python calculations instead of trusting the CI output.
These behaviors result in massive, unproductive reasoning traces that consume token budgets without necessarily improving accuracy.
Methodology: CoRT and Hint-Engineering
To address these inefficiencies, the authors propose CoRT (Code-Optimized Reasoning Training), centered on a novel data synthesis strategy called Hint-Engineering.
The Hint-Engineering Approach
Instead of merely prompting a model to use Python, human annotators strategically inject specific hints into the reasoning trace to correct suboptimal habits. For instance, if a model begins tedious manual calculations, a hint like "It looks tedious, and we can use python code to simplify the reasoning" is injected. If the model expresses doubt about a CI output, the hint "We don't need to doubt the accuracy of python calculations" is used.
Training Pipeline
The CoRT pipeline is designed to scale across different model sizes:
- Frontier Models (32B): Initial training uses just 30 high-quality Hint-Engineered examples for Supervised Fine-Tuning (SFT). This is followed by Rejection Fine-Tuning (RFT) on a filtered dataset of 800 examples.
- Lightweight Models (1.5B): Capabilities are distilled from the 32B model into a 1.5B variant, followed by Reinforcement Learning (RL) using the GRPO algorithm. This stage employs a dual reward system that incentivizes correct answers while penalizing execution failures.
Experimental Setup
The framework was evaluated across several rigorous benchmarks:
- Mathematical Reasoning: AIME24, AIME25, AMC23, MATH500, and OlympiadBench.
- Out-of-Distribution (OOD): A subset of the GPQA benchmark focusing on Chemistry was used to test the generalization of tool-use strategies beyond mathematics.
Key Results
CoRT demonstrates that strategic tool integration can lead to both higher accuracy and greater efficiency.
Accuracy and Efficiency Gains
CoRT achieved absolute accuracy improvements of +4% on the 32B model and +8% on the 1.5B model across mathematical benchmarks. Crucially, this was achieved with a massive reduction in token usage: approximately 30% for the 32B model and 50% for the 1.5B model compared to pure natural language baselines.
Strategic Insights
- Quality Over Quantity: Only 30 meticulously crafted examples were required to instill efficient code-integration behaviors, suggesting that the strategic placement of hints is more critical than dataset volume.
- Shift from Verification to Calculation: Hint-Engineering successfully shifted model behavior from using code as a verification tool to using it for direct calculation from the outset.
- Spontaneous Tool Discovery: In OOD chemistry tests, the model spontaneously utilized the
RDKitlibrary—unseen during training—to solve problems. This indicates that CoRT teaches a generalizable problem-solving strategy rather than just specific syntax.
Discussion and Future Work
While successful, the authors note that full RL on 32B models remains computationally expensive. Furthermore, as LRM architectures evolve, specific hint-engineering tactics may require refinement. Future research will explore the synergy between LRMs and other external tools, such as search engines or automated theorem provers, to further expand the capabilities of general-purpose AI reasoning.
Summary updated