教大模型高效用代码解题,提升数学推理准确率与效率
CoRT: Code-integrated Reasoning within Thinking
- 通过提示工程合成带代码提示的推理数据,优化模型与代码解释器协作
- 在多个数学数据集上,32B和1.5B模型分别提升8%和4%准确率
- 相比纯文本模型,32B模型少用30% token,1.5B模型少用50%
大型推理模型(LRMs)如o1和DeepSeek-R1在自然语言推理中展现出显著进展,但处理复杂数学运算时仍存在效率低或不准确的问题。借助计算工具(如计算库和符号求解器)虽具前景,但引入了技术挑战:代码解释器(CI)带来模型内部文本表示之外的外部知识,直接结合效率不高。本文提出CoRT,一种用于教会LRMs高效利用CI的后训练框架。首先,通过提示工程(Hint-Engineering)合成代码集成推理数据,在合适位置插入不同提示以优化模型与CI的交互。手动构建30个高质量样本,对1.5B至32B参数模型进行监督微调、拒绝微调和强化学习。实验表明,提示工程模型在五个挑战性数学推理数据集上,对DeepSeek-R1-Distill-Qwen-32B和DeepSeek-R1-Distill-Qwen-1.5B分别实现4%和8%的绝对性能提升。此外,32B模型减少约30%的token使用,1.5B模型减少50%。模型与代码已开源于https://github.com/ChengpengLi1003/CoRT。
原文摘要 · Abstract (English)
Large Reasoning Models (LRMs) like o1 and DeepSeek-R1 have shown remarkable progress in natural language reasoning with long chain-of-thought (CoT), yet they remain inefficient or inaccurate when handling complex mathematical operations. Addressing these limitations through computational tools (e.g., computation libraries and symbolic solvers) is promising, but it introduces a technical challenge: Code Interpreter (CI) brings external knowledge beyond the model's internal text representations, thus the direct combination is not efficient. This paper introduces CoRT, a post-training framework for teaching LRMs to leverage CI effectively and efficiently. As a first step, we address the data scarcity issue by synthesizing code-integrated reasoning data through Hint-Engineering, which strategically inserts different hints at appropriate positions to optimize LRM-CI interaction. We manually create 30 high-quality samples, upon which we post-train models ranging from 1.5B to 32B parameters, with supervised fine-tuning, rejection fine-tuning and reinforcement learning. Our experimental results demonstrate that Hint-Engineering models achieve 4\% and 8\% absolute improvements on DeepSeek-R1-Distill-Qwen-32B and DeepSeek-R1-Distill-Qwen-1.5B respectively, across five challenging mathematical reasoning datasets. Furthermore, Hint-Engineering models use about 30\% fewer tokens for the 32B model and 50\% fewer tokens for the 1.5B model compared with the natural language models. 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 官方产品;中文卡片由大模型生成,请以原文为准。