Abstract
Tool-Integrated Reasoning (TIR) enables large language models (LLMs) to solve complex tasks by interacting with external tools, yet existing approaches depend on high-quality synthesized trajectories selected by scoring functions and sparse outcome-based rewards, providing limited and biased supervision for learning TIR. To address these challenges, in this paper, we propose AutoTraj, a two-stage framework that automatically learns TIR by repairing and rewarding tool-use trajectories. Specifically, in the supervised fine-tuning (SFT) stage, AutoTraj generates multiple candidate tool-use trajectories for each query and evaluates them along multiple dimensions. High-quality trajectories are directly retained, while low-quality ones are repaired using a LLM (i.e., LLM-as-Repairer). The resulting repaired and high-quality trajectories form a synthetic SFT dataset, while each repaired trajectory paired with its original low-quality counterpart constitutes a dataset for trajectory preference modeling. In the reinforcement learning (RL) stage, based on the preference dataset, we train a trajectory-level reward model to assess the quality of reasoning paths and combine it with outcome and format rewards, thereby explicitly guiding the optimization toward reliable TIR behaviors. Experiments on real-world benchmarks demonstrate the effectiveness of AutoTraj in TIR.
Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities in reasoning, but complex real-world tasks often require interaction with external environments, such as executing code or querying databases. This paradigm, known as Tool-Integrated Reasoning (TIR), faces two primary bottlenecks in current training workflows. First, the "Synthesize-then-Filter" approach in Supervised Fine-Tuning (SFT) discards low-quality trajectories, leading to a loss of diverse reasoning patterns and informative negative examples. Second, Reinforcement Learning (RL) typically relies on sparse, outcome-based rewards (e.g., final answer correctness), which fails to provide granular feedback on the intermediate steps of tool usage. This can lead to models that achieve the right answer through flawed logic or redundant tool calls.
The AutoTraj Framework
AutoTraj addresses these limitations through a novel two-stage process that focuses on the quality and supervision of reasoning trajectories.
Stage 1: SFT via Trajectory Repair
Instead of discarding trajectories that fail evaluation criteria (such as correctness, reasoning confidence, or length), AutoTraj employs an LLM-as-Repairer. This component takes low-quality trajectories and attempts to fix logical errors, remove redundancies, or correct formatting.
- High-quality trajectories are retained as-is.
- Low-quality trajectories are repaired using the LLM-as-Repairer. The combination of these forms a robust SFT dataset. Crucially, the pairs of original (low-quality) and repaired (high-quality) trajectories provide a natural preference dataset for the subsequent RL stage.
Stage 2: Trajectory-Aware Reinforcement Learning
To overcome reward sparsity, AutoTraj introduces a Trajectory Reward Model (RM). This model is trained on the preference pairs generated in Stage 1 to distinguish between effective and ineffective reasoning paths. During RL, the model is optimized using Group Relative Policy Optimization (GRPO) with a composite reward signal:
- Format Reward: Ensures compliance with tool-calling syntax.
- Outcome Reward: Rewards correct final answers.
- Trajectory Reward: Provides dense feedback on the reasoning process itself.
Experimental Evaluation
We evaluated AutoTraj across nine benchmarks spanning mathematical reasoning (e.g., AIME, GSM8K) and knowledge-intensive tasks (e.g., HotpotQA, HLE).
Performance and Accuracy
AutoTraj consistently outperformed state-of-the-art TIR methods. As shown in the results table, it achieved an average accuracy of 34.38%, surpassing the baseline Tool-Star (31.98%) and RL-only methods like ToRL (26.90%). Notably, it showed significant gains in challenging benchmarks like AIME24 and HLE, where precise tool use is critical.
Reasoning Efficiency
One of the most striking results is AutoTraj's efficiency. By explicitly rewarding concise and logical trajectories, the model learns to avoid "over-thinking." The average trajectory length for AutoTraj was approximately 251 tokens, compared to over 1,000 tokens for Tool-Star and nearly 2,000 for ToRL. This represents a nearly 5x improvement in reasoning efficiency without sacrificing accuracy.
Conclusion
AutoTraj demonstrates that low-quality synthetic data is a valuable resource when properly repaired. By transforming "trash" into "treasure," the framework provides both diverse SFT data and the necessary signals for dense RL rewards. This approach not only improves the accuracy of Tool-Integrated Reasoning but also leads to more efficient and logical model behavior. Future work will explore multi-round repair strategies to further increase data utilization.
Summary updated