강화 학습을 통한 대형 언어 모델 기반 어셈블리 코드 성능 개선
Improving Assembly Code Performance with Large Language Models via Reinforcement Learning
May 16, 2025
저자: Anjiang Wei, Tarun Suresh, Huanmi Tan, Yinglun Xu, Gagandeep Singh, Ke Wang, Alex Aiken
cs.AI
초록
대규모 언어 모델(LLM)은 다양한 프로그래밍 작업에서 강력한 성능을 보여왔지만, 코드 최적화에 대한 잠재력은 아직 충분히 탐구되지 않았습니다. 본 연구는 LLM이 어셈블리 코드의 성능을 최적화할 수 있는지 조사하며, 여기서는 실행에 대한 세밀한 제어를 통해 고수준 언어에서는 표현하기 어려운 개선이 가능합니다. 우리는 강화 학습 프레임워크를 제시하여, 테스트 케이스를 통해 검증된 기능적 정확성과 산업 표준 컴파일러인 gcc -O3 대비 실행 성능을 고려한 보상 함수를 기반으로 Proximal Policy Optimization(PPO)을 사용해 LLM을 학습시킵니다. 이 연구를 지원하기 위해 8,072개의 실제 프로그램으로 구성된 벤치마크를 도입했습니다. 우리의 모델인 Qwen2.5-Coder-7B-PPO는 테스트 통과율 96.0%와 gcc -O3 기준 대비 평균 1.47배의 속도 향상을 달성하며, Claude-3.7-sonnet을 포함한 평가된 20개의 다른 모든 모델을 능가했습니다. 이러한 결과는 강화 학습이 LLM의 잠재력을 해제하여 어셈블리 코드 성능을 위한 효과적인 최적화 도구로 활용할 수 있음을 시사합니다.
English
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.Summary
AI-Generated Summary