Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →

Q16IntermediateConcept

Explain query transformation techniques: rewriting, multi-query, HyDE, step-back, and decomposition.

30-second answerSay your answer out loud first, then reveal.
A user query goes through a transform step that branches into rewrite or expand, multi-query paraphrases, HyDE hypothetical answers or decomposition into sub-questions, then retrieval for each, fusion and deduplication with RRF, and reranking before the LLM.

The techniques compared

TechniqueHowHelps whenCost
Rewrite / expandLLM fixes typos, expands acronyms, adds domain termsVague or short queries ("PF withdrawl rules")1 small LLM call
Multi-queryGenerate N paraphrases, retrieve for each, fuseVocabulary mismatchN retrievals
HyDE (Gao et al. 2022)LLM writes a fake answer; embed that (answers look like documents)Question-vs-document style mismatch1 LLM call; risky if the fake answer is wrong-headed
Step-backAsk a higher-level question ("What's the leave policy?") alongside the specific oneSpecific questions needing background principlesExtra retrieval
Decomposition"Compare Q2 vs Q3 churn" → two queriesMulti-part / comparison / multi-hop questionsMultiple retrievals, maybe sequential
Conversational condensationTurn a follow-up into a standalone question (Q24)Chat interfaces1 small LLM call

Trade-offs

Every transformation adds latency and cost and can drift from the user's intent. Measure the recall gain on your eval set, and consider routing: only transform when the query looks ambiguous or complex.

Common mistakes

  • Applying HyDE everywhere. For exact-match queries (IDs, names) it can hurt.

Little by little, you're building something great.