arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2505.21668cs.AIcs.CLcs.SC
收藏

R1-Code-Interpreter: LLMs通过监督学习和多阶段强化学习进行代码推理

R1-Code-Interpreter: LLMs Reason with Code via Supervised and Multi-stage Reinforcement Learning

MIT / Harvard(麻省理工学院/哈佛大学);University of Illinois Urbana-Champaign(伊利诺伊大学厄巴纳-香槟分校);University of Michigan(密歇根大学);MIT(麻省理工学院);University of Wisconsin–Madison(威斯康星大学麦迪逊分校);MIT-IBM Watson AI Lab(麻省理工-IBM沃森人工智能实验室);Harvard(哈佛大学)

Yongchao Chen, Yueying Liu, Junwei Zhou, Yilun Hao, Jingquan Wang, Yang Zhang, Na Li, Chuchu Fan

AI总结:

R1-Code-Interpreter通过监督学习和多阶段强化学习提升LLM的代码推理能力,实现对多样化任务的高效处理,显著提升模型性能。

摘要:

在训练大型语言模型(LLMs)以利用代码解释器解决多样化任务方面缺乏实际指导。我们提出了R1-Code-Interpreter,这是通过多轮监督微调(SFT)和强化学习(RL)训练的纯文本LLM的扩展,能够自主在逐步推理过程中生成多个代码查询。与以往专注于数学或检索等狭窄领域的RL + 工具使用方法不同,我们精心挑选了144种多样化的推理和规划任务,并展示了在这些任务上训练通用的代码解释器存在显著挑战,因为任务异质性和有效样本的稀缺性。为了解决这个问题,我们引入了一种多阶段课程学习方法,通过测量改进潜力来划分训练样本。RL训练优先处理潜力更高的样本,然后逐渐转向潜力较低的样本,使RL收益从仅+3.4%增加到+9.3%(在Qwen-2.5模型中,3/7/14B)。我们的最终模型R1-CI-14B在37个测试任务上的平均准确性从44.1%提高到72.4%,优于纯文本GPT-4o(58.6%)和带有代码解释器的GPT-4o(70.9%)。值得注意的是,R1-CI-14B还通过代码生成表现出涌现的自我检查行为。数据集、代码和模型可在https://github.com/yongchao98/R1-Code-Interpreter和https://huggingface.co/yongchao98获取。

英文摘要:

Practical guidance on training Large Language Models (LLMs) to leverage Code Interpreter across diverse tasks remains lacking. We present R1-Code-Interpreter, an extension of a text-only LLM trained via multi-turn supervised fine-tuning (SFT) and reinforcement learning (RL) to autonomously generate multiple code queries during step-by-step reasoning. Unlike prior RL + tool-use efforts focused on narrow domains such as math or retrieval, we curate 144 diverse reasoning and planning tasks and show that training a general-purpose Code Interpreter across them presents significant challenges due to task heterogeneity and scarcity of effective samples. To address this, we introduce a multi-stage curriculum learning approach that partitions training samples by measured improvement potential. The RL training prioritizes samples with higher potential and gradually shifts to lower-potential ones, increasing the average RL gains from merely +3.4% to +9.3% across Qwen-2.5 models (3/7/14B). Our final model, R1-CI-14B, improves average accuracy on the 37 test tasks from 44.1% to 72.4%, outperforming text-only GPT-4o (58.6%) and GPT-4o with Code Interpreter (70.9%). Notably, R1-CI-14B also exhibits emergent self-checking behavior through code generation. Datasets, Codes, and Models are available at https://github.com/yongchao98/R1-Code-Interpreter and https://huggingface.co/yongchao98.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