BM25

Also known as: Best Matching 25, Okapi BM25

Category: NLP / Language Processing

A ranking function used in information retrieval that scores documents based on query term frequency, document length, and corpus statistics.

Full Explanation

BM25 (Best Matching 25) is a probabilistic ranking function that extends TF-IDF with term frequency saturation and document length normalization. It remains one of the most effective sparse retrieval methods decades after its introduction. BM25 scores are computed based on three factors: how often query terms appear in a document (with diminishing returns for repeated occurrences), the rarity of the query terms across the corpus (IDF), and the document length relative to the average. Two key parameters, k1 and b, control term frequency saturation and length normalization respectively. BM25 is the default ranking algorithm in search engines like Elasticsearch and Apache Lucene. Despite the rise of neural retrieval methods, BM25 remains highly competitive, especially for queries requiring exact term matching, and is commonly used as a first-stage retriever or in hybrid search systems.

Related Terms

More in NLP / Language Processing

Explore More