mlsanityData to 7 Oct 2026

FT2Ra: A Fine-Tuning-Inspired Approach to Retrieval-Augmented Code Completion

arXiv 2404.01554 ↗First posted 2 Apr 2024cs.SEcited by 9

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

  1. 2022ReACC: A Retrieval-Augmented Code Completion Framework15 Mar
  2. 2021Retrieval Augmented Code Generation and Summarization26 Aug
  3. 2020Retrieval-Augmented Generation for Code Summarization via Hybrid GNN9 Jun

Other references · 29

  1. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  2. 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,160
  3. 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,779
  4. 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
  5. 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
  6. 2021Improving language models by retrieving from trillions of tokenscited by 1,278
  7. 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 890
  8. 2019Generalization through Memorization: Nearest Neighbor Language Modelscited by 788
  9. 2023REPLUG: Retrieval-Augmented Black-Box Language Modelscited by 786
  10. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  11. 2021GPT Understands, Toocited by 715
  12. 2023In-Context Retrieval-Augmented Language Modelscited by 694
17 more
  1. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  2. 2023Active Retrieval Augmented Generationcited by 506
  3. 2023LeanDojo: Theorem Proving with Retrieval-Augmented Language Modelscited by 414
  4. 2023RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generationcited by 357
  5. 2022UniXcoder: Unified Cross-Modal Pre-training for Code Representationcited by 355
  6. 2022Repository-Level Prompt Generation for Large Language Models of Codecited by 106
  7. 2021Efficient Nearest Neighbor Language Modelscited by 93
  8. 2023Automatic Semantic Augmentation of Language Model Prompts (for Code Summarization)cited by 72
  9. 2020Code Prediction by Feeding Trees to Transformerscited by 70
  10. 2022Repair Is Nearly Generation: Multilingual Program Repair with LLMscited by 68
  11. 2022FiD-Light: Efficient and Effective Retrieval-Augmented Text Generationcited by 63
  12. 2017Code Completion with Neural Attention and Pointer Networkscited by 49
  13. 2022Decoupling Knowledge from Memorization: Retrieval-augmented Prompt Learningcited by 36
  14. 2023Why do Nearest Neighbor Language Models Work?cited by 29
  15. 2019ATOM: Commit Message Generation Based on Abstract Syntax Tree and Hybrid Rankingcited by 25
  16. 2023Domain Adaptive Code Completion via Language Models and Decoupled Domain Databasescited by 19
  17. 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

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 2; 2025: 6; 2026: 1.

9 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2024Retrieval-augmented code completion for local projects using large language models
  2. 2024A Lightweight Framework for Adaptive Retrieval In Code Completion With Critique Model
  3. 2024CodeXEmbed: A Generalist Embedding Model Family for Multiligual and Multi-task Code Retrieval
  4. 2024Repoformer: Selective Retrieval for Repository-Level Code Completion
  5. 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
  6. 2025CodeRAG: Finding Relevant and Necessary Knowledge for Retrieval-Augmented Repository-Level Code Completion
  7. 2025Impact-driven Context Filtering For Cross-file Code Completion
  8. 2025ReCode: Improving LLM-based Code Repair with Fine-Grained Retrieval-Augmented Generation