← Latest papers
💻 computer science

Do AI Models Dream of Faster Code? An Empirical Study on LLM-Proposed Performance Improvements in Real-World Software

This empirical study demonstrates that while Large Language Models can solve complex performance optimization tasks in real-world Java systems, their solutions remain highly volatile and generally inferior to human developers due to struggles with autonomously identifying hotspots and synthesizing optimal algorithms, revealing that current algorithmic benchmarks overestimate their true capabilities.

Original authors: Lirong Yi, Gregory Gay, Philipp Leitner

Published 2026-04-10
📖 5 min read🧠 Deep dive

Original authors: Lirong Yi, Gregory Gay, Philipp Leitner

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 very talented, super-fast apprentice named "AI." This apprentice can read millions of cookbooks and write recipes instantly. You ask them to make a dish faster. Sometimes, they surprise you by finding a clever shortcut you never thought of. But other times, they accidentally add too much salt, burn the sauce, or use a knife that's too dull, making the meal take longer to prepare than before.

This paper is essentially a report card on how well this "AI Apprentice" performs when asked to speed up real, complex software systems (like the engines behind big websites or data tools), rather than just solving simple logic puzzles.

Here is the breakdown of their findings, using some everyday analogies:

1. The Setup: Puzzles vs. Real Life

The Old Way: Previous studies tested AI on "algorithmic puzzles." Think of these like Lego sets with instructions. You give the AI a specific block and ask, "How do I make this tower taller?" The AI is great at this because the rules are clear and the pieces are isolated.

The New Way: This study asked the AI to optimize real-world software. This is more like asking the AI to fix a racing car engine while it's still on the track. The engine is huge, parts are connected in weird ways, and you can't just swap a bolt without understanding how the whole car vibrates. The researchers took 65 real performance problems from famous open-source projects (like Apache Kafka and Netty) and asked different AI models to fix them.

2. The Results: The "Volatility" Problem

The study found that the AI is extremely inconsistent.

  • The "Good" Days: Sometimes, the AI finds a brilliant, non-obvious shortcut. For example, in one case, a human developer spent time splitting locks to reduce traffic jams in the code. The AI, however, realized they could just remove the lock entirely in certain situations, making the code run 8 times faster than the human's fix.
  • The "Bad" Days: More often, the AI makes things worse. In one instance, the AI tried to "optimize" a queue system by changing how it orders items. Instead of helping, it slowed the system down by 66% (it took 3 times longer to run). The AI thought it was fixing a traffic jam, but it actually built a roadblock.

The Verdict: On average, the AI is slower than a human expert. While the AI can generate code that is faster than the original broken code, it rarely beats the speed of the code a human engineer wrote to fix it.

3. The Secret Sauce: Context is King

The researchers tested different ways of asking the AI for help:

  • No Clues: Just giving the code and saying "Make it faster." (Result: The AI guesses wildly and often fails).
  • The "Problem Description": Telling the AI what is wrong (e.g., "This part is too slow because it's checking the same thing twice"). (Result: Much better! The AI knows where to look).
  • The "Benchmark": Giving the AI the test scores. (Result: Helpful, but not enough on its own).

The Analogy: Imagine asking a mechanic to fix a car.

  • No Clues: "My car is slow. Fix it." (The mechanic might change the tires, but the engine is the problem).
  • Problem Description: "My car is slow because the engine is overheating." (The mechanic knows to check the cooling system).
  • The Study's Finding: The AI needs the "Problem Description" to be effective. Without it, the AI is like a mechanic guessing in the dark.

4. How the AI "Thinks" vs. How Humans Think

When the AI does fix the code, it does it differently than humans:

  • Humans tend to simplify things. They might remove a whole unnecessary step.
  • The AI tends to add more complex logic. It tries to solve the problem by adding elaborate "if-this-then-that" rules. It's like trying to fix a leaky faucet by building a complex water filtration system around it, rather than just tightening the screw.

The study found that when the AI's solution looked exactly like the human's solution, it worked best. When the AI tried to be "creative" and do something totally different, it usually made the performance worse.

5. The Big Takeaway: AI is a Co-Pilot, Not the Pilot

The paper concludes that we shouldn't expect AI to replace performance engineers just yet.

  • Current State: AI is a high-variance search engine. It can find gold, but it can also dig up a hole. It lacks the "intuition" to know where the problem is without being told.
  • Future Solution: We need AI Agents. Instead of just asking the AI to write code, we need an AI system that can:
    1. Run the car (profile the code to see where it's slow).
    2. Diagnose the issue (tell the AI why it's slow).
    3. Propose a fix (write the code).
    4. Test the fix (run the benchmark again).

Summary in One Sentence

AI models are surprisingly good at writing code, but when it comes to making that code fast in the real world, they are currently unreliable guessers that need a human expert to point them in the right direction before they can truly shine.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →