DeRL-SWE: Decoupled Reinforcement Learning with Nested Credit Assignment for Software Engineering
Abstract
Recent state-of-the-art systems for repository-level software engineering (SWE) rely heavily on SWE-specific Supervised Fine-Tuning (SFT) or mid-training, which improves benchmark performance at the cost of narrowing the base model's general ability. Reinforcement Learning (RL) avoids this imitation bias by directly optimizing task-level returns. However, applying RL to repository-level SWE is difficult, since agentic training over long-horizon tool-use trajectories suffers from massive action spaces and delayed binary rewards that destabilize credit assignment. We propose DeRL-SWE, a decoupled RL framework that exploits the localize-then-repair agentless pipeline. Training proceeds in two stages: (i) repair-only RL under oracle localization to bootstrap edit capability, and (ii) joint localization-repair RL with nested credit assignment, where each localization is rewarded by the subsequent success of repair operations sampled from it. We show that this nested estimator yields an unbiased Monte Carlo estimate of the joint policy gradient, turning credit assignment from a heuristic into a principled decomposition of the end-to-end objective. On SWE-bench Verified, DeRL-SWE-32B reaches 47.4% single-attempt and 61.8% with test-time patch selection under the agentless framework. Meanwhile, the model preserves the base model's reasoning capabilities on general benchmarks such as math and general knowledge.