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 Retrieval | BM25 | |
|---|---|---|
| Matches on | Meaning (embedding similarity) | Exact terms |
| Finds paraphrases | Yes | No |
| Finds exact codes and names | Less reliably | Yes |
| Setup | An embedding model and a vector index | An 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
- Karpukhin et al. (2020). Dense Passage Retrieval for Open-Domain Question Answering.
- 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/