Training Software Engineering Agents and Verifiers with SWE-Gym

Jiayi Pan, Xingyao Wang, Graham Neubig, Navdeep Jaitly, Heng Ji, Alane Suhr, Yizhe Zhang

TL;DR

The authors introduce SWE-Gym, the first interactive training environment designed specifically for cultivating software engineering (SWE) agents using real-world codebases, executable runtimes, and unit tests. By fine-tuning open-weight models and training trajectory verifiers on SWE-Gym, they achieve a new state-of-the-art performance for open-weight agents on SWE-Bench, demonstrating clear scaling laws across both training data and inference compute.

What Problem Does This Paper Address?

While large language models (LLMs) have shown impressive capabilities as autonomous software engineers, progress has been bottlenecked by a heavy reliance on prompting proprietary models (like GPT-4 or Claude). In other domains like mathematics or web navigation, open-weight models improve rapidly through post-training (supervised fine-tuning and reinforcement learning) within interactive environments.

However, software engineering has lacked such training environments. Existing benchmarks like SWE-Bench provide evaluation splits, but their training splits only contain final code patches (git diffs), missing the step-by-step trial-and-error trajectories required to train an agent to interact with a bash terminal or file editor. SWE-Gym bridges this gap by providing a fully interactive, verified training environment.

Methods

The paper leverages SWE-Gym to train both agent policies and verifiers using three main techniques:

  1. Rejection Sampling Fine-Tuning (Filtered Behavior Cloning): The authors collect successful trajectories from strong teacher models (GPT-4o, Claude 3.5 Sonnet) interacting with SWE-Gym and fine-tune open-weight base models (Qwen-2.5-Coder) on these step-by-step action sequences.
  2. Inference-Time Scaling with Verifiers: They train an Outcome-Supervised Reward Model (ORM) as a verifier. At inference time, the agent generates multiple candidate trajectories (rollouts), and the verifier selects the one with the highest predicted probability of success.
  3. Self-Improvement with Per-Instance Capping: To enable models to improve on their own data without a teacher, they implement online rejection sampling. To prevent the model from biasing its training data toward easy tasks (which are naturally solved more frequently), they introduce per-instance capping, limiting the number of successful trajectories saved per task.

Datasets

The paper introduces and evaluates several dataset splits:

  • SWE-Gym: The core contribution—2,438 real-world Python task instances sourced from 11 popular open-source repositories, complete with pre-configured Docker environments and unit tests.
  • SWE-Gym Lite: A subset of 230 easier, self-contained tasks designed for rapid prototyping.
  • SWE-Gym Raw: A massive unverified collection of 64,689 Python GitHub issues across 358 repositories without executable environments, released to aid future dataset synthesis.
Figure 2: Repository distribu- tion of SWE-Gym instances.

Agents trained on SWE-Gym are evaluated on the standard, independent benchmarks SWE-Bench Lite and SWE-Bench Verified.

Key Insights and Ideas

  • Curing the "Stuck-in-Loop" Disease: Open-weight models frequently get trapped in repetitive action loops when given general-purpose agent prompts. Fine-tuning on SWE-Gym trajectories dramatically reduces this behavior (by up to 18.6% absolutely), teaching the model how to navigate out of dead ends.
  • Compute-Performance Scaling Laws: Both training-time data scaling and inference-time rollout scaling show log-linear performance gains with no signs of saturation yet. This implies that agent performance is currently limited by compute budgets rather than environment capacity.
Training and Inference Time Scaling Curves
  • The Easy-Task Bias Trap: Simply training a model on all of its own successful rollouts hurts self-improvement because it over-indexes on easy tasks. Capping the samples per instance balances the dataset and restores learning efficacy.

Key Results

  • Policy Fine-Tuning: Fine-tuning a 32B Qwen-2.5-Coder model on just 491 trajectories boosted its resolution rate on SWE-Bench Verified from 7.0% to 20.6%.
  • Verifier Reranking: Deploying the trained verifier for inference-time scaling (selecting the best out of 16 rollouts) pushed the 32B model's performance to 32.0% on SWE-Bench Verified and 26.0% on SWE-Bench Lite, setting a new state-of-the-art for open-weight SWE agents.

Limitations and Future Work

  • Environment Diversity: SWE-Gym is currently limited to Python and spans only 11 repositories. Expanding to other languages and more diverse codebases via automatic environment synthesis is a critical next step.
  • Algorithmic Sophistication: The self-improvement gains using simple rejection sampling were modest for larger models. The authors suggest that more advanced online reinforcement learning methods (like PPO) could unlock better self-improvement.
  • Human-Agent Collaboration: Current setups treat agent execution as entirely autonomous, ignoring real-world human-in-the-loop dynamics and user simulation.

Summary updated

BibTeX
@inproceedings{pan2025training,
  author = {Jiayi Pan and Xingyao Wang and Graham Neubig and Navdeep Jaitly and Heng Ji and Alane Suhr and Yizhe Zhang},
  title = {{Training Software Engineering Agents and Verifiers with SWE-Gym}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Cq1BNvHx74},
}
Figure