Towards LLM-based optimization compilers. Can LLMs learn how to apply a single peephole optimization? Reasoning is all LLMs need!
Xiangxin Fang, Lev Mukhanov

TL;DR
This paper investigates whether large language models can learn to apply peephole optimizations in assembly code, highlighting the importance of reasoning capabilities and chain-of-thought processes in improving their performance.
Contribution
The study compares fine-tuned Llama2 with advanced reasoning models like GPT-o1, demonstrating the critical role of reasoning mechanisms in code optimization tasks.
Findings
GPT-o1 outperforms fine-tuned Llama2 and GPT-4o in applying peephole optimization.
Chain-of-thought reasoning significantly enhances LLMs' code optimization abilities.
Enhanced reasoning models show promise for future compiler optimization applications.
Abstract
Large Language Models (LLMs) have demonstrated great potential in various language processing tasks, and recent studies have explored their application in compiler optimizations. However, all these studies focus on the conventional open-source LLMs, such as Llama2, which lack enhanced reasoning mechanisms. In this study, we investigate the errors produced by the fine-tuned 7B-parameter Llama2 model as it attempts to learn and apply a simple peephole optimization for the AArch64 assembly code. We provide an analysis of the errors produced by the LLM and compare it with state-of-the-art OpenAI models which implement advanced reasoning logic, including GPT-4o and GPT-o1 (preview). We demonstrate that OpenAI GPT-o1, despite not being fine-tuned, outperforms the fine-tuned Llama2 and GPT-4o. Our findings indicate that this advantage is largely due to the chain-of-thought reasoning…
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
MethodsFocus
