What is HyDE (Hypothetical Document Embedding)?medium
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?