mlsanityData to 7 Oct 2026

A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model

arXiv 2406.10263 ↗First posted 11 Jun 2024cs.SEcited by 0

On the map: Retrieval-augmented generation → RAG for code

Abstract (arXiv)

Recent advancements in Retrieval-Augmented Generation have significantly enhanced code completion at the repository level. Various RAG-based code completion systems are proposed based on different design choices. For instance, gaining more effectiveness at the cost of repeating the retrieval-generation process multiple times. However, the indiscriminate use of retrieval in current methods reveals issues in both efficiency and effectiveness, as a considerable portion of retrievals are unnecessary and may introduce unhelpful or even harmful suggestions to code language models. To address these challenges, we introduce CARD, a lightweight critique method designed to provide insights into the necessity of retrievals and select the optimal answer from multiple predictions. CARD can seamlessly integrate into any RAG-based code completion system. Our evaluation shows that CARD saves 21% to 46% times of retrieval for Line completion, 14% to 40% times of retrieval for API completion, and 6% to 46.5% times of retrieval for function completion respectively, while improving the accuracy. CARD reduces latency ranging from 16% to 83%. CARD is generalizable to different LMs, retrievers, and programming languages. It is lightweight with training in few seconds and inference in few milliseconds.

Key facts. No citing papers in the map yet (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 22 of its 42 references that are in the map. First posted on arXiv 11 Jun 2024.

Builds on

22 of 42 references.

Closest ancestors · 2

Same direction, newest first

  1. 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May
  2. 2024Repoformer: Selective Retrieval for Repository-Level Code Completion15 Mar

Other references · 20

  1. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
  2. 2016XGBoost: A Scalable Tree Boosting Systemcited by 5,120
  3. 2019Can You Trust Your Model's Uncertainty? Evaluating Predictive Uncertainty Under Dataset Shiftcited by 1,274
  4. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  5. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  6. 2020A Review of Uncertainty Quantification in Deep Learning: Techniques, Applications and Challengescited by 813
  7. 2023Semantic Uncertainty: Linguistic Invariances for Uncertainty Estimation in Natural Language Generationcited by 795
  8. 2023The Internal State of an LLM Knows When It's Lyingcited by 644
  9. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  10. 2023Enhancing Retrieval-Augmented Large Language Models with Iterative Retrieval-Generation Synergycited by 343
  11. 2024INSIDE: LLMs' Internal States Retain the Power of Hallucination Detectioncited by 317
  12. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
8 more
  1. 2020Unsupervised Quality Estimation for Neural Machine Translationcited by 210
  2. 2022Practical Program Repair in the Era of Large Pre-trained Language Modelscited by 133
  3. 2024Unsupervised Real-Time Hallucination Detection based on the Internal States of Large Language Modelscited by 84
  4. 2024Uncertainty Estimation and Quantification for LLMs: A Simple Supervised Approachcited by 73
  5. 2024When Do LLMs Need Retrieval Augmentation? Mitigating LLMs' Overconfidence Helps Retrieval Augmentationcited by 59
  6. 2024Dataflow-Guided Retrieval Augmentation for Repository-Level Code Completioncited by 40
  7. 2024REPOFUSE: Repository-Level Code Completion with Fused Dual Contextcited by 32
  8. 2021Long-Range Modeling of Source Code Files with eWASH: Extended Window Access by Syntax Hierarchycited by 14

Built on by

Not cited yet.

Similar, not cited

Close in wording, no citation either way

  1. 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat
  2. 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches
  3. 2024Retrieval-augmented code completion for local projects using large language models
  4. 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model
  5. 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion
  6. 2025When Retriever Meets Generator: A Joint Model for Code Comment Generation ↗
  7. 2024CodeRAG-Bench: Can Retrieval Augment Code Generation?
  8. 2022ReACC: A Retrieval-Augmented Code Completion Framework