Skip to content

HyDE (Hypothetical Document Embeddings)

A technique to improve search in RAG: before searching, the model generates a hypothetical response to the question, which is then converted into an embedding and used as a search query.

Why

The question and relevant document are often phrased differently. A hypothetical response is closer in style to a real document than a short question, thus the search finds more accurate fragments.

How it works

1. The model writes a rough answer to the question.
2. The answer is converted into an embedding.
3. Similar documents are searched based on the embedding.
4. The found content is added to the context for the final answer.

See also

← All terms