SWE-fficiency: Can Language Models Optimize Real-World Repositories on Real Workloads?
Abstract
Optimizing the performance of large-scale software repositories demands expertise in code reasoning and software engineering (SWE) to reduce runtime while preserving program correctness. However, most benchmarks emphasize what to fix rather than how to fix code. We introduce SWE-fficiency, a benchmark for evaluating repository-level performance optimization on real workloads. Our suite contains 498 tasks across nine widely used data-science, machine-learning, and HPC repositories (e.g., numpy, pandas, scipy): given a complete codebase and a slow workload, an agent must investigate code semantics, localize bottlenecks and relevant tests, and produce a patch that matches or exceeds expert speedup while passing the same unit tests. To enable this how-to-fix evaluation, our automated pipeline scrapes GitHub pull requests for performance-improving edits, combining keyword filtering, static analysis, coverage tooling, and execution validation to both confirm expert speedup baselines and identify relevant repository unit tests. Empirical evaluation of state-of-the-art agents reveals significant underperformance. On average, top agents achieve less than 0.23x the expert speedup: agents struggle in localizing optimization opportunities, reasoning about execution across functions, and maintaining correctness in proposed edits. We release the benchmark and accompanying data pipeline to facilitate research on automated performance engineering and long-horizon software reasoning.
Lay Summary
Widely-used software libraries like numpy and pandas power much of modern data science and AI, but speeding them up still requires scarce human expertise: engineers who can hunt down slow code, rewrite it, and prove they haven't broken anything in the process. We built SWE-fficiency, a benchmark that asks AI coding agents to do exactly this on real performance task directly drawn from these libraries' development histories. Today's best agents reach only 0.23× the speedup that human experts achieved, showing how automated performance engineering is not yet a saturated capability. Our benchmark, task formulation, and data flywheel provides the research community a concrete target for evaluating and characterizing state-of-the-art coding agents and towards automating software repository performance engineering.