GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

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

8,135 executable coding tasks built from commits instead of issues, and a finding about picking patches: tests and a learned judge each plateau near 43%, while combined they reach 51%.

Breakdown by FDE Interviews · 12 min read · Updated

About the original · 2025
AUTHORS
Jain, Singh, Shetty, Zheng, Sen, Stoica
FROM
UC Berkeley, Australian National University
PUBLISHED
Apr 2025 · arXiv preprint
CITED BY
168Semantic Scholar · Oct 2026
IN THIS BREAKDOWN · 10 SECTIONS

You can read 19% of this breakdown.

01

The paper in one minute

Open-weight coding agents lag behind proprietary ones, and the authors name two reasons: too few executable training environments, and weak ways to spend extra compute at test time.

For the first, they introduce SWE-GEN. Instead of starting from GitHub issues, which most commits do not have, they start from commits. Commits are filtered for small, focused fixes (at most five non-test files, 100 edited lines, 2,000 characters of patch). A Docker environment is built for each historical commit by searching dependency versions until one installs. Tests that fail before the commit and pass after (Fail-to-Pass tests) are taken from the commit or generated. Finally, a model writes an issue from the commit message, the patch and the failing test output, a step called back-translation. The result, R2E-Gym, has 8,135 tasks; 4,578 come from repositories outside SWE-bench and are used for training.

Fine-tuning Qwen-2.5-Coder on 3,321 successful trajectories from Claude 3.5 Sonnet, collected in these environments, gives a 32B agent that solves 34.4% of SWE-bench Verified on one attempt.

For the second, they sample 26 patches per problem and compare two ways to choose. Execution-based verifiers run tests: a trained testing agent writes reproduction tests and regression tests filter breakage. Execution-free verifiers are a judge model that reads the issue, the agent's trajectory and the patch and outputs a probability of YES. Each plateaus near 43%. A hybrid, which keeps the judge's top candidates and ranks them by test results, reaches 51.0%.

THE IDEA, VISUALLY
SWE-GEN: TASKS FROM COMMITS, NOT ISSUES Commits small fixes Environment Docker build F→P tests found or written Issue text back-translated The issue is written from the commit and the failing test's output, so it reads like a bug report without the fix. 8,135 tasks; 4,578 in repositories outside SWE-bench TRAIN, THEN SPEND COMPUTE CHOOSING Editing agent Qwen-2.5-Coder SFT on 3,321 Claude 3.5 Sonnet runs Testing agent, 32B writes 10 tests per script; plus regression tests Judge, 14B (LoRA) reads issue + trajectory + patch; scores P(YES) Hybrid judge's top n, then test score, judge breaks ties Most generated tests cannot tell a correct patch from a wrong one; a few pass wrong patches and fail right ones. The judge leans on how confident the agent's thoughts sound. PASS@1, SAME RECIPE, DIFFERENT DATA (TABLE 3) 7B SWE-Gym 10.6 R2E-Gym 19.0 14B SWE-Gym 16.4 R2E-Gym 26.8 32B SWE-Gym 20.6 R2E-Gym 34.4 CHOOSING 1 OF 26 PATCHES (FIGURE 4) execution-free judge 42.8 execution-based tests 43.7 hybrid 51.0 perfect picker (pass@26) 64.4 HYBRID ABLATIONS (FIGURE 8) regression tests only 47.4 Agentless tests instead 48.8 without top-n filter 49.8 full hybrid 51.0 WHAT THE JUDGE NEEDS (FIGURE 7A) patch + full trajectory 42.8 trajectory without thoughts 41.4 final patch only 37.6
R2E-Gym builds training tasks from small commits by finding or writing tests that fail before the fix and pass after, then writing the issue from the test failure. Its second half is about choosing among sampled patches: generated tests rarely discriminate, a learned judge is swayed by confident-sounding reasoning, and using the judge to shortlist and tests to decide beats either alone.
Research notes: the problem, approach and results
51.0%

SWE-bench Verified choosing one of 26 patches with the hybrid verifier; tests alone 43.7%, judge alone 42.8%

20.6% → 34.4%

pass@1 of a fine-tuned 32B agent, SWE-Gym data versus R2E-Gym data, same base model

37.6%

the judge's result when shown only the final patch, down from 42.8% with the agent's full trajectory

THE PROBLEM

Training open coding agents needs many executable tasks, and the usual source, GitHub issues with human-written tests, is limited: most commits have no issue. Then, at test time, sampling many patches only helps if you can tell which one is right, and both test-based and model-based selectors have failure modes nobody had compared side by side.

THE IDEA

Build tasks from commits: filter for small fixes, build a Docker environment for each, collect or generate tests that fail before and pass after, and back-translate an issue from the failing test output. For selection, combine a testing agent's generated tests (plus regression tests) with a judge model that reads the agent's trajectory: shortlist with the judge, decide with tests.

THE RESULT

The data trained a 32B agent to 34.4% on SWE-bench Verified, against 20.6% with SWE-Gym's data. Picking one of 26 patches, tests alone reached 43.7% and the judge alone 42.8%; the hybrid reached 51.0%, out of 64.4% possible.

02

Why it matters to an FDE

Two lessons apply well beyond SWE-bench.

You can build evaluation tasks from a customer's history. Any team with version control has thousands of small fixes and almost no tidy bug reports. R2E-Gym's recipe turns commits into tasks with a runnable environment, a test that defines success and a written problem statement. For a pilot, that means an evaluation set from the customer's own codebase instead of a public benchmark that may not resemble it.

Neither tests nor judges are enough on their own. Generated tests mostly fail to separate correct from incorrect patches: for most problems, under 20% of generated tests discriminate at all, and a few are "toxic", passing a wrong patch and failing the right one. A model judge discriminates better but leans on how confident the agent sounded; shown only the final patch, it dropped from 42.8% to 37.6%. Using the judge to shortlist and tests to decide gained more than seven points over either.

That pattern applies whenever you choose among several model outputs: support replies, SQL queries, extracted records. Use a cheap check that is reliable when it fires and a model judge for ranking, and do not let the judge read the agent's self-assessment if you can avoid it.

Know the data's lineage before calling the result open: the training trajectories came from Claude 3.5 Sonnet.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 149 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    How tasks are built, how the agent was trained, why each verifier fails, and three misreadings

    Free account
  2. 04How it works

    The SWE-GEN pipeline, the training setup, the three verifiers and the hybrid rule

    Premium
  3. 05The numbers that matter

    Data scale, pass@1 by model size, verifier plateaus, test quality and the ablations

    Premium
  4. 06Try it yourself

    Apply the paper's test metrics to a toy matrix, then simulate tests, a judge and the hybrid

    Premium
  5. 07Where it breaks

    Distilled training data, best-of-26 comparisons, synthetic tests, unstated settings and slips

    Premium
  6. 08Using it on a deployment

    Building an eval set from a customer's commits and a hybrid verifier for any multi-sample system

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →