HyDE: Hypothetical Document Embeddings

Generate a hypothetical answer, embed the answer not the question, then retrieve

HyDE: Hypothetical Document Embeddings Generate a hypothetical answer, embed the answer not the question, then retrieve 01 / Query 02 / Generate 03 / Embed 04 / Retrieve 05 / Answer Question · user query · 01 / Query · input Question user query input LLM Generator · drafts hypothetical answer · 02 / Generate · no facts needed LLM Generator drafts hypothetical answer no facts needed Embedder · encodes the draft · 03 / Embed Embedder encodes the draft Vector Store · document embeddings · 04 / Retrieve · corpus Vector Store document embeddings corpus Similarity Search · answer-embedding query · 04 / Retrieve · top-k Similarity Search answer-embedding query top-k Answer Synthesis · grounded response · 05 / Answer · cited Answer Synthesis grounded response cited prompt hypothetical doc answer embedding doc vectors matched documents Legend primary data policy / PII async batch data store

The HyDE Trick

  • • The model first drafts a plausible answer with no retrieval
  • • That hypothetical answer, not the raw question, is embedded
  • • Retrieval runs on the answer-embedding against the corpus

Why It Retrieves Better

  • • Answers look like documents; questions do not
  • • Answer-to-document similarity beats question-to-document
  • • The original question still conditions the final synthesis