Evaluating Agentic Optimization on Large Codebases
The paper introduces FormulaCode, a benchmark comprising 957 real-world performance bottlenecks with expert patches and community workloads, to evaluate the holistic, multi-objective optimization capabilities of LLM agents on large codebases, revealing that this remains a significant challenge for frontier models.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Imagine you have a massive, bustling city called Code City. This city is built from millions of lines of code, with different neighborhoods (libraries like Pandas, SciPy, and Scikit-learn) handling everything from traffic control to power grids.
For a long time, AI coding assistants were like junior mechanics. They were great at fixing a single broken lightbulb in a single house or replacing a specific engine part. But now, we want these AIs to act like City Planners. We want them to look at the entire city, find out why traffic is jamming on Main Street, and redesign the whole intersection to make everything flow faster, without causing a blackout in the power grid next door.
This paper introduces FORMULACODE, a new "training ground" and "exam" designed to test if these AI City Planners are ready for the job.
The Problem: The "One-Task" Trap
Previously, we tested coding AIs with simple, made-up puzzles. It was like asking a mechanic, "Can you tighten this one bolt?" They could say "Yes!" and pass.
But in the real world, fixing a performance problem is messy. If you speed up the traffic lights, you might accidentally slow down the garbage trucks. If you optimize the power grid, you might break the water system. Real-world optimization requires balancing many different goals at once (multi-objective optimization) while making sure the city doesn't catch fire (correctness).
The Solution: FormulaCode (The "F1" of Code)
The authors created FORMULACODE, named after Formula 1 racing.
- The Analogy: In F1, you don't just tune the engine; you tune the aerodynamics, the tires, the weight distribution, and the fuel strategy all at once to get the fastest lap time.
- The Benchmark: FORMULACODE contains 957 real-world performance problems mined from famous open-source projects (like the ones that power data science and quantum computing).
- The Twist: For every problem, there isn't just one test. There are 264 different "workloads" (like different traffic scenarios: rush hour, a parade, a storm). The AI must fix the code so it runs faster in all these scenarios, not just one.
How the Exam Works
- The Baseline: The AI is given a snapshot of the code as it exists today (the "broken" city).
- The Goal: The AI must rewrite the code to make it faster.
- The Safety Check: The AI must pass all the existing safety tests (the city must still function).
- The Scorecard: The AI is compared against human experts. Did the AI do better than a human? Did it do worse? Did it break something?
What They Found (The Results)
The researchers tested the smartest AI models available (like GPT-5, Claude 4, and Gemini) using this new exam. Here is what happened:
The AI is a "Local Fixer," not a "Global Planner":
The AIs are great at fixing small, isolated problems (like tightening a single bolt). But when they try to optimize the whole city, they often get lost. They might speed up one part of the code but accidentally slow down another part, resulting in a net loss.- Analogy: The AI might build a super-fast highway, but then realize they forgot to build an exit ramp, causing a massive traffic jam.
Humans Still Win:
On average, the AI agents performed worse than human experts. Humans are better at seeing the "big picture" and understanding how different parts of the system interact.The "Popularity" Bias:
The AIs did surprisingly well on moderately popular projects but struggled on very obscure ones (because they hadn't seen enough similar code in their training) and very famous ones (because those projects were already so optimized there was little room for improvement).The Cost of Thinking:
The most powerful AIs were the most expensive to run. Interestingly, the "cheaper" models often took longer to think and made more mistakes, making them less cost-effective overall.
Why This Matters
This paper is a wake-up call. It tells us that while AI is getting incredibly good at writing new code, it still struggles to optimize complex, existing systems.
- For Researchers: It gives them a clear target. We can't just make AIs smarter at writing code; we need to teach them how to think like system architects who understand trade-offs.
- For the Future: FORMULACODE is a "living" benchmark. It updates every month with new problems, ensuring that as AI gets better, the test gets harder. It's like a video game that levels up automatically so the player never gets bored.
The Bottom Line
FORMULACODE is the first rigorous test to see if AI can truly act as an autonomous engineer for large software systems. The verdict? The AI is a talented apprentice, but it's not yet ready to replace the master architect. It needs more training on how to balance speed, safety, and complexity across an entire system.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.