GrepRAG
Properties
- Paper: GrepRAG: An Empirical Study and Optimization of Grep-Like Retrieval for Code Completion
- Paper summary ( Top Information Retrieval Papers Vol.142 for Feb 02 - Feb 08, 2026)
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.