PerfCoder: Large Language Models for Interpretable Code Performance Optimization
Paper · 2026 · Jiuding Yang, Shengyao Lu, Hongxuan Liu et al.
Summary
LLMs usually write functionally correct code, but they are weak at making programs run faster. The authors attribute this mainly to missing supervision that explains which optimization helps and why, not only to a lack of data. They present PerfCoder, a family of fine-tuned LLMs for C++ performance optimization.
The authors rebuilt the PIE dataset into 30,649 slow–fast program pairs. An open 32B instruction-tuned model then automatically annotated each pair with strategies, each made of a category from a fixed set of fifteen plus a program-specific explanation. Supervised fine-tuning teaches the model to output the strategy plan and the optimized code in one pass. A reinforcement stage (GRPO) then improves the planner using measured runtime as the reward.
On PIE, evaluated with the gem5 simulator, PerfCoder outperforms single-step baselines and larger general models. Its plans also substantially speed up code produced by stronger optimizers, including GPT-5. This shows that strategy awareness can matter more than model scale, and that the optimization process can be interpretable and reusable.
Key points
- Data: PIE was reconstructed into 30,649 slow–fast C++ pairs using endpoint selection. Strategies are mapped to 15 canonical categories, such as Algorithm Design Optimization and Loop Efficiency Techniques.
- Output format: Control tokens ([SUGG/], [/SUGG], [OPT/], [/OPT]) separate the strategy plan from the code. This enables two modes: plan+code, or plan-only, where PerfCoder acts as a planner for another LLM.
- Training: SFT produces PerfCoder Jr. Next, GRPO updates only the planner with a runtime-based reward, while the optimizer model stays frozen.
- Results: The 7B PerfCoder reaches a 2.50× speedup, compared with 1.73× for PIE-CodeLlama and 1.50× for Qwen2.5-Inst-32B. A 1.5B planner lifts a 32B optimizer to 3.03× and GPT-5 to 4.82×, up from 1.96× for GPT-5 alone.
- Release: The code is public at github.com/XpastaX/PerfCoder. A stated limitation is that larger base models were not tested.
Institutions
Fields, topics and concepts
📚 Shelves 6The field of science this work belongs to (OpenAlex fields).Computer Science · 18,614 worksArtificial Intelligence · 17,965 worksArts and Humanities · 17,450 worksLanguage and Linguistics · 17,296 worksInformation Systems · 1,730 worksHardware and Architecture · 167 works
🧭 Topics 1Research subjects and languages the work is about.Language models & pretraining · 3,894 works
Cite
Cite as Jiuding Yang, Shengyao Lu, Hongxuan Liu, Shayan Shirahmad Gale Bagi, Zahra Fazel, Tomasz Czajkowski and Di Niu. 2026. PerfCoder: Large Language Models for Interpretable Code Performance Optimization. Findings of the Association for Computational Linguistics: ACL 2026.
@inproceedings{yang2026perfcoder,
title = {{PerfCoder: Large Language Models for Interpretable Code Performance Optimization}},
author = {Jiuding Yang, Shengyao Lu, Hongxuan Liu, Shayan Shirahmad Gale Bagi, Zahra Fazel, Tomasz Czajkowski and Di Niu},
booktitle = {Findings of the Association for Computational Linguistics: ACL 2026},
year = {2026},
doi = {10.18653/v1/2026.findings-acl.675},
url = {https://doi.org/10.18653/v1/2026.findings-acl.675}
}References
- Baleegh Ahmad, Shailja Thakur, Benjamin Tan, Ramesh Karri, and Hammond Pearce. 2024. On hardware security bug code fixes by prompting large language models. IEEE Transactions on Information Forensics and Security. find
- Carlo Baronio, Pietro Marsella, Ben Pan, Simon Guo, and Silas Alberti. 2025. Kevin: Multi-turn rl for generating cuda kernels. arXiv preprint arXiv:2507.11948.
- Berkay Berabi, Alexey Gronskiy, Veselin Raychev, Gishor Sivanrupan, Victor Chibotaru, and Martin Vechev. 2024. Deepcode ai fix: Fixing security vulnerabilities with large language models. arXiv preprint arXiv:2402.13291. — [arXiv:2402.13291](https://arxiv.org/abs/2402.13291) find
- Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, and 1 others. 2021. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374.
- Weize Chen, Jiarui Yuan, Chen Qian, Cheng Yang, Zhiyuan Liu, and Maosong Sun. 2024a. Optima: Optimizing effectiveness and efficiency for llm-based multi-agent system. arXiv preprint arXiv:2410.08115. find
- Zimin Chen, Sen Fang, and Martin Monperrus. 2024b. Supersonic: Learning to generate source code optimizations in c/c++. IEEE Transactions on Software Engineering. find
- Tristan Coignion, Clément Quinton, and Romain Rou-voy. 2024. A performance study of llm-generated code on leetcode. In Proceedings of the 28th International Conference on Evaluation and Assessment in Software Engineering, pages 79–89. find
- Chris Cummins, Volker Seeker, Dejan Grubisic, Baptiste Roziere, Jonas Gehring, Gabriel Synnaeve, and Hugh Leather. 2025. Llm compiler: Foundation language models for compiler optimization. In Proceedings of the 34th ACM SIGPLAN International Conference on Compiler Construction, pages 141– 153. find
- Carlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik Narasimhan. 2023. Swe-bench: Can language models resolve real-world github issues? arXiv preprint arXiv:2310.06770.
- Yangruibo Ding, Zijian Wang, Wasi Ahmad, Hantian Ding, Ming Tan, Nihal Jain, Murali Krishna Ramanathan, Ramesh Nallapati, Parminder Bhatia, Dan Roth, and 1 others. 2023. Crosscodeeval: A diverse and multilingual benchmark for cross-file code completion. Advances in Neural Information Processing Syst… find
- Matthew Jin, Syed Shahriar, Michele Tufano, Xin Shi, Shuai Lu, Neel Sundaresan, and Alexey Svyatkovskiy. 2023. Inferfix: End-to-end program repair with llms. In Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pages… find
- Tuan Dinh, Jinman Zhao, Samson Tan, Renato Negrinho, Leonard Lausen, Sheng Zha, and George Karypis. 2023. Large language models of code fail at completing code with potential bugs. Advances in Neural Information Processing Systems, 36:41386– 41412. find
- Jia Li, Ge Li, Xuanming Zhang, Yunfei Zhao, Yihong Dong, Zhi Jin, Binhua Li, Fei Huang, and Yongbin Li. 2024. Evocodebench: An evolving code generation benchmark with domain-specific evaluations. Advances in Neural Information Processing Systems, 37:57619–57641. find
- Mingzhe Du, Anh Tuan Luu, Bin Ji, Qian Liu, and See-Kiong Ng. 2024. Mercury: A code efficiency benchmark for code large language models. arXiv preprint arXiv:2402.07844. — [arXiv:2402.07844](https://arxiv.org/abs/2402.07844) find
- Fang Liu, Zhenwei Liu, Qianhui Zhao, Jing Jiang, Li Zhang, Zian Sun, Ge Li, Zhongqi Li, and Yuchi Ma. 2024. Fastfixer: An efficient and effective approach for repairing programming assignments. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering, pages 669–… find
- Shukai Duan, Nikos Kanakaris, Xiongye Xiao, Heng Ping, Chenyu Zhou, Nesreen K Ahmed, Guixiang Ma, Mihai Capota, Theodore L Willke, Shahin Nazarian, and 1 others. 2023. Leveraging reinforcement learning and large language models for code optimization. arXiv preprint arXiv:2312.05657. — [arXiv:2312.05657](https://arxiv.org/abs/2312.05657) find
- Hugging Face. 2025. Open r1: A fully open reproduction of deepseek-r1. find
- Shuzheng Gao, Cuiyun Gao, Wenchao Gu, and Michael Lyu. 2024. Search-based llms for code optimization. In 2025 IEEE/ACM 47th International Conference on Software Engineering (ICSE), pages 254–266. IEEE Computer Society. find
- Dong Huang, Jianbo Dai, Han Weng, Puzhen Wu, Yuhao Qing, Heming Cui, Zhijiang Guo, and Jie Zhang. 2024a. Effilearner: Enhancing efficiency of generated code via self-optimization. Advances in Neural Information Processing Systems, 37:84482– 84522. find
- Dong Huang, Yuhao Qing, Weiyi Shang, Heming Cui, and Jie Zhang. 2024b. Effibench: Benchmarking the efficiency of automatically generated code. Advances in Neural Information Processing Systems, 37:11506– 11544. find
- Dong Huang, Guangtao Zeng, Jianbo Dai, Meng Luo, Han Weng, Yuhao Qing, Heming Cui, Zhijiang Guo, and Jie M Zhang. 2024c. Effi-code: Unleashing code efficiency in language models. arXiv preprint arXiv:2410.10209.
- Shu Ishida, Gianluca Corrado, George Fedoseev, Hudson Yeo, Lloyd Russell, Jamie Shotton, João F Henriques, and Anthony Hu. 2024. Langprop: A code optimization framework using large language models applied to driving. arXiv preprint arXiv:2401.10314. — [arXiv:2401.10314](https://arxiv.org/abs/2401.10314) find
- Tianyang Liu, Canwen Xu, and Julian McAuley. 2023. Repobench: Benchmarking repository-level code auto-completion systems. arXiv preprint arXiv:2306.03091.
- Zeyuan Ma, Hongshu Guo, Jiacheng Chen, Guojun Peng, Zhiguang Cao, Yining Ma, and Yue-Jiao Gong. 2024. Llamoco: Instruction tuning of large language models for optimization code generation. arXiv preprint arXiv:2403.01131. — [arXiv:2403.01131](https://arxiv.org/abs/2403.01131) find
- Aman Madaan, Alexander Shypula, Uri Alon, Milad Hashemi, Parthasarathy Ranganathan, Yiming Yang, Graham Neubig, and Amir Yazdanbakhsh. 2023. Learning performance-improving code edits. arXiv preprint arXiv:2302.07867, 8. find
- Daniel Nichols, Pranav Polasam, Harshitha Menon, Aniruddha Marathe, Todd Gamblin, and Abhinav Bhatele. 2024. Performance-aligned llms for generating fast code. arXiv preprint arXiv:2404.18864. — [arXiv:2404.18864](https://arxiv.org/abs/2404.18864) find
- Changan Niu, Ting Zhang, Chuanyi Li, Bin Luo, and Vincent Ng. 2024. On evaluating the efficiency of source code generated by llms. In Proceedings of the 2024 IEEE/ACM First International Conference on AI Foundation Models and Software Engineering, pages 103–107. find
- OpenAI. 2023. Gpt-3.5: Openai language model. https://platform.openai.com/docs/models/ gpt-3-5. Accessed: 2025-05-15. ↗
- OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, and 1 others. 2023. Gpt-4 technical report. arXiv preprint arXiv:2303.08774.
- Hammond Pearce, Benjamin Tan, Baleegh Ahmad, Ramesh Karri, and Brendan Dolan-Gavitt. 2023. Examining zero-shot vulnerability repair with large language models. In 2023 IEEE Symposium on Security and Privacy (SP), pages 2339–2356. IEEE. find
- Siddhant Waghjale, Vishruth Veerendranath, Zora Zhiruo Wang, and Daniel Fried. 2024. Ecco: Can we improve model-generated code efficiency without sacrificing functional correctness? arXiv preprint arXiv:2407.14044. find
- Qiwei Peng, Yekun Chai, and Xuhong Li. 2024. Humaneval-xl: A multilingual code generation benchmark for cross-lingual natural language generalization. arXiv preprint arXiv:2402.16694. find
- Junqiao Wang, Zeng Zhang, Yangfan He, Yuyang Song, Tianyu Shi, Yuchen Li, Hengyuan Xu, Kunyu Wu, Guangwu Qian, Qiuwu Chen, and 1 others. 2024. Enhancing code llms with reinforcement learning in code generation. arXiv preprint arXiv:2412.20367. — [arXiv:2412.20367](https://arxiv.org/abs/2412.20367) find
- Louis-Noël Pouchet. 2012. Polybench: The polyhedral benchmark suite. http://www.cs.colostate.edu/~pouchet/software/polybench/. Accessed: 2025-05-22. ↗
- Louis-Noël Pouchet. 2016. Polybench/c 4.2.1. https://github.com/MatthiasJReisinger/ PolyBenchC-4.2.1. Accessed: 2025-05-22. ↗
- Miguel Romero Rosas, Miguel Torres Sanchez, and Rudolf Eigenmann. 2024. Should ai optimize your code? a comparative study of current large language models versus classical optimizing compilers. arXiv preprint arXiv:2406.12146. — [arXiv:2406.12146](https://arxiv.org/abs/2406.12146) find
- Baptiste Roziere, Jonas Gehring, Stenio Fernandes, Armand Joulin, and Guillaume Lample. 2023. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950.
- Zhihong Shao, Peiyi Wang, Qihao Zhu, Runxin Xu, Junxiao Song, Xiao Bi, Haowei Zhang, Mingchuan Zhang, YK Li, Yang Wu, and 1 others. 2024. Deepseekmath: Pushing the limits of mathematical reasoning in open language models. arXiv preprint arXiv:2402.03300.
- Alexander Shypula, Aman Madaan, Yimeng Zeng, Uri Alon, Jacob R. Gardner, Yiming Yang, Milad Hashemi, Graham Neubig, Parthasarathy Ranganathan, Osbert Bastani, and Amir Yazdanbakhsh. 2024. Learning performance-improving code edits. In Proceedings of the Twelfth International Conference on Learning Re… find
- Jubi Taneja, Avery Laird, Cong Yan, Madan Musuvathi, and Shuvendu K Lahiri. 2025. Llm-vectorizer: Llm-based verified loop vectorizer. In Proceedings of the 23rd ACM/IEEE International Symposium on Code Generation and Optimization, pages 137–149. find
- DeepSeek Team. 2025. Deepseek-r1-distill-qwen-32b. https://huggingface.co/deepseek-ai/ DeepSeek-R1-Distill-Qwen-32B. ↗
- Qwen Team. 2024a. Qwen2.5-coder technical report. arXiv preprint arXiv:2409.12186.
- Qwen Team. 2024b. Qwen2.5 technical report. arXiv preprint arXiv:2412.15115. find
- Hugo Touvron, Louis Martin, Kevin Lu, Fazl Barez, Rohan Anil, Susan Zhang, Aurelien Rodriguez, Nicolas Usunier, Thomas Scialom, Jeff Wang, and 1 others. 2024. Llama 3: Open foundation and instruction-tuned language models. Meta AI, Technical Report. find
- Yi Wu, Nan Jiang, Hung Viet Pham, Thibaud Lutellier, Jordan Davis, Lin Tan, Petr Babkin, and Sameena Shah. 2023. How effective are neural networks for fixing security vulnerabilities. In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis, pages 1282–1294. find
- Chunqiu Steven Xia, Yuxiang Wei, and Lingming Zhang. 2023. Automated program repair in the era of large pre-trained language models. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE), pages 1482–1494. IEEE. find
- Chunqiu Steven Xia and Lingming Zhang. 2024. Automated program repair via conversation: Fixing 162 out of 337 bugs for $0.42 each using chatgpt. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, pages 819–831. find
- Zhihui Xie, Jie Chen, Liyu Chen, Weichao Mao, Jingjing Xu, and Lingpeng Kong. 2025. Teaching language models to critique via reinforcement learning. In International Conference on Machine Learning, pages 68559–68577. PMLR. find
- Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. 2023. Repocoder: Repository-level code completion through iterative retrieval and generation. arXiv preprint arXiv:2303.12570.
- Terry Yue Zhuo, Minh Chien Vu, Jenny Chim, Han Hu, Wenhao Yu, Ratnadira Widyasari, Imam Nur Bani Yusuf, Haolan Zhan, Junda He, Indraneil Paul, and 1 others. 2024. Bigcodebench: Benchmarking code generation with diverse function calls and complex instructions. arXiv preprint arXiv:2406.15877.
Updated
This page in Markdown → https://md.research.elamur.ai/free/en/papers/yang-2026-perfcoder-large-language-models-interpretable/