Learning Performance-Improving Code Edits
Alexander Shypula, Aman Madaan, Yimeng Zeng, Uri Alon, Jacob R. Gardner, Yiming Yang, Milad Hashemi, Graham Neubig, Parthasarathy Ranganathan, Osbert Bastani, Amir Yazdanbakhsh
摘要
The waning of Moore's Law has shifted the focus of the tech industry towards alternative methods for continued performance gains. While optimizing compilers are a standard tool to help increase program efficiency, programmers continue to shoulder much responsibility in crafting and refactoring code with better performance characteristics. In this paper, we investigate the ability of large language models (LLMs) to suggest functionally correct, performance improving code edits. We hypothesize that language models can suggest such edits in ways that would be impractical for static analysis alone. We investigate these questions by curating a large-scale dataset of Performance-Improving Edits, PIE. PIE contains trajectories of programs, where a programmer begins with an initial, slower version and iteratively makes changes to improve the program's performance. We use PIE to evaluate and improve the capacity of large language models. Specifically, use examples from PIE to fine-tune multiple variants of CODEGEN, a billion-scale Transformer-decoder model. Additionally, we use examples from PIE to prompt OpenAI's CODEX using a few-shot prompting. By leveraging PIE, we find that both CODEX and CODEGEN can generate performance-improving edits, with speedups of more than 2.5x for over 25% of the programs, for C++ and Python, even after the C++ programs were compiled using the O3 optimization level. Crucially, we show that PIE allows CODEGEN, an open-sourced and 10x smaller model than CODEX, to match the performance of CODEX on this challenging task. Overall, this work opens new doors for creating systems and methods that can help programmers write efficient code.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 61 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Self-Refine: Iterative Refinement with Self-Feedback 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Teaching Large Language Models to Self-Debug 引用了 Self-Refine: Iterative Refinement with Self-Feedback
- Teaching Large Language Models to Self-Debug 引用了 Language Models are Few-Shot Learners
- Teaching Large Language Models to Self-Debug 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Decision Transformer: Reinforcement Learning via Sequence Modeling 引用了 Language Models are Few-Shot Learners
- ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution 引用了 Self-Refine: Iterative Refinement with Self-Feedback
- ReEvo: Large Language Models as Hyper-Heuristics with Reflective Evolution 引用了 Teaching Large Language Models to Self-Debug
- Towards a Unified View of Parameter-Efficient Transfer Learning 引用了 Language Models are Few-Shot Learners
- WizardCoder: Empowering Code Large Language Models with Evol-Instruct 引用了 Language Models are Few-Shot Learners
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models 引用了 Calibrate Before Use: Improving Few-shot Performance of Language Models
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution 引用了 Self-Refine: Iterative Refinement with Self-Feedback
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution 引用了 Teaching Large Language Models to Self-Debug
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution 引用了 Language Models are Few-Shot Learners
- CRUXEval: A Benchmark for Code Reasoning, Understanding and Execution 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Calibrate Before Use: Improving Few-shot Performance of Language Models 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper61
- Self-Refine: Iterative Refinement with Self-FeedbackAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan 等NeurIPS 2023 · 4,972 次引用
- Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 次引用
- WizardCoder: Empowering Code Large Language Models with Evol-InstructZiyang Luo, Can Xu, Pu Zhao, Qingfeng Sun 等ICLR 2024 · 945 次引用
- ReEvo: Large Language Models as Hyper-Heuristics with Reflective EvolutionHaoran Ye, Jiarui Wang, Zhiguang Cao, Federico Berto 等NeurIPS 2024 · 424 次引用
- CRUXEval: A Benchmark for Code Reasoning, Understanding and ExecutionAlex Gu, Baptiste Rozière, Hugh James Leather, Armando Solar-Lezama 等ICML 2024 · 270 次引用
它引用的 Paper17
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- Decision Transformer: Reinforcement Learning via Sequence ModelingLili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee 等NeurIPS 2021 · 2,557 次引用
- Calibrate Before Use: Improving Few-shot Performance of Language ModelsZihao Zhao, Eric Wallace, Shi Feng, Dan Klein 等ICML 2021 · 1,843 次引用
- Towards a Unified View of Parameter-Efficient Transfer LearningJunxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick 等ICLR 2022 · 1,182 次引用
相关 Paper
- PerfCoder: Large Language Models for Interpretable Code Performance OptimizationJiuding Yang, Shengyao Lu, Hongxuan Liu, Shayan Shirahmad Gale Bagi 等ACL Findings 2026
- Let the Code LLM Edit Itself When You Edit the CodeZhenyu He, Jun Zhang, Shengjie Luo, Jingjing Xu 等ICLR 2025
- Grace: Language Models Meet Code EditsPriyanshu Gupta, Avishree Khare, Yasharth Bajpai, Saikat Chakraborty 等FSE 2023 · 15 次引用
- ECCO: Can We Improve Model-Generated Code Efficiency Without Sacrificing Functional Correctness?Siddhant Waghjale, Vishruth Veerendranath, Zhiruo Wang, Daniel FriedEMNLP 2024 · 3 次引用
- Optimas: An Intelligent Analytics-Informed Generative AI Framework for Performance OptimizationMohammad Zaeed, Tanzima Z. Islam, Vladimir IndicKDD 2026
