Prompt-based Code Completion via Multi-Retrieval Augmented Generation
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
Automated code completion, aiming at generating subsequent tokens from unfinished code, has been significantly benefited from recent progress in pre-trained Large Language Models (LLMs). However, these models often suffer from coherence issues and hallucinations when dealing with complex code logic or extrapolating beyond their training data. Existing Retrieval Augmented Generation (RAG) techniques partially address these issues by retrieving relevant code with a separate encoding model where the retrieved snippet serves as contextual reference for code completion. However, their retrieval scope is subject to a singular perspective defined by the encoding model, which largely overlooks the complexity and diversity inherent in code semantics. To address this limitation, we propose ProCC, a code completion framework leveraging prompt engineering and the contextual multi-armed bandits algorithm to flexibly incorporate and adapt to multiple perspectives of code. ProCC first employs a prompt-based multi-retriever system which crafts prompt templates to elicit LLM knowledge to understand code semantics with multiple retrieval perspectives. Then, it adopts the adaptive retrieval selection algorithm to incorporate code similarity into the decision-making process to determine the most suitable retrieval perspective for the LLM to complete the code. Experimental results demonstrate that ProCC outperforms state-of-the-art code completion technique by 8.6% on our collected open-source benchmark suite and 10.1% on the private-domain benchmark suite collected from a billion-user e-commerce company in terms of Exact Match. ProCC also allows augmenting fine-tuned techniques in a plug-and-play manner, yielding 5.6% improvement over our studied fine-tuned model.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 50 of its 90 references that are in the map. First posted on arXiv 13 May 2024.
Builds on
50 of 90 references.
Closest ancestors · 3
Same direction, newest first
- 2024FT2Ra: A Fine-Tuning-Inspired Approach to Retrieval-Augmented Code Completion2 Apr
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
Other references · 47
- 2017Attention Is All You Needcited by 59,932
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2023Judging LLM-as-a-Judge with MT-Bench and Chatbot Arenacited by 8,393
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2020Scaling Laws for Neural Language Modelscited by 6,411
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2023Generative Agents: Interactive Simulacra of Human Behaviorcited by 3,500
- 2021TruthfulQA: Measuring How Models Mimic Human Falsehoodscited by 2,919
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
35 more
- 2021SimCSE: Simple Contrastive Learning of Sentence Embeddingscited by 2,168
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2023WizardLM: Empowering large pre-trained language models to follow complex instructionscited by 1,116
- 2023SGLang: Efficient Execution of Structured Language Model Programscited by 1,107
- 2016An overview of gradient descent optimization algorithmscited by 1,021
- 2020On Faithfulness and Factuality in Abstractive Summarizationcited by 895
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023Towards General Text Embeddings with Multi-stage Contrastive Learningcited by 705
- 2022Precise Zero-Shot Dense Retrieval without Relevance Labelscited by 508
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 492
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2023RepoBench: Benchmarking Repository-Level Code Auto-Completion Systemscited by 346
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
- 2022Efficient Training of Language Models to Fill in the Middlecited by 248
- 2023How Abilities in Large Language Models are Affected by Supervised Fine-tuning Data Compositioncited by 222
- 2023CrossCodeEval: A Diverse and Multilingual Benchmark for Cross-File Code Completioncited by 181
- 2022Large Language Models Meet NL2Code: A Surveycited by 135
- 2023PMC-LLaMA: Towards Building Open-source Language Models for Medicinecited by 87
- 2020Contrastive Code Representation Learningcited by 76
- 2022PromptBERT: Improving BERT Sentence Embeddings with Promptscited by 75
- 2022CoCoMIC: Code Completion By Jointly Modeling In-file and Cross-file Contextcited by 64
- 2019Code Generation as a Dual Task of Code Summarizationcited by 62
- 2017Code Completion with Neural Attention and Pointer Networkscited by 49
- 2024Teaching Code LLMs to Use Autocompletion Tools in Repository-Level Code Generationcited by 30
- 2022CoCoSoDa: Effective Contrastive Learning for Code Searchcited by 21
- 2023Domain Adaptive Code Completion via Language Models and Decoupled Domain Databasescited by 19
- 2024How Far Can We Go with Practical Function-Level Program Repair?cited by 16
- 2024BinaryAI: Binary Software Composition Analysis via Intelligent Binary Source Code Matchingcited by 9
- 2021Toward Less Hidden Cost of Code Completion with Acceptance and Ranking Modelscited by 4
- 2023Green Runner: A tool for efficient model selection from model repositoriescited by 1
Built on by
Citing papers per year: 2024: 3; 2025: 9; 2026: 4.
16 papers.
Sort:
By area:
- 2024InstructRAG: Instructing Retrieval-Augmented Generation via Self-Synthesized Rationalescited by 100
- 2024RAGChecker: A Fine-grained Framework for Diagnosing Retrieval-Augmented Generationcited by 59
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
- 2025AdaSearch: Balancing Parametric Knowledge and Search in Large Language Models via Reinforcement Learningcited by 5
- 2025Knowledge Graph Based Repository-Level Code Generationcited by 4
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generationcited by 3
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2025Pre-Filtering Code Suggestions using Developer Behavioral Telemetry to Optimize LLM-Assisted Programmingcited by 2
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generationcited by 1
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Banditscited by 1
- 2026Empowering Autonomous Debugging Agents with Efficient Dynamic Analysiscited by 1
4 more
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Modelcited by 0
- 2025Which Programming Language and Model Work Best With LLM-as-a-Judge For Code Retrieval?cited by 0
- 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generationcited by 0
- 2026Mapping the RAG Landscape: A Four Axis Taxonomy of Efficiency, Defense, Interactivity, and Reasoningcited by 0
- 2026Mapping the RAG Landscape: A Four Axis Taxonomy of Efficiency, Defense, Interactivity, and Reasoning1 Oct 2026
- 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation1 Sep 2026
- 2026Empowering Autonomous Debugging Agents with Efficient Dynamic Analysis27 Apr 2026
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Bandits19 Jan 2026
- 2025AdaSearch: Balancing Parametric Knowledge and Search in Large Language Models via Reinforcement Learning18 Dec 2025
- 2025Pre-Filtering Code Suggestions using Developer Behavioral Telemetry to Optimize LLM-Assisted Programming24 Nov 2025
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025RESCUE: Retrieval Augmented Secure Code Generation21 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Which Programming Language and Model Work Best With LLM-as-a-Judge For Code Retrieval?30 Sep 2025
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation4 Jun 2025
- 2025Knowledge Graph Based Repository-Level Code Generation20 May 2025
4 more
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation28 Jan 2025
- 2024RAGChecker: A Fine-grained Framework for Diagnosing Retrieval-Augmented Generation15 Aug 2024
- 2024InstructRAG: Instructing Retrieval-Augmented Generation via Self-Synthesized Rationales19 Jun 2024
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model11 Jun 2024
- 2024InstructRAG: Instructing Retrieval-Augmented Generation via Self-Synthesized Rationalescited by 100
- 2024RAGChecker: A Fine-grained Framework for Diagnosing Retrieval-Augmented Generationcited by 59
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2025RESCUE: Retrieval Augmented Secure Code Generationcited by 7
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generationcited by 3
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generationcited by 1
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Modelcited by 0
- 2025RESCUE: Retrieval Augmented Secure Code Generation21 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025Across Programming Language Silos: A Study on Cross-Lingual Retrieval-augmented Code Generation4 Jun 2025
- 2025Optimizing Code Runtime Performance through Context-Aware Retrieval-Augmented Generation28 Jan 2025
- 2024RAGChecker: A Fine-grained Framework for Diagnosing Retrieval-Augmented Generation15 Aug 2024
- 2024InstructRAG: Instructing Retrieval-Augmented Generation via Self-Synthesized Rationales19 Jun 2024
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model11 Jun 2024
- 2025AdaSearch: Balancing Parametric Knowledge and Search in Large Language Models via Reinforcement Learningcited by 5
- 2025Knowledge Graph Based Repository-Level Code Generationcited by 4
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgetscited by 3
- 2025Pre-Filtering Code Suggestions using Developer Behavioral Telemetry to Optimize LLM-Assisted Programmingcited by 2
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Banditscited by 1
- 2025Which Programming Language and Model Work Best With LLM-as-a-Judge For Code Retrieval?cited by 0
- 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generationcited by 0
- 2026Adaptive Critical Token-Aware Retrieval for Repository-Level Code Generation1 Sep 2026
- 2026A Component-Based Survey of Interactions between Large Language Models and Multi-Armed Bandits19 Jan 2026
- 2025AdaSearch: Balancing Parametric Knowledge and Search in Large Language Models via Reinforcement Learning18 Dec 2025
- 2025Pre-Filtering Code Suggestions using Developer Behavioral Telemetry to Optimize LLM-Assisted Programming24 Nov 2025
- 2025Practical Code RAG at Scale: Task-Aware Retrieval Design Choices under Compute Budgets23 Oct 2025
- 2025Which Programming Language and Model Work Best With LLM-as-a-Judge For Code Retrieval?30 Sep 2025
- 2025Knowledge Graph Based Repository-Level Code Generation20 May 2025
Similar, not cited
Close in wording, no citation either way
- 2024Retrieval-augmented code completion for local projects using large language models
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
- 2025Completion by Comprehension: Guiding Code Generation with Multi-Granularity Understanding
- 2025SpareCodeSearch: Searching for Code Context When You Have No Spare GPU
- 2025An Empirical Study of Retrieval-Augmented Code Generation: Challenges and Opportunities
- 2025CoRoVA: Compressed Representations for Vector-Augmented Code Completion
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model