用强化学习优化数学推理中的工具调用,提升大模型准确性
THOR: Tool-Integrated Hierarchical Optimization via RL for Mathematical Reasoning
- 通过多智能体生成高质量工具调用数据集
- 分层强化学习同时优化解题步骤和代码生成
- 推理时自修正错误路径,适合各类大模型使用
大语言模型在数学推理方面虽有进展,但在数值计算和符号操作等高精度任务上仍表现不佳。引入外部工具成为弥补这一差距的可行方法。然而现有方法面临三大挑战:构建工具集成推理数据困难、细粒度优化不足、推理能力有限。为此,我们提出THOR(基于强化学习的工具集成层次优化)。首先,设计TIRGen——一种基于多智能体的流水线,用于生成高质量的工具集成推理路径数据集,与策略对齐且跨模型泛化能力强。其次,提出一种强化学习策略,联合优化整体解题过程与每一步的代码生成,其核心洞察是中间工具调用的成功与否能有效预测最终答案正确性。最后,引入自校正机制,利用工具即时反馈在推理过程中动态修正错误路径。该方法在多种模型上展现良好泛化性,无论是否具备推理能力均有效;在多个数学基准测试中达到同规模模型的最先进水平,并在代码基准上持续提升。代码将公开于https://github.com/JingMog/THOR。
原文摘要 · Abstract (English)
Large Language Models (LLMs) have made remarkable progress in mathematical reasoning, but still continue to struggle with high-precision tasks like numerical computation and formal symbolic manipulation. Integrating external tools has emerged as a promising approach to bridge this gap. Despite recent advances, existing methods struggle with three key challenges: constructing tool-integrated reasoning data, performing fine-grained optimization, and enhancing inference. To overcome these limitations, we propose THOR (Tool-Integrated Hierarchical Optimization via RL). First, we introduce TIRGen, a multi-agent based pipeline for constructing high-quality datasets of tool-integrated reasoning paths, aligning with the policy and generalizing well across diverse models. Second, to perform fine-grained hierarchical optimization, we introduce an RL strategy that jointly optimizes for both episode-level problem solving and step-level code generation. This is motivated by our key insight that the success of an intermediate tool call is a strong predictor of the final answer's correctness. Finally, THOR incorporates a self-correction mechanism that leverages immediate tool feedback to dynamically revise erroneous reasoning paths during inference. Our approach demonstrates strong generalization across diverse models, performing effectively in both reasoning and non-reasoning models. It further achieves state-of-the-art performance for models of a similar scale on multiple mathematical benchmarks, while also delivering consistent improvements on code benchmarks. Our code will be publicly available at https://github.com/JingMog/THOR.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。