Retrieval for Repository-Level
Code Completion

Ho Anh Minh · Ivan Smirnov · Maryana Smirnova · Vladislav Veselov

Technical University of Darmstadt

Can you fill in the missing line?

Try a completion, then change the retrieval method to see which code it would bring into the prompt.

Illustrative examples
Retrieval method

Active file

          
Retrieved context

          

Original teaching examples with scripted suggestions. The page does not run a model.

What retrieval changes

AIRCoder ranks repository snippets using three kinds of evidence.

QueryCode at the cursor
Text similarityFind similar snippets
DependenciesFind relevant symbols
StructureCompare enclosing code
Ranked contextSnippets for the generator

Published results

Accuracy and retrieval latency reported by Shi, Gao, and Gao in the AIRCoder paper.

Swapping in DraCo dependency extraction

Code exact match with StarCoder2-3B

CrossCodeEval-Python

AIRCodera36.68%
With DraCo36.88%

RepoEval API

AIRCodera49.77%
With DraCo47.86%

Only the dependency extractor changes. Table 4

Time spent on retrieval

Mean seconds per query

DraCo0.032 s
AIRCodera0.366 s
RepoCoder0.610 s
CodeRAG3.732 s

AIRCoder spent 0.320 s per query on dependency extraction. Table 7

Explore all Table 4 ablations

The DraCo rows use its static dependency extractor inside AIRCoder. Code EM is exact match, ES is edit similarity, and ID metrics score identifiers.

Papers