HyDE retrieval is a zero-shot dense retrieval technique that asks a language model to write a hypothetical answer to the user’s question, then searches the corpus using that invented document instead of the question itself. The central question is why searching with a made-up answer would ever beat searching with the real question, and the answer is that questions and answers live in different parts of embedding space: a draft answer looks far more like the documents you want than the question ever will.
HyDE stands for Hypothetical Document Embeddings. It was introduced by Gao, Ma, Lin and Callan in December 2022, in the paper “Precise Zero-Shot Dense Retrieval without Relevance Labels”, and it needs no training data and no fine-tuned retriever. That combination — no labels, no training, better retrieval — is why it became one of the most widely discussed retrieval techniques in the RAG era.
Key takeaways
- HyDE retrieval generates a hypothetical answer document, embeds it, and uses that vector to find real documents similar to the draft.
- It works because answers resemble answers: the draft’s embedding lands closer to relevant passages than the question’s embedding does.
- The draft may contain false details, but the encoder’s dense bottleneck filters most of them out before search.
- HyDE shines with unsupervised retrievers and no labelled data; it adds a model call, latency and cost to every query.
The problem HyDE solves
Dense retrieval compares the embedding of a query with the embeddings of documents. This works well when the query and the documents are written in similar language, but a question and its answer are not similar texts. A question asks; an answer states. A question is short and uncertain; an answer is long and specific. Their embeddings sit in different regions, and a nearest-neighbour search from the question can miss documents that a search from the answer would find easily.
This gap is worst in the zero-shot setting, where you have no labelled examples to fine-tune the retriever. A general-purpose encoder has never been taught which passages answer which questions in your domain. HyDE sidesteps the teaching entirely: instead of fixing the encoder, it fixes the query by turning it into something that looks like an answer.
It is worth noting what HyDE does not do. It does not improve the corpus, the index or the embedding model. It changes only the search vector. If your corpus does not contain the answer, HyDE cannot conjure it, and if your encoder is weak, a better query vector helps only so far. Retrieval accuracy still depends on chunk quality and index design as much as on the query.
How HyDE retrieval works
The pipeline has four steps, and none of them requires training. First, the user’s question is sent to an instruction-following language model with a prompt such as “write a passage that answers this question”. Second, the model writes a hypothetical document: a short passage that reads like a real answer, even though it may contain invented details. Third, an unsupervised contrastive encoder embeds that passage, and the question’s own embedding is averaged in. Fourth, the combined vector searches the corpus for the nearest real documents.
The averaging step matters. The original paper combines the hypothetical document’s embedding with the query’s embedding, so the search is anchored by the real question as well as the draft. This guards against a draft that wanders off-topic: the question pulls the search back towards what was actually asked.
The authors’ key insight is that the encoder acts as a lossy filter. A dense embedding cannot carry every detail of the draft, so fine-grained falsehoods — a wrong date, a wrong name — tend to be dropped, while the overall shape of the answer survives: the topic, the terminology, the style of text that answers this kind of question. What reaches the index is the draft’s useful structure, not its mistakes.

