What semantic property does BM25 capture that dense embeddings tend to miss?
BM25 rewards exact rare-term matches (IDs, proper nouns, code symbols) that dense embeddings smooth away into nearby concepts.
Imagine searching a library two ways. The first librarian looks for books that share the actual rare words you said, like the exact serial number on a part or the exact name of a person. The second librarian works from the vibe of your sentence. Ask for cheap weekend getaways and she finds books about budget trips even if the word cheap never appears. She is great at meaning, but if you ask for serial number A7-9921 she might bring you any technical manual that feels similar. Keyword search is the first librarian. Dense search is the second. Real systems hire both and let each do what it does best.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
60s: BM25 catches exact rare-token matches that dense smooths away; hybrid retrievers combine the two on ranks (RRF) because score distributions are not comparable; standard production stack on enterprise corpora.
Real products, models, and research that use this idea.
- GitHub code search and Sourcegraph rely on BM25-style sparse signals for exact symbol lookup, because dense-only retrieval blurs function names and identifiers.
- Elastic, Vespa, and OpenSearch ship hybrid retrieval out of the box, pairing BM25 with an ANN index over embeddings like OpenAI text-embedding-3-large or Voyage v3.
- Cohere's 2026 RAG reference architecture uses Cohere embed-v4 + BM25 + Cohere rerank as the canonical three-stage stack precisely because hybrid beats dense-only on enterprise corpora with codes and IDs.
- Anthropic's contextual retrieval recipe pairs sparse BM25 with dense embeddings from Voyage and reranks with a cross-encoder, citing rare-token recall as the reason BM25 stays in the stack.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does Reciprocal Rank Fusion outperform a simple weighted sum of BM25 and cosine scores?
QHow would you choose between hybrid retrieval and dense-only for a new domain?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Assuming dense embeddings strictly dominate BM25. They lose on rare-token queries where exact match is the signal that matters.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.