What is HyDE?

RAG & Retrieval
Definition

Hypothetical document embeddings: a retrieval technique where a language model first writes a made-up answer to the question, and that hypothetical document - rather than the question itself - is embedded and used as the search key. Answers sit near other answers in embedding space even when they sit far from the question, so retrieval matches the shape of an answer instead of the wording of a query.

Why It Matters

Questions make bad search keys. They are short and phrased the way people ask, while the documents that answer them are written in a different register - dense, declarative, full of detail. In embedding space those two texts can sit far apart even when one answers the other, so a retrieval pass over raw questions surfaces documents that merely talk the way users talk.

HyDE sidesteps the mismatch instead of attacking it. A generated stand-in, phrased the way a real answer document would read, lands in the same neighborhood as the documents worth finding. The technique needs no relevance-labeled training data, which is what makes it practical for teams that cannot fine-tune a retriever on query-document pairs they do not have.

How It Works

The question first goes to a language model with an instruction to write a short hypothetical answer. The output is a fabrication by design - fluent enough to pass for a real answer, wrong on specifics more often than not. That paragraph gets embedded and searched against the index through ordinary vector search, and the real documents nearest to it become the retrieved context. The original question and the retrieved documents, never the hypothetical, go to the generator.

The hypothetical is a search key. It never reaches the user, and its invented details wash out because the embedding only preserves the shape of answer-like text. The approach comes from Gao et al., Precise Zero-Shot Dense Retrieval without Relevance Labels (2022), where it matched fine-tuned retrievers across web search, QA, and fact verification benchmarks with no training data at all.

Where It Breaks

Drift is the signature failure. The model invents specifics inside the hypothetical - a version number, a product detail - and the embedding chases the invention. Retrieval then follows the fabricated detail away from the real answer, and the more confident the invention, the further the search wanders.

Exact-string queries suffer worst. A question built around a part number or an error code needs the verbatim string matched, and a hypothetical full of invented specifics pulls the search everywhere except toward it. That traffic belongs to hybrid search, where the keyword leg handles literal strings. Cost is the quieter tax: one extra generation call per query, paid in latency and spend whether or not the hypothetical helped.

How Flytebit Handles It

In our RAG development builds, HyDE goes in only for traffic where vague questions dominate, and exact-identifier queries route around it to the keyword leg instead. The hypothetical never leaves the retrieval layer, and the eval harness measures it against a baseline of direct-question retrieval on real user queries before it ships. Better Questions covers where the pattern earns its keep and where the invention leads the search.

More info

On flytebit.com

Reviewed by Jayaveer Bhupalam, Founder & CTO Last updated November 30, 2026