BM25
Also known as: Best Match 25, Okapi BM25
Classical TF-IDF-style lexical scoring: a surprisingly strong baseline, still the first stage of many hybrid RAG pipelines.
A bag-of-words ranking function used by traditional search engines. Scores documents by term-frequency × inverse-document-frequency with length normalization. Still the strongest non-neural baseline; commonly used as the first stage in hybrid RAG.
In practice
Ignore it and your dense retriever may underperform. Production interviews increasingly want hybrid (BM25 + dense) plus a reranker.
How it compares
BM25 matches on exact word overlap; embedding search matches on semantic meaning. Best results often combine both.
Related topics
Questions that mention this term
- Why does hybrid retrieval…
- Modern vector databases combine sparse (BM25) and dense vectors at the storage layer via two distinct patterns. Identify them.
- Why combine BM25 with dense embeddings for retrieval?
- When does hybrid (dense + BM25) retrieval outperform pure dense for context engineering?
- Pick the right way to fuse BM25 and dense scores before context assembly
- What semantic property does BM25 capture that dense embeddings tend to miss?
Related terms
AI System Design
End-to-end design of production LLM systems: ingestion, retrieval, serving, eval, monitoring.
Chunking
Cutting documents into retrievable pieces before embedding them.
Context Engineering
Deciding what makes it into the model's context window (prompt + RAG + history + memory), and why.
Context Window
The max number of tokens a model can attend to at once.
Fixed-size Chunking
Slice documents every N tokens with a small overlap. Fast and format-agnostic, but cuts through headings and mid-topic.
Hallucination
When a model confidently makes up something that isn't true.