What is bm25 in search

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.


Home · By Runze