Should AI Optimize Your Code? A Comparative Study of Classical Optimizing Compilers Versus Current Large Language Models
Miguel Romero Rosas, Miguel Torres Sanchez, Rudolf Eigenmann

TL;DR
This study compares classical optimizing compilers and large language models in code optimization, revealing LLMs' potential to outperform compilers but highlighting issues with correctness and the impact of prompting strategies.
Contribution
It introduces a benchmark suite and evaluation framework for comparing classical compilers and LLMs in code optimization, demonstrating the potential and limitations of LLMs.
Findings
LLMs can outperform classical compilers in code speedups.
Incorrect code generation by LLMs increases with code size.
Prompt engineering significantly improves LLM performance.
Abstract
Traditional optimizing compilers have played an important role in adapting to the growing complexity of modern software systems. The need for efficient parallel programming in current architectures requires strong optimization techniques. The beginning of Large Language Models (LLMs) raises intriguing questions about the potential of these AI approaches to revolutionize code optimization methodologies. This work aims to answer an essential question for the compiler community: "Can AI-driven models revolutionize the way we approach code optimization?". To address this question, we present a comparative analysis between three classical optimizing compilers and two recent large language models, evaluating their respective abilities and limitations in optimizing code for maximum efficiency. In addition, we introduce a benchmark suite of challenging optimization patterns and an automatic…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Topic Modeling
MethodsResidual Connection · Softmax · Layer Normalization · Byte Pair Encoding · Label Smoothing · Adam · Attention Is All You Need · Linear Layer · Multi-Head Attention · Position-Wise Feed-Forward Layer
