Why rewrite the user's query before retrieval?
mediumAnswer
- User queries are often conversational, terse, or use pronouns / references ('what about the other one?').
- Rewriting expands them into standalone, keyword-rich forms.
- Techniques: (1) LLM-based rewrite of the last user turn using the chat history; (2) HyDE (Hypothetical Document Embeddings) — ask the LLM to write a hypothetical passage answering the query, embed that instead; (3) Multi-query expansion — generate N variants and retrieve for each.
- Improves recall 10-30% on multi-turn RAG.
Check yourself — multiple choice
- Query as-is always
- Rewrite conversational / terse queries → standalone keyword-rich form; HyDE, multi-query — 10-30% recall gain
- Only for BM25
- Impossible
Query rewriting: standalone + HyDE + multi-query → big recall gain on conversational RAG.
#rag#retrieval
Practise LLMs & GenAI
214 interview questions in this topic.