arXiv:2608.07147cs.AI2026-08

提出细粒度代码变更奖励机制,提升编程智能体训练效果

DiDPO: Diff-in-Diff Policy Optimization for Coding Agent Training

论文配图:DiDPO: Diff-in-Diff Policy Optimization for Coding Agent Training
图 1 · 摘自论文原文
  • 基于代码差异构建微粒级奖励单元,精准定位每步代码修改贡献
  • 在长序列编程任务上超越现有强化学习基线超10%,接近更大模型性能
  • 适合研究编程智能体、代码生成与强化学习融合的开发者使用

基于可验证奖励的强化学习(RLVR)已成为训练编程智能体的重要范式,其通过编译和测试反馈提供客观验证。然而,与一般智能体任务不同,编程智能体面临更细粒度的信用分配挑战:每一步代码操作同时在代码的不同区域引入变化,导致独立修改的贡献难以区分。现有RLVR方法多依赖结果奖励或步骤级奖励,无法深入代码差异,忽视了代码动作的独特属性。本文提出差分内差分策略优化(DiDPO),一种无评判器的强化学习方法,直接从代码差异结构构建细粒度信用单元。DiDPO将多轮编程交互组织为多个思维-行动步骤,提取采样轨迹中的代码差异,并通过“可聚类评分”聚合高度相似的子差异,形成最优语义范围与聚合质量平衡的锚点分割方案。最终,这些锚点构成优势组,并将差异级优势回传至具体响应标记。在长时程编程与推理基准测试中,DiDPO显著优于强基线。在Qwen2.5-7B-Coder上,性能超越同类方法超过10%,缩小与更大模型的差距。同时开源verl-code,支持多种强化学习方法与编程基准。

原文摘要 · Abstract (English)

Reinforcement learning with Verifiable Reward (RLVR) has emerged as a powerful paradigm for training coding agents, where the execution feedback from compilation and tests provides objective verification. However, unlike agent tasks, coding agents face a unique and finer-grained credit assignment challenge: at each step, coding actions simultaneously pack varying changes into different regions of a code version, which makes the contribution of independent change indistinguishable. Existing RLVR methods mostly leverage the outcome reward or step-level reward, which fails to dive into a code diff and makes unique properties of coding actions invisible to training. In this paper, we propose Diff-in-Diff Policy Optimization (DiDPO), a critic-free RL method that constructs fine-grained credit units directly from the structure of code diffs. DiDPO organizes multi-turn coding interactions into multiple thought--action steps and discovers code diffs across sampled trajectories. It then selects anchors by aggregating highly similar sub-diffs split from each whole diff by our ``groupability score'', which provides the splitting schema that optimally balances the semantic scope of anchors and the group mass they may form. Finally these anchors form advantage groups and project the diff-level advantage back to individual response tokens. Experiments on long-horizon coding and reasoning benchmarks show that DiDPO significantly outperforms strong agentic RL baselines. On Qwen2.5-7B-Coder, DiDPO exceeds comparable methods by over 10\% and narrows the gap with far larger models, offering a principled framework for fine-grained credit assignment in coding agent training. We also open-source verl-code, an agentic rl codebase that supports various RL methods and coding benchmarks.

编程智能体强化学习代码生成信用分配

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