FT2Ra: A Fine-Tuning-Inspired Approach to Retrieval-Augmented Code Completion
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
The rise of code pre-trained models has significantly enhanced various coding tasks, such as code completion, and tools like GitHub Copilot. However, the substantial size of these models, especially large models, poses a significant challenge when it comes to fine-tuning them for specific downstream tasks. As an alternative approach, retrieval-based methods have emerged as a promising solution, augmenting model predictions without the need for fine-tuning. Despite their potential, a significant challenge is that the designs of these methods often rely on heuristics, leaving critical questions about what information should be stored or retrieved and how to interpolate such information for augmenting predictions. To tackle this challenge, we first perform a theoretical analysis of the fine-tuning process, highlighting the importance of delta logits as a catalyst for improving model predictions. Building on this insight, we develop a novel retrieval-based method, FT2Ra, which aims to mimic genuine fine-tuning. While FT2Ra adopts a retrieval-based mechanism, it uniquely adopts a paradigm with a learning rate and multi-epoch retrievals, which is similar to fine-tuning.In token-level completion, which represents a relatively easier task, FT2Ra achieves a 4.29% improvement in accuracy compared to the best baseline method on UniXcoder. In the more challenging line-level completion task, we observe a substantial more than twice increase in Exact Match (EM) performance, indicating the significant advantages of our theoretical analysis. Notably, even when operating without actual fine-tuning, FT2Ra exhibits competitive performance compared to the models with real fine-tuning.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 32 of its 47 references that are in the map. First posted on arXiv 2 Apr 2024.
Builds on
32 of 47 references.
Closest ancestors · 3
Same direction, newest first
- 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
- 2021Retrieval Augmented Code Generation and Summarization26 Aug
- 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNN9 Jun
Other references · 29
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
- 2021Improving language models by retrieving from trillions of tokenscited by 1,278
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
- 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
- 2023REPLUG: Retrieval-Augmented Black-Box Language Modelscited by 786
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2021GPT Understands, Toocited by 715
- 2023In-Context Retrieval-Augmented Language Modelscited by 694
17 more
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2023Active Retrieval Augmented Generationcited by 506
- 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
- 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
- 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
- 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
- 2021Efficient Nearest Neighbor Language Modelscited by 93
- 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
- 2020Code Prediction by Feeding Trees to Transformerscited by 70
- 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
- 2022FiD-Light: Efficient and Effective Retrieval-Augmented Text Generationcited by 63
- 2017Code Completion with Neural Attention and Pointer Networkscited by 49
- 2022Decoupling Knowledge from Memorization: Retrieval-augmented Prompt Learningcited by 36
- 2023Why do Nearest Neighbor Language Models Work?cited by 29
- 2019ATOM: Commit Message Generation Based on Abstract Syntax Tree and Hybrid Rankingcited by 25
- 2023Domain Adaptive Code Completion via Language Models and Decoupled Domain Databasescited by 19
- 2022You can't pick your neighbors, or can you? When and how to rely on retrieval in the kNN-LMcited by 18
Built on by
Citing papers per year: 2024: 2; 2025: 6; 2026: 1.
9 papers.
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Modelcited by 40
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyondcited by 22
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approachescited by 20
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generationcited by 16
- 2025LLM/Agent-as-Data-Analyst: A Surveycited by 15
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Codecited by 7
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChatcited by 5
- 2025FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generationcited by 2
- 2026FeatLens: Feature-Guided Dynamic Code Graph Construction and Retrieval for Repository-Level Code Generationcited by 0
- 2026FeatLens: Feature-Guided Dynamic Code Graph Construction and Retrieval for Repository-Level Code Generation22 Sep 2026
- 2025FidelityGPT: Correcting Decompilation Distortions with Retrieval Augmented Generation22 Oct 2025
- 2025Retrieval-Augmented Code Generation: A Survey with Focus on Repository-Level Approaches6 Oct 2025
- 2025LLM/Agent-as-Data-Analyst: A Survey28 Sep 2025
- 2025A Deep Dive into Retrieval-Augmented Generation for Code Completion: Experience on WeChat24 Jul 2025
- 2025What to Retrieve for Effective Retrieval-Augmented Code Generation? An Empirical Study and Beyond26 Mar 2025
- 2025Marking Code Without Breaking It: Code Watermarking for Detecting LLM-Generated Code26 Feb 2025
- 2024GraphCoder: Enhancing Repository-Level Code Completion via Code Context Graph-based Retrieval and Language Model11 Jun 2024
- 2024Prompt-based Code Completion via Multi-Retrieval Augmented Generation13 May 2024
Similar, not cited
Close in wording, no citation either way
- 2024Retrieval-augmented code completion for local projects using large language models
- 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model
- 2024CodeXEmbed: A Generalist Embedding Model Family for Multiligual and Multi-task Code Retrieval
- 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion
- 2025Impact-driven Context Filtering For Cross-file Code Completion
- 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generation