← 首页|学术|DiDPO: Diff-in-Diff Policy Optimization for Coding Agent Training
cs.AI · 2608.07147 · 2026-08-07

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

Xucong Wang,Zhe Zhao,Liheng Yu,Di Wu,Xiaofeng Cao,Pengkun Wang
TL;DR:代码 agent 的 RLVR 遇到更细的信用分配问题:一步动作同时改多个区域,各改动贡献难分。DiDPO 把 diff 视为可分割单元,用 sub-diff anchor 算出 diff 级优势再做 policy optimization。

🎯 问题

RLVR(可验证奖励强化学习)已成为训练代码 agent 的主流,但代码 agent 有更细粒度的信用分配难题:一步动作同时向代码的不同区域打包多种改动,各独立改动的贡献无法区分。

🔬 方法

DiDPO:diffs 是可分割的(divisible)、动态 sub-diff anchors、diff advantage 计算、diff-in-diff policy optimization,并给出理论保证;把"轨迹/状态级优势"细化到"diff 级优势"。
章节结构(全文标题提取):
1 Introduction
2 Related Work
2.1 Agentic Reinforcement Learning
2.2 Code Generation and Coding Agents
3 Problem Setting
3.1 Coding as Markov Decision Process
3.2 Trajectory / State-Level Advantage
4 Methodology
4.1 Diffs are Divisible
4.2 Dynamic Sub-Diff Anchors

📊 结果

相比普通 RLVR,对独立改动的信用分配更准,代码 agent 训练效率与最终性能均提升。

📝 原文摘要

▶ 原文摘要 Abstract
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.
Deep Read · 2026-08-11高松灯 / Agent 日报
AgentCodingRLVRCredit-Assignment