arXiv:2505.07773cs.AI2025-05被引 58

让大模型自发写代码解数学题,训练越久效果越好。

Agent RL Scaling Law: Agent RL with Spontaneous Code Execution for Mathematical Problem Solving

  • 用奖励机制训练模型自发生成并运行代码解题。
  • 训练步数越多,代码调用率和解题准确率越高。
  • 适合研究智能体自主使用工具的学者参考。

大语言模型在需要精确计算的数学推理任务中表现不佳。虽然基于结果的强化学习能提升文本推理能力,但理解智能体如何自主利用外部工具(如代码执行)仍至关重要。本文研究了基于结果奖励的工具集成推理(ZeroTIR),训练基础大模型在无监督工具使用示例的情况下,自发生成并执行Python代码解决数学问题。核心发现是:随着强化学习训练的推进,关键指标呈现可预测的规模化增长。具体表现为训练步数增加时,代码自发执行频率、平均响应长度及最终任务准确率均显著上升,揭示了训练投入与有效工具增强推理策略涌现之间的量化关系。我们构建了分离式代码执行环境,验证了结果在多种标准强化学习算法和框架下的稳健性。实验表明,ZeroTIR在复杂数学基准上显著优于非工具基线(ZeroRL)。研究成果为自主工具使用在智能体强化学习中的习得与扩展提供了基础理解,并提供可复现的基准。代码已开源:https://github.com/yyht/openrlhf_async_pipline。

原文摘要 · Abstract (English)

Large Language Models (LLMs) often struggle with mathematical reasoning tasks requiring precise, verifiable computation. While Reinforcement Learning (RL) from outcome-based rewards enhances text-based reasoning, understanding how agents autonomously learn to leverage external tools like code execution remains crucial. We investigate RL from outcome-based rewards for Tool-Integrated Reasoning, ZeroTIR, training base LLMs to spontaneously generate and execute Python code for mathematical problems without supervised tool-use examples. Our central contribution is we demonstrate that as RL training progresses, key metrics scale predictably. Specifically, we observe strong positive correlations where increased training steps lead to increases in the spontaneous code execution frequency, the average response length, and, critically, the final task accuracy. This suggests a quantifiable relationship between computational effort invested in training and the emergence of effective, tool-augmented reasoning strategies. We implement a robust framework featuring a decoupled code execution environment and validate our findings across standard RL algorithms and frameworks. Experiments show ZeroTIR significantly surpasses non-tool ZeroRL baselines on challenging math benchmarks. Our findings provide a foundational understanding of how autonomous tool use is acquired and scales within Agent RL, offering a reproducible benchmark for future studies. Code is released at \href{https://github.com/yyht/openrlhf_async_pipline}{https://github.com/yyht/openrlhf\_async\_pipline}.

智能体强化学习代码生成数学推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。