FormulaCode: Evaluating Agentic Optimization on Large Codebases
Organizations: The University of Texas at Austin · California Institute of Technology · Cornell University
Abstract
Large language model (LLM) coding agents increasingly operate at the repository level, motivating benchmarks that evaluate their ability to optimize entire codebases under realistic constraints. Existing code benchmarks largely rely on synthetic tasks, binary correctness signals, or single-objective evaluation, limiting their ability to assess holistic optimization behavior. We introduce FormulaCode, a benchmark for evaluating agentic optimization on large, real-world codebases with fine-grained, multi-objective performance metrics. FormulaCode comprises 957 performance bottlenecks mined from scientific Python repositories on GitHub, each paired with expert-authored patches and, on average, 264.6 community-maintained performance workloads per task, enabling the holistic ability of LLM agents to optimize codebases under realistic correctness and performance constraints. Our evaluations reveal that repository-scale, multi-objective optimization remains a major challenge for frontier LLM agents. Project website at: https://formula-code.github.io
Figures & tables
| Mean | Max | ||
| Issue Text | Length (Tokens) | 2718.03 | 15781 |
| Gold Patch | # Lines edited | 38.088 | 526 |
| # Files edited | 3.93 | 34 | |
| # Func. edited | 6.06 | 54 | |
| Workloads | # Eval. Fns | 264.58 | 1364 |
| % Coverage | 41.24% | 97.86% |
Appendix figures & tables21 assets
Supplementary material from the paper’s appendix.
Appendix
| 1 | INPUT SIGNATURE |
| 2 | |
| 3 | problem_description : string |
| 4 | Problem statement and technical context from PR/issue. |
| 5 | |
| 6 | git_patch : string |
| 1 | Example PR |
| 2 | |
| 3 | CLASSIFIER INPUT |
| 4 | |
| 5 | problem_description : string |
| 6 | Labels: performance; Description: Fixes #14471. |
| 1 | Performance type & difficulty classifier |
| 2 | |
| 3 | INPUT SIGNATURE PROMPT |
| 4 | |
| 5 | problem_description : string |
| 6 | Problem statement and technical context from PR/issue. |
| 1 | INPUT SIGNATURE |
| 2 | |
| 3 | owner_repo : string |
| 4 | The repository this commit belongs to (e.g., scikit-learn/scikit-learn). |
| 5 | |
| 6 | sha : string |
| 1 | Example PR |
| 2 | |
| 3 | CLASSIFIER INPUT |
| 4 | |
| 5 | problem_description : string |
| 6 | Labels: performance; Description: Fixes #14471. |
| 1 | Judge performance related PR prompt |
| 2 | |
| 3 | INPUT SIGNATURE PROMPT |
| 4 | |
| 5 | problem_description : string |
| 6 | Problem statement and technical context from PR/issue. |
| 1 | Problem Extractor Prompt description |
| 2 | |
| 3 | INPUT SIGNATURE PROMPT |
| 4 | |
| 5 | pr_title : string |
| 6 | The GitHub PR title |
| Repository Name | #Stars | #Forks | Filter Stage 1 | Filter Stage 2 | Latest Task Date | Description |
|---|---|---|---|---|---|---|
| 2 . scikit-learn/scikit-learn | 63792 | 26359 | 2434 | 243 | 2025-10-31 | scikit-learn: machine learning in Python |
| 3 . pandas-dev/pandas | 46922 | 19184 | 3298 | 560 | 2025-11-11 | Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more |
| 4 . scipy/scipy | 14120 | 5516 | 1454 | 209 | 2025-10-29 | SciPy library main repository |
| 5 . apache/arrow | 16089 | 3884 | 1988 | 267 | 2025-07-22 | Apache Arrow is the universal columnar format and multi-language toolbox for fast data interchange and in-memory analytics |
| 6 . networkx/networkx | 16277 | 3415 | 288 | 44 | 2025-09-16 | NetworkX is a Python package for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks. |
| 7 . Qiskit/qiskit | 6598 | 2659 | 717 | 212 | 2025-11-19 | Qiskit is an open-source SDK for working with quantum computers at the level of pulses, circuits, and application modules. |
| Repository | #Tasks | Latest Task | Avg. Difficulty | Avg. Patch Size (Tokens) | Avg. PR Size (Tokens) | Most Common Optimization |
|---|---|---|---|---|---|---|
| 2 . pandas-dev/pandas | 222 | 2025-10-21 | 0.77 | 1842.85 | 489.35 | Micro Optimizations (26.6%) |
| 3 . scikit-learn/scikit-learn | 143 | 2025-10-31 | 1.0 | 2735.29 | 491.49 | Micro Optimizations (23.1%) |
| 4 . Qiskit/qiskit | 142 | 2025-10-03 | 1.73 | 4438.38 | 505.02 | Use Lower Level System (28.2%) |
| 5 . xdslproject/xdsl | 134 | 2025-10-09 | 1.36 | 3567.76 | 463.46 | Remove Or Reduce Work (37.3%) |
| 6 . optuna/optuna | 94 | 2025-11-05 | 0.96 | 546.29 | 471.81 | Use Better Algorithm (24.5%) |
| 7 . pydata/xarray | 69 | 2025-11-21 | 0.98 | 1929.9 | 474.04 | Micro Optimizations (30.4%) |
| 1 | OBJECTIVE |
| 2 | You are a performance optimization expert. Speed up the repository while maintaining correctness . |
| 3 | |
| 4 | TOOLING |
| 5 | The micromamba environment includes Pytest for correctness testing and Airspeed Velocity (ASV) for benchmarking measurements and profiling. |
| 6 |
| 1 | OBJECTIVE |
| 2 | You are a performance optimization expert. Speed up the repository while maintaining correctness . |
| 3 | |
| 4 | TOOLING |
| 5 | The micromamba environment includes Pytest for correctness testing and Airspeed Velocity (ASV) for benchmarking measurements and profiling. |
| 6 |
| 1 | OBJECTIVE |
| 2 | You are a performance optimization expert. Speed up the repository while maintaining correctness . |
| 3 | |
| 4 | TOOLING |
| 5 | The micromamba environment includes Pytest for correctness testing and Airspeed Velocity (ASV) for benchmarking measurements and profiling. |
| 6 |
| Parameter | Terminus 2 | OpenHands |
|---|---|---|
| Decoding and sampling | ||
| Temperature | ||
| Top- | provider default (unset) a | |
| Top- / penalties | provider default | provider default |
| Reasoning effort | per model (Table 13 ) | per model (Table 13 ) |
| Max output tokens | model cap (Table 13 ) | model cap (Table 13 ) |
| Model | Adv | LogAdv | RP Rank |
| Claude 4.0 Sonnet | 1 | ||
| Qwen 3 Coder | 2 | ||
| GPT-5 | 3 |
| Model | ||
| Claude 4.0 Sonnet | 0.94 | 0.97 |
| GPT-5 | 0.96 | 0.96 |
| Gemini 2.5 Pro | 0.98 | 0.95 |
| Qwen 3 Coder | 0.96 | 0.97 |