ToolRL: Reward is All Tool Learning Needs

Paper · arXiv 2504.13958 · Published April 16, 2025
Reinforcement Learning

Current Large Language Models (LLMs) often undergo supervised fine-tuning (SFT) to acquire tool use capabilities. However, SFT struggles to generalize to unfamiliar or complex tool use scenarios. Recent advancements in reinforcement learning (RL), particularly with R1- like models, have demonstrated promising reasoning and generalization abilities. Yet, reward design for tool use presents unique challenges: multiple tools may be invoked with diverse parameters, and coarse-grained reward signals, such as answer matching, fail to offer the finegrained feedback required for effective learning. In this work, we present the first comprehensive study on reward design for tool selection and application tasks within the RL paradigm. We systematically explore a wide range of reward strategies, analyzing their types, scales, granularity, and temporal dynamics. Building on these insights, we propose a principled reward design tailored for tool use tasks and apply it to train LLMs using Group Relative Policy Optimization (GRPO). Empirical evaluations across diverse benchmarks demonstrate that our approach yields robust, scalable, and stable training, achieving a 17% improvement over base models and a 15% gain over SFT models. These results highlight the critical role of thoughtful reward design in enhancing the tool use capabilities and generalization performance of LLMs. All the code are released to facilitate future research.1

Introduction. Recent advances in Large Language Models (LLMs) have showcased remarkable capabilities in complex reasoning tasks (Kumar et al., 2025). Among the techniques that have significantly contributed to this progress, Reinforcement Learning (RL) has emerged as a powerful paradigm, enabling LLMs to develop emergent capabilities such as selfreflection, self-correction, and long-horizon planning (Guo et al., 2025; Team et al., 2025). These capabilities have been instrumental in the success of models like o1 and R1, particularly in mathematical and logical reasoning domains (Qin et al., 2024a; Huang et al., 2024; Li et al., 2025b; Kang et al., 2025). Beyond traditional reasoning tasks, an increasingly important area is Tool-Integrated Reasoning (TIR). TIR involves LLMs interacting with external tools, such as search engines (Jin et al., 2025; Zheng et al., 2025), calculators (Chen et al., 2023b; Qin et al., 2023), or code interpreters (Gou et al., 2023; Liao et al., 2024), in a multi-step, feedbackdriven loop to arrive at solutions. TIR is particularly important because it addresses core limitations of LLMs, such as outdated knowledge, calculation inaccuracy, and shallow reasoning. By integrating external tools that offer real-time access and specialized capabilities, TIR enables models to tackle complex tasks in a more grounded and goal-directed way. Unlike textual reasoning, which primarily involves deduction and inference from static text, TIR additionally demands the model’s ability to select appropriate tools, interpret intermediate outputs, and adaptively refine its trajectory on the fly. These dynamic and interactive reasoning skills position TIR at the core of the emerging paradigm of LLMs-as-agents. As such, TIR enables a wide range of applications, including scientific discovery (Roohani et al., 2024; Inoue et al., 2024), research automation (Baek et al., 2024; Wang et al., 2024), embodied task completion (Zhang et al., 2023; Huang et al., 2023), and everyday decisionmaking (Ye et al., 2023; Zhai et al., 2024).

Training LLMs for TIR tasks has predominantly relied on Supervised Fine-Tuning (SFT), wherein existing approaches typically generate these integrated reasoning steps offline, followed by subsequent SFT on these trajectories (Chen et al., 2023a; Zeng et al., 2024; Chen et al., 2024; Acikgoz et al., 2025). While SFT is effective to some extent, it struggles with generalization, exploration, and adaptability (Chu et al., 2025; Guo et al., 2025). As illustrated in Figure 1, a model trained with SFT on deep-thinking trajectories over-interprets the tool and fails to reject the inappropriate tool, merely imitating cues like “but wait” without engaging in genuine deep thinking. As such, SFT often fails to capture the strategic flexibility needed for optimal tool use, particularly in open-ended or multi-step settings. This motivates a fundamental research question: Can RL-based training methods better equip LLMs with agentic tool-using capabilities, and if so, what is the optimal RL design for TIR?

Recent efforts such as Search-R1 (Jin et al., 2025) and TORL (Li et al., 2025b) have begun to explore this direction. However, their focus is narrow: either constrained to search tools in question answering settings or code tools in math problemsolving. In contrast, our work aims to study RLbased training for general-purpose tool selection and application, across diverse and complex tool sets with different task types.

