Vibeleaderboard
← All Intel
Intel / article

Better Call Grep: Evaluating and Improving Grep-Like Lexical Retrieval for Repository-Level Code Completion

Source
arxiv.org
Author
Baoyi Wang, Xingliang Wang, Guochang Li, Chen Zhi, Junxiao Han, Xinkui Zhao, Nan Wang, Shuiguang Deng, Jianwei Yin
Date

Context

An AI completing code often needs definitions from other files. GrepRAG finds that through text searches, avoiding a separately maintained search index. Its authors report that even a basic version, where the model generates search commands, competed with graph-based retrieval in their tests. The improved version ranks matches using code identifiers and removes structurally redundant results, addressing noisy matches and fragmented context. On CrossCodeEval, it achieved a reported 7.04–15.58% relative improvement in exact-match completion over the strongest comparison method. The finding makes lightweight search a credible baseline for repository code completion. Research abstract.

Key takeaways · AI-distilled
  • Letting the model write its own ripgrep commands to pull context matched graph-based retrieval that has to build and maintain a code index. It worked because the lines grep matched tended to sit physically near the spot being completed.
  • Plain text search breaks in two specific ways: high-frequency ambiguous keywords drag in noise, and fixed truncation boundaries cut retrieved code mid-structure so the model sees fragments.
  • GrepRAG fixes both with post-processing rather than a new index: re-rank matches by identifier weight, then dedupe along structural boundaries. That beat the best prior method by 7-15% relative on exact-match code completion.
  • The framing worth stealing: before paying for or a code graph, measure how far index-free search already gets you, since the index is a permanent maintenance cost and grep is not.
Terms in this piece · Glossary
  • context window — The maximum amount of text a model can consider at once — its working memory for the current conversation or task.
  • embedding — A list of numbers representing a piece of text's meaning, so that similar meanings end up numerically close and can be searched.
Key quotes

“Despite its simplicity, Naive GrepRAG achieves performance comparable to sophisticated graph-based baselines.”

“Further analysis shows that its effectiveness stems from retrieving lexically precise code fragments that are spatially closer to the completion site.”

“Extensive evaluation on CrossCodeEval and RepoEval-Updated demonstrates that GrepRAG consistently outperforms state-of-the-art (SOTA) methods, achieving 7.04-15.58 percent relative improvement in code exact match (EM) over the best baseline on CrossCodeEval.”

Recommended reads
Comments

Checking sign-in…

Loading comments…