Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Optimizing software performance through automated code refinement offers a promising avenue for enhancing execution speed and efficiency. Despite recent advancements in LLMs, a significant gap remains in their ability to perform in-depth program analysis. This study introduces AUTOPATCH, an in-context learning approach designed to bridge this gap by enabling LLMs to automatically generate optimized code. Inspired by how programmers learn and apply knowledge to optimize software, AUTOPATCH incorporates three key components: (1) an analogy-driven framework to align LLM optimization with human cognitive processes, (2) a unified approach that integrates historical code examples and CFG analysis for context-aware learning, and (3) an automated pipeline for generating optimized code through in-context prompting. Experimental results demonstrate that AUTOPATCH achieves a 7.3% improvement in execution efficiency over GPT-4o across common generated executable code, highlighting its potential to advance automated program runtime optimization.
Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 30 of its 37 references that are in the map. First posted on arXiv 28 Jan 2025.
Builds on
30 of 37 references.
Closest ancestors · 3
Same direction, newest first
- 2024Enhancing Code Translation in Language Models with Few-Shot Learning via Retrieval-Augmented Generation29 Jul
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May
Other references · 27
- 2024A Survey on RAG Meeting LLMs: Towards Retrieval-Augmented Large Language Modelscited by 450
- 2024Retrieval-Augmented Generation for AI-Generated Content: A Surveycited by 352
- 2023Using an LLM to Help With Code Understandingcited by 222
- 2023In-Context Unlearning: Language Models as Few Shot Unlearnerscited by 214
- 2021CodeNet: A Large-Scale AI for Code Dataset for Learning a Diversity of Coding Taskscited by 199
- 2023What Makes Good Examples for Visual In-Context Learning?cited by 150
- 2023Compositional Exemplars for In-context Learningcited by 143
- 2023CodePlan: Repository-level Coding using LLMs and Planningcited by 139
- 2023The Learnability of In-Context Learningcited by 126
- 2023Finding Support Examples for In-Context Learningcited by 104
- 2023Learning Performance-Improving Code Editscited by 103
- 2023LLM-Assisted Content Analysis: Using Large Language Models to Support Deductive Codingcited by 64
15 more
- 2024Enchanting Program Specification Synthesis by Large Language Models using Static Analysis and Program Verificationcited by 55
- 2024How Efficient is LLM-Generated Code? A Rigorous & High-Standard Benchmarkcited by 39
- 2024Search-Based LLMs for Code Optimizationcited by 27
- 2024Do Machines and Humans Focus on Similar Code? Exploring Explainability of Large Language Models in Code Summarizationcited by 16
- 2024Utilizing Deep Learning to Optimize Software Development Processescited by 15
- 2023Static Code Analysis in the AI Era: An In-depth Exploration of the Concept, Function, and Potential of Intelligent Code Analysis Agentscited by 12
- 2023JarviX: A LLM No code Platform for Tabular Data Analysis and Optimizationcited by 10
- 2024EyeTrans: Merging Human and Machine Attention for Neural Code Summarizationcited by 9
- 2023Modeling Programmer Attention as Scanpath Predictioncited by 7
- 2022Pre-Training Representations of Binary Code Using Contrastive Learningcited by 6
- 2024RAG-Enhanced Commit Message Generationcited by 6
- 2023Frustrated with Code Quality Issues? LLMs can Help!cited by 5
- 2022Leveraging Artificial Intelligence on Binary Code Comprehensioncited by 3
- 2024MalMixer: Few-Shot Malware Classification with Retrieval-Augmented Semi-Supervised Learningcited by 3
- 2024Demo-Craft: Using In-Context Learning to Improve Code Generation in Large Language Modelscited by 2
Built on by
Citing papers per year: 2025: 1.
1 paper.
Similar, not cited
Close in wording, no citation either way
- 2025FasterPy: An LLM-based Code Execution Efficiency Optimization Framework
- 2024Thinking Before Running! Efficient Code Generation with Thorough Exploration and Optimal Refinement
- 2025LLM Program Optimization via Retrieval Augmented Search
- 2024Should AI Optimize Your Code? A Comparative Study of Classical Optimizing Compilers Versus Current Large Language Models
- 2026When LLMs Lag Behind: Knowledge Conflicts from Evolving APIs in Code Generation
- 2025What Makes In-Context Examples Effective for Code Generation? ↗
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation
- 2026EffiSkill: Agent Skill Based Automated Code Efficiency Optimization