liveBook · Manning

BM25

As explained in The Art of AI Product Development

BM25 is a lexical ranking function that scores documents using term frequency, document frequency, and document-length normalization.

BM25 is a lexical ranking function for prioritizing documents with exact query terms. It scores term frequency, document frequency, and document-length normalization, complementing semantic search when meaning alone is too broad. section 7.2.4

Exact terms versus related meaning

A search for “augmented workflow” may retrieve broadly related documents through semantic search, while BM25 prioritizes documents containing that exact product phrase. The same hybrid approach helps retrieve API endpoints and distinguish “business” class from documents about doing business. section 7.2.4

Figure 7.8 Combining semantic and lexical search can increase overall retrieval accuracy.
A diagram of a diagram

AI-generated content may be incorrect.

Shows how combining semantic and lexical search can improve overall retrieval accuracy. section 7.2.4

How The Art of AI Product Development covers it

How deep it goes
Defines scoring through term frequency, document frequency, and length normalization without deriving the ranking algorithm.
Examples
Uses product taxonomy phrases, API endpoints, and the ambiguous term “business” to demonstrate exact-match needs.
What it assumes
Assumes semantic search is available and positions lexical ranking as its precision-oriented complement.
What you can do after
Apply BM25 through hybrid retrieval to prioritize exact terms while retaining semantically related context.
How it connects
Connects BM25 with lexical search, semantic search, embeddings, and retrieval accuracy.

Also explained in

Compare how 5 books explain BM25 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of AI Product Development. The section links point to the parts of the book it draws on.