BM25

BM25 helps rank search results by checking how well a document matches the search words.

What it does

BM25 helps rank search results by checking how well a document matches the search words.

Relevance: How well a result matches • Saturation: Stopping counting

How it works

  • Count matching words.
  • Adjust for very long or very short documents.
  • Rank the best matches higher.

Uses and applications

  • A website search box can show the best pages first.
  • A help center can find the right support article.
  • An online store can rank products that match your search.

In short

BM25 is used for search ranking.

Related methods

  • TF-IDF: The simpler word-weighting idea BM25 builds on.
  • RAG (Open Book AI): Retrieves documents with methods like BM25 before generating an answer.

Back to Search and retrieval · All topics

The interactive demonstration and the Python walkthrough for this topic need JavaScript.