Introduction
Program optimization has traditionally relied on human-engineered heuristics within compilers like gcc or clang. While effective, these heuristics often miss the absolute most efficient instruction sequences. "Superoptimization" aims to find these optimal sequences but has historically struggled to scale beyond small, synthetic benchmarks. Researchers have now introduced a framework that successfully superoptimizes real-world x86-64 assembly code by combining a Transformer-based architecture with a novel training strategy and a massive new dataset.
Scaling with the Big Assembly Dataset
A primary hurdle in applying deep learning to superoptimization has been the lack of diverse, real-world training data. Previous benchmarks, such as Hacker's Delight, contain only a handful of functions. To address this, the authors introduced Big Assembly, a dataset of over 25,000 x86-64 assembly functions mined from open-source GitHub projects.
Unlike its predecessors, Big Assembly includes complex branching and memory operations, providing the necessary variety to train models that can generalize to "in-the-wild" software.
The SILO Framework
The researchers treated superoptimization as a neural machine translation task, translating unoptimized code into more efficient versions. They utilized a standard Transformer encoder-decoder model but found that traditional Reinforcement Learning (RL) methods like REINFORCE were too brittle for the sparse reward space of assembly code, where a single incorrect character breaks functionality.
To overcome this, they developed Self Imitation Learning for Optimization (SILO). This iterative approach allows the model to explore new rewrites and, upon finding a verified improvement, update its training set with the new "gold" standard. This effectively transforms a difficult RL problem into a more stable, iterative supervised learning task.
Experimental Results and Verification
The effectiveness of SILO was compared against standard RL and pre-training baselines. The results demonstrated that SILO significantly outperforms traditional policy gradient methods in finding verified optimizations over time.
To ensure the correctness of the generated code, the team employed a rigorous verification pipeline using random test cases and formal SMT solvers (Z3). Ultimately, SILO achieved a 5.9% superoptimization rate on complex test functions, outperforming the most aggressive compiler settings (gcc -O3). This represents a five-fold improvement over standard RL approaches.
Conclusion
By leveraging large-scale data mining and a specialized imitation learning strategy, this research demonstrates that neural models can discover optimizations that elude traditional compilers. While challenges remain in scaling formal verification to even larger functions, this work marks a significant step toward automated, AI-driven software performance tuning.
Summary updated