Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Recent advances in large language models (LLMs) have significantly improved automated code generation. While existing approaches have achieved strong performance at the function and file levels, real-world software engineering requires reasoning over entire repositories, including cross-file dependencies, evolving execution environments, and global semantic consistency. This challenge has led to the emergence of Repository-Level Code Generation (RLCG), where models must retrieve, organize, and utilize repository-scale context to generate coherent and executable code changes. To address these challenges, Retrieval-Augmented Generation (RAG) has become an increasingly important paradigm for repository-level code intelligence. In this survey, we present a comprehensive review of Retrieval-Augmented Code Generation (RACG), with a particular focus on repository-level approaches. Rather than viewing RACG as a static ``retrieve-then-generate'' pipeline, we characterize it as a coupled and evolving process involving context construction, retrieval optimization, generation, and environment interaction. We organize existing methods through a unified analytical framework spanning retrieval substrate, control regime, and evaluation setting. Based on this framework, we systematically examine retrieval strategies, graph-based and non-graph-based retrieval paradigms, training-driven optimizations, and autonomous agent architectures. We further summarize widely used datasets, benchmarks, and system configurations, and discuss key challenges including scalability, reliability, efficiency, and the necessity boundary between RACG and long-context LLMs. Through this survey, we aim to provide a structured understanding of the rapidly evolving RACG landscape and highlight promising directions for future AI-powered software engineering research.
Key facts. Cited by 23 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 128 of its 220 references that are in the map. First posted on arXiv 6 Oct 2025.
Builds on
128 of 220 references.
Closest ancestors · 28
Same direction, newest first
- 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion19 Sep
- 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generation2 Sep
- 2025Impact-driven Context Filtering For Cross-file Code Completion8 Aug
- 2025SelfRACG: Enabling LLMs to Self-Express and Retrieve for Code Generation25 Jul
- 2025SACL: Understanding and Combating Textual Bias in Code Retrieval with Semantic-Augmented Reranking and Localization25 Jun
- 2025cAST: Enhancing Code Retrieval-Augmented Generation with Structural Chunking via Abstract Syntax Tree18 Jun
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation4 Jun
- 2025RAG or Fine-tuning? A Comparative Study on LCMs-based Code Completion in Industry21 May
- 2025ARCS: Agentic Retrieval-Augmented Code Synthesis with Iterative Refinement29 Apr
- 2025GraphCodeAgent: Dual Graph-Guided LLM Agent for Retrieval-Augmented Repo-Level Code Generation14 Apr
- 2025RTLRepoCoder: Repository-Level RTL Code Completion through the Combination of Fine-Tuning and Retrieval Augmentation11 Apr
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond26 Mar
16 more
- 2025When LLMs Meet API Documentation: Can Retrieval Augmentation Aid Code Generation Just as It Helps Developers?19 Mar
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities23 Jan
- 2024PERC: Plan-As-Query Example Retrieval for Underrepresented Code Generation17 Dec
- 2024Building A Coding Assistant via the Retrieval-Augmented Language Model21 Oct
- 2024Preference-Guided Refactored Tuning for Retrieval Augmented Code Generation24 Sep
- 2024RepoGenReflex: Enhancing Repository-Level Code Completion with Verbal Reinforcement and Retrieval-Augmented Generation19 Sep
- 2024Retrieval-augmented code completion for local projects using large language models9 Aug
- 2024Retrieval-Augmented Code Generation for Situated Action Generation: A Case Study on Minecraft25 Jun
- 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?20 Jun
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May
- 2024CodeGRAG: Bridging the Gap between Natural Language and Programming Language via Graphical Retrieval Augmented Generation3 May
- 2024FT2Ra: A Fine-Tuning-Inspired Approach to Retrieval-Augmented Code Completion2 Apr
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion15 Mar
- 2024EVOR: Evolving Retrieval for Code Generation19 Feb
- 2023RAP-Gen: Retrieval-Augmented Patch Generation with CodeT5 for Automatic Program Repair12 Sep
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
Other references · 100
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2021Program Synthesis with Large Language Modelscited by 3,637
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,373
- 2023Qwen Technical Reportcited by 3,344
- 2023Code Llama: Open Foundation Models for Codecited by 2,139
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
- 2023MetaGPT: Meta Programming for A Multi-Agent Collaborative Frameworkcited by 1,808
- 2024SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineeringcited by 1,737
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2024Qwen2.5-Coder Technical Reportcited by 1,203
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
- 2024OpenHands: An Open Platform for AI Software Developers as Generalist Agentscited by 1,002
38 more
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2023StarCoder: may the source be with you!cited by 799
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 609
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 502
- 2024A Survey on RAG Meeting LLMs: Towards Retrieval-Augmented Large Language Modelscited by 452
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 367
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 361
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 353
- 2025WebThinker: Empowering Large Reasoning Models with Deep Research Capabilitycited by 335
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 331
- 2024AutoCodeRover: Autonomous Program Improvementcited by 278
- 2024SWE-bench Multimodal: Do AI Systems Generalize to Visual Software Domains?cited by 203
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 183
- 2018Learning to Mine Aligned Code and Natural Language Pairs from Stack Overflowcited by 165
- 2024LLM-Based Multi-Agent Systems for Software Engineering: Literature Review, Vision and the Road Aheadcited by 155
- 2023SMART-LLM: Smart Multi-Agent Robot Task Planning using Large Language Modelscited by 153
- 2023CodePlan: Repository-level Coding using LLMs and Planningcited by 140
- 2023CodeGen2: Lessons for Training LLMs on Programming and Natural Languagescited by 125
- 2023InferFix: End-to-End Program Repair with LLMscited by 114
- 2024Jasper and Stella: distillation of SOTA embedding modelscited by 112
- 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
- 2025A Survey on Code Generation with LLM-based Agentscited by 106
- 2023RTLFixer: Automatically Fixing RTL Syntax Errors with Large Language Modelscited by 100
- 2024RepoGraph: Enhancing AI Software Engineering with Repository-level Code Graphcited by 91
- 2025SWE-Fixer: Training Open-Source LLMs for Effective and Efficient GitHub Issue Resolutioncited by 90
- 2025LocAgent: Graph-Guided LLM Agents for Code Localizationcited by 86
- 2024Automated Unit Test Improvement using Large Language Models at Metacited by 75
- 2024DevEval: A Manually-Annotated Code Generation Benchmark Aligned with Real-World Code Repositoriescited by 72
- 2022CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Contextcited by 65
- 2024CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databasescited by 65
- 2024Agents in Software Engineering: Survey, Landscape, and Visioncited by 60
- 2024Alibaba LingmaAgent: Improving Automated Issue Resolution via Comprehensive Repository Explorationcited by 58
- 2025SWE-Debate: Competitive Multi-Agent Debate for Software Issue Resolutioncited by 53
- 2024Long Code Arena: a Set of Benchmarks for Long-Context Code Modelscited by 50
- 2024Iterative Refinement of Project-Level Code Context for Precise Code Generation with Compiler Feedbackcited by 46
50 most cited of 100 All 100 (JSON)
Built on by
Citing papers per year: 2025: 2; 2026: 21.
23 papers.
Sort:
By area:
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
- 2026EET: Experience-Driven Early Termination for Cost-Efficient Software Engineering Agentscited by 7
- 2025Agentic Software Issue Resolution with Large Language Models: A Surveycited by 6
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCPcited by 6
- 2026Codified Context: Infrastructure for AI Agents in a Complex Codebasecited by 5
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolutioncited by 5
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
- 2026Large Language Models for Multilingual Code Intelligence: A Surveycited by 2
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformaticscited by 1
- 2026Beyond Functional Correctness: Design Issues in AI IDE-Generated Large-Scale Projectscited by 1
- 2026Automated Root-Cause Subclassification and No-Code Fix Generation for Invalid Bug Reportscited by 1
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generationcited by 1
11 more
- 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generationcited by 1
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphscited by 0
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Studycited by 0
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent Systemcited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
- 2026SSDAU: Structured Semantic Data Augmentation for Joint Entity and Relation Extractioncited by 0
- 2026Enhancing SLMs for Sustainable Code Optimization in Radio-Astronomycited by 0
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineeringcited by 0
- 2026Large Language Models at the Intersection of Software Engineering and Software Security:An Evidence-Centered Structured Survey and Research Agendacited by 0
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migrationcited by 0
- 2026RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generationcited by 0
- 2026RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generation10 Sep 2026
- 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation2 Sep 2026
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migration21 Aug 2026
- 2026Large Language Models at the Intersection of Software Engineering and Software Security:An Evidence-Centered Structured Survey and Research Agenda21 Aug 2026
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineering3 Aug 2026
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation3 Aug 2026
- 2026Enhancing SLMs for Sustainable Code Optimization in Radio-Astronomy23 Jul 2026
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolution24 May 2026
- 2026SSDAU: Structured Semantic Data Augmentation for Joint Entity and Relation Extraction22 May 2026
- 2026BLAgent: Agentic RAG for File-Level Bug Localization18 May 2026
- 2026Automated Root-Cause Subclassification and No-Code Fix Generation for Invalid Bug Reports17 May 2026
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent System7 May 2026
11 more
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study6 May 2026
- 2026Large Language Models for Multilingual Code Intelligence: A Survey27 Apr 2026
- 2026Beyond Functional Correctness: Design Issues in AI IDE-Generated Large-Scale Projects7 Apr 2026
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP28 Mar 2026
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformatics23 Mar 2026
- 2026Codified Context: Infrastructure for AI Agents in a Complex Codebase24 Feb 2026
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs28 Jan 2026
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs13 Jan 2026
- 2026EET: Experience-Driven Early Termination for Cost-Efficient Software Engineering Agents9 Jan 2026
- 2025Agentic Software Issue Resolution with Large Language Models: A Survey24 Dec 2025
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation30 Oct 2025
- 2026EET: Experience-Driven Early Termination for Cost-Efficient Software Engineering Agentscited by 7
- 2025Agentic Software Issue Resolution with Large Language Models: A Surveycited by 6
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCPcited by 6
- 2026Codified Context: Infrastructure for AI Agents in a Complex Codebasecited by 5
- 2026Beyond Functional Correctness: Design Issues in AI IDE-Generated Large-Scale Projectscited by 1
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineeringcited by 0
- 2026ACEM: A Cost Estimation Model for Agentic Software Engineering3 Aug 2026
- 2026Beyond Functional Correctness: Design Issues in AI IDE-Generated Large-Scale Projects7 Apr 2026
- 2026Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP28 Mar 2026
- 2026Codified Context: Infrastructure for AI Agents in a Complex Codebase24 Feb 2026
- 2026EET: Experience-Driven Early Termination for Cost-Efficient Software Engineering Agents9 Jan 2026
- 2025Agentic Software Issue Resolution with Large Language Models: A Survey24 Dec 2025
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphscited by 4
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generationcited by 1
- 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generationcited by 1
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Studycited by 0
- 2026BLAgent: Agentic RAG for File-Level Bug Localizationcited by 0
- 2026RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generationcited by 0
- 2026RCL: A Retrieval-Confidence Layer for Detecting Insufficient Context in Enterprise Retrieval-Augmented Code Generation10 Sep 2026
- 2026CodePoisonRAG: Knowledge Poisoning Attacks on Retrieval-Augmented Code Generation2 Sep 2026
- 2026Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation3 Aug 2026
- 2026BLAgent: Agentic RAG for File-Level Bug Localization18 May 2026
- 2026How Does Chunking Affect Retrieval-Augmented Code Completion? A Controlled Empirical Study6 May 2026
- 2026Reliable Graph-RAG for Codebases: AST-Derived Graphs vs LLM-Extracted Knowledge Graphs13 Jan 2026
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generationcited by 8
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolutioncited by 5
- 2026Large Language Models for Multilingual Code Intelligence: A Surveycited by 2
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformaticscited by 1
- 2026Automated Root-Cause Subclassification and No-Code Fix Generation for Invalid Bug Reportscited by 1
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphscited by 0
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent Systemcited by 0
- 2026SSDAU: Structured Semantic Data Augmentation for Joint Entity and Relation Extractioncited by 0
- 2026Enhancing SLMs for Sustainable Code Optimization in Radio-Astronomycited by 0
- 2026Large Language Models at the Intersection of Software Engineering and Software Security:An Evidence-Centered Structured Survey and Research Agendacited by 0
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migrationcited by 0
- 2026Specification Portability Across LLM Development Agents: Cross-Agent Compatibility in Specification-Driven Software Migration21 Aug 2026
- 2026Large Language Models at the Intersection of Software Engineering and Software Security:An Evidence-Centered Structured Survey and Research Agenda21 Aug 2026
- 2026Enhancing SLMs for Sustainable Code Optimization in Radio-Astronomy23 Jul 2026
- 2026Specification-Based Code-Text-Code Reengineering for LLM-Mediated Software Evolution24 May 2026
- 2026SSDAU: Structured Semantic Data Augmentation for Joint Entity and Relation Extraction22 May 2026
- 2026Automated Root-Cause Subclassification and No-Code Fix Generation for Invalid Bug Reports17 May 2026
- 2026MAS-Algorithm: A Workflow for Solving Algorithmic Programming Problems with a Multi-Agent System7 May 2026
- 2026Large Language Models for Multilingual Code Intelligence: A Survey27 Apr 2026
- 2026Do Papers Tell the Whole Story? A Benchmark and Framework for Uncovering Hidden Implementation Gaps in Bioinformatics23 Mar 2026
- 2026Context-Augmented Code Generation Using Programming Knowledge Graphs28 Jan 2026
- 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation30 Oct 2025
Similar, not cited
Close in wording, no citation either way
- 2026Do Not Treat Code as Natural Language: Implications for Repository-Level Code Generation and Beyond
- 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
- 2026TICoder: A Repository-Level Code Generation Framework with Test-Driven Planning and Implementation-Aware Reuse ↗
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model
- 2026Not All RAGs Are Created Equal: A Component-Wise Empirical Study for Software Engineering Tasks
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model
- 2026MRCoder: An Efficient Context Selecting Approach for Repository-Level Code Generation ↗