Embedding-based retrieval identifies passages according to semantic similarity between vector representations. Although effective for natural-language questions, dense retrieval can struggle with exact identifiers such as permit numbers, contract references, product codes, and alphanumeric clause designations.
BM25 is a lexical retrieval algorithm that ranks documents according to query-term occurrence, term rarity, and document-length normalization. It complements semantic retrieval by prioritizing passages containing distinctive identifier strings that embeddings may not represent with sufficient precision.
Anthropic's Contextual Retrieval methodology combines contextual embeddings with BM25 lexical retrieval to improve document-retrieval reliability. Ranked results can subsequently be combined and optionally reranked before relevant passages are supplied to Claude.
Hybrid retrieval architecture

Hybrid retrieval preserves semantic search capabilities while improving identifier-specific lookups.
A hybrid implementation should preserve identifier tokenization and normalize equivalent formatting where appropriate. Reciprocal rank fusion or another suitable ranking strategy can combine dense and lexical candidate lists.
Generated paraphrases may alter exact identifiers. Excessively small chunks can destroy contractual context, while embedding-model fine-tuning introduces additional complexity without guaranteeing reliable identifier matching.
Hybrid retrieval directly addresses the observed lexical-search deficiency while preserving the existing natural-language retrieval capabilities.
Reference Topics: Anthropic Contextual Retrieval, BM25, semantic embeddings, hybrid search, reciprocal rank fusion, exact-identifier retrieval, and knowledge grounding.