arXiv:2511.07833cs.LGcs.AI2025-11被引 2

让大模型在代码生成中学会根据反馈反复修改,效果显著提升。

MURPHY: Feedback-Aware GRPO with Retrospective Credit Assignment for Multi-Turn Code Generation

  • 构建带反馈的多轮推理树,让错误尝试也能获得修正价值
  • 在三个基准上实现最高6%的通过率提升,难题上提升超4%
  • 适合需要迭代纠错的代码生成任务,尤其擅长处理复杂问题

基于可验证奖励的强化学习(RLVR)已成为后训练大模型进行推理任务的标准方法,其中分组相对策略优化(GRPO)是主流方案。然而,GRPO及其变体本质上是单轮的:仅基于终端奖励优化孤立的提示-响应对,难以适应需要模型根据环境反馈持续改进的智能体场景。本文提出MURPHY,一种面向自修正代码生成的多轮GRPO扩展。MURPHY构建反馈条件化的回溯轨迹树,将失败的候选解与执行反馈配对,并扩展为后续轮次;同时将奖励反向传播至树中,使后期成功的修正能为早期提供有价值反馈的尝试赋予权重。研究了两种传播策略(最大奖励和平均奖励),并引入事后剪枝机制以降低多轮优化开销。在三个代码生成基准(HumanEval、MBPP、LiveCodeBench-v6)及两个模型家族(Qwen3-1.7B/4B、OLMo-2-7B)上,MURPHY相较最强先验多轮执行反馈方法,绝对通过率(pass@1)提升最高达6%。在中等/困难题集上提升最为显著(第5轮迭代时分别达+4.38%和+4.20%),证明了迭代自我修正的重要性。

原文摘要 · Abstract (English)

Reinforcement Learning with Verifiable Rewards (RLVR) has become a standard recipe for post-training LLMs on reasoning tasks, with Group Relative Policy Optimization (GRPO) emerging as a leading approach. However, GRPO and its variants are inherently single-turn: they optimize from terminal rewards on isolated prompt-response pairs, leaving them poorly suited to agentic settings where models must iteratively refine solutions in response to environmental feedback. We introduce MURPHY, a multi-turn extension of GRPO for self-correcting code generation. MURPHY constructs feedback-conditioned rollout trees in which failed candidate solutions are paired with executor feedback and expanded into subsequent turns, and propagates rewards backward through the tree so that later successful refinements credit earlier attempts that surfaced informative feedback. We study two propagation strategies, Max Reward (MARS) and Mean Reward (MERS), and introduce post-rollout pruning mechanisms that reduce multi-turn optimization cost. Across three code generation benchmarks (HumanEval, MBPP, LiveCodeBench-v6) and two model families (Qwen3-1.7B/4B, OLMo-2-7B), MURPHY delivers up to 6% absolute pass@1 gains over the strongest prior multi-turn execution-feedback methods. Gains are largest on the Medium/Hard subset (+4.38/+4.20 at Iter-5), where iterative self-correction matters more.

代码生成强化学习多轮推理自修正

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