What the original results showed
On the TREC Deep Learning 2019 web search benchmark, HyDE lifted the unsupervised Contriever retriever from 44.5 to 61.3 on nDCG@10, a large jump for a method that uses no relevance labels. Its mean average precision of 41.8 matched the fine-tuned Contriever model, which had been trained on labelled relevance data, and its recall at 1,000 results was actually higher. The method also improved results across six low-resource BEIR datasets covering science, argumentation, finance and news.
Those results come with an important caveat that the same paper makes clear. HyDE’s gains were measured with a large instruction-tuned generator, and the benefit shrinks — or reverses — when the generator is small or the encoder is already fine-tuned. On a fine-tuned encoder, the authors describe HyDE as “not the intended usage”. The technique is a zero-shot tool for unsupervised retrievers, not a universal upgrade.
HyDE vs other query techniques
HyDE sits in a family of query-side techniques, and choosing between them is mostly a question of cost, latency and how much labelled data you have. Query rewriting restates the question; HyDE replaces it with an answer-shaped draft. Multi-query generation produces several paraphrases and merges their results. All three add a model call before retrieval, so their costs are comparable, but they fail in different ways.
| Technique | What is searched | Needs training | Main strength | Main weakness |
|---|---|---|---|---|
| HyDE retrieval | Embedding of a draft answer | No | Strong zero-shot gains | Extra generation cost and latency |
| Query rewriting | Embedding of a restated question | No | Fixes vague or ambiguous wording | Can lose the original intent |
| Multi-query | Several paraphrase embeddings | No | Covers several interpretations | Multiple searches to merge |
| Fine-tuned retriever | Embedding of the raw question | Yes, labelled pairs | Best accuracy when data exists | Needs labelled data and retraining |
| BM25 keyword search | Raw question terms | No | Fast, exact and explainable | Missed by vocabulary mismatch |
A related technique, Query2doc, also generates a passage from the question but appends it to the query for a keyword retriever rather than embedding it for a dense one. It shares HyDE’s intuition — generated text bridges the vocabulary gap — but it targets lexical search, where the added words matter directly.
When HyDE retrieval helps
HyDE helps most when you have no labelled retrieval data, an unsupervised encoder, and questions whose answers use very different words from the questions themselves. It is a strong fit for new systems, prototypes and domains where collecting relevance labels is slow or expensive. It also helps on short, underspecified queries, where the draft supplies the context the question lacks.
It helps least when you already have a fine-tuned retriever, a small or weak generator, or a latency budget that cannot absorb a generation step before retrieval. If your generator is small, its drafts may be poor enough that the search vector is worse than the question’s. The paper’s own results show the gain scaling with generator size, so a weak generator is a real risk, not a theoretical one.
Best for: zero-shot retrieval with an unsupervised encoder and no labelled data, where a strong instruction-tuned model is already available in the stack.
Implementing HyDE in a RAG pipeline
A practical implementation has five parts: the prompt, the generator, the encoder, the combination step and the evaluation. The prompt should ask for a passage that answers the question, in the style of your corpus. If your documents are formal reports, ask for a formal paragraph; if they are support articles, ask for a support-style answer. Matching the draft’s style to the corpus improves the embedding match.
Generate more than one draft when you can afford it. The original paper samples several hypothetical documents and averages their embeddings, which smooths out the quirks of any single draft. Two or three samples are usually enough in practice, and the extra cost is small compared with the main generation step that follows retrieval.
Keep the original question in the search. Average the question embedding with the draft embedding, as the paper does, rather than searching with the draft alone. Then retrieve, rerank against the original question, and generate the final answer only from the retrieved real documents — never from the draft. The draft is a search tool, not a source. Treating it as a source would let invented details leak into answers, which is exactly the failure that hallucination testing is designed to catch.
Costs and risks to watch
Every HyDE query pays for a generation before retrieval begins. That adds latency to time-to-first-token and spend to every request, including the easy questions that plain retrieval would have answered. Gate HyDE the way you would gate any expensive step: use it when the query is short, the domain is new, or plain retrieval scores are low, and skip it when the question is precise or the corpus is small enough for keyword search to work.
The second risk is drift. A draft that confidently invents a wrong framing can pull retrieval towards the wrong topic, and the reranker may not recover if the right passages never made the shortlist. Logging drafts alongside queries makes this visible: if drafts keep wandering, the prompt or the generator needs work. The third risk is the false comfort of a good benchmark number. HyDE’s headline results came from a specific setup; your corpus, generator and encoder will behave differently, so test on your own questions before trusting it in production.
HyDE retrieval checklist
- Confirm you actually need it: no labelled data, an unsupervised encoder, and vocabulary mismatch between questions and documents.
- Match the draft prompt to your corpus style so the draft resembles real documents.
- Sample two or three drafts and average their embeddings to smooth out single-draft quirks.
- Average the draft embedding with the original question embedding; never search with the draft alone.
- Rerank retrieved passages against the original question, not the draft.
- Generate the final answer only from retrieved real documents, never from the draft itself.
- Log drafts with queries so drift is visible and reviewable.
- A/B test HyDE against plain retrieval on your own labelled questions before rolling it out.
Frequently asked questions
What is HyDE retrieval?
HyDE retrieval is a zero-shot technique that asks a language model to write a hypothetical answer to a question, embeds that draft, and searches a document corpus for real passages similar to it, instead of searching with the question alone.
Does HyDE need training data?
No. HyDE uses an existing instruction-following language model and an unsupervised encoder, with no fine-tuning and no relevance labels. That is its main advantage over a fine-tuned retriever.
Can the invented details in a HyDE draft corrupt the answer?
They can corrupt retrieval if the draft drifts badly, but the final answer should only ever be generated from retrieved real documents, never from the draft. The encoder also filters out many fine-grained false details.
When does HyDE not help?
HyDE helps least with an already fine-tuned retriever, a small or weak generator, or a strict latency budget. The original paper notes that HyDE with a fine-tuned encoder is not its intended use.
How many drafts should HyDE generate per query?
The original paper samples several drafts and averages their embeddings. In practice, two or three drafts smooth out single-draft quirks without adding much cost.
Where can I read the original HyDE paper?
The paper is “Precise Zero-Shot Dense Retrieval without Relevance Labels” by Gao, Ma, Lin and Callan, published at ACL 2023 and available as arXiv:2212.10496.







