title: Improving Assembly Code Performance with Large Language Models via
    Reinforcement Learning
summary: Large language models (LLMs) have demonstrated strong performance across a
  wide range of programming tasks, yet their potential for code optimization
  remains underexplored. This work investigates whether LLMs can optimize the
  performance of assembly code, where fine-grained control over execution enables
  improvements that are difficult to express in high-level languages. We present
  a reinforcement learning framework that trains LLMs using Proximal Policy
  Optimization (PPO), guided by a reward function that considers both functional
  correctness, validated through test cases, and execution performance relative
  to the industry-standard compiler gcc -O3. To support this study, we introduce
  a benchmark of 8,072 real-world programs. Our model, Qwen2.5-Coder-7B-PPO,
  achieves 96.0% test pass rates and an average speedup of 1.47x over the gcc -O3
  baseline, outperforming all 20 other models evaluated, including
  Claude-3.7-sonnet. These results indicate that reinforcement learning can
  unlock the potential of LLMs to serve as effective optimizers for assembly code
  performance.
paper_authors._id: 682b5efc970fc73c32ddc4e4
paper_authors.name: Anjiang Wei
paper_authors._id: 682b5efc970fc73c32ddc4e5
paper_authors.name: Tarun Suresh
paper_authors.status: claimed_verified
paper_authors.statusLastChangedAt: 2025-06-05T07:29:10.961Z
paper_authors._id: 65e7bb35e5e78134ab049942
paper_authors.avatarUrl: /avatars/3c0972f0d59e51ebb5c218ee736d4458.svg
paper_authors.fullname: Tarun Suresh
paper_authors.type: user
paper_authors.user: tarsur909
paper_authors._id: 682b5efc970fc73c32ddc4e6
paper_authors.name: Huanmi Tan
paper_authors._id: 682b5efc970fc73c32ddc4e7
paper_authors.name: Yinglun Xu
paper_authors._id: 682b5efc970fc73c32ddc4e8
paper_authors.name: Gagandeep Singh
paper_authors._id: 682b5efc970fc73c32ddc4e9
paper_authors.name: Ke Wang
paper_authors._id: 682b5efc970fc73c32ddc4ea
paper_authors.name: Alex Aiken
paper_title: Improving Assembly Code Performance with Large Language Models via
    Reinforcement Learning
paper_summary: Large language models (LLMs) have demonstrated strong performance across a
  wide range of programming tasks, yet their potential for code optimization
  remains underexplored. This work investigates whether LLMs can optimize the
  performance of assembly code, where fine-grained control over execution enables
  improvements that are difficult to express in high-level languages. We present
  a reinforcement learning framework that trains LLMs using Proximal Policy
  Optimization (PPO), guided by a reward function that considers both functional
  correctness, validated through test cases, and execution performance relative
  to the industry-standard compiler gcc -O3. To support this study, we introduce
  a benchmark of 8,072 real-world programs. Our model, Qwen2.5-Coder-7B-PPO,
  achieves 96.0% test pass rates and an average speedup of 1.47x over the gcc -O3
  baseline, outperforming all 20 other models evaluated, including
  Claude-3.7-sonnet. These results indicate that reinforcement learning can
  unlock the potential of LLMs to serve as effective optimizers for assembly code
  performance.
paper_ai_summary: Reinforcement learning using Proximal Policy Optimization trains large language models to optimize assembly code performance, achieving higher speedups and test pass rates compared to standard compilers.
paper_ai_keywords: reinforcement learning Proximal Policy Optimization LLMs assembly code functional correctness execution performance gcc -O3 benchmark Qwen2.5-Coder-7B-PPO Claude-3.7-sonnet