Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

BM25 is a lexical ranking function: it scores documents that contain a search query’s terms and orders them by how well those terms match. It rewards term occurrences, gives more weight to rarer terms, and adjusts for document length. The result is a ranking score—not a calibrated probability that a document is relevant.

How does BM25 work?

BM25 belongs to the probabilistic relevance framework, a family of approaches for estimating how useful a document is for a query. In practice, the score combines evidence from query terms: whether they appear in a document, how often they appear, and how common they are across the collection. Document length also affects the contribution of term frequency.

Think of a search for “rare orchid care.” A page containing “orchid” and “care” offers matching evidence, but a comparatively uncommon query term such as “orchid” may be more discriminating than a word appearing in many documents. A document that repeats a term can score higher, but repetition has diminishing returns. BM25 combines these signals to rank candidates; it does not determine relevance with certainty.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Term frequency: occurrences matter, but less over time

Term frequency (TF) is the number of times a query term occurs in a document. More occurrences can increase that term’s contribution, but BM25 uses a saturating function: the gain from each additional occurrence becomes smaller. This helps prevent a page from dominating simply because it repeats a keyword many times.

#1 Best Overall
Sale
Introduction to Information Retrieval
  • Used Book in Good Condition

Inverse document frequency: rare terms carry more information

Inverse document frequency (IDF) reflects how widely a term appears across the document collection. A term found in relatively few documents generally provides stronger evidence for distinguishing a match than one found almost everywhere. IDF is collection-dependent: the same word can have a different weight in a different index.

Length normalization: counts are read in context

A raw count means something different in a short document than in a long one. BM25 adjusts term frequency in relation to document length and the collection’s average document length. This reduces the advantage long documents might otherwise receive merely because they have more opportunities to contain a term.

What do k1 and b mean?

In implementations that expose the standard BM25 parameters, k1 controls how quickly the term-frequency contribution saturates, while b controls the degree of document-length normalization. These settings change how matching evidence is weighted; they do not change the basic idea of the model.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Parameter What it controls Elasticsearch reference default
k1 Nonlinear saturation of term frequency 1.2, as documented in Elastic’s Elasticsearch similarity settings reference accessed 2026-10-07
b Degree of document-length normalization 0.75, as documented in Elastic’s Elasticsearch similarity settings reference accessed 2026-10-07

Those figures are documented Elasticsearch defaults, not universal BM25 constants or benchmark results. Elastic’s reference describes BM25 as “The algorithm used by default in Elasticsearch and Lucene.” Defaults and configuration details are implementation- and version-specific, so check the documentation for the version you deploy. Neither a default nor a parameter value is automatically best for every corpus; judge settings against the relevance needs of your search collection.

Is BM25 the same as TF-IDF?

No. Both approaches use term frequency and inverse document frequency to represent lexical matching, but BM25 is not simply the TF-IDF formula with another name. In BM25, the term-frequency contribution saturates, and length normalization is controlled through the model’s parameters. The distinction matters when interpreting rankings or configuring an implementation.

Where does BM25 fit in modern search?

BM25 is a lexical full-text method: it relies on query terms appearing in indexed documents. In a retrieval pipeline, it can help find and rank candidate documents, but it is not a complete description of every modern search system. Search systems may combine lexical results with vector-search results, then apply a later reranking stage. Lexical matching and semantic similarity are different signals; combining them does not guarantee a win for every query or corpus.

Evaluate the approach on the collection and queries that matter to your application. The useful comparison is not an abstract claim that one method always wins, but whether the system retrieves and orders the relevant material for your users.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How does BM25F handle documents with multiple fields?

Ordinary BM25 is often presented for plain-text documents. BM25F is a conceptual extension for structured or multi-field documents, such as records with separate title, abstract, and body fields. It can combine term evidence across fields while applying field-specific weights and length normalization. That allows a match in a title to be treated differently from a match in a long body, for example. Exact configuration and API details depend on the search library.

Further reading on information retrieval

For broader background beyond BM25, Cambridge University Press lists Introduction to Information Retrieval by Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schütze. It is a textbook on classical and web information retrieval, not a BM25-only guide.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.