Search

Search IconIcon to open search

HyDE

Last updatedUpdated: by Jakub Žovák · 1 min read

Properties
created 27.11.2024, 13:37
modified 08.11.2025, 18:12
published Empty
topics HyDE, Hypothetical Documents, Zero-Shot Dense Retrieval, Query Expansion
authors Empty
ai-assisted No

HyDE Paper:

Hypothetical Document Embeddings (HyDE). Given a query, HyDE first zero-shot instructs an instruction-following language model (e.g. InstructGPT) to generate a hypothetical document. The document captures relevance patterns but is unreal and may contain false details. Then, an unsupervised contrastively learned encoder (e.g. Contriever) encodes the document into an embedding vector. This vector identifies a neighborhood in the corpus embedding space, where similar real documents are retrieved based on vector similarity. This second step ground the generated document to the actual corpus, with the encoder’s dense bottleneck filtering out the incorrect details

Article that summarizes HyDE paper well: How to Use HyDE for Better LLM RAG Retrieval
LangChain specifically offers implementation of the HyDE retriever.
There are two approaches that use both the query and hypothetical document for the retrieval:

  1. Query2Doc
  2. QA-RAG