What is HyDE?

Updated on

HyDE is a zero-shot retrieval method that generates one or more hypothetical answer-like documents, embeds them as query representations, and searches for nearby real documents.

Quick Facts

Full NameHypothetical Document Embeddings
SpecificationOfficial Specification

How It Works

Generate, Embed, Aggregate, Retrieve

Prompt the generator for document-like passages matched to the corpus genre, encode each passage with the same document encoder and preprocessing used for the index, and aggregate the vectors with a declared rule such as a mean. The original method sampled several hypothetical documents; current frameworks may expose a different count or pipeline. Query text, prompt, generator, sampling settings, encoder and aggregation rule all belong to the retrieval revision.

Keep Hypotheses Outside the Evidence Boundary

A plausible hypothetical passage can invent a product name, statute, API or causal claim and pull retrieval toward the wrong neighborhood. Never cite it or place it in answer context as evidence. Label it as generated in traces, isolate it from real candidates, and permit the final answer to use only retrieved sources that pass permissions and grounding checks. For high-risk or exact-identifier queries, route to lexical or original-query branches instead of trusting HyDE alone.

Measure Incremental Value and Cost

Compare original-query dense retrieval, HyDE, lexical and hybrid variants on identical relevance judgments. Report Recall@K, nDCG or MRR, generation failure rate, topic-drift rate, latency, token cost and cache hit rate, with slices for short queries, domain mismatch, named entities, negation, multilingual input and ambiguous intent. The ACL results demonstrate viability under their models and benchmark tasks; they do not establish that HyDE improves every corpus or a supervised in-domain retriever.

Key Characteristics

  • Uses generated document-like text as an intermediate retrieval representation
  • Pivots from query-to-document matching toward document-to-document similarity
  • Can aggregate several hypothetical-document embeddings into one search vector
  • Requires the same document encoder contract used to build the target index
  • Adds generation latency, cost, nondeterminism and topic-drift risk before retrieval
  • Keeps generated hypotheses strictly separate from attributable evidence

Common Use Cases

  1. Testing zero-shot dense retrieval when no relevance labels are available
  2. Bridging vocabulary gaps between short user questions and specialist documents
  3. Generating document-shaped retrieval probes for unfamiliar domains
  4. Adding a HyDE branch to an original-query or hybrid candidate pipeline
  5. Studying whether multiple generated perspectives improve exploratory retrieval

Example

loading...
Loading code...

Frequently Asked Questions

Can a HyDE-generated document be cited as evidence?

No. It is generated to shape a search vector and may be false. Citations and answer claims must come from real retrieved sources that pass authorization, provenance and grounding checks.

Does HyDE always improve dense retrieval?

No. It can help with vocabulary mismatch and zero-shot domains, but it can also add topic drift, latency and cost. Compare it with the original query embedding, lexical search and hybrid retrieval on the same held-out judgments.

Why generate more than one hypothetical document?

Multiple samples can represent different relevant wording and reduce dependence on one generation, but averaging can also blur distinct intents. Treat sample count and aggregation as tunable parts of the retrieval contract.

How is HyDE different from ordinary query rewriting?

Ordinary rewriting usually emits another query or several concise search expressions. HyDE emits answer-like, document-shaped text and embeds it so retrieval operates near the expected document distribution.

Which queries are risky for HyDE?

Exact identifiers, current facts, ambiguous multi-intent questions, negation and domains unknown to the generator are risky because invented details can steer the search. Keep original and lexical branches, inspect drift, and abstain when real evidence is absent.

Related Terms

Related Articles