코드 검색 벤치마크 재검토, 텍스트 검색이 조건에 따라 충분할 수 있음
Embeddings vs. Grep: Rethinking the Dense Advantage in Code Search
- 매체
- Hugging Face
- 게시
- 중요도
- 3/5
- 화제 지수
- 9
한국어 요약
기존 코드 검색 벤치마크는 밀집 인코더를 BM25보다 훨씬 앞선다고 보이지만, 실제 코딩 에이전트는 grep으로 잘 작동한다. 새 벤치마크 Repo-Premium에서 실제 저장소의 파일을 순위매기며, BM25를 공정하게 평가한 결과 LLM이 쓴 식별자로 쿼리를 확장(generate-then-grep)하면 BM25이 모든 Python 풀에서 밀집 검색과 동등해질 수 있음을 보였다. 세 가지 지침을 도출했다: 공정한 렉시컬 기준선으로 밀집 이득을 측정할 것, 밀집과 BM25를 융합할 것, 쿼리에 코드의 단어를 더할 것.
원문 발췌 · English
Code-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. To find out, we build Repo-Premium, a realistic repository-level code-search benchmark. It ranks files in real repositories, with curated and raw queries in Python, JavaScript, TypeScript, Go, Rust and Java, pull requests from 2022 to 2026, and a preregistered test pool over 91 repositories. Our experiments trace the advantage to two sources: evaluation choices that favor dense retrieval, such as splitting files into chunks for BM25 and counting edited tests as relevant, and queries that lack the code's rare identifiers. Expanding the query with LLM-written identifiers (generate-then-grep) helps BM25 far more than dense retrieval, letting it match dense retrieval in every Python pool, even on pull requests opened after the LLM was released. No method we tried predicts which retriever will win on a given query. From these results we derive three guidelines: measure dense gains against a fair lexical baseline, fuse dense retrieval with BM25, and add the code's words to queries that lack them.