Topic 4 of 5 · 5 min read
HyDE, multi-query and step-back prompting
Goal: Choose between HyDE, multi-query and step-back expansion for a described failure and predict the cost in extra calls.
Query expansion techniques change what you search with, not what you search in: each one fixes a specific kind of mismatch between the question and the documents, and each costs an extra model call. Pick by the failure you see, not by habit.
Check yourself · 1 of 3
In HyDE, what does the model write before the search?
Why it matters
A question and its answer often look different. Questions are short and vague; documents are long, specific and written in another register. When recall is poor, the cause is usually that mismatch. Three standard fixes target it from different angles.
The three techniques
HyDE (hypothetical document embeddings). Ask the model to write a short, plausible answer first, then embed that answer and search with it. The made-up text does not need to be correct. It only needs to look like a real document, so it lands near real ones in embedding space. The HyDE paper reports it helps zero-shot retrieval without labelled data. Best for short, abstract questions against long technical documents. Risk: if the model hallucinates in the wrong direction, you search for the wrong thing.
Multi-query. Ask the model for several paraphrases of the question, search each, and merge the results (for example by reciprocal rank fusion). Best when users word things differently than the documents and one phrasing misses. Cost: several searches, and more near-duplicate results to merge.
Step-back. Ask a more general question first ("What are the rules for refunds?" before "Can I refund an opened license key?"), and retrieve for both. The step-back paper shows that grounding in principles helps reasoning-heavy questions. Best when the specific question is too narrow to match any page. Risk: the general query pulls in broad, off-point chunks.
Choosing
| Failure | Try |
|---|---|
| Question is vague, documents are dense | HyDE |
| Right pages exist but wording differs | Multi-query |
| Question too specific, needs the rule behind it | Step-back |
Measure before you keep one. Run your test questions with and without it and compare recall at the top few results. Count the added calls: HyDE adds one generation plus one embedding; multi-query adds one generation and N searches; step-back adds one generation and one extra search.
Before and after
Weak: a team switches on all three for every query.
latency: 1 call -> 4 calls, recall change: none on exact lookups, noise in context
Fixed: use expansion only when the first retrieval scores low, and only the technique that matches the failure.
What goes wrong
- Expanding queries that already match, which adds noise and cost.
- Trusting HyDE's hypothetical text as a fact. It is a search string, never evidence.
- Merging multi-query results without deduplicating, so the same chunk fills the prompt.
Examples
HyDE on a vague question
Question: "why is my build slow?" HyDE writes a short paragraph about cache misses, dependency downloads and parallelism. Embedding that paragraph retrieves the build-performance guide that the six-word question missed.
Step-back for a narrow case
Question: "Can I return a mattress I slept on for two nights?" A step-back query "return policy for opened or used items" finds the general rule page; the narrow query alone found nothing.
Key points
- Expansion fixes a mismatch between the question and the documents, and every technique costs at least one extra model call.
- HyDE searches with a model-written hypothetical answer, which only has to resemble a real document, not be correct.
- Multi-query searches several paraphrases and merges the results, which helps when wording differs from the documents.
- Step-back adds a more general question to retrieve the rule behind a too-specific query.
- Choose by observed failure, measure recall with and without, and never treat the hypothetical text as evidence.
Common mistakes
- Turning on every expansion for every query, multiplying latency without measured recall gains.
- Presenting HyDE's hypothetical answer to the user or the final model as evidence.
- Merging multi-query results without deduplication or rank fusion.
- Picking a technique by popularity instead of the failure seen in the retrieval logs.
Check yourself · 2 of 3
Users ask for "time off" but the handbook says "annual leave", and single-phrasing searches keep missing the page. Which technique fits best?
Check yourself · 3 of 3
A team enables multi-query with five paraphrases on every request. How many extra model calls and searches does one question now cost, at minimum?
Practice items, not counted towards your mastery.
Start here
- Precise Zero-Shot Dense Retrieval without Relevance Labels (HyDE) (opens in a new tab)PaperFree
Introduces searching with a generated hypothetical answer instead of the raw question.
- Query Rewriting for Retrieval-Augmented Large Language Models (opens in a new tab)PaperFree
Shows rewriting the query before retrieval as its own trainable step in a RAG pipeline.
- Measuring and Narrowing the Compositionality Gap in Language Models (Self-Ask) (opens in a new tab)PaperFree
Explains why multi-part questions fail and how asking sub-questions closes the gap.
More for this topic
- Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models (opens in a new tab)PaperFree
Defines step-back prompting: asking a more general question first to ground the answer.