← Latest papers
💬 NLP

SuperCoder: Assembly Program Superoptimization with Large Language Models

This paper introduces SuperCoder, a large language model-based approach for assembly superoptimization that, through the creation of a new large-scale benchmark and reinforcement learning fine-tuning, achieves 95% correctness and a 1.46x speedup over industry-standard compilers, demonstrating the viability of LLMs for program performance optimization beyond traditional heuristics.

Original authors: Anjiang Wei, Tarun Suresh, Huanmi Tan, Yinglun Xu, Gagandeep Singh, Ke Wang, Alex Aiken

Published 2026-02-02
📖 4 min read☕ Coffee break read

Original authors: Anjiang Wei, Tarun Suresh, Huanmi Tan, Yinglun Xu, Gagandeep Singh, Ke Wang, Alex Aiken

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 recipe for a cake that a world-class chef has already perfected. The chef has measured every ingredient, chosen the best oven temperature, and timed the baking to the second. This is your "optimized" code, created by a standard computer compiler (like gcc -O3).

Now, imagine asking a brilliant but inexperienced apprentice (a Large Language Model, or LLM) to look at that perfect recipe and say, "I can make this cake even faster."

This is exactly what the paper SuperCoder investigates. Here is the story of their experiment, explained simply.

The Challenge: Beating the Master Chef

For decades, computer scientists have tried to write programs that automatically find the fastest way to do things. This is called Superoptimization.

  • The Old Way: Previous attempts were like trying to optimize a single sentence. They could only handle tiny, simple tasks without any loops (repeating actions). It was like trying to make a sandwich faster, but you couldn't even add a second slice of bread.
  • The New Goal: The authors wanted to see if modern AI could optimize a whole "meal" (a complex program with loops and logic) that was already cooked by the best professional chefs (industrial compilers).

The Toolkit: A Massive New Playground

To test this, the researchers couldn't just use the old tiny datasets. They needed a massive gym to train their AI.

  • The Dataset: They built a library of 8,072 assembly programs (the raw, low-level instructions computers actually run).
  • The Scale: These weren't tiny snippets; they averaged 130 lines of code and included complex loops. Think of it as moving from optimizing a single Lego brick to optimizing an entire castle.
  • The Safety Net: They created thousands of "test cases" (like taste tests) to ensure that if the AI changed the recipe, the cake still tasted exactly the same, just baked faster.

The Experiment: Training the Apprentice

They took 23 different AI models and asked them to rewrite the assembly code to be faster.

  • The Initial Results: Most AIs were terrible at this. They either wrote code that crashed (the cake fell apart) or code that was just as slow as the original.
  • The Star Performer: One model, Claude-opus-4, was the best of the bunch. It managed to make the code 1.43 times faster on average while still working correctly. That's like cutting a 10-minute baking time down to 7 minutes without ruining the cake.

The Secret Sauce: Reinforcement Learning

The researchers realized that just asking the AI to "do better" wasn't enough. They needed to train it like a video game character.

  • The Reward System: They used a technique called Reinforcement Learning.
    • If the AI wrote code that crashed or gave the wrong answer, it got zero points.
    • If the code worked, it got points based on how much faster it was.
  • The Result: They took a solid model (Qwen2.5-Coder-7B) and trained it with this reward system.
    • Before Training: It was correct 61% of the time and only 10% faster.
    • After Training (SuperCoder): It became correct 95% of the time and 46% faster on average.

How They Polished the Gem

Even after training, they used two clever tricks to get even better results:

  1. Best-of-N Sampling: Instead of asking the AI for one answer, they asked it for 8 different versions and picked the absolute best one. This boosted the speedup even further.
  2. Iterative Refinement: If the AI made a mistake, they showed it the error message and asked, "Try again, but fix this specific problem." The AI used this feedback to correct itself, getting smarter with every attempt.

What Did the AI Actually Change?

When the researchers looked at how the AI made the code faster, they found it was doing things like:

  • Loop Restructuring: Rearranging the order of steps to be more efficient.
  • Instruction Selection: Swapping a long, slow instruction for a short, specialized CPU trick (like using a secret shortcut).
  • Removing Bloat: Taking out safety checks or complex math that the compiler had kept but wasn't strictly necessary for that specific task.

The Bottom Line

This paper proves, for the first time, that AI can act as a superoptimizer. It can take code that has already been optimized by the world's best human-engineered compilers and find ways to make it even faster, without breaking it.

They didn't just guess; they built a massive testing ground, trained the AI with a strict reward system, and showed that with the right training, AI can outperform the current "gold standard" of computer optimization.

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 →