hypothetical document embeddings

Hypothetical Document Embeddings (HyDE) improves retrieval-augmented generation by using an LLM to generate a hypothetical answer to a query then embedding that hypothetical document for similarity search rather than embedding the raw query. This addresses the fundamental asymmetry between short queries and long documents in embedding space since a generated passage is semantically closer to relevant documents than a terse question. The process involves prompting an LLM to generate a plausible answer which may contain hallucinations, encoding the hypothetical document with the retrieval encoder, and performing nearest-neighbor search against the document corpus. Even factually incorrect hypothetical documents retrieve relevant real documents because they share topical vocabulary and semantic structure. HyDE consistently improves retrieval recall across diverse domains without requiring task-specific fine-tuning of the retrieval model, making it a zero-shot technique compatible with any dense retriever and particularly effective for domain-specific or technical queries.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account