arXiv:2510.20342cs.CLcs.AI2025-10NeurIPS被引 8

教大模型用工具推理,提升数学题解得又快又准

Teaching Language Models to Reason with Tools

  • 用提示工程生成高质量带工具的推理数据,优化模型与代码解释器协作
  • 在多个数学数据集上,大模型准确率提升4%~8%,小模型效率提高50%
  • 适合想让AI更靠谱解题的研究者和开发者

大型推理模型(LRMs)如OpenAI-o1在自然语言推理中表现优异,但在复杂数学运算中常出现效率低或错误。整合代码解释器(CIs)虽是有效方案,却因模型内部概率推理与外部确定性工具间的冲突,导致无效思考。为此,我们提出CoRT(代码优化推理训练)框架,通过提示工程策略,在推理路径中适时注入多样化提示,生成专为优化LRM-CI交互设计的高质量数据。基于此,我们对1.5B至32B参数模型进行了30个样本的监督微调。CoRT进一步利用拒绝采样和强化学习,优化多轮内外部交互流程。实验表明,该方法在五个挑战性数学推理数据集上,使DeepSeek-R1-Distill-Qwen-32B和1.5B模型准确率分别提升4%和8%;同时显著提升效率,32B模型减少约30%、1.5B模型减少50%的令牌使用量。相关模型与代码已开源。

原文摘要 · Abstract (English)

Large reasoning models (LRMs) like OpenAI-o1 have shown impressive capabilities in natural language reasoning. However, these models frequently demonstrate inefficiencies or inaccuracies when tackling complex mathematical operations. While integrating computational tools such as Code Interpreters (CIs) offers a promising solution, it introduces a critical challenge: a conflict between the model's internal, probabilistic reasoning and the external, deterministic knowledge provided by the CI, which often leads models to unproductive deliberation. To overcome this, we introduce CoRT (Code-Optimized Reasoning Training), a post-training framework designed to teach LRMs to effectively utilize CIs. We propose \emph{Hint-Engineering}, a new data synthesis strategy that strategically injects diverse hints at optimal points within reasoning paths. This approach generates high-quality, code-integrated reasoning data specifically tailored to optimize LRM-CI interaction. Using this method, we have synthesized 30 high-quality samples to post-train models ranging from 1.5B to 32B parameters through supervised fine-tuning. CoRT further refines the multi-round interleaving of external CI usage and internal thinking by employing rejection sampling and reinforcement learning. Our experimental evaluations demonstrate CoRT's effectiveness, yielding absolute improvements of 4\% and 8\% on DeepSeek-R1-Distill-Qwen-32B and DeepSeek-R1-Distill-Qwen-1.5B, respectively, across five challenging mathematical reasoning datasets. Moreover, CoRT significantly enhances efficiency, reducing token usage by approximately 30\% for the 32B model and 50\% for the 1.5B model compared to pure natural language reasoning baselines. The models and code are available at: https://github.com/ChengpengLi1003/CoRT.

推理增强工具使用数学推理模型训练

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