Scalable Supervision for Software Agents via Patch Reasoning

Junjielong Xu, Boyin Tan, Xiaoyuan Liu, Chao Peng, Pengfei Gao, Pinjia HearXiv 2025

TL;DR

Training software engineering agents typically requires running heavy, fragile test sandboxes (like Docker), which severely limits scalability since most real-world code lacks high-coverage tests. This paper introduces R4P (Patch Reasoning), a method that verifies code patches without execution by comparing a group of candidate patches against each other for mutual context. Using R4P, the authors train Mini-SE, a completely execution-free coding agent that achieves significant performance gains purely through reinforcement learning and test-time scaling.

What Problem Does This Paper Address?

Large Language Model (LLM) agents excel at software engineering (SWE) tasks, but their training and evaluation heavily depend on "test-based supervision"—running unit tests inside isolated environments to see if a generated patch works. The authors identify two major bottlenecks with this approach:

  1. Low Test Coverage: High-quality, high-coverage tests are rare in the wild. In a study of GitHub repositories with over 500 stars, the authors found that only 28.11% of resolved issues actually contained corresponding tests.
  2. Infrastructure Overhead: Building and maintaining sandboxes (e.g., Docker containers) is slow, labor-intensive, and prone to crashing under heavy parallel workloads during reinforcement learning (RL) training.

Existing model-based verifiers try to judge patches without execution, but they are often tightly coupled to specific agent trajectories, hindering their ability to generalize to other agents.

Methods

The authors propose R4P, a scaffold-agnostic, execution-free patch verification method. Instead of evaluating a single patch in isolation—which often leads to false positives due to a lack of dependency context—R4P introduces a group-wise training objective.

Given an issue description and a group of $N$ candidate patches, R4P reads all of them simultaneously. It cross-references edit locations and code changes across the patches, using them as mutual context to spot subtle bugs. It then outputs the IDs of the correct patches.

To demonstrate R4P's practical utility, the authors design Mini-SE, a lightweight, fully execution-free agentic scaffold. Mini-SE bypasses trial-and-error tool use and sandbox testing entirely during its rollout, delegating all verification and selection to R4P.

Figure 1: Mini-SE: a fully execution-free scaffold designed to demonstrate R4P’s scalable supervision practicality on downstream tasks. All patch review burden is shifted to R4P.

Datasets

  • SWE-Gym: Used to sample 14,628 patches across 2,438 issues via Claude-3.7-Sonnet to train R4P using Group Relative Policy Optimization (GRPO).
  • R2E-Gym-Subset: Used for training the Mini-SE agent via pure RL without using official test sandboxes.
  • SWE-bench-verified: A high-quality subset of 500 issues used to evaluate the downstream performance of Mini-SE and R4P.

Key Insights and Ideas

  • Group-wise over Point-wise: Evaluating patches in isolation causes LLMs to overestimate patch quality. When patches are grouped, they act as a "reference set" for each other. If multiple patches compete to modify adjacent code snippets, the model can easily contrast the correct logic against incorrect variants.
  • Denser Reward Signals: Group-wise verification transforms a sparse binary outcome space (Pass/Fail) into a denser accuracy-based reward signal, which significantly stabilizes reinforcement learning and prevents reward collapse.
  • Speed vs. Noise Trade-off: While model-based rewards are inherently noisier than actual test execution, the benefits of data scaling outweigh the slight noise. R4P takes less than 1 second per patch, compared to an average of 50 seconds for traditional sandbox testing.

Key Results

  • High Verification Accuracy: Built on a 32B model, R4P achieves a patch-level accuracy of 72.2% on SWE-bench-verified, outperforming trajectory verifiers and matching frontier proprietary models like Claude-4.5-Sonnet (71.6%) and Gemini-3.1-Pro (73.8%).
Figure 2: Comparison with RMs. (Acc.) (“∗" mark means pair-wise selection)
  • Downstream RL Success: Mini-SE (powered by Qwen3-32B) trained with R4P rewards achieved a 26.2% Pass@1 score, a 10% absolute improvement over the base model, proving that R4P provides a stable training signal without reward collapse.
  • Test-Time Scaling (TTS): When sampling 16 candidate patches and using R4P to select the best one, Mini-SE's resolution rate scales up steadily to 32.8%.

Limitations and Future Work

  • Static Weights: R4P's weights remain fixed after training. As the agent's policy improves, the static reward model might become misaligned with true patch quality. The authors plan to explore periodic calibration using high-quality sandboxes in future work.
  • No In-Loop Self-Fixing: Because R4P is execution-free, it cannot supervise an agent's internal trial-and-error or self-debugging behaviors, which inherently require a runtime environment.
  • Language Constraints: The current implementation of R4P and Mini-SE is Python-centric and relies on Python static analysis tools (tree-sitter). Extending to other languages requires new dataset collection and tool adaptation.

Summary updated

BibTeX
@misc{xu2025scalable,
  author = {Junjielong Xu and Boyin Tan and Xiaoyuan Liu and Chao Peng and Pengfei Gao and Pinjia He},
  title = {{Scalable Supervision for Software Agents via Patch Reasoning}},
  year = {2025},
  eprint = {2510.22775},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2510.22775},
}
Figure