Repo-Premium traces code-search dense gains to unfair baselines
Original title: Embeddings vs. Grep: Rethinking the Dense Advantage in Code Search
LLM-written identifiers let BM25 match dense retrieval in every Python pool, including later pull requests.
The paper argues that code-search benchmarks overstate dense encoders versus BM25 because they use curated queries, older code, and a handicapped lexical baseline, while coding agents often rely on grep. The authors introduce Repo-Premium, which ranks files in real repositories across Python, JavaScript, TypeScript, Go, Rust and Java, with pull requests from 2022 to 2026 and a preregistered pool of 91 repositories. They attribute the dense edge to evaluation choices and queries missing rare identifiers, and recommend a fair lexical baseline, fusion with BM25, and adding the code’s words to queries.
- Generate-then-grep helps BM25 more than dense retrieval.
- No method they tried predicts which retriever wins on a given query.
- The test pool covers 91 repositories and six languages.
- Chunking files for BM25 and counting edited tests as relevant favored dense retrieval.
From the original article
1 min read at huggingface.coCode-search benchmarks show dense encoders well ahead of BM25, yet coding agents do well with grep. What does this dense advantage measure? Existing benchmarks cannot tell: they use curated queries, old code and a handicapped BM25.
By Siqiao Xue, Ziyin Zhang, Zihan Liao · huggingface.co
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.