# BM25

> 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.

- Identifier: PTL-0127
- Category: Retrieval & Tool Use
- Canonical URL: https://protologue.com/t/bm25/
- Also known as: Okapi BM25, sparse retrieval, keyword search, lexical search

## Description

It is the standard sparse, lexical retrieval method and remains a strong baseline. It excels at exact matches, such as product codes, error messages, and names, where embedding search is weaker, and needs no training. It does not match synonyms or paraphrases, so it is usually paired with dense retrieval.

## Related terms

- [Dense Retrieval](https://protologue.com/t/dense-retrieval/)
- [Hybrid Search](https://protologue.com/t/hybrid-search/)
- [Contextual Retrieval](https://protologue.com/t/contextual-retrieval/)

## Comparisons

- [BM25 vs Dense Retrieval](https://protologue.com/compare/dense-retrieval-vs-bm25/)

## Sources

- Robertson and Zaragoza (2009). The Probabilistic Relevance Framework: BM25 and Beyond. https://doi.org/10.1561/1500000019

## Cite this entry

Protologue. (2026). BM25. In Protologue: A Taxonomy of Prompting and LLM Techniques (v1.4.0, PTL-0127). https://protologue.com/t/bm25/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
