Why it matters
Questions and answers are written in different registers: a question is short and interrogative, a passage is declarative and dense. Dense encoders trained on question-passage pairs narrow that gap but do not close it for specialised corpora. HyDE closes it by drafting an answer in the corpus's own style and using that draft as the query, so the vector points at the region where answers live.
Mental model
HyDE is describing a suspect from memory and then searching for people who match the description, rather than searching for the word suspect. The metaphor breaks when the description invents a detail, because the search will faithfully find someone with that invented feature.
How it works
Synthetic HyDE record · query r-4471
One draft · two retrieval lists · four passages
bounding boxes
Step 1Write the answer first
The draft is written in the corpus register: declarative, specific and the length of a passage, because that is the region of the space retrieval has to reach.
HYDE · QUERY r-4471 · DRAFT + ORIGINAL QUERY
A hypothetical answer as the query
| Draft detail | In passages | Action |
|---|---|---|
| Flex plan | no | strip |
| 14 → 7 days | p3 | keep |
| single renewal date | p3 | keep |
| Passage | Draft rank | Query rank |
|---|---|---|
| p3 | 1 | 1 |
| p7 | 2 | 3 |
| p9 | — | 2 |
| p12 | 3 | — |
48 draft tokens · 3 checked · 1 stripped · 4 passages · 1 generation call
Step record
- Draft tokens
- 48
- Generation
- 1 call
- Register
- passage
The text version summarises this figure; select a region for its full text.
Figure. One question, one generated draft and two retrieval lists. The draft names a plan that appears in no passage, so that detail is stripped before embedding; the specifics the passages carry are kept. The draft list and the query list share two passages, which fuse to four unique passages.
What to notice. Synthetic query and draft. The draft text is authored to show the mechanism and is not a model sample; the four passages and ranks are illustrative. The figure shows what has to be separated before a generated answer becomes a query, not a measured recall gain.
Text version
A HyDE record for the question “Why did renewal drop after the plan change?” A draft answer says annual plans moved to a single renewal date while monthly plans kept their cycle, the window narrowed from 14 days to 7, and monthly accounts on the Flex plan cancelled. A table checks three draft details: the Flex plan appears in no passage and is stripped, while the 14 to 7 day window and the single renewal date appear in p3 and are kept. Fields record 48 draft tokens, one generation call and embedding on the document side. A retrieval table gives draft and query ranks for four passages: p3 is first in both, p7 is second and third, p9 appears only in the query list, p12 only in the draft list. Fusion gives a union of four, two shared and one from each list alone. Steps mark the draft, the checks, the encoder choice, both lists, the fusion and the evaluation slice.
- Generate a short passage that answers the question in the register and vocabulary of the target corpus.
- Strip or flag invented specifics such as names, figures and dates before embedding, since they are ungrounded.
- Embed the generated passage with the document-side encoder, not the query-side one.
- Retrieve nearest passages to that vector, optionally also retrieving with the original query.
- Fuse the two result lists so a bad generation cannot eliminate the original query's hits.
- Measure recall against the plain-query baseline, sliced by whether the generated draft contained invented entities.
Trade-offs
| Choice | Good for | Cost | Fails when |
|---|---|---|---|
| HyDE alone | Strong recall on terse or jargon-heavy queries | One generation call and hallucination risk | Questions ask for exact identifiers or figures |
| HyDE fused with the original query | Robust to a bad draft | Two retrieval passes | Latency budget is single-pass |
| HyDE on every query | Uniform pipeline | Pays generation cost on easy queries | Queries are already long and specific |
| No HyDE | Cheapest and deterministic | Question-answer register gap remains | The corpus is highly specialised |
Good for
Strong recall on terse or jargon-heavy queries
Cost
One generation call and hallucination risk
Fails when
Questions ask for exact identifiers or figures
- Questions ask for exact identifiers or figures
- Latency budget is single-pass
- Queries are already long and specific
- The corpus is highly specialised
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: HyDE alone is good for Strong recall on terse or jargon-heavy queries, costs One generation call and hallucination risk, and fails when Questions ask for exact identifiers or figures. HyDE fused with the original query is good for Robust to a bad draft, costs Two retrieval passes, and fails when Latency budget is single-pass. HyDE on every query is good for Uniform pipeline, costs Pays generation cost on easy queries, and fails when Queries are already long and specific. No HyDE is good for Cheapest and deterministic, costs Question-answer register gap remains, and fails when The corpus is highly specialised
Failure modes
- Invented entity anchors the search. The draft names a plausible product that does not exist and retrieval returns passages about it. Debug: diff named entities in the draft against entities in the retrieved passages and the query.
- Register mismatch. The draft is written like a chatbot reply rather than like the corpus, so the vector is still off-distribution. Debug: compare the draft's style and length with the gold passages for a sample.
- Generation failure treated as no result. A refusal or empty draft produces an empty vector and zero hits. Debug: validate the draft before embedding and fall back to the original query on refusal.
In production
Cache drafts by query hash and cap their length. Monitor the share of drafts containing entities absent from both the query and the retrieved passages, which is the signal for drift.
Common misconceptions
People think: The hypothetical answer must be correct.
Actually: It only needs to occupy the right region of the embedding space; correctness is not the objective.
People think: HyDE replaces the user's query.
Actually: The original query is still the ground truth of intent and should remain in the retrieval path as a fallback.
Interview angle
Explain the question-answer register gap and why an answer-shaped vector helps. Name hallucinated specifics as the main risk and fuse with the original query. Describing the generation step without saying what happens when the draft is wrong is the incomplete version.
Sources
- Gao et al., Precise Zero-Shot Dense Retrieval without Relevance Labels — the HyDE method and its zero-shot retrieval results.
- Karpukhin et al., Dense Passage Retrieval — the query and passage encoders HyDE substitutes into.
- Ma et al., Query Rewriting for Retrieval-Augmented Large Language Models — rewriting as a family of techniques that HyDE belongs to.