paper-with-me

Papers

R1-Code-Interpreter: Training LLMs to Reason with Code via Supervised and Reinforcement Learning

2025-05-27 · Yongchao Chen, Yueying Liu, Junwei Zhou, Yilun Hao, Jingquan Wang, Yang Zhang, Chuchu Fan

Despite advances in reasoning and planning of R1-like models, Large Language Models (LLMs) still struggle with tasks requiring precise computation, symbolic manipulation, optimization, and algorithmic reasoning, in which textual reasoning lacks the rigor of code execution. A key challenge is enabling LLMs to decide when to use textual reasoning versus code generation. While OpenAI trains models to invoke a Code Interpreter as needed, public research lacks guidance on aligning pre-trained LLMs to effectively leverage code and generalize across diverse tasks. 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. We curate 144 reasoning and planning tasks (107 for training, 37 for testing), each with over 200 diverse questions. We fine-tune Qwen-2.5 models (3B/7B/14B) using various SFT and RL strategies, investigating different answer formats, reasoning vs. non-reasoning models, cold vs. warm starts, GRPO vs. PPO, and masked vs. unmasked code outputs. Unlike prior RL work on narrow domains, we find that Code Interpreter training is significantly harder due to high task diversity and expensive code execution, highlighting the critical role of the SFT stage. Our final model, R1-CI-14B, improves average accuracy on the 37 test tasks from 44.0\% to 64.1\%, outperforming GPT-4o (text-only: 58.6\%) and approaching GPT-4o with Code Interpreter (70.9\%), with the emergent self-checking behavior via code generation. Datasets, Codes, and Models are available at https://github.com/yongchao98/R1-Code-Interpreter and https://huggingface.co/yongchao98.

📄 PDF Abstract BibTeX arXiv:2505.21668

Code (1)

yongchao98/r1-code-interpreter 공식 구현 pytorch

Tasks

Code GenerationReinforcement Learning (RL)

Methods 이 논문이 사용한 방법론

SFT Shrink and Fine-Tune, or SFT, is a type of distillation that avoids explicit distillation by copying parameters to a student student model and then fine-tuning.…
Entropy Regularization 설명 없음
PPO Proximal Policy Optimization, or PPO, is a policy gradient method for reinforcement learning. The motivation was to have an algorithm with the data efficiency and reliable…

Similar Papers 제목 키워드 기반

Solving Challenging Math Word Problems Using GPT-4 Code Interpreter with Code-based Self-Verification

2023-08-15 · Aojun Zhou, Ke Wang, Zimu Lu, Weikang Shi 외

Recent progress in large language models (LLMs) like GPT-4 and PaLM-2 has brought significant advancements in addressing math reasoning problems. In particular, OpenAI's latest version of GPT-4, known as GPT-4 Code Inter…

Arithmetic ReasoningMathMathematical ReasoningMath Word Problem Solving

PAL: Program-aided Language Models

2022-11-18 · Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon 외

Large language models (LLMs) have recently demonstrated an impressive ability to perform arithmetic and symbolic reasoning tasks, when provided with a few examples at test time ("few-shot prompting"). Much of this succes…

Arithmetic ReasoningGSM8KMathMathematical Reasoning+1

MuMath-Code: Combining Tool-Use Large Language Models with Multi-perspective Data Augmentation for Mathematical Reasoning

2024-05-13 · Shuo Yin, Weihao You, Zhilong Ji, Guoqiang Zhong 외

The tool-use Large Language Models (LLMs) that integrate with external Python interpreters have significantly enhanced mathematical reasoning capabilities for open-source LLMs, while tool-free methods chose another track…

Data AugmentationGSM8KMathMathematical Reasoning

MARIO: MAth Reasoning with code Interpreter Output -- A Reproducible Pipeline

2024-01-16 · Minpeng Liao, Wei Luo, Chengxi Li, Jing Wu 외

Large language models (LLMs) have seen considerable advancements in natural language understanding tasks, yet there remains a gap to bridge before attaining true artificial general intelligence, especially concerning sho…

GSM8KMathMathematical ReasoningNatural Language Understanding

Exploring Extrinsic and Intrinsic Properties for Effective Reasoning with Code Interpreter

2026-06-15 · Patomporn Payoungkhamdee, Napat Laosaengpha, Jenta Wonglertsakul, Pittawat Taveekitworachai 외 arxiv

Reasoning with a Code Interpreter (CI) has emerged as an effective paradigm for enhancing the reasoning capabilities of large language models (LLMs) through executable computation and iterative verification. Despite its …

Reinforcement Learning