What is HyDE (Hypothetical Document Embedding)?medium

Type
conceptual
Topic
is-hyde-hypothetical-document-embedding
Frequency
common
Tags
rag, what, hyde, hypothetical, document, embedding
Answer

Instead of embedding the user query directly, ask the LLM to generate a hypothetical ideal answer, then embed that.

Explanation

Instead of embedding the user query directly, ask the LLM to generate a hypothetical ideal answer, then embed that. The hypothesis is closer to the document distribution than a short query. Improves retrieval when queries are short/ambiguous and documents are long/verbose. Tradeoff: adds one LLM call per query (latency + cost). Useful for financial filings where query vocabulary differs from document vocabulary.

Follow-upCan you give a production example?