NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

R2E-Gym: Procedural Environment Generation and Hybrid Verifiers for Scaling Open-Weights SWE Agents

Naman Jain, Jaskirat Singh, Manish Shetty, Tianjun Zhang, Liang Zheng, Koushik Sen, Ion Stoica

TL;DR

This paper introduces R2E-Gym, a massive dataset of over 8.1K executable environments for training AI agents to solve real-world software engineering tasks. They also propose a novel "hybrid verifier" that combines two existing methods to significantly improve the accuracy of these agents, achieving state-of-the-art results for open-weight models and rivaling proprietary systems.

What Problem Does This Paper Address?

Training AI agents to tackle complex software engineering tasks, like fixing bugs in GitHub issues, is a promising area. However, two major hurdles exist:

  1. Scalable Training Environments: Creating realistic, executable environments for training these agents is incredibly difficult and time-consuming. Existing datasets often lack executable environments or rely heavily on human-written issues and tests, limiting their scale.
  2. Efficient Test-Time Performance: Once trained, how do we efficiently verify if an agent's proposed solution is correct? Existing methods for this verification have their own limitations, and combining them effectively has been an open question.

This paper aims to overcome these challenges by providing a large-scale, procedurally generated training environment and a more effective method for verifying agent solutions.

Methods

The paper introduces two core contributions:

  1. SWEGEN (Synthetic Data Curation Recipe): This is the engine behind R2E-Gym. Instead of relying on human-written issues and tests, SWEGEN uses a process of "back-translation" from code commits and test generation. This allows them to automatically create a vast number of executable training environments from existing code repositories, drastically improving scalability.
  2. Hybrid Test-Time Scaling: The authors analyze two types of verifiers:
  3. Execution-Based Verifiers: These use generated test cases to check if a proposed code patch fixes the issue. Their limitation is that they can struggle to differentiate between very similar patches.
  4. Execution-Free Verifiers: These analyze the agent's entire thought process and actions (the "trajectory") to predict correctness, without actually running the code. These are better at distinguishing between patches but can be biased by non-code-related heuristics in the agent's reasoning.

The key innovation here is a hybrid approach that combines the strengths of both. By using execution-based verifiers to narrow down possibilities and then execution-free verifiers to rank the remaining candidates, they achieve significantly better performance than either method alone.

Datasets

  • R2E-Gym: The paper introduces R2E-Gym, a new dataset comprising over 8.1K procedurally curated, executable environments for training SWE agents. This is significantly larger than previous efforts.
  • SWE-Bench Verified: This existing benchmark is used for evaluating the performance of the trained agents. The paper also uses a subset of R2E-Gym that does not overlap with SWE-Bench for training to avoid data contamination.

Key Insights and Ideas

  • Synthetic Data is Scalable: Generating training data synthetically using SWEGEN is not only scalable but also yields performance comparable to using real-world, human-curated data. This is a major step towards democratizing AI for software engineering.
  • Execution-Based Verifiers Lack Distinguishability: Tests generated by execution-based methods often fail to differentiate between correct and incorrect patches, limiting their effectiveness in re-ranking.
  • Execution-Free Verifiers Can Be Misled by Heuristics: These verifiers can be biased by "agent thoughts" or stylistic elements in the reasoning process, leading to incorrect judgments even if the code itself is flawed.
  • Hybrid is Better Than the Sum of its Parts: Combining execution-based and execution-free verifiers is crucial. While each method plateaus around 42-43% accuracy, their hybrid approach achieves a significant boost to 51%.

Key Results

  • R2E-Gym Size: The dataset contains over 8.1K executable environments.
  • SWEGEN Training Performance: Models trained with SWEGEN achieve a PASS@1 score of 34.4% on the SWE-Bench Verified benchmark.
  • Hybrid Verifier Performance: The proposed hybrid verifier achieves a BEST@26 performance of 51% on SWE-Bench Verified.
  • State-of-the-Art for Open-Weights: This 51% performance represents a new state-of-the-art for open-weight SWE agents, making them competitive with proprietary systems like OpenAI's o1 and Anthropic's sonnet-3.5-v2.
  • Agent Trajectory Example: The paper includes a detailed walkthrough of an agent successfully solving a real-world bug, showcasing its systematic exploration, root cause analysis, and solution implementation.

Limitations and Future Work

  • Repository Installation Complexity: While they use a Docker-based approach, installing historical commits with evolving dependencies remains a challenge. They suggest future work could involve more LLM-driven dependency resolution.
  • Test Toxicity: Execution-based verifiers can sometimes generate "toxic tests" that incorrectly favor incorrect patches. While rare, this can impact reliability.
  • Agent Thought Bias: Execution-free verifiers can be misled by agent thoughts. Future work could explore methods to mitigate this bias.
  • Scaling Further: The authors suggest that future work could explore context-parallelism to handle even larger contexts for training SWE agents on more complex tasks. They also aim to open-source their environments, models, and agent trajectories.

Summary updated

BibTeX
@inproceedings{jain2025r,
  author = {Naman Jain and Jaskirat Singh and Manish Shetty and Tianjun Zhang and Liang Zheng and Koushik Sen and Ion Stoica},
  title = {{R2E-Gym: Procedural Environment Generation and Hybrid Verifiers for Scaling Open-Weights SWE Agents}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=7evvwwdo3z},
}
Figure