Organizations: MAIS, Institute of Automation, Chinese Academy of Sciences · School of Artificial Intelligence, University of Chinese Academy of Sciences · Tencent Inc., China
Long-horizon software engineering (SWE) agents trained with reinforcement learning with verifiable rewards (RLVR) typically receive only terminal outcome supervision, making it difficult to distinguish productive actions from redundant exploration or functional regressions. We propose SWE-MILE, an asynchronous potential-induced milestone credit assignment framework that derives fine-grained process supervision from workflow runtime, without auxiliary reward models or external evaluators. SWE-MILE quantifies task-relevant file exposure and test-state alignment as navigation and verification potentials, respectively. Differences in these potentials attribute milestone progress and regressions to individual actions, while discounted backward credit propagates supervision to preceding steps. To efficiently acquire intermediate verification states, SWE-MILE further introduces asynchronous shadow probing, which replays repository-changing actions in an isolated sandbox and runs verification in parallel with the agent's primary interaction, largely hiding verification latency. The resulting process credit augments terminal outcome advantages and provides informative learning signals. Experiments on two representative long-horizon SWE tasks demonstrate substantial improvements in agent performance, highlighting workflow runtime signals as a practical source of process supervision for long-horizon SWE agents.
Figures & tables
Figure 1: Overview of SWE-MILE. Navigation potential tracks the exposure of task-relevant context during primary interaction, while repository-changing actions are asynchronously replayed in a shadow sandbox to probe verification potential and provide fine-grained process rewards.
Figure 2
Proprietary Models
Models
SWE-bench Verified
SWE-bench Pro
GPT-5.4 / 5.5 / 5.6 Sol
– / – / –
57.7 / 58.6 / 64.6
Claude Opus 4.6 / 4.8 / 5
80.8 / 88.6 / 96.0
53.4 / 69.2 / 79.2
Qwen-3.6-Max / 3.7-Max / 3.8-Max
– / 80.4 / –
57.3 / 60.6 / 67.7
DeepSeek V4-Flash / V4-Pro
79.0 / 80.6
52.6 / 55.4
GLM 4.6 / 5 / 5.2
68.0 / 77.8 / –
– / 55.1 / 62.1
Table 2: Issue resolution results. Best and second-best results among process reward methods are in bold and underlined , respectively.
Proprietary Models
Models
Doc2Repo
NL2Repo-Bench
GPT-5.4 / 5.5 / 5.6 Sol
61.64 / – / –
41.3 / 50.7 / 56.8
Claude Opus 4.6 / 4.8 / 5
60.39 / – / –
49.8 / 69.7 / 75.3
Qwen-3.6-Max / 3.7-Max / 3.8-Max
– / – / –
42.9 / 47.2 / 55.9
DeepSeek V4-Flash / V4-Pro
– / 57.20
39.4 / 38.5
GLM-4.6 / 5 / 5.2
– / 56.76 / –
17.5 / 35.9 / 48.9
Table 3: Whole-repository generation results.
Methods
SWE-bench Verified
SWE-bench Pro
Avg@4 ↑
Resp. Length ↓
Turns ↓
Avg@4 ↑
Resp. Length ↓
Turns ↓
Base Model
53.6
47426
79.6
30.8
32649
85.8
SWE-MILE
63.8
25825
81.8
39.3
25094
78.4
w/o milestone
59.4
29359
115.5
34.7
29156
115.6
w/o navigation
62.0
26319
87.3
38.0
26731
87.8
w/o verification
60.7
28489
96.4
35.8
27580
95.7
Table 4: Ablation results on SWE-bench Verified and SWE-bench Pro.
Figure 3: Sensitivity to navigation and verification potential weights on SWE-bench Verified and SWE-bench Pro.
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Appendix Sections
Contents
Appendix A
Related Work
Appendix B
Experimental Settings Details
Appendix C
Training Dynamics
Appendix D
Further Discussions
Appendix E
Prompts and Instructions
Appendix
Table 7
Hyperparameter
Issue Resolution
Whole-Repository Generation
Policy Optimization
Initial policy model
Qwen3.5-9B
Qwen3.5-35B-A3B
Optimizer
Adam
Adam
Learning rate
1e-6
1e-6
Learning rate schedule
Constant
Constant
Training Dataset
SWE-rebench V2
DeNovoSWE
Appendix
Table 5: Training hyperparameters for issue resolution and whole-repository generation.
Parameter
Issue Resolution
Whole-Repository Generation
Sampling temperature
0.6
0.6
Top- p
0.95
0.95
Top- k
20
20
Maximum turns
200
500
Maximum context length (tokens)
256k
256k
Maximum output tokens per turn
8192
16384
Appendix
Table 6: Evaluation settings for issue resolution and whole-repository generation.
Tool
Mode
Description
search
text
Find case-sensitive literal text with surrounding context.
symbol
Match symbols at identifier boundaries with surrounding context.
file
Find file paths by filename substring.
directory
Find directory paths by directory name substring.
read_file
file
Read a line range with line numbers.
diff
Show the diff against Git HEAD, optionally scoped to a path.
Appendix
Table 7: Codeflow tools and modes. “–” indicates that the tool has no mode parameter.
Runtime Component
Mean
Unit
Samples
Agent generation - turn
6.30 s
turn
314,547
Agent generation - traj
704.84 s
rollout
2,814
Action execution
5.30 s
turn
314,547
Primary agent interaction
1,761.83 s
rollout
2,814
Shadow verifier probe
308.77 s
probe
74,673
Primary final verifier
298.90 s
rollout
2,814
Appendix
Table 8: Runtime statistics of probe merge and multi-shadow probing for whole-repository generation.
Figure 4: SWE-bench Pro evaluation dynamics across training checkpoints.
Figure 5: Training rollout dynamics across reward settings.
Figure 6: Policy optimization dynamics across reward settings.
Repository-level software engineering (SWE) is a challenging long-horizon setting: agents must reason over extended interactions, use tools, and adapt to stateful environments. Recent work trains SWE agents with reinforcement learning methods such as Group Relative Policy Optimization (GRPO), which independently sample multiple trajectories per issue, test the resulting patches, and compare terminal rewards within a fixed group. However, this training setup does not reuse verifier feedback from failed patches as context for subsequent attempts, even though this feedback contains valuable diagnostic information about what went wrong. Training on recovery trajectories is challenging because the preceding outcome determines whether the next trajectory is generated, while the failed execution determines its conditioning context. We introduce FC-SWE, a failure-conditioned RL framework that incorporates recovery attempts into policy training. After a patch fails verification, FC-SWE restores the repository to its original task state and uses the failed patch and verifier feedback as context for a recovery trajectory. FC-SWE adapts GRPO to these chains of complete, multi-turn tool-use trajectories through two mechanisms. Trajectory-local rewards preserve each attempt's verifier outcome, preventing recovery success from rewarding an earlier failed patch. Active-set advantage estimation forms a comparison group from all initial and recovery trajectories actually executed for the same issue, so failed attempts remain in the group while unexecuted attempts are excluded. On all 500 SWE-bench Verified tasks under a verifier-assisted protocol, FC-SWE with Qwen3.5-4B and SWE-agent achieves 41.7% Resolved@1 and 52.8% Resolved@2, compared with 38.9% and 48.5% for GRPO. Although trained with at most two attempts per chain, FC-SWE reaches 70.7% Resolved@11 under an eleven-attempt test-time budget.
AI agents are increasingly expected to complete long-horizon workflows that require sustained progress over hours, millions of tokens, and complex environments. Yet current agent benchmarks largely evaluate short-form tasks, such as single pull requests, small tickets, or 5-10 minute exercises, limiting our ability to measure agents' capabilities in planning, long-context understanding, and memory use. We introduce SWE-Marathon, a benchmark of 20 long-horizon tasks spanning software engineering and adjacent technical domains. Each task consists of a unique executable environment, a human-written reference solution, and a multi-layer verification suite. Logged agent attempts average 27.2M total tokens, making SWE-Marathon substantially longer-horizon than existing SWE and command-line agent benchmarks. Current frontier coding agents solve fewer than 30% of tasks. Failures often arise from poor self-verification, self-reported infeasibility, and premature termination. We also observe reward-hacking behavior in 13.8% of rollouts, where agents attempt to exploit the environment or verifier to bypass the intended workflow. SWE-Marathon includes adversarial review of test suites and execution environments, as well as multi-layer checks designed to prevent shortcut solutions. We release SWE-Marathon, evaluation code, and agent trajectories at https://swe-marathon.org/.
Reinforcement learning with verifiable rewards (RLVR) provides reliable supervision for software engineering agents through executable tests, but binary rewards fail to distinguish trajectories with substantially different debugging quality. We investigate whether the current policy can judge its own trajectories and use these judgments to improve task performance without a separately trained reward model. To this end, we introduce Behavioral Self-Rewarding (BSR), a reward-refinement method that reuses the policy to compare observable debugging behavior among trajectories from the same task with the same verifier outcome. BSR aggregates pairwise preferences into task-local scores and converts them into bounded auxiliary rewards, introducing reward contrast while preserving the verifier-defined pass/fail ordering. This provides additional supervision from already-collected trajectories without requiring new environment interactions. Experiments on SWE-bench Verified and SWE-bench-Live show consistent improvements across the evaluated Qwen3-14B and Qwen3-32B configurations, supporting using the policy's own comparative judgments as a complementary learning signal for training software engineering agents.
Yiran Wu, Andrew Zhao, Yurui Chang +2
Pennsylvania State University · Microsoft Research · AG2AI