protologue

Dense Retrieval vs BM25

BM25 ranks documents by the query's exact words, weighted by how rare each word is, and needs no training. Dense retrieval compares embedding vectors, so it matches meaning and paraphrases but can miss exact identifiers, names and codes. Production search often combines the two in hybrid search.

Definitions

Dense Retrieval PTL-0126
Dense retrieval finds relevant passages by embedding the query and every passage as dense vectors, usually with a dual encoder, and returning the passages whose vectors are most similar to the query's.
BM25 PTL-0127
BM25 is a keyword ranking function that scores documents by how often the query's terms appear in them, weighted by how rare each term is across the collection and normalized for document length.

Differences

Dense RetrievalBM25
Matches onMeaning (embedding similarity)Exact terms
Finds paraphrasesYesNo
Finds exact codes and namesLess reliablyYes
SetupAn embedding model and a vector indexAn inverted index; no training

Which to use

  • Use dense retrieval when users phrase things differently from the documents.
  • Use BM25 for error messages, product codes and names; use both in hybrid search when you can.

Sources

  1. Karpukhin et al. (2020). Dense Passage Retrieval for Open-Domain Question Answering.
  2. Robertson and Zaragoza (2009). The Probabilistic Relevance Framework: BM25 and Beyond.

Cite this page

Protologue. (2026). Dense Retrieval vs BM25. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.4.0). https://protologue.com/compare/dense-retrieval-vs-bm25/

Markdown