1:1 mentoring with Big Tech AI engineers
RAG & MCP

Retrieval & Reranking

Advanced retrieval and reranking for RAG: BM25, dense retrieval, cross-encoder reranking, and hybrid search strategies.

Last updated

4. Retrieval — Hybrid Search, Reranking & Query Understanding

4. Retrieval — Hybrid Search, Reranking & Query Understanding

Why Hybrid Search (Vector + Keyword)

Vector search captures semantic similarity ("car" matches "automobile"). Keyword search (BM25) captures exact terms ("error code E-4502" won't match semantically but BM25 finds it instantly). Production systems need both.

Search TypeWins WhenFails When
Dense (vector)Semantic queries, paraphrases, conceptual searchExact term matching (product codes, error codes, names)
Sparse (BM25)Exact keywords, rare terms, technical identifiersParaphrased queries, conceptual similarity
Hybrid (fusion)Most real-world queries (mix of concept + specific terms)Simple queries where one method suffices (adds latency)

Reciprocal Rank Fusion (RRF)

The standard way to merge results from multiple retrievers:

Related

More in RAG & MCP

Get full access to all 87+ sections with code examples, diagrams, and interactive animations.

Unlock Premium