SWE重构基准:编码代理能否完成长周期、全仓库的堆栈迁移?

·

研究论文 · 2026/08/27

现代软件系统在数十年的开发中积累了技术债务,使得迁移成本高昂且大多依赖人工。随着编码代理在修复错误方面越来越有能力,它们能否自主执行此类迁移?现有基准无法回答这个问题,因为它们只评估行为正确性,而不评估迁移是否实际发生。这导致了一个简单的漏洞:代理复制原始实现以使测试通过。我们称之为“盲目性”。为解决这个问题,我们引入了SWE Refactor Bench,一个包含20个全仓库迁移的基准,涵盖4种技术债务。一个三阶段的评估协议同时衡量迁移完整性和行为正确性。(1)迁移审计验证迁移是否发生。(2)行为测试用固定测试套件衡量正确性。(3)代理验证使用6个独立编码代理为隐藏的行为差异生成针对性测试。在来自8个前沿模型和26个模型-努力配置的520次运行中,只有28次(5.4%)通过所有三个阶段,20个任务中有13个没有接受的解决方案,最佳模型(claude-opus-5)得分为47.0/100。迁移完整性和行为正确性是两种不同的能力:少数运行通过跳过迁移来保持行为,并在迁移审计中被阻止;大多数尝试迁移但破坏了行为,并在行为测试中被阻止。代理无法实现完美的迁移:在通过迁移审计的340次运行中,58%达到固定检查的99%,但只有26%达到100%。代理能力因迁移类别而异:在构建工具链重写中得分31.4,但在语言重写中仅得分5.6。这些发现将SWE Refactor Bench定位为开发可靠全仓库迁移的编码代理的严格测试平台。

该论文针对现有编码代理基准的盲点,提出了一个严格的全仓库迁移基准,并通过大量实验揭示了当前模型的局限性,为未来研究提供了明确的方向。

Modern software systems accumulate technical debt over decades of development, which makes migration expensive and largely manual. As coding agents become increasingly capable at bug fixing, can they autonomously perform such migrations? Existing benchmarks cannot answer this question because they evaluate only behavioural correctness, not whether the migration actually occurred. This leads an easy hack: agents copy the original implementation to make tests pass. We call this Blindness. To address this problem, we introduce SWE Refactor Bench, a benchmark comprising 20 whole-repository migrations, covering 4 kinds of technical debt. A three-stage evaluation protocol measures both migration completeness and behavioural correctness. (1) Migration Audit verifies that the migration occurred. (2) Behavioural Tests measure correctness with a fixed test suite. (3) Agentic Verification uses 6 independent coding agents to generate targeted tests for hidden behavioural differences. Across 520 runs from 8 frontier models and 26 model-effort configurations, only 28 of 520 runs (5.4%) pass all three stages, 13 of the 20 tasks receive no accepted solution, and the best model (claude-opus-5) scores 47.0/100. Migration completeness and behavioural correctness are distinct abilities: a few runs preserve behaviour by skipping the migration and are stopped at Migration Audit; most attempt it and break behaviour, and are stopped at Behavioural Tests. Agents cannot deliver a perfect migration: among the 340 runs that pass Migration Audit, 58% reach 99% of the fixed checks, yet only 26% reach 100%. Agent capability differs across migration categories: agents score 31.4 on build toolchain rewrites but only 5.6 on language rewrites. Together, these findings position SWE Refactor Bench as a rigorous testbed for developing coding agents for reliable whole-repository migrations.

阅读原文

参与讨论