Method
BM25
BM25, also called Okapi BM25, is a family of ranking functions used to order documents by how well their terms match a search query. It is a lexical retrieval method: it scores term matches without considering the terms’ relative positions in a document.
What it is
BM25 ranks documents using the query terms that appear in each document. It is used in search engines to order matching documents by relevance to a query.1
BM25 is not one fixed scoring function, but a family whose components and parameters can vary. Its ranking treats query terms independently of their relationships within a document, such as how close together they appear.1
How it works
BM25 combines a term’s frequency in a document with a factor reflecting how common that term is across the collection. In Lucene’s implementation, the inverse document frequency factor is log(1 + (docCount − docFreq + 0.5) / (docFreq + 0.5)), where docFreq is the number of documents containing the term and docCount is the collection’s document count.12
Lucene’s k1 parameter controls how term-frequency gains saturate, while b controls how much document length affects term-frequency normalization. Its default settings are k1 = 1.2 and b = 0.75; by default, tokens that overlap in position are discounted from document length.2
Where it came from
Lucene identifies the introduction of BM25 with Stephen E. Robertson, Steve Walker, Susan Jones, Micheline Hancock-Beaulieu, and Mike Gatford’s “Okapi at TREC-3,” presented at TREC in 1994. The name Okapi BM25 reflects the Okapi information retrieval system, which was the first system to implement the function.12
Versions and relatives
Strengths and limits
How recent papers use it
In Thetis++, BM25 supplies keyword search alongside knowledge-graph-based semantic table search.3
In the study of Heinrich Bullinger’s correspondence, BM25 serves as a lexical retrieval baseline for comparison with dense and hybrid retrieval. It achieves 94% Recall@20 for explicit citations in the evaluation dataset.4
KnowMe evaluates BM25 as a lexical retrieval baseline using paper titles and abstracts as inputs.5
In ElbowHop, Okapi BM25 supplies the sparse ranking used by Hybrid RRF for schema retrieval.6
Names and versions
- Also written as
- Okapi BM25
Papers that mention BM25
19 Nov 2026Used
Exploring Semantic Table Search in Data Lakes
BM25 is the paper’s implementation of keyword search.
18 Nov 2026Compared against
Retrieving Patristic References and Modelling Topics in Bullinger's Reformation Correspondence
BM25 is the lexical retrieval baseline used for comparison with dense and hybrid retrieval.
18 Nov 2026Compared against
KnowMe Paper Radar: Lightweight Discovery of Promising Papers in the Age of Autoresearch
BM25 is the lexical retrieval baseline evaluated with title and abstract inputs.
16 Nov 2026Used
Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQL
Okapi BM25 supplies the sparse ranking used by Hybrid RRF.
Results papers report for it
| What was measured | Value | Conditions | Compared with |
|---|---|---|---|
| Retrieving Patristic References and Modelling Topics in Bullinger's Reformation Correspondence | |||
| Recall@20 on explicit citations in the evaluation dataset | 94 % | Dense approaches | |
Papers differ in data, settings and implementation, so values from different papers are not directly comparable unless the papers say so.
Sources
- 1BM25 | Springer Nature Linklink.springer.com
- 2BM25Similarity (Lucene 9.12.2 core API)lucene.apache.org
- 3Exploring Semantic Table Search in Data LakesPaper explained on this site
- 4Retrieving Patristic References and Modelling Topics in Bullinger's Reformation CorrespondencePaper explained on this site
- 5KnowMe Paper Radar: Lightweight Discovery of Promising Papers in the Age of AutoresearchPaper explained on this site
- 6Adaptive-Elbow Graph Traversal for Schema Retrieval in Text-to-SQLPaper explained on this site
Every paragraph above was checked against the sources it cites before it was published.