HyDE
HyDE, or Hypothetical Document Embeddings, is a retrieval technique in which a language model first generates a hypothetical answer document for a query, and that synthetic document — rather than the raw query — is then embedded and used to search a vector database for relevant real content. The core insight is that a query like "What causes transformer attention to scale quadratically?" is very different in embedding space from an actual passage that answers it, so using a generated answer as the search probe reduces that gap and improves retrieval precision.
Think of it like asking a librarian not just to look for books matching your question, but to first draft a rough answer themselves and then search the stacks for books that resemble that draft. The draft may not be accurate, but its vocabulary and framing more closely match the language of authoritative sources than your original question did.
A concrete HyDE pipeline: a user queries a RAG system with "explain LoRA fine-tuning memory savings." The LLM generates a hypothetical paragraph describing LoRA's low-rank decomposition and its effect on GPU memory. That paragraph is passed through an Embedding model to produce a vector, which is then used as the query vector against a Vector Database of technical papers. The retrieved documents feed back into the LLM for a grounded final answer. In practice, HyDE improves recall on domain-specific corpora where query vocabulary differs significantly from document vocabulary.
HyDE sits at the intersection of RAG architecture, Embedding quality, and Prompt Engineering; it is often compared to query expansion and reranking as complementary retrieval-improvement strategies. The technique is sensitive to Hallucination in the hypothetical document — if the LLM's draft is badly wrong, it can steer retrieval toward irrelevant passages.
You will encounter HyDE in advanced RAG system design discussions, research papers on dense retrieval, and engineering blogs describing how teams improve search quality in enterprise knowledge bases.