Related work. Tool-Integrated Reasoning of LLMs. Toolintegrated reasoning (TIR) has emerged as a promising approach to enhance the capabilities of LLMs. Early studies introduced the concept of equipping LLMs with external tools to overcome their inherent limitations (Schick et al., 2023; Qin et al., 2024b; Yao et al., 2023), such as program executors (Chen et al., 2022) and search engines (Vu et al., 2023). To systematically assess these enhanced capabilities, several benchmarks have been proposed to evaluate tool use performance across various dimensions, including API selection, argument generation, and generalization (Qin et al., 2024c; Patil et al., 2023; Qian et al., 2024a). Building on this foundation, subsequent research has focused on constructing high-quality tool use datasets (Liu et al., 2024; Qian et al., 2025), enabling models to autonomously create and invoke tools (Qian et al., 2023, 2024b), and applying these techniques to problems spanning different modalities (Shen et al., 2025) and specialized domains (Ling et al., 2023). More recently, reinforcement learning (RL) has been explored as an effective framework to further improve TIR, demonstrating success in tasks such as information retrieval (Jin et al., 2025) and math computation (Li et al., 2025b). These advances collectively highlight the growing potential of tool-augmented LLMs for general-purpose reasoning in open-domain settings.

Exploration of RL in LLMs. Previous work has primarily relied on supervised fine-tuning (SFT) with carefully curated datasets to enhance LLM performance in tool use (Schick et al., 2023; Qin et al., 2024c). Recently, reinforcement learning (RL) has gained traction as a more scalable and generalizable training paradigm. The development of RL methods for LLMs has evolved from reinforcement learning from human feedback (RLHF) (Kaufmann et al., 2023) and proximal policy optimization (PPO) (Schulman et al., 2017) to more advanced techniques such as direct preference optimization (DPO) (Rafailov et al., 2023), SimPO (Meng et al., 2024), and group relative policy optimization (GRPO) (Shao et al., 2024). Extensions like dynamic sampling policy optimization (DAPO) (Yu et al., 2025) and the more recent value-based augmented proximal policy optimization (VAPO) (Yuan et al., 2025) further improve training stability and efficiency. Among these, GRPO (Shao et al., 2024) is specifically designed for LLMs, replacing the traditional critic with a group-based evaluation strategy. It has shown strong performance in enhancing reasoning abilities across a range of tasks, including mathematical problem solving (Shao et al., 2024; Xie et al., 2025), search engine interaction (Jin et al., 2025; Song et al., 2025), and code generation (Li et al., 2025b).

Method. Supervised fine-tuning (SFT), as illustrated in Figure 1, often suffers from overfitting to certain patterns and constrains the model’s ability to learn optimal strategies for tool use. To address this, we introduce a reinforcement learning (RL) approach for enhancing tool-integrated reasoning (TIR) in LLMs. In this section, we begin by defining the TIR task (Section 3.1), followed by our customized rollout strategy (Section 3.2) and reward design (Section 3.3). These components are then integrated into the Group Relative Policy Optimization (GRPO) framework (Shao et al., 2024) to guide model training on general TIR tasks (Section 3.4).

Tool-Integrated Reasoning (TIR) is the process of incorporating external tools into the reasoning trajectory of an LLM to solve a user task. A typical TIR trajectory involves multiple tool invocations over several reasoning steps, with the final outcome determined by the cumulative success of these intermediate decisions. Formally, given a tool set T = {t1, t2, . . . , tn} containing n available tools, and a user query Q, the reasoning trajectory up to step k is denoted as: where ri denotes the model’s natural language reasoning at step i, Ti ⊆T denotes the set of tool calls invoked at step i, and oi denotes the observation received after executing tools in Ti, possibly including both environment and user feedback. At each step k + 1, the model must generate the next reasoning step rk+1, select a set of tools Tk+1 ⊆T , and formulate a grounded tool call (i.e., a parameterized invocation of each tool) to make progress toward solving Q. The model’s policy is defined as π : sk → (rk+1, Tk+1), where the model’s objective at each step is to select a tool set Tk+1 that maximizes the immediate reward:

3.2 TIR Rollout To enable the model to autonomously generate reasoning traces and tool calls, we utilize a system prompt as shown in Figure 4 during rollout. The Tool List placeholder denotes the tool set T , which contains all tools available for invocation. We indicate in the instruction that the LLM should use special tokens <think>, <tool_call>, and <response> to indicates their thoughts, tool calls and responses in output. As illustrated in Figure 3, when the model output includes <tool_call>, we automatically parse the tool calls into individual invocations using the model-predicted parameters. The outputs from executions are then inserted into the <obs> field and appended to the dialogue history, whose format is shown in Figure 12, serving as the model’s interaction trajectory. Similarly, if the output contains <response>, the corresponding response is parsed and appended to the dialogue history.

3.3 Reward Design Rule-based reward mechanisms have demonstrated strong empirical performance and are commonly employed. In our training, we similarly adopt a reward formulation that combines structural and correctness-based components, in line with prior works (Jin et al., 2025; Li et al., 2025b; Xie et al., 2025). Specifically, the format reward assesses whether the model output adheres to the expected structure including thoughts, tool calls, and responses, while the correctness reward evaluates the accuracy of tool invocations. Formally, the overall reward Rfinal(·) is decomposed into two components: Rformat + Rcorrect, each described in detail below:

Format Reward. The format reward Rformat ∈ {0, 1} checks whether the model output contains all required special tokens in the correct order as specified by the ground truth:

System Prompt for Training You are a helpful dialogue assistant capable of leveraging tool calls to solve user tasks and provide structured chat responses.

Available Tools In your response, you can use the following tools: {{Tool List}} Steps for Each Turn 1. Think: Recall relevant context and analyze the current user goal. 2. Decide on Tool Usage: If a tool is needed, specify the tool and its parameters. 3. Respond Appropriately: If a response is needed, generate one while maintaining consistency across user queries.

Discussion. These findings highlight that while PPO can benefit from our reward design, its impact is more limited compared to the more robust and consistent improvements observed with GRPO.

Generalization Studies. We evaluate the generalization ability of our trained model in two challenging settings: unfamiliar scenarios and novel task goals (both from BFCL benchmark subset). Specifically, we test the model’s performance in tool usage within unseen programming languages and its ability to detect irrelevant tools, neither of Free-form Inference Effectiveness. While our model is trained with a focus on tool call format and correctness, we further evaluate its ability to handle free-form tool use in a QA setting. Unlike the structured tool selection and application tasks, QA setting: (1) imposes no constraints on tool call parameters, and (2) evaluates only the final answer, making it a “goal-oriented” rather than a “process-oriented” task. This naturally introduces a multi-step interaction scenario. Specifically, we use Bamboogle, a multi-hop QA dataset, to assess this capability. The model is equipped with a web search tool, and we report both the answer accuracy and the number of tool calls for all baselines and our approach. As shown in Table 3, our reward design achieves the highest performance, despite this setting not being explicitly seen during training. Notably, our cold start GRPO model surpasses others in accuracy without relying on excessive number of tool calls. This suggests that the model can flexibly invoke tools when needed, effectively leverage feedback, wisely and efficiently navigating toward the correct answer.

Conclusion. In this paper, we present a reward design tailored for GRPO training on tool use tasks. Empirically, our model trained from scratch using GRPO consistently outperforms both SFT-based and SFTinitialized RL baselines, as well as models trained with alternative RL algorithms, across a variety of held-out tool use benchmarks. Furthermore, we demonstrate that our model generalizes well to QA settings, exhibiting robust multi-turn interactions, emergent proactiveness, and metacognitive behaviors, all of which are key traits for efficient and adaptable tool use, lying at the core of foundational agent capabilities. Our in-depth analysis of reward types, scaling strategies, granularity, and temporal dynamics provides further insights into how reward shaping influences learning and behavior. We hope these findings serve as a roadmap for future work in applying reinforcement learning to tool use. Ultimately, we envision that reward is all tool learning needs, and that RL offers a powerful path toward generalizable and creative agent behavior.

Limitations. • Longer reasoning trace is not inherently better and length rewards can degrade performance.

• Dynamic reward scale helps models transition smoothly from simple to complex behaviors.

Lines of inquiry this paper opens 24

Research framings built by reading the notes related to this paper — the questions it feeds into.

Does chain-of-thought reveal genuine reasoning or merely imitate learned behavior? Can visual rendering-based rewards effectively improve code and layout quality? How can reward models overcome their inherent blindspots and biases? Can agents learn from feedback and experience to improve behavior? How important is reward engineering relative to pretraining for reasoning? How does task-specific training affect model generalization and capability transfer? Can agent-created code become persistent, reusable infrastructure that improves over time? How does policy entropy collapse constrain the scaling of reasoning RL? What trajectory qualities should agent evaluation measure beyond task success? Can AI systems formally evaluate design quality and taste? What prevents AI agents from achieving claimed real-world autonomy? How do supervised fine-tuning and reinforcement learning compare in preserving reasoning quality?