Advanced RAG Patterns
Patterns for hard retrieval problems
Beyond basic RAG: multi-hop chains, query rewriting, self-reflection, and structured data retrieval. Each pattern addresses a specific failure class — know which problem you're solving before you adopt one.
What you will learn
- Match advanced patterns to failure classes
- Implement query rewriting and routing
- Evaluate whether an advanced pattern earned its complexity
What is this?
Advanced RAG layers solve specific weaknesses: query rewriting rescues vague questions; multi-hop chains split questions that need several documents; self-reflection re-retrieves when answers choke; structured/graph memory handles relational facts. Every pattern adds latency and surface — apply it only where its named failure actually bites.
Why do you need it?
- Vague user questions genuinely cost retrieval recall.
- Multi-hop answers need multiple retrievals, not one top-k.
- Self-reflection catches its own low-confident generations.
- Structured needs (numbers, joins, people) beat pure text retrieval.
Mental model
A toolbox of specialty drills
Advanced RAG
Basic RAG is the standard drill. Query rewriting is the countersink, multi-hop the extended bit, reflection the re-measure, structured retrieval the masonry bit. Buying all of them 'because they exist' adds weight; you pick the drill your wall actually needs.
How it works
- Query rewriting: rephrase/expand the question into better retrieval terms.
- Routing: judge whether a query needs text, SQL, or multimodality — send to the right vector.
- Multi-hop: chain retrieval+generation over intermediate results.
- Self-reflection: generation produces sub-questions; retrieval re-runs to close gaps.
- Structured/graph: tables and relations retrieved alongside text to answer joins.
Advanced pattern routing.
In production
- Data-dense products pair text RAG with SQL retrieval for exact numbers.
- Cross-doc research bots rewrite vague probes before search.
- Support escalation bots self-reflect: low-confidence → more context → re-answer.
Best practices
- Adopt one pattern per measured weakness, and gate it on eval lift.
- Keep simple RAG as the baseline in every eval.
- Make pattern usage observable; A/B survivors stick.
- Watch latency: every rewrite/reflection loop multiplies calls.
Common mistakes
- Building the whole toolbox 'for production' before any problem exists.
- Rewriting queries that were already clear — adding drift.
- Unbounded self-reflection loops blowing latency and cost.
Common issues
Reflection loop runs hotCoverage check too strict
Cap loop depth, loosen thresholds, force fallback answer.
Rewriting garbles precise queriesRewrite model too aggressive
Route only low-confidence/ambiguous queries to rewriting.
Debugging tips
- Pattern doesn't help → confirm the actual failure class (measure with stage metrics).
- Rewrite hurt → the original query was precise; log & A/B.
- Multi-hop answers worse than single-prompt → the intermediate hops lose grounding; verify.
Interview checkpoint
Quick quiz
Multi-hop RAG is for…
Every RAG system should ship query rewriting from day one.