What is HyDE and how does it help retrieval?
hardAnswer
- Hypothetical Document Embeddings (Gao 2022): ask the LLM to generate a hypothetical passage answering the query, embed that passage, and retrieve using its embedding instead of the query's embedding.
- Rationale: real answer passages look more like other real passages than a raw question does.
- Works especially well for zero-shot retrieval (no fine-tuned encoder available).
- Cost: one extra LLM call per query.
- Gains: 5-20% in cold-start / zero-shot settings.
Check yourself — multiple choice
- Embed the query directly
- Generate a hypothetical answer passage with the LLM → embed it → retrieve → passages closer to real answers than to questions
- Only for classification
- Same as reranking
HyDE: embed a hypothetical answer instead of the query → 5-20% zero-shot retrieval gain.
#rag#retrieval
Practise LLMs & GenAI
214 interview questions in this topic.