RAPGen: An Approach for Fixing Code Inefficiencies in Zero-Shot
Not on the map. Why?
Abstract (arXiv)
Performance bugs are non-functional bugs that can even manifest in well-tested commercial products. Fixing these performance bugs is an important yet challenging problem. In this work, we address this challenge and present a new approach called Retrieval-Augmented Prompt Generation (RAPGen). Given a code snippet with a performance issue, RAPGen first retrieves a prompt instruction from a pre-constructed knowledge-base of previous performance bug fixes and then generates a prompt using the retrieved instruction. It then uses this prompt on a Large Language Model (such as Codex) in zero-shot to generate a fix. We compare our approach with the various prompt variations and state of the art methods in the task of performance bug fixing. Our evaluation shows that RAPGen can generate performance improvement suggestions equivalent or better than a developer in ~60% of the cases, getting ~42% of them verbatim, in an expert-verified dataset of past performance changes made by C# developers.
Key facts. Cited by 14 papers in the map (data through 14 Oct 2026). Builds on 21 of its 56 references that are in the map. First posted on arXiv 29 Jun 2023.
Builds on
21 of 56 references.
References · 21
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformercited by 14,599
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2019BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehensioncited by 5,893
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,915
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,795
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
- 2019Language Models as Knowledge Bases?cited by 1,936
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2019How Can We Know What Language Models Know?cited by 959
- 2021GPT Understands, Toocited by 716
9 more
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 479
- 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
- 2021Examining Zero-Shot Vulnerability Repair with Large Language Modelscited by 105
- 2022Less Training, More Repairing Please: Revisiting Automated Program Repair via Zero-shot Learningcited by 76
- 2021Neural Transfer Learning for Repairing Security Vulnerabilities in C Codecited by 36
- 2018Aroma: Code Recommendation via Structural Code Searchcited by 29
- 2018A Comprehensive Study of Automatic Program Repair on the QuixBugs Benchmarkcited by 18
- 2021DeepDebug: Fixing Python Bugs Using Stack Traces, Backtranslation, and Code Skeletonscited by 17
- 2016Learning a Static Analyzer from Datacited by 7
Built on by
Citing papers per year: 2023: 2; 2024: 3; 2025: 6; 2026: 3.
14 papers.
Sort:
By area:
- 2024A Performance Study of LLM-Generated Code on Leetcodecited by 49
- 2024Search-Based LLMs for Code Optimizationcited by 28
- 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++cited by 16
- 2023ZeroLeak: Using LLMs for Scalable and Cost Effective Side-Channel Patchingcited by 6
- 2024DCA-Bench: A Benchmark for Dataset Curation Agentscited by 6
- 2025How Do Agents Perform Code Optimization? An Empirical Studycited by 4
- 2025Efficient Domain-adaptive Continual Pretraining for the Process Industry in the German Languagecited by 3
- 2025PerfBench: Can Agents Resolve Real-World Performance Bugs?cited by 3
- 2026Beyond Local Code Optimization: Multi-Agent Reasoning for Software System Optimizationcited by 2
- 2025Investigating Execution-Aware Language Models for Code Optimizationcited by 1
- 2025Repairing Tool Calls Using Post-tool Execution Reflection and RAGcited by 0
- 2025GrowthHacker: Automated Off-Policy Evaluation Optimization Using Code-Modifying LLM Agentscited by 0
- 2026T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Framework15 Aug 2026
- 2026Can Coding Agents Implement Missed Compiler Optimizations? Evaluating LLM Agents on LLVM Peephole Optimizations2 Jul 2026
- 2026Beyond Local Code Optimization: Multi-Agent Reasoning for Software System Optimization16 Mar 2026
- 2025How Do Agents Perform Code Optimization? An Empirical Study25 Dec 2025
- 2025GrowthHacker: Automated Off-Policy Evaluation Optimization Using Code-Modifying LLM Agents2 Nov 2025
- 2025Repairing Tool Calls Using Post-tool Execution Reflection and RAG17 Oct 2025
- 2025PerfBench: Can Agents Resolve Real-World Performance Bugs?28 Sep 2025
- 2025Efficient Domain-adaptive Continual Pretraining for the Process Industry in the German Language28 Apr 2025
- 2025Investigating Execution-Aware Language Models for Code Optimization11 Mar 2025
- 2024Search-Based LLMs for Code Optimization22 Aug 2024
- 2024A Performance Study of LLM-Generated Code on Leetcode31 Jul 2024
- 2024DCA-Bench: A Benchmark for Dataset Curation Agents11 Jun 2024
2 more
- 2024DCA-Bench: A Benchmark for Dataset Curation Agentscited by 6
- 2025Repairing Tool Calls Using Post-tool Execution Reflection and RAGcited by 0
- 2025GrowthHacker: Automated Off-Policy Evaluation Optimization Using Code-Modifying LLM Agentscited by 0
- 2026Can Coding Agents Implement Missed Compiler Optimizations? Evaluating LLM Agents on LLVM Peephole Optimizationscited by 0
- 2026Can Coding Agents Implement Missed Compiler Optimizations? Evaluating LLM Agents on LLVM Peephole Optimizations2 Jul 2026
- 2025GrowthHacker: Automated Off-Policy Evaluation Optimization Using Code-Modifying LLM Agents2 Nov 2025
- 2025Repairing Tool Calls Using Post-tool Execution Reflection and RAG17 Oct 2025
- 2024DCA-Bench: A Benchmark for Dataset Curation Agents11 Jun 2024
- 2024A Performance Study of LLM-Generated Code on Leetcodecited by 49
- 2024Search-Based LLMs for Code Optimizationcited by 28
- 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++cited by 16
- 2023ZeroLeak: Using LLMs for Scalable and Cost Effective Side-Channel Patchingcited by 6
- 2025How Do Agents Perform Code Optimization? An Empirical Studycited by 4
- 2025Efficient Domain-adaptive Continual Pretraining for the Process Industry in the German Languagecited by 3
- 2025PerfBench: Can Agents Resolve Real-World Performance Bugs?cited by 3
- 2025Investigating Execution-Aware Language Models for Code Optimizationcited by 1
- 2026T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Frameworkcited by 0
- 2026T-LLM Compiler: Trusted LLM-based Code Optimization and Verification Framework15 Aug 2026
- 2025How Do Agents Perform Code Optimization? An Empirical Study25 Dec 2025
- 2025PerfBench: Can Agents Resolve Real-World Performance Bugs?28 Sep 2025
- 2025Efficient Domain-adaptive Continual Pretraining for the Process Industry in the German Language28 Apr 2025
- 2025Investigating Execution-Aware Language Models for Code Optimization11 Mar 2025
- 2024Search-Based LLMs for Code Optimization22 Aug 2024
- 2024A Performance Study of LLM-Generated Code on Leetcode31 Jul 2024
- 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++26 Sep 2023
- 2023ZeroLeak: Using LLMs for Scalable and Cost Effective Side-Channel Patching24 Aug 2023
Similar, not cited
Close in wording, no citation either way
- 2025Retrieval-Augmented Few-Shot Prompting Versus Fine-Tuning for Code Vulnerability Detection
- 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair
- 2024The Impact of Prompt Programming on Function-Level Code Generation
- 2025Towards Effectively Leveraging Execution Traces for Program Repair with Code LLMs
- 2025FeedbackEval: A Benchmark for Evaluating Large Language Models in Feedback-Driven Code Repair Tasks
- 2026QiMeng-PRepair: Precise Code Repair via Edit-Aware Reward Optimization
- 2023Learning Performance-Improving Code Edits
- 2025Do Prompt Patterns Affect Code Quality? A First Empirical Assessment of ChatGPT-Generated Code