Hybrid search is a retrieval technique that combines two fundamentally different search algorithms — keyword-based (sparse) search and semantic (dense) vector search — to produce results that are more accurate and comprehensive than either method alone. It is the industry standard approach for production RAG (Retrieval-Augmented Generation) systems because it addresses the core weaknesses of each individual method.
Keyword search (typically BM25) excels at exact-match queries: serial numbers, product codes, proper nouns, and domain-specific acronyms. If a user searches for “PROP-2847” or “HVAC maintenance,” BM25 will find documents containing those exact terms with high precision. However, it completely misses documents that discuss the same concept using different words — a document about “air conditioning servicing” won’t match “HVAC maintenance” unless both terms appear.
Semantic search using dense vector embeddings solves this by capturing meaning: it understands that “HVAC maintenance” and “air conditioning servicing” are conceptually similar. But it has its own blind spot — it can miss exact keyword matches, struggle with rare terms or identifiers, and sometimes return conceptually related but contextually wrong results. Hybrid search runs both methods in parallel and fuses their results, giving you the best of both worlds.
Hybrid search operates two parallel retrieval pipelines against the same document corpus:
Pipeline 1 — Sparse/Keyword (BM25): The query is tokenized and matched against an inverted index. BM25 scores each document based on term frequency (how often query terms appear in the document), inverse document frequency (how rare those terms are across the corpus), and document length normalization. This produces a ranked list of documents with BM25 relevance scores.
Pipeline 2 — Dense/Semantic (Vector Search): The query is converted to a dense vector embedding using the same model that encoded the documents at ingestion time. An ANN (approximate nearest neighbor) algorithm finds the most similar document vectors, producing a ranked list with cosine similarity or distance scores.
Hybrid search runs keyword (BM25) and vector (semantic) retrieval in parallel on the same query, then fuses the two ranked result lists into a single, unified ranking. Neither pipeline alone achieves the quality that the combination delivers.
A critical challenge in hybrid search is that the two pipelines produce scores on completely different scales. BM25 scores are unbounded positive numbers (typically 0–25+ depending on corpus statistics), while cosine similarity scores range from -1 to 1 (or 0 to 1 for normalized embeddings). You cannot simply add these scores together — a BM25 score of 15.3 and a cosine similarity of 0.87 are not meaningfully comparable.
This score incompatibility is why fusion algorithms are necessary. The two most common approaches are:
Most hybrid search implementations expose an alpha parameter that controls the relative weight of semantic vs. keyword search in the final ranking:
# Alpha controls the balance between search methods
alpha = 0.0 # Pure keyword search (BM25 only)
alpha = 0.5 # Equal weight to both methods
alpha = 0.7 # 70% semantic, 30% keyword (common default)
alpha = 1.0 # Pure vector search (semantic only)
# Weaviate hybrid search example
result = client.query.get("Document", ["title", "content"]) \
.with_hybrid(
query="pool maintenance schedule",
alpha=0.7
) \
.with_limit(10) \
.do()
Start with alpha=0.6 for most applications. Lower it if you’re getting too many loosely related semantic matches (need more keyword precision). Raise it if you’re missing conceptually related content (need more semantic breadth). The optimal alpha is domain-specific — run evaluations with real queries to find your sweet spot.
After both pipelines return their ranked lists, a fusion algorithm merges them. The two dominant approaches:
Reciprocal Rank Fusion (RRF) assigns each document a score of 1 / (rank + k) from each list (where k is typically 60), then sums the scores. A document ranked #1 in both lists scores 1/61 + 1/61 = 0.0328, while a document ranked #1 in one and #100 in the other scores 1/61 + 1/160 = 0.0226. RRF rewards consensus — documents that appear in both lists rank higher.
Weighted Linear Combination normalizes scores from each pipeline to a [0, 1] range using min-max scaling, then combines them: final_score = alpha * semantic_score_normalized + (1 - alpha) * bm25_score_normalized. This preserves the magnitude of score differences but requires that the normalization is representative — outlier scores can skew the scaling.
There are two main architectural approaches to implementing hybrid search:
Hybrid search is the retrieval backbone of production RAG systems. When a user asks the AI assistant “What’s the WiFi password for the conference center?”, keyword search catches the exact terms “WiFi” and “conference center” while semantic search surfaces documents about “internet access” and “meeting facilities.” Together, they retrieve the most relevant documents with higher recall rates, enabling the LLM to generate more accurate, grounded responses. Benchmarks show hybrid RAG systems achieving up to 35% accuracy improvement over semantic-only retrieval.
Real users issue wildly different types of queries. Some are keyword-heavy (“room 401 checkout time”), some are conceptual (“what’s there to do with kids”), and many are somewhere in between. Hybrid search handles this diversity without requiring query classification — the fusion algorithm naturally weights the more useful pipeline for each query. Keyword-heavy queries get most of their signal from BM25; conceptual queries lean on semantic search.
Searching technical documentation where both exact identifiers (function names, error codes, config parameters) and conceptual understanding matter is a classic hybrid search use case. A query for “how to configure max_connections” needs BM25 to find the exact parameter name and semantic search to find related configuration guides.
Hybrid search is inherently slower than either method alone because it runs two pipelines. Typical benchmarks show:
The ~2x latency cost is almost always worth the accuracy improvement in production systems. The pipelines run in parallel, so hybrid latency is roughly max(bm25_latency, vector_latency) + fusion_overhead, not their sum.
alpha parameter controls the weighting balance — start at 0.6 and tune with real queries against evaluation metrics.