精心设计奖励机制,让大模型学会灵活用工具。
ToolRL: Reward is All Tool Learning Needs

- 提出一套系统化的奖励设计方法,针对工具调用的复杂性优化反馈。
- 在多个基准上提升17%性能,比基线模型和监督微调效果更好。
- 适合研究大模型工具使用、强化学习奖励设计的学者和工程师。
当前大语言模型(LLMs)通常通过监督微调(SFT)获得工具使用能力,但SFT难以泛化到陌生或复杂的工具使用场景。尽管基于强化学习(RL)的R1类模型展现出出色的推理与泛化能力,但工具使用中的奖励设计面临独特挑战:多种工具可能以不同参数被调用,而粗粒度奖励信号(如答案匹配)无法提供有效学习所需的精细反馈。本文首次系统研究了强化学习范式下工具选择与应用任务的奖励设计,全面分析了奖励类型、尺度、粒度与时序动态。基于这些洞察,我们提出一种针对工具使用任务的合理奖励设计,并结合分组相对策略优化(GRPO)训练大模型。在多个基准上的实证评估表明,该方法实现稳健、可扩展且稳定的训练,相比基线模型提升17%,较SFT模型提升15%。结果凸显了精心设计奖励对提升大模型工具使用能力与泛化性能的关键作用。所有代码均已公开,以促进后续研究。
原文摘要 · Abstract (English)
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 codes are released to facilitate future research.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。