Why pure vector search loses some queries
Embeddings are great at meaning but mediocre at tokens. They will not reliably rank a chunk that contains the exact error code 'ERR_CONNECTION_REFUSED' above a chunk that paraphrases the concept. Product names, SKUs, version numbers, and rare technical terms tend to live in the surface form — exactly what BM25 (a 1994-vintage probabilistic keyword scorer) is built for.
What BM25 actually does
For each query term, BM25 scores a document by term frequency (more occurrences = higher), inverse document frequency (rare terms count more), and a length normalization. The result is a ranking that loves exact matches, punishes verbosity, and ignores meaning. The opposite failure mode of vector search.
The cheapest hybrid
- Run vector search → top-N candidates.
- Run BM25 → top-N candidates.
- Merge ids, take the union, then re-rank by either a fusion score or a cross-encoder.
Two retrievers, one merge step. That alone often beats vector-only retrieval by 10–20% on factoid queries.