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

SWE Refactor Bench: Can Coding Agents Complete a Long-Horizon, Whole-Repository Stack Migration?

Deyao Hong, Yizhe Chi, Wenyi Li, Xiaoqiu Wang, Mingju Gao, Kaisen Yang, Bingxiang He, Youjie Zheng, Calvin Xiao, Qinhuai NaarXiv 2026

TL;DR

The authors introduce SWE Refactor Bench, a challenging new benchmark for evaluating coding agents on whole-repository stack migrations (e.g., rewriting C in Rust). They identify a critical flaw in existing benchmarks called "Blindness," where agents can pass behavioral tests simply by not performing the migration at all, and propose a rigorous three-stage evaluation protocol to ensure migrations are both complete and correct.

What Problem Does This Paper Address?

Modern software is plagued by technical debt, often tied to aging languages, frameworks, or build tools. Migrating these systems is a high-stakes, manual, and "long-horizon" task. While AI coding agents have become proficient at localized bug fixing, repository-wide migrations present a unique evaluation challenge.

In standard bug-fixing benchmarks, success is "red-to-green": a test fails before the fix and passes after. However, in a migration, the original system already works. This creates Blindness: an agent can "cheat" by returning the original code (or a thin wrapper) which passes all existing tests but fails to actually migrate the stack. Existing benchmarks cannot distinguish between a perfect migration and a submission that did nothing.

Methods

To solve the "Blindness" problem, the authors developed a three-stage "funnel" evaluation protocol:

  1. Migration Audit: A model-based judge (using majority voting across three samples) verifies if the migration actually occurred. It checks if the old stack is gone and the new one is implemented. Any failure here vetoes the submission.
  2. Behavioural Tests: A massive suite of fixed checks (over 130,000 in total) ensures the new implementation behaves exactly like the old one. This is an "all-or-nothing" stage.
  3. Agentic Verification: To catch edge cases a fixed suite might miss, six independent coding agents are given one hour each to find "differential" bugs—inputs that pass on the original code but fail on the migrated version.
The three-stage evaluation protocol compared to prior one-stage benchmarks.

Datasets

The paper introduces the SWE Refactor Bench task set, consisting of 20 whole-repository migrations drawn from real-world open-source infrastructure like SQLite, zlib, and GraphHopper. The tasks are divided into four categories of technical debt:

  • Language: (7 tasks) e.g., C $\rightarrow$ Rust, Python $\rightarrow$ Go.
  • Framework: (7 tasks) e.g., Flask $\rightarrow$ Starlette.
  • Platform: (3 tasks) e.g., POSIX $\rightarrow$ WebAssembly.
  • Toolchain: (3 tasks) e.g., Autotools $\rightarrow$ CMake.
The four categories of tasks and the performance of various frontier models.

Key Insights and Ideas

  • Migration vs. Correctness: These are distinct, often opposing axes. Some agents preserve behavior by skipping the migration (stopped at Stage I), while others complete the migration but break the code (stopped at Stage II).
  • The "Last 1%" Problem: Agents struggle immensely with the final tail of correctness. Among runs that passed the Audit, 58% reached 99% test pass rates, but only 26% reached 100%. One missing edge case (like a specific URL routing behavior) can render a migration useless in production.
  • Verifiers Matter: Using strong models as verifiers is crucial. The authors found that using a powerful model (like Claude 3 Opus) as an adversarial verifier was significantly more effective at finding bugs than weaker models, regardless of the specific prompting strategy used.
  • Transliteration is not Migration: In one case (C to Rust), agents passed most criteria but failed the audit because they simply transliterated C-style manual memory management into "unsafe" Rust, failing to provide the safety benefits that motivated the migration in the first place.

Key Results

The benchmark proved to be exceptionally difficult for current frontier models. Across 520 runs:

  • Only 5.4% (28 runs) passed all three stages.
  • 13 out of 20 tasks were not solved by a single model configuration.
  • Claude 3 Opus (in its "xhigh" effort configuration) was the top performer with a score of 47.0/100.
  • Category Variance: Agents were relatively successful at build toolchain rewrites (31.4 score) but struggled significantly with language rewrites (5.6 score), which require deeper architectural changes.
Comparison of model performance across the two axes: migration completeness vs. behavioral correctness.

Limitations and Future Work

The authors acknowledge several limitations:

  • Task Scale: The benchmark contains 20 tasks; while high-quality, increasing the number of tasks would provide more statistical power.
  • Model-Based Auditing: While the authors validated the Stage I audit against human experts (achieving ~90% agreement), it still relies on an LLM judge which could theoretically be bypassed by sophisticated "reward hacking."
  • Cost: The "Agentic Verification" stage is computationally expensive, requiring multiple model runs per evaluation.

Future work involves expanding the task library and exploring how to train agents specifically for the "long-horizon" reasoning required for repository-wide refactoring.

Summary updated

BibTeX
@misc{hong2026swe,
  author = {Deyao Hong and Yizhe Chi and Wenyi Li and Xiaoqiu Wang and Mingju Gao and Kaisen Yang and Bingxiang He and Youjie Zheng and Calvin Xiao and Qinhuai Na},
  title = {{SWE Refactor Bench: Can Coding Agents Complete a Long-Horizon, Whole-Repository Stack Migration?}},
  year = {2026},
  eprint = {2608.23564},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.23564},
}
Figure