- All Courses
- Retrieval-Augmented Generation in Practice
- Retrieval Quality
- Query rewriting and expansion
Query rewriting and expansion
In a conversation, a follow-up like "what about the second one" contains almost nothing to match on.
Overview
The question as asked is often not searchable
In a conversation, a follow-up like "what about the second one" contains almost nothing to match on. Rewriting it against the history into a standalone question is what makes multi-turn retrieval work at all.
Expansion generates several phrasings of the same question, retrieves for each, and merges the results. It rescues queries whose vocabulary happens not to match the corpus.
Rewriting can also destroy intent. Always retrieve for the original query alongside the rewrites, so an over-eager reformulation cannot lose the answer entirely.
In this lesson you will:
- Resolve pronouns from conversation history
- Expand a short query into several
- Avoid rewriting away the user intent
Resources
Notes are not saved yet — they clear when you leave this page.
Re-ranking results
5m
Measuring retrieval with recall@k
7m