SuperCoder: Assembly Program Superoptimization with Large Language Models

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Wei, Anjiang, Suresh, Tarun, Tan, Huanmi, Xu, Yinglun, Singh, Gagandeep, Wang, Ke, Aiken, Alex
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866914293982691328
author Wei, Anjiang
Suresh, Tarun
Tan, Huanmi
Xu, Yinglun
Singh, Gagandeep
Wang, Ke
Aiken, Alex
author_facet Wei, Anjiang
Suresh, Tarun
Tan, Huanmi
Xu, Yinglun
Singh, Gagandeep
Wang, Ke
Aiken, Alex
contents Superoptimization is the task of transforming a program into a faster one while preserving its input-output behavior. In this work, we investigate whether large language models (LLMs) can serve as superoptimizers, generating assembly programs that outperform code already optimized by industry-standard compilers. We construct the first large-scale benchmark for this problem, consisting of 8,072 assembly programs averaging 130 lines, in contrast to prior datasets restricted to 2-15 straight-line, loop-free programs. We evaluate 23 LLMs on this benchmark and find that the strongest baseline, Claude-opus-4, achieves a 51.5% test-passing rate and a 1.43x average speedup over gcc -O3. To further enhance performance, we fine-tune models with reinforcement learning, optimizing a reward function that integrates correctness and performance speedup. Starting from Qwen2.5-Coder-7B-Instruct (61.4% correctness, 1.10x speedup), the fine-tuned model SuperCoder attains 95.0% correctness and 1.46x average speedup, with additional improvement enabled by Best-of-N sampling and iterative refinement. Our results demonstrate, for the first time, that LLMs can be applied as superoptimizers for assembly programs, establishing a foundation for future research in program performance optimization beyond compiler heuristics.
format Preprint
id arxiv_https___arxiv_org_abs_2505_11480
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle SuperCoder: Assembly Program Superoptimization with Large Language Models
Wei, Anjiang
Suresh, Tarun
Tan, Huanmi
Xu, Yinglun
Singh, Gagandeep
Wang, Ke
Aiken, Alex
Computation and Language
Artificial Intelligence
Performance
Programming Languages
Software Engineering
Superoptimization is the task of transforming a program into a faster one while preserving its input-output behavior. In this work, we investigate whether large language models (LLMs) can serve as superoptimizers, generating assembly programs that outperform code already optimized by industry-standard compilers. We construct the first large-scale benchmark for this problem, consisting of 8,072 assembly programs averaging 130 lines, in contrast to prior datasets restricted to 2-15 straight-line, loop-free programs. We evaluate 23 LLMs on this benchmark and find that the strongest baseline, Claude-opus-4, achieves a 51.5% test-passing rate and a 1.43x average speedup over gcc -O3. To further enhance performance, we fine-tune models with reinforcement learning, optimizing a reward function that integrates correctness and performance speedup. Starting from Qwen2.5-Coder-7B-Instruct (61.4% correctness, 1.10x speedup), the fine-tuned model SuperCoder attains 95.0% correctness and 1.46x average speedup, with additional improvement enabled by Best-of-N sampling and iterative refinement. Our results demonstrate, for the first time, that LLMs can be applied as superoptimizers for assembly programs, establishing a foundation for future research in program performance optimization beyond compiler heuristics.
title SuperCoder: Assembly Program Superoptimization with Large Language Models
topic Computation and Language
Artificial Intelligence
Performance
Programming Languages
Software Engineering
url https://arxiv.org/abs/2505.11480