\section{Introduction}
\label{sec:intro}
A software agent can spend many turns inspecting a repository, proposing edits, running commands, and revising its patch before receiving a final test verdict. A trajectory-level reward summarizes the completed artifact, but does not identify which surviving edits contributed to that outcome. This distinction matters even for unsuccessful trajectories: an incomplete repair can preserve useful changes alongside changes that break other behavior. Repository benchmarks provide executable tests \citep{jimenez2024swebench}, making it possible to ask a more specific question about the artifact the agent produced.
Our question is whether a single, directly tested intervention can supply useful feedback to the turns that produced an edit. Existing approaches already provide local feedback through learned critics, execution-derived reward models, evaluator diagnostics, or policy continuations \citep{zhou2025sweet,li2026boostapr,jin2026rcca,pmlr-v267-kazemnejad25a}. The opportunity considered here is narrower: use the completed repository itself to construct one removal experiment, without fitting an additional scoring model or sampling how the policy would continue after an intervention.
\emph{Counterfactual edit credit} selects a block of consecutive editing turns whose touched paths are not edited later. Starting from the final repository, it restores those paths to their contents immediately before the block and retains every other final file. Testing the resulting artifact yields a signed utility difference. A positive difference means that removing the selected file effects worsens this completed artifact; a negative difference means that the removal improves it. The method adds this signal to the advantages of the producing turns, including their reasoning and tool-call tokens.
The intervention and its allocation are distinct design decisions. An improvement over terminal-only training could come from additional test information, from its concentration, or from where that concentration is placed. We therefore define a broadcast control with the same query and eligibility rules. On any shared reference rollout, broadcast and localized credit have equal signed and absolute coefficient mass before the policy loss. A second control concentrates the ordinary terminal group advantage on the selected turns without using a counterfactual score. These comparisons distinguish the proposed allocation from two concrete alternatives; they keep its information source and optimizer effects explicit.
The contribution developed in this draft has three parts:
\begin{enumerate}
\item an executable final-artifact intervention that removes one surviving edit block with at most one additional verifier trial;
\item an additive turn-credit construction and a pointwise, coefficient-mass-matched broadcast control;
\item a fixed experimental protocol comparing those rules with terminal-only and terminal edit-focus training, supported by factual replay and implementation checks.
\end{enumerate}
The central empirical question is whether localized credit improves held-out repair performance relative to broadcast delivery of this signal. \Cref{sec:method} defines the intervention and coefficients; \cref{sec:design,sec:evaluation} specify the comparisons and evaluation units.
完整资料 / TEX_1_INTRODUCTION
1_introduction · 完整稿件源码
paper-rl/paper/sections/1_introduction.tex
公开内容 SHA-256 48f1d8352d3d4052860946a14bc7df25822183f7f661bb58bd74f074006954ad