Search

Search IconIcon to open search

GrepRAG

Last updatedUpdated: by Jakub Žovák · 1 min read

Properties
created 11.02.2026, 19:42
modified 11.02.2026, 19:45
published Empty
topics GrepRAG, Code Retrieval, Lexical Retrieval, BM25 Reranking
authors Empty
ai-assisted No

This paper from Zhejiang University introduces GrepRAG, a lightweight retrieval framework for repository-level code completion that challenges the assumption that complex semantic or graph-based retrieval methods are necessary for effective cross-file dependency resolution. The authors first establish a baseline called Naive GrepRAG, where LLMs autonomously generate ripgrep commands to locate relevant code through lexical matching, demonstrating that this simple approach achieves performance comparable to sophisticated graph-based methods while offering significantly lower latency (sub-second vs. multi-second retrieval times on large repositories). Through systematic analysis, they identify that Naive GrepRAG succeeds because it retrieves lexically precise code fragments closer to the completion site using four main keyword patterns (class names, method names, variable names, and others). However, they also uncover critical limitations, including keyword ambiguity with high-frequency terms, context fragmentation from rigid truncation boundaries, and information redundancy from overlapping retrievals. To address these issues, the enhanced GrepRAG incorporates a lightweight post-processing pipeline featuring identifier-weighted BM25 re-ranking and structure-aware deduplication. Evaluation demonstrates that GrepRAG achieves 7–15% relative improvement in exact match over state-of-the-art baselines while maintaining minimal retrieval overhead.