arXiv:2610.33667cs.AIOct 2026

Manuscript Offprint

arXiv:2610.33667

SWE-Ladder: Learning to Localize, Reproduce, and Patch via Progressive Privileged Self-Distillation

Xudong Cai, Zhengxi Lu, Yuchen Yan, Jian Shao, Jun Xiao, Yueting Zhuang, Yongliang Shen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Resolving a repository-level issue typically requires a software-engineering (SWE) agent to localize the faulty code, reproduce the failure, and patch the code. Reinforcement learning trains such agents from a single test result on the final patch, while on-policy self-distillation (OPSD) adds token-level supervision from a teacher with privileged evidence, exposing the full reference patch at every step. Neither provides stage-specific guidance for localization or reproduction. We propose SWE-LADDER, which turns the verified repair of each training instance into stage-specific evidence: the changed files and lines for localization, the fail-to-pass tests for reproduction, and the diff for patching. A rule-based router assigns each step of an end-to-end rollout to a stage based on its tool call, a frozen teacher sees only the matching evidence, and the stages are distilled in repair order while GRPO optimizes the full trajectory. With Qwen3-4B-Instruct-2507 on SWE-bench Verified under the R2E-Gym scaffold, SWE-LADDER improves pass@1 from 9.6% to 16.4%, compared with 10.4% for GRPO and 12.4% for OPSD with the full patch. Under the OpenHands scaffold, it improves pass@1 from 13.0% to 17.6%. Reversing the stage order under R2E-Gym reduces pass@1 to 11.4%. Code is available at https://github.com/sekongger/SWE-Ladder.

1 Introduction

Reinforcement learning with verifiable rewards (RLVR) has become an effective approach to training software-engineering (SWE) agents (Luo et al., 2025; Golubev et al., 2025). The agent edits a repository over many tool calls, and the only training signal is whether its final patch passes the designated tests (Jimenez et al., 2024; Chowdhury et al., 2024). Over dozens of turns, it is difficult to identify which decision caused a failure (Xia et al., 2024). On-policy self-distillation (OPSD) offers

Figure

Figure 1: Supervision signals compared in this paper. GRPO assigns one reward to the whole trajectory; GRPO+OPSD shows the teacher the full reference patch at every step; SWE-LADDER gives the teacher stage-specific evidence and introduces the stages one at a time.

denser supervision (Zhao et al., 2026; Hübotter et al., 2026). The same model acts as a teacher that receives privileged evidence withheld from the student and scores every token of the student's trajectory (Lu and Thinking Machines Lab, 2025; Agarwal et al., 2024). In SWE, the available evidence is the verified repair of each training instance, and the natural choice is to show the teacher the full reference patch at every step (Figure 1).

To see what these signals teach, we measure three intermediate behaviors (Figure 2). They record whether the agent edits the files changed by the reference repair, reproduces the failure with a script, and re-runs the script successfully after its last edit. We find two patterns. First, the outcome reward does not consistently improve these behaviors: under GRPO, pass@1 barely moves (from 9.6% to 10.4%), while reproduction falls from 59.4% to 48.6%. Second, showing the teacher the full patch raises pass@1 but lowers post-edit verification from 22.6% to 16.2%.

The full patch conflates the evidence for three

Figure

Figure 2: Stage-wise diagnostics on SWE-bench Verified. Bars show changes from the base model at the final checkpoint; labels mark the changes discussed in Section 1. Base values appear under each metric. Definitions are in Appendix A.1.

different skills. Localization needs to know where the fault is, reproduction needs to know how the failure shows up, and patching needs to know what to change. During a localization step, a teacher that sees the full patch receives not only localization cues but also patch-generation details, and may therefore favor editing over searching. A similar effect has been reported in single-turn reasoning, where a teacher conditioned on the full reference makes the student skip intermediate steps and verify less (Zhang, 2026). At each step, the teacher should therefore see only the part of the verified repair that the current stage needs.

The three skills support one another: localization identifies the code to investigate, reproduction makes the failure concrete, and the resulting test provides a basis for checking a patch. We therefore organize privileged supervision into a progressive training schedule: localization, then reproduction, then patch generation.

Following these observations, we propose SWE-LADDER, which trains a single end-to-end agent with progressive privileged self-distillation. Prior work obtains stage-level supervision by fixing a localize-then-repair pipeline at inference time (Xia et al., 2024; Ma et al., 2025; He et al., 2026), which limits how the agent can explore. SWE-LADDER leaves the agent's actions unconstrained and decomposes only the teacher's evidence. A deterministic router labels each step as localization (LOC), reproduction (REP), or patch generation (PATCH) from its tool call. The teacher then sees only the slice of the repair for that stage. Training proceeds through the three stages in order, distilling one stage at a time, while GRPO optimizes the full trajectory.

With Qwen3-4B-Instruct-2507 on SWE-bench Verified, the gain depends on how the teacher receives evidence. Without privileged evidence, GRPO improves pass@1 from 9.6% to 10.4%. With the full patch at every step, GRPO+OPSD reaches 12.4%, and training all three stages at once also reaches 12.4%. Introducing the stages in order, SWE-LADDER reaches 16.4% and is the only method that improves both localization and verification without lowering reproduction (Figure 2). Reversing the order lowers pass@1 to 11.4%, and on the OpenHands scaffold SWE-LADDER improves pass@1 from 13.0% to 17.6%.

Our contributions are threefold:

• We show with stage-wise diagnostics that outcome rewards do not consistently improve intermediate repair behavior and that a full-patch teacher lowers post-edit verification.

• We propose SWE-LADDER, which shows the teacher one stage’s slice of the verified repair at a time, following the order of repair.

• SWE-LADDER outperforms GRPO and full-patch GRPO+OPSD on two agent scaffolds, and removing any stage, reversing the order, or training all stages at once lowers pass@1.

References (42)