Proceedings

POLO: An LLM-Powered Project-Level Code Performance Optimization Framework

Download BibTeX Cite

Proceedings of the Thirty-Fourth International Joint Conference on Artificial Intelligence. Main Track. Pages 7319-7328.

https://doi.org/10.24963/ijcai.2025/814

Abstract

Program performance optimization is essential for achieving high execution efficiency, yet it remains a challenging task that requires expertise in both software and hardware.

Large Language Models (LLMs), trained on high-quality code from platforms like GitHub and other open-source sources, have shown promise in generating optimized code for simple snippets. However, current LLM-based solutions often fall short when tackling project-level programs due to the complexity of call graphs and the intricate interactions among functions. In this paper, we emulate the process a human expert might follow when optimizing project-level programs and introduce a three-phase framework POLO (PrOject-Level Optimizer) to address this limitation.

First, we profile the program to identify performance bottlenecks using an iterative weighting algorithm.

Next, we conduct structural analysis by scanning the project and generating a graph that represents the program's structure.

Finally, two LLM agents collaborate in iterative cycles to rewrite and optimize the code at these hotspots, gradually improving performance.

We conduct experiments on open-source and proprietary projects. The results demonstrate that POLO accurately identifies performance bottlenecks and successfully applies optimizations. Under the O3 compilation flag, the optimized programs achieved speedups ranging from 1.34x to 21.5x.

  1. [Achiam et al., 2023] Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Florencia Leoni Ale- man, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, et al. Gpt-4 technical report. arXiv preprint arXiv:2303.08774, 2023.
  2. [Bairi et al., 2024] Ramakrishna Bairi, Atharv Sonwane, Aditya Kanade, Vageesh D. C., Arun Iyer, Suresh Parthasarathy, Sriram Rajamani, B. Ashok, and Shashank Shet. Codeplan: Repository-level coding using llms and planning. Proc. ACM Softw. Eng., 1(FSE), July 2024.
  3. [Bell et al., 1990] Timothy Bell, John Cleary, and Ian Wit- ten. Calgary corpus. https://www.data-compression.info/ Corpora/CalgaryCorpus/, 1990. Accessed: October 20, 2024. Link
  4. [Chen et al., 2024] Zimin Chen, Sen Fang, and Martin Mon- perrus. Supersonic: Learning to generate source code opti- mizations in c/c++. IEEE Transactions on Software Engi- neering, 2024.
  5. [Conte, 2015] Brad Conte. Basic implementations of stan- dard cryptography algorithms, like aes and sha-1. https: //github.com/B-Con/crypto-algorithms/tree/master, 2015. Accessed: October 20, 2024. Link
  6. [DBAIWangGroup, 2021] DBAIWangGroup. Benchmark of nearest neighbor search on high dimensional data. https: //github.com/DBAIWangGroup/nns benchmark, 2021. Ac- cessed: October 20, 2024. Link
  7. [Della Toffola et al., 2015] Luca Della Toffola, Michael Pradel, and Thomas R Gross. Performance problems you can fix: A dynamic analysis of memoization opportunities. ACM SIGPLAN Notices, 50(10):607-622, 2015.
  8. [Du et al., 2024] Xueying Du, Mingwei Liu, Kaixin Wang, Hanlin Wang, Junwei Liu, Yixuan Chen, Jiayi Feng, Chaofeng Sha, Xin Peng, and Yiling Lou. Evaluating large language models in class-level code generation. In Pro- ceedings of the IEEE/ACM 46th International Conference on Software Engineering, pages 1-13, 2024.
  9. [Feng et al., 2020] Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, et al. Codebert: A pre-trained model for programming and natural languages. arXiv preprint arXiv:2002.08155, 2020.
  10. [Gao et al., 2024] Shuzheng Gao, Cuiyun Gao, Wenchao Gu, and Michael Lyu. Search-based llms for code optimization. arXiv preprint arXiv:2408.12159, 2024.
  11. [Garg et al., 2022] Spandan Garg, Roshanak Zilouchian Moghaddam, Colin B Clement, Neel Sundaresan, and Chen Wu. Deepperf: A deep learning-based approach for improving software performance. arXiv preprint arXiv:2206.13619, 2022.
  12. [Garg et al., 2023] Spandan Garg, Roshanak Zilouchian Moghaddam, and Neel Sundaresan. Rapgen: An approach for fixing code inefficiencies in zero-shot. arXiv preprint arXiv:2306.17077, 2023.
  13. [Gregg, 2016] Brendan Gregg. The flame graph. Communi- cations of the ACM, 59(6):48-57, 2016.
  14. [Group, 2006] Princeton CASS Group. Audio datasets. https: //www.cs.princeton.edu/cass/demos.htm, 2006. Accessed: October 20, 2024. Link
  15. [Huang et al., 2023] Dong Huang, Qingwen Bu, Jie M Zhang, Michael Luck, and Heming Cui. Agentcoder: Multi-agent- based code generation with iterative testing and optimisa- tion. arXiv preprint arXiv:2312.13010, 2023.
  16. [Jegou et al., 2010] Herve Jegou, Matthijs Douze, and Cordelia Schmid. Product quantization for nearest neighbor search. IEEE transactions on pattern analysis and machine intelligence, 33(1):117-128, 2010.
  17. [Liu et al., 2024a] Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang, and Lingming Zhang. Is your code generated by chatgpt really correct? rigorous evaluation of large lan- guage models for code generation. Advances in Neural Information Processing Systems, 36, 2024.
  18. [Liu et al., 2024b] Zhijie Liu, Yutian Tang, Xiapu Luo, Yum- ing Zhou, and Liang Feng Zhang. No need to lift a finger anymore? assessing the quality of code generation by chat- gpt. IEEE Transactions on Software Engineering, 2024.
  19. [Luo et al., 2024] Qinyu Luo, Yining Ye, Shihao Liang, Zhong Zhang, Yujia Qin, Yaxi Lu, Yesai Wu, Xin Cong, Yankai Lin, Yingli Zhang, Xiaoyin Che, Zhiyuan Liu, and Maosong Sun. RepoAgent: An LLM-powered open-source framework for repository-level code documentation genera- tion. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing: System Demon- strations, pages 436-464, Miami, Florida, USA, November 2024. Association for Computational Linguistics.
  20. [Nethercote and Seward, 2007] Nicholas Nethercote and Ju- lian Seward. Valgrind: a framework for heavyweight dynamic binary instrumentation. ACM Sigplan notices, 42(6):89-100, 2007.
  21. [Ni et al., 2023] Ansong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov, Wen-tau Yih, Sida Wang, and Xi Victoria Lin. Lever: Learning to verify language-to-code generation with execution. In International Conference on Machine Learning, pages 26106-26128. PMLR, 2023.
  22. [Nistor et al., 2013] Adrian Nistor, Tian Jiang, and Lin Tan. Discovering, reporting, and fixing performance bugs. In 2013 10th working conference on mining software reposito- ries (MSR), pages 237-246. IEEE, 2013. [OpenAI, 2024] OpenAI. Hello gpt-4o. https://openai.com/index/hello-gpt-4o/, 2024. Accessed: October 20, 2024. Link
  23. [Page et al., 1999] Lawrence Page, Sergey Brin, Rajeev Mot- wani, and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford info- lab, 1999.
  24. [Roziere et al., 2023] Baptiste Roziere, Jonas Gehring, Fabian Gloeckle, Sten Sootla, Itai Gat, Xiaoqing Ellen Tan, Yossi Adi, Jingyu Liu, Tal Remez, Jérémy Rapin, et al. Code llama: Open foundation models for code. arXiv preprint arXiv:2308.12950, 2023.
  25. [Shypula et al., 2023] Alexander Shypula, Aman Madaan, Yi- meng Zeng, Uri Alon, Jacob Gardner, Milad Hashemi, Gra- ham Neubig, Parthasarathy Ranganathan, Osbert Bastani, and Amir Yazdanbakhsh. Learning performance-improving code edits. arXiv preprint arXiv:2302.07867, 2023.
  26. [Smidt, 2012] Joseph Smidt. quant++: A c++ quantitative trading framework. https://github.com/jsmidt/quantpp/tree/ master, 2012. Accessed: October 20, 2024. Link
  27. [Song and Lu, 2017] Linhai Song and Shan Lu. Performance diagnosis for inefficient loops. In 2017 IEEE/ACM 39th International Conference on Software Engineering (ICSE), pages 370-380. IEEE, 2017.
  28. [Sturtevant, 2012] N. Sturtevant. Benchmarks for grid-based pathfinding. Transactions on Computational Intelligence and AI in Games, 4(2):144 -148, 2012.
  29. [Team, 2007] The Clang Team. Libtooling. https://clang.llvm.org/docs/LibTooling.html, 2007. Accessed: October 20, 2024. Link
  30. [Wang et al., 2024] Yi Wang, Qidong Zhao, Dongkuan Xu, and Xu Liu. Purpose enhanced reasoning through iterative prompting: uncover latent robustness of chatgpt on code comprehension. In Proceedings of the Thirty-Third Inter- national Joint Conference on Artificial Intelligence, pages 6513-6521, 2024. IJCAI
  31. [Weidendorfer, 2012] Josef Weidendorfer. Cache perfor- mance analysis with callgrind and kcachegrind. In 8 VI- HPS Tuning Workshop, 2012.
  32. [Xiao et al., 2013] Xusheng Xiao, Shi Han, Dongmei Zhang, and Tao Xie. Context-sensitive delta inference for iden- tifying workload-dependent performance bottlenecks. In Proceedings of the 2013 International Symposium on Soft- ware Testing and Analysis, pages 90-100, 2013.
  33. [Xu et al., 2010] Guoqing Xu, Nick Mitchell, Matthew Arnold, Atanas Rountev, Edith Schonberg, and Gary Sevit- sky. Finding low-utility data structures. In Proceedings of the 31st ACM SIGPLAN Conference on Programming Lan- guage Design and Implementation, pages 174-186, 2010.
  34. [Yang et al., 2023] Guang Yang, Yu Zhou, Xiang Chen, Xi- angyu Zhang, Tingting Han, and Taolue Chen. Exploit- gen: Template-augmented exploit code generation based on codebert. Journal of Systems and Software, 197:111577, 2023.
  35. [Yu et al., 2024] Hao Yu, Bo Shen, Dezhi Ran, Jiaxin Zhang, Qi Zhang, Yuchi Ma, Guangtai Liang, Ying Li, Qianxiang Wang, and Tao Xie. Codereval: A benchmark of pragmatic code generation with generative pre-trained models. In Pro- ceedings of the 46th IEEE/ACM International Conference on Software Engineering, pages 1-12, 2024.
  36. [Zan et al., 2022] Daoguang Zan, Bei Chen, Dejian Yang, Zeqi Lin, Minsu Kim, Bei Guan, Yongji Wang, Weizhu Chen, and Jian-Guang Lou. CERT: Continual pre-training on sketches for library-oriented code generation. In The 2022 International Joint Conference on Artificial Intelli- gence, 2022. IJCAI
  37. [Zhang et al., 2023] Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, and Weizhu Chen. RepoCoder: Repository-level code completion through iterative retrieval and generation. In Houda Bouamor, Juan Pino, and Kalika Bali, editors, Pro- ceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 2471-2484, Sin- gapore, December 2023. Association for Computational Linguistics.
  38. [Zheng et al., 2023a] Lin Zheng, Jianbo Yuan, Zhi Zhang, Hongxia Yang, and Lingpeng Kong. Self-infilling code generation. In Forty-first International Conference on Ma- chine Learning, 2023.
  39. [Zheng et al., 2023b] Wenqing Zheng, SP Sharan, Ajay Ku- mar Jaiswal, Kevin Wang, Yihan Xi, Dejia Xu, and Zhangyang Wang. Outline, then details: Syntactically guided coarse-to-fine code generation. In International Conference on Machine Learning, pages 42403-42419.
  40. PMLR, 2023.
  41. [Zhu et al., 2024] Yuqi Zhu, Jia Li, Ge Li, YunFei Zhao, Zhi Jin, and Hong Mei. Hot or cold? adaptive temperature sampling for code generation with large language mod- els. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 38, pages 437-445, 2024.

References were extracted automatically from the PDF and may contain errors.

Welcome Future Conferences AI Journal Division IJCAI Proceedings About IJCAI IJCAI Awards