Intermediate · Systems
HyDE (Hypothetical Document Embeddings)
Visual diagram · (in preparation) · Math · (in preparation) · Worked example · 3 difficulty levels.
TL;DR. A retrieval technique that asks an LLM to generate a hypothetical answer first, then embeds and retrieves real documents similar to it.
Technical Definition
A retrieval technique that asks an LLM to generate a hypothetical answer first, then embeds and retrieves real documents similar to it.
How it works
HyDE (Gao et al., 2022) addresses the query–document asymmetry in dense retrieval: queries are short and underspecified while passages are long. The LLM hallucinates a plausible answer-shaped document, which is embedded and used as the search vector. The fake content does not matter; only its embedding does. HyDE often beats zero-shot dense retrieval without any training on the target corpus.
Related Concepts
- Embedding — A dense vector representation that captures semantic meaning, mapping discrete items like words into continuous mathematical space.
- Retrieval-Augmented Generation (RAG) — A technique that enhances LLM responses by retrieving relevant documents from an external knowledge base before generating an answer.
- Reranker — A second-stage model (often a cross-encoder) that re-orders an initial set of retrieved candidates for higher precision before they reach an LLM.