Abstract
Effective tool use is essential for large language models (LLMs) to interact meaningfully with their environment. However, progress is limited by the lack of efficient reinforcement learning (RL) frameworks specifically designed for tool use, due to challenges in constructing stable training environments and designing verifiable reward mechanisms. To address this, we propose an automated environment construction pipeline, incorporating scenario decomposition, document generation, function integration, complexity scaling, and localized deployment. This enables the creation of high-quality training environments that provide detailed and measurable feedback without relying on external tools. Additionally, we introduce a verifiable reward mechanism that evaluates both the precision of tool use and the completeness of task execution. When combined with trajectory data collected from the constructed environments, this mechanism integrates seamlessly with standard RL algorithms to facilitate feedback-driven model training. Experiments on LLMs of varying scales demonstrate that our approach significantly enhances the models' tool-use performance without degrading their general capabilities, regardless of inference modes or training algorithms. Our analysis suggests that these gains result from improved context understanding and reasoning, driven by updates to the lower-layer MLP parameters in models.
Introduction
While Large Language Models (LLMs) have demonstrated remarkable cognitive abilities, their capacity to act as agents—interacting with external APIs and tools to solve complex, real-world problems—remains a significant challenge. Training models for tool use via Reinforcement Learning (RL) is considered the gold standard for improving decision-making. However, this approach is hindered by two primary obstacles: environment instability and reward sparsity. Real-world online APIs are often unstable, costly, and subject to rate limits, making them unsuitable for the high-iteration requirements of RL. Furthermore, providing precise feedback on tool-use trajectories is difficult, as traditional methods often rely on inconsistent "LLM-as-a-Judge" scoring.
Methodology: Automated Environment Construction
To overcome these hurdles, we propose a framework that constructs stable, locally executable training environments. This automated pipeline consists of five key stages:
- Scenario Decomposition: Complex queries are broken down into logical sub-tasks, ranging from simple single-hop questions to complex parallel multi-hop sequences.
- Document Generation: An LLM generates JSON schemas for tools specifically tailored to solve these sub-tasks.
- Function Integration: Overlapping functionalities are merged to streamline the toolset.
- Complexity Scaling: The environment is hardened by introducing "distractor" tools and complex parameter types to test model robustness.
- Localized Deployment: Tool definitions are converted into local Python code, ensuring 100% uptime and immediate feedback for RL training.
Task Scenarios
The framework categorizes tool-use tasks into logical scenarios to ensure comprehensive training coverage. These range from single-hop questions to complex sequences of dependent sub-questions.
Verifiable Reward Mechanism
We introduce a mathematical reward function ($R$) designed to balance precision and completeness, moving away from subjective LLM grading: $$R = \frac{2q}{p+1}$$ Here, $q$ represents the number of successfully solved sub-questions, and $p$ denotes the total number of tool invocations. This mechanism rewards task completion while penalizing redundant or "hallucinated" tool calls.
Experimental Results
The proposed "FTRL" training method was evaluated across several benchmarks, including ToolHop, $\tau$-bench, and RoTBench.
Performance Gains and Robustness
The framework yielded an average 10% performance improvement across all tool-use benchmarks. Notably, fine-tuned 7B and 14B models from the Qwen series frequently outperformed larger closed-source models like GPT-4o and Claude 4.0-Sonnet on specialized datasets like RoTBench and ToolHop. This suggests that high-quality, feedback-driven training can bridge the gap between smaller open-source models and proprietary giants.
Preservation of General Capabilities
A critical concern in specialized training is "catastrophic forgetting." Our experiments show that models maintained their performance on general reasoning and coding benchmarks such as MMLU, BBH, GSM8K, and HumanEval. This indicates that tool-use specialization can be achieved without compromising the model's foundational intelligence.
Key Insights
- Early Layer Updates: Parameter-level analysis revealed that the most significant updates during training occurred in the MLP parameters of the first three layers (0–2). This suggests that tool-use proficiency is rooted in how the model initially represents the context of a prompt.
- The Reasoning Paradox: While "Reasoning Mode" (e.g., in Qwen3) aids complex multi-hop tasks, it can lead to "overthinking" and performance degradation in simpler, single-hop scenarios where the model may hallucinate complex dependencies.
Conclusion
By automating the construction of local training environments and implementing a verifiable reward mechanism, we have developed a scalable and effective framework for improving LLM tool use. The results demonstrate significant performance gains across diverse benchmarks while preserving general capabilities. Future work will focus on better aligning the model's internal reasoning traces with its external actions to further bridge the gap between "thinking" and "doing."
Summary updated