Hybrid Retrieval is a pattern that adapts the retrieval strategy based on the structure and metadata of the underlying index. Instead of treating all queries the same, it uses filters, hybrid search, or multi-index routing to narrow the search space before ranking.
At a Glance
- Problem: Users describe symptoms in casual words while documentation uses precise terminology, so a query like "flaky deploy" fails to reach a document about "intermittent pipeline failures" and the right chunk falls below the relevance threshold.
- Forces: Semantic recall versus exact keyword matches, balanced by a weight that must be tuned per domain; wider query rewrites find more candidates, but drift adds noise; each added technique improves accuracy, but costs latency and maintenance.
- Solution: Reshape the query or the search mechanism to fit how the index stores information: run BM25 and vector search together with a tunable alpha weight, and add query expansion, HyDE hypothetical answers, or graph links between chunks when the vocabulary gap demands it.
- Consequences: Gains: relevant documents surface even when user vocabulary differs from the corpus, and running BM25 beside vector search adds little cost. Costs: HyDE adds an LLM call, expansion multiplies search load, the keyword-versus-semantic weight needs tuning per domain, and two index types need maintenance.
What problem does Hybrid Retrieval solve?
A user asks your RAG system "how do I fix a flaky deploy?" and gets back nothing useful. The knowledge base does contain the answer, in a document titled "Resolving Intermittent CI/CD Pipeline Failures." Once you see it, the cause is obvious: the user said "flaky deploy," the document says "intermittent pipeline failures," and the vector similarity between those two phrases is lower than you would expect.
This vocabulary mismatch shows up all the time in real systems. Domain experts write documentation using precise terminology. End users ask questions using casual language, abbreviations, or descriptions of symptoms rather than root causes. A support engineer might index a troubleshooting guide under "connection pool exhaustion" while a developer searches for "database keeps timing out."
The gap gets worse when your knowledge base spans multiple teams or time periods. Terminology drifts: one team calls it "deployment," another calls it "release," and a third says "ship." Basic vector search treats these as related but not identical, and that slight distance can push the right document below your relevance threshold.
How does Hybrid Retrieval work?
Index-aware retrieval is a family of techniques that reshape either the query or the search mechanism to account for how information is actually stored in your index. Instead of hoping the user's words land close enough to the right embeddings, you close the gap yourself.
HyDE (Hypothetical Document Embeddings) searches with an answer instead of the question. Before searching, you ask an LLM to generate a hypothetical answer to the user's question. You do not show this answer to the user; you embed it and use that embedding as your search vector. The reasoning is that a plausible answer will use vocabulary much closer to what exists in your knowledge base than the original question did. A hypothetical answer to "fix a flaky deploy" might mention "intermittent failures," "retry logic," and "pipeline stability," which are exactly the terms your indexed documents contain.
Query expansion takes a different approach. Rather than generating a full answer, you rewrite the original query into multiple variations that cover different phrasings. "Fix a flaky deploy" becomes three or four queries: "resolve intermittent deployment failures," "CI/CD pipeline instability troubleshooting," "unreliable release process." You run all of them and merge the results. You search more broadly without inventing a hypothetical answer.
Hybrid search changes the retrieval engine instead of the query. Pure vector search captures semantic meaning but can miss exact keyword matches. Traditional keyword search (BM25) catches exact terms but misses semantic similarity. Hybrid search runs both in parallel and combines their scores with a tunable weight, often called alpha. At alpha=0 you get pure keyword search, and at alpha=1, pure vector. Most production systems land somewhere around 0.5 to 0.7, leaning toward semantic but keeping keyword matching as a safety net.
Graph-based retrieval adds structural relationships between chunks. Instead of treating every chunk as an independent point in vector space, you build a graph where chunks link to related chunks, parent documents, entities, and concepts. When a query matches one chunk, the graph lets you pull in neighboring chunks that share entities or belong to the same topic cluster. This helps most with questions that span multiple documents or require connecting information from different sections.
When should you use Hybrid Retrieval?
Start with basic vector search and measure your retrieval quality. If you notice that relevant documents frequently appear outside the top-k results, or that users rephrase questions multiple times before getting a good answer, you have a vocabulary gap problem.
HyDE works well when your knowledge base uses specialized terminology and your users do not. It adds one LLM call per query, so it suits cases where users can tolerate some extra latency and retrieval accuracy matters more than speed.
Query expansion is a lighter touch. It works well when users tend to ask short, ambiguous questions. If your average query is three to five words, expansion helps fill in the missing context.
Hybrid search should be your default in production. Running BM25 alongside vector search costs very little, and it improves accuracy consistently across domains, so you will rarely have a reason to skip it.
Graph-based retrieval makes sense when your knowledge base has strong entity relationships, when questions often require connecting information across documents, or when you have a well-structured corpus like technical documentation with cross-references.
When not to use it: Do not add HyDE, expansion, or a graph when plain vector search already scores well on your evaluation set; the extra latency and maintenance buy little. If the right chunks are retrieved but ranked below tangential ones, the gap is ranking, not vocabulary, so use Retrieval Refinement. If a question needs evidence chained across several documents, rewriting one query will not gather it; use Deep Search.
Worked Example: Cost and Latency
An internal docs assistant answers 10,000 questions a day, passing 5 chunks of 400 tokens to the large model and getting a 300-token answer.
| Setup | Calls per request | Tokens per request (in / out) | Cost per 1,000 requests | Latency per request |
|---|---|---|---|---|
| Vector search only | 1 search + 1 LLM | 2,300 / 300 | $11.40 | 5.8 s |
| Hybrid search (BM25 + vector in parallel) | 2 searches + 1 LLM | 2,300 / 300 | $11.40 | 5.8 s |
| Hybrid search + HyDE (small model) | 2 searches + 2 LLM | 2,350 / 450 | $11.50 | 7.3 s |
Generation costs 2,300 × $3.00 per million = $0.0069 plus 300 × $15.00 per million = $0.0045, so $11.40 per 1,000, with 0.3 s assumed for search and 0.5 s + 300 / 60 = 5.5 s to generate. Hybrid search runs both indexes in parallel, so latency takes the slower one and stays at 0.3 s; BM25 adds an index to run but no model tokens. HyDE on the small model reads 50 tokens and writes a 150-token hypothetical answer: 50 × $0.15 per million plus 150 × $0.60 per million ≈ $0.0001, and embedding the hypothetical at $0.02 per million adds $0.003 per 1,000, for $0.10 per 1,000 in total. HyDE's call follows the reference formula, 0.5 s + 150 / 150 = 1.5 s, and runs before retrieval, so it adds directly to the total; embedding the hypothetical is assumed negligible.
Hybrid search is close to free in model cost, while HyDE adds under 1% to cost but about 26% to latency, so add HyDE only when your evaluation set shows a vocabulary gap that hybrid search alone does not close.
What are the common pitfalls?
HyDE can backfire if the LLM generates a confidently wrong hypothetical answer. If the hypothetical mentions incorrect terminology, you will retrieve documents about the wrong concept. The risk is highest in specialized domains where the LLM knows little.
Query expansion can introduce noise. If your rewritten queries drift too far from the original intent, you pull in irrelevant results that dilute the good ones. Five expanded queries that each return ten results means fifty candidates to process, and many of them may be off-topic.
Hybrid search requires tuning the alpha parameter per domain. A value that works for legal documents may perform poorly for code documentation. If you set it once and never revisit it, you lose much of the benefit.
Graph-based approaches carry the highest implementation cost. Building and maintaining the graph requires entity extraction, relationship mapping, and ongoing updates as your knowledge base changes. If your corpus is flat and unstructured, the graph adds more complexity than it pays back.
What are the trade-offs?
Every technique here adds latency, complexity, or both. HyDE adds an LLM call before retrieval. Query expansion multiplies your search load. Hybrid search requires maintaining two index types. Graph retrieval requires building and updating a knowledge graph.
Add a technique only when your retrieval quality problems justify the complexity. If basic vector search gives you 90% accuracy on your evaluation set, adding HyDE to get to 93% may not be worth the extra 1.5 seconds per query. If basic search gives you 60% accuracy, you need these techniques.
Start with hybrid search, because it costs little and helps across most domains. Add query expansion if short queries are common. Reserve HyDE for domains with severe vocabulary mismatch. Consider graph retrieval only when your questions really require multi-document reasoning and you have the engineering capacity to maintain the graph.
Goes Well With
Semantic Indexing improves the quality of what gets stored in the index. Index-aware retrieval improves how you search it. Used together, they work on the vocabulary gap from both the index side and the query side.
Retrieval Refinement picks up where retrieval leaves off. Even with better queries, your retrieved set will contain noise. Reranking and filtering clean up the results before they reach the LLM.
Basic RAG is the baseline pipeline. Knowing it makes it easier to see where each index-aware technique plugs in and what it changes.
References
- Nogueira, R., & Cho, K. (2019). Passage Re-ranking with BERT. arXiv preprint. arXiv