Skip to content

BM25

A classic keyword search algorithm. Used in hybrid search alongside vector-based methods.

What is it

BM25 is a ranking algorithm that evaluates how relevant a document is to a query based on word matches. It takes into account:

  • word frequency in the document;
  • word rarity in the collection;
  • document length.

When BM25 excels

  • searching for exact names and article numbers;
  • rare terms;
  • queries where the exact text is important, not the meaning.

When it falls short

BM25 does not understand synonyms: 'cat' and 'kitten' are different words to it. Therefore, it is combined with vector search.

See also

← All terms