Retrieval & generation · Glossary term
What is BM25?
A lexical ranking function that scores a document from query-term matches while accounting for term rarity, repeated occurrences, and document length.
Why does BM25 matter?
It is a strong exact-term retrieval baseline and complements dense retrieval for identifiers, rare words, and domain-specific phrases.
BM25 in practice
Retrieve candidates with BM25 and dense search, combine their ranks, then evaluate the merged results before adding a more expensive reranker.
What is the common confusion about BM25?
BM25 does not understand semantic similarity directly, and its score has no universal meaning across different queries or index configurations.
Learn BM25 in the course
Lessons that name BM25 in a title or section
- Hybrid Retrieval with BM25 and Dense Embeddings
Lexical and semantic retrieval fail on opposite query distributions. Hybrid retrieval with reciprocal rank fusion does not interpolate, it votes - and the vote wins on every query class.
- Information Retrieval and Search
BM25 is precise but brittle. Dense casts a wide net but misses keywords. Hybrid is the 2026 default. Everything else is tuning.
- Advanced RAG (Chunking, Reranking, Hybrid Search)
Basic RAG retrieves the top-k most similar chunks. That works for simple questions. It falls apart for multi-hop reasoning, ambiguous queries, and large corpora.
Covered in Phase 05: NLP: Foundations to Advanced, Phase 11: LLM Engineering and Phase 19: Capstone Projects.
Related terms
- Hybrid RetrievalRetrieval that combines signals from different methods, commonly lexical matching and dense-vector similarity, before merging or reranking…
- Dense RetrievalFirst-stage retrieval that embeds queries and candidates into vector representations and ranks candidates by a similarity function.
- RerankerA second-stage model or scoring function that reorders a small candidate set using a richer comparison between the query and each candidate.
- RAG (Retrieval-Augmented Generation)A system pattern that retrieves evidence relevant to a request and supplies selected content to a generative model before it answers or…
- Reciprocal Rank Fusion (RRF)A rank-fusion method that combines several result lists by summing contributions that decrease with each item's rank in each list.
Sources
More terms in Retrieval & generation
This entry comes from glossary/terms.md on GitHub. Browse all 250 glossary terms.