BM25 is a ranking function used by search engines to score how relevant a document is to a query. It rewards documents that contain the query terms, gives less weight to very common words, and dampens the effect of repeating a term many times, while adjusting for document length.
For each query term, BM25 combines term frequency in the document, an inverse document frequency weight that down-weights common words, and a length normalization so that long documents do not win just by being long. The per-term scores are summed into a final relevance score.
BM25 uses a saturation parameter so that the first few occurrences of a term add the most relevance and further repetitions add progressively less. This limits keyword stuffing, since repeating a word many times yields diminishing returns.
BM25 is a strong lexical baseline in many search systems and libraries and is often combined with newer neural or embedding-based rankers. Because it is fast and transparent, it is widely used for retrieval before a more expensive re-ranking step.
Not in the modern sense. BM25 is a probabilistic ranking formula with a few tunable parameters, not a trained neural network, though it is often used alongside learned rankers.
k1 controls how quickly term-frequency saturates, and b controls how strongly document length is normalized. Common defaults are around k1=1.5 and b=0.75.
Home · By Runze