FormulaCode Exposes How AI Coding Agents Still Lose to Human Experts
A new live benchmark pits frontier coding agents against human experts on 957 real performance bottlenecks from scientific Python repositories, and the humans still win.
ProTakeaways
- FormulaCode is a live benchmark of 957 real performance bottlenecks from 70 scientific Python repos.
- Each task ships with ~265 community-written performance workloads plus expert patches for comparison.
- All seven frontier agent-model configurations trail human experts on the advantage metric.
- Agents excel at parallelization and batching but struggle with vectorization and C-extension delegation.
- Roughly half of agent patches get rolled back for failing correctness checks (PyTest or snapshot tests).
- Dataset, harness, and leaderboard are open at github.com/formula-code/fc-eval.
Coding agents are moving from writing snippets to editing whole repositories, but the benchmarks that measure them haven't kept up. Most still boil the answer down to whether unit tests pass or fail, which tells you nothing about whether the code got faster, slower, or accidentally ballooned memory usage. A team from UT Austin, Caltech, and Cornell just released FormulaCode, a benchmark built specifically to measure whether LLM agents can actually optimize real codebases, and the headline result is that even the best frontier configurations still trail human experts.
Why binary pass/fail misses the point
The core problem is that performance optimization is a fundamentally different task from bug fixing. Real-world optimization is rarely isolated, diagnosing and improving performance often requires reasoning about architectural decisions, component interactions, and design trade-offs on the system-level rather than tuning an isolated function. Existing repo-scale benchmarks like SWE-Bench check whether tests pass, which gives agents a discrete signal and no incentive to think about tradeoffs across an entire codebase.
FormulaCode reframes the problem as multi-objective optimization. Each task presents an agent with a repository snapshot containing a known performance bottleneck, plus a large collection of community-written performance workloads that stress different execution paths. The agent has to make the codebase faster on the workloads collectively while still passing correctness checks. Speeding up one path at the cost of another is fair game, and that tension is the point.

What's inside the dataset
The benchmark is built from real merged pull requests across mature scientific Python projects. FormulaCode is constructed from 957 real-world performance bottlenecks mined from 70 scientific, open-source Python repositories, like Pandas, Scikit-learn, and SciPy. The key differentiator is measurement density: each task in FormulaCode is paired with an average of 264.6 community-maintained performance workloads alongside expert-authored patches.
Those workloads come from the airspeed-velocity (ASV) framework that projects like NumPy and Pandas already use in production to catch performance regressions. That matters because it means the measurement infrastructure is battle-tested, and the workloads reflect what the actual maintainers care about rather than synthetic stress tests.
The dataset construction runs through a four-stage automated pipeline:
- Scraping. A BigQuery script over GitHub's public dataset finds 766 repos containing ASV configurations, with active maintenance and at least 100 stars.
- Attribute filtering. Rule-based filters plus an LLM classifier scan 26,717 pull requests to identify 3,181 candidates where the primary intent was performance optimization.
- Environment synthesis. A reflexive LLM agent iteratively writes Docker build scripts for each candidate, using chronological caching from adjacent commits to keep costs down. This yields 1,232 reproducible containers.
- Statistical validation. Expert patches are executed against baselines with the Mann-Whitney U test (p < 0.002) to confirm the improvement is real and not measurement noise, leaving 957 final tasks.

Because the pipeline is fully automated, FormulaCode operates as a live benchmark, adding roughly 27 new tasks per month, which limits the contamination problem that plagues static benchmarks trained into every new model.
How agents are scored
The primary metric is advantage, defined as the agent's geometric-mean speedup minus the human expert's speedup on the same workloads. A score of zero means the agent matched the human, positive means it beat them, and negative means it fell short. The paper also introduces a stratified advantage that measures performance at module, class, and function granularity, so you can tell whether an agent is making surgical function-level tweaks or restructuring things at the architectural level.
The scoreboard: humans still winning
The team evaluated seven configurations pairing four frontier models (GPT-5, Claude 4.0 Sonnet, Gemini 2.5 Pro, Qwen 3 Coder) with two agent harnesses (Terminus 2 and OpenHands). All evaluated configurations attain speedup > 1 on FormulaCode-V relative to the baseline codebase, indicating that agents can successfully identify and implement runtime-relevant changes. But for all agents, the overall advantage is negative, indicating a fundamental performance gap.
The best configuration was OpenHands paired with Claude 4.0 Sonnet, which came closest to expert-level performance but still fell short. Several more granular findings are worth flagging:
- Local beats global. Agents are stronger at function-level rewrites than at architectural refactors that span modules.
- Strategy matters. Agents beat experts on parallelization and batching, but consistently lose when the optimal fix involves delegating to lower-level system implementations like C extensions or vectorized numpy operations.
- Popularity curve is non-monotonic. Agents do worst on the least-popular and fourth-quintile repos, and best on mid-popularity ones. The tail case likely reflects distribution shift; the fourth-quintile dip reflects mature codebases where obvious wins are already taken.
- Expensive models are cheaper overall. Because smaller open-weight models burn far more tokens inside the agent loop, frontier models are more cost-effective per unit of improvement.
- No leakage detected. Performance doesn't consistently drop on tasks created after a model's knowledge cutoff, suggesting the gap is capability-based, not memorization-based.
The interesting failure modes
The qualitative analysis is where this paper gets useful. In one Optuna task, both the agent and the expert correctly identified that a naive $O(N^3)$ hypervolume algorithm could be reduced to $O(N^2)$. The expert wrote a fully vectorized numpy solution using cumulative minimums along both axes; the agent wrote a Python sweep-line with bisect. Same asymptotic complexity, very different constants, and the human won.
In another case involving Modin's backend caching logic, the agent found and fixed a legitimate bug in the caching code, but the bug was not on the performance-critical path. The expert instead disabled an expensive auto-switching feature by default, a systemic change the agent never considered. This is a recurring pattern: agents are good at identifying local problems and much worse at triaging what the actual bottleneck is.
The correctness numbers are also sobering. Across configurations, roughly half of all agent patches get rolled back for failing either the PyTest suite or snapshot tests, meaning the agent spends most of its budget exploring solutions that never ship.
Availability and how to try it
Everything is open. The dataset lives on Hugging Face, the evaluation harness is on GitHub, and there is a live leaderboard that updates as new models are evaluated. Running a task locally is a two-step install:
uv tool install fc-eval
fc-eval run --dataset formulacode --task-id shapely_shapely_2283 --config your-config.json
For anyone building coding agents, this is one of the more honest evaluation surfaces available. The correctness constraint is real, the performance measurements come from tools maintainers actually use, and the tasks continue to grow every month, which means gaming the benchmark by training on it becomes progressively harder.