Improving Assembly Code Performance with Large Language Models via Reinforcement Learning
Abstract
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.
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.
Community
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- VeriCoder: Enhancing LLM-Based RTL Code Generation through Functional Correctness Validation (2025)
- Iterative Self-training for Code Generation via Reinforced Re-ranking (2025)
- Insights from Verification: Training a Verilog Generation LLM with Reinforcement Learning with Testbench Feedback (2025)
- VecTrans: LLM Transformation Framework for Better Auto-vectorization on High-performance CPU (2025)
- CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis (2025)
- Integrating Symbolic Execution into the Fine-Tuning of Code-Generating LLMs (2025)
- FAIT: Fault-Aware Fine-Tuning for Better Code Generation (2025)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper