SECLMar 15, 2024

Repoformer: Selective Retrieval for Repository-Level Code Completion

arXiv:2403.10059v281 citationsh-index: 9ICML
Originality Incremental advance
AI Analysis

This work addresses the problem of slow and unreliable code completion for developers by introducing a more efficient and robust method, though it is incremental as it builds on existing RAG approaches.

The paper tackles the inefficiency and robustness issues in retrieval-augmented generation for repository-level code completion by proposing a selective RAG framework that avoids retrieval when unnecessary, achieving state-of-the-art performance on benchmarks like RepoEval and CrossCodeEval with up to 70% inference speedup.

Recent advances in retrieval-augmented generation (RAG) have initiated a new era in repository-level code completion. However, the invariable use of retrieval in existing methods exposes issues in both efficiency and robustness, with a large proportion of the retrieved contexts proving unhelpful or harmful to code language models (code LMs). In this paper, we propose a selective RAG framework to avoid retrieval when unnecessary. To power this framework, we design a self-supervised learning approach to enable a code LM to accurately self-evaluate whether retrieval can improve its output quality and robustly leverage the potentially noisy retrieved contexts. Using this LM as both the selective RAG policy and the generation model, our framework achieves state-of-the-art repository-level code completion performance on diverse benchmarks including RepoEval, CrossCodeEval, and CrossCodeLongEval, a new long-form code completion benchmark. Meanwhile, our analyses show that selectively retrieving brings as much as 70% inference speedup in the online serving setting without harming the performance. We further demonstrate that our framework is able to accommodate different generation models, retrievers, and programming languages. These advancements position our framework as an important step towards more accurate and efficient repository-level code completion.

Foundations

The foundational work for this paper's niche, ranked by how specifically the neighbourhood builds on it — not by global fame.

Your Notes