Retrieval: Finding What's Actually Relevant
Query Rewriting & HyDE
9 min+85 XPStep 1/10
The user wrote a bad query
Real queries are chatty ('so my thing broke and idk'), ambiguous ('it won't sync' — which it?), and written in user vocabulary that doesn't match document vocabulary ('login broken' vs docs saying 'authentication failure').
Query rewriting uses an LLM to canonicalize: resolve pronouns from chat history, map user terms to doc terms, expand abbreviations. Decomposition splits multi-hop questions ('compare X and Y's pricing') into sub-queries each retrievable alone. Both spend a small generation to fix the retrieval input — usually worth it, sometimes the fix itself.