mlsanityData to 7 Oct 2026

Should AI Optimize Your Code? A Comparative Study of Classical Optimizing Compilers Versus Current Large Language Models

arXiv 2406.12146 ↗First posted 17 Jun 2024cs.AI cs.PF cs.SEcited by 1

Not on the map. Why?

Abstract (arXiv)

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 mechanism for evaluating the performance and correctness of the code generated by LLMs. We used three different prompting strategies to evaluate the performance of the LLMs, Simple Instruction (IP), Detailed Instruction Prompting (DIP), and Chain of Thought (CoT). A key finding is that while LLMs have the potential to outperform current optimizing compilers, they often generate incorrect code on large code sizes, calling for automated verification methods. In addition, expressing a compiler strategy as part of the LLMs prompt substantially improves its overall performance. Our evaluation across three benchmark suites shows CodeLlama-70B as the superior LLM, capable of achieving speedups of up to x1.75. Additionally, CETUS is the best among the current optimizing compilers, achieving a maximum speedup of 1.67x. We also found substantial differences among the three prompting strategies.

Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 14 of its 35 references that are in the map. First posted on arXiv 17 Jun 2024.

Builds on

14 of 35 references.

References · 14

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  3. 2021Program Synthesis with Large Language Modelscited by 3,509
  4. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  5. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  6. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  7. 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 711
  8. 2021Reframing Instructional Prompts to GPTk's Languagecited by 176
  9. 2023Learning Performance-Improving Code Editscited by 103
  10. 2022InstructDial: Improving Zero and Few-shot Generalization in Dialogue through Instruction Tuningcited by 39
  11. 2023Comparing Llama-2 and GPT-3 LLMs for HPC kernels generationcited by 30
  12. 2023Limits for Learning with Language Modelscited by 17
2 more
  1. 2023HPC-Coder: Modeling Parallel Programs using Large Language Modelscited by 11
  2. 2023Advising OpenMP Parallelization via a Graph-Based Approach with Transformerscited by 10

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2023Large Language Models for Compiler Optimization
  2. 2024CompilerDream: Learning a Compiler World Model for General Code Optimization
  3. 2025Agentic Auto-Scheduling: An Experimental Study of LLM-Guided Loop Optimization
  4. 2026Prior Knowledge or Search? A Study of LLM Agents in Hardware-Aware Code Optimization
  5. 2025FasterPy: An LLM-based Code Execution Efficiency Optimization Framework
  6. 2025REASONING COMPILER: LLM-Guided Optimizations for Efficient Model Serving
  7. 2025Small Language Models as Compiler Experts: Auto-Parallelization for Heterogeneous Systems
  8. 2025AwareCompiler: Agentic Context-Aware Compiler Optimization via a Synergistic Knowledge-Data Driven Framework