Slides · Retrieval-augmented generation
All RAG types
1 / 24
All RAG types
One pipeline for every question is a trap. This lesson shows how to pick the lightest RAG design that fixes a failure you can name.
By the end you can:
- state the decision rule and walk the decision tree,
- say when naive, advanced, modular and agentic RAG each earn their place,
- match HyDE, parent-child, GraphRAG, Self-RAG, Corrective RAG and Adaptive RAG to the failure each fixes,
- pick a variant for a scenario and defend it with its cost and failure mode.
Concept
Three questions, one method
- Question 1: what is the status of a specific order?
- Question 2: what changed in the policies this week?
- Question 3: how long does a refund take?
- A search that only asks “which page is about this?” treats all three the same.
- They fail in different ways, so they may need different fixes.
“RAG” is a family of designs. Each named variant adds one step aimed at one failure of the plain pipeline.
Concept
A toolbox, not a ladder
- The baseline is hybrid search plus a reranker. It is a good general tool.
- Each variant is a specialist tool. You reach for it only when you can name the job.
- Every extra LLM call adds latency, cost and a new way to fail.
The decision rule: start with the simplest thing that meets the quality bar, measure, and add complexity only for a failure you can name.
A weak answer lists ten variants. A strong answer picks one, states its cost and says how it would measure the gain.
Diagram
Walking the decision tree: questions 1 to 3
Ask about failures in order. The first “yes” points to a variant.
Diagram
Walking the decision tree: questions 4 to 6
Compare
Four generations of architecture
The survey by Gao et al. groups RAG work into naive, advanced and modular paradigms. Agentic RAG is newer and not part of the survey: a model chooses the steps.
| Generation | What it adds | Earns its place when | Costs |
|---|---|---|---|
| Naive | Index, top-k retrieve, stuff the prompt | Prototype, small clean corpus | Low precision, no rewrite or rerank |
| Advanced | Pre-retrieval (rewrite, filters) and post-retrieval (rerank, compress) | Most production use | More stages, more latency |
| Modular | Swappable modules wired by a router | Many sources, need to test parts alone | Orchestration complexity |
| Agentic | A model decides whether, where and when to retrieve | Multi-step, multi-source questions | Variable latency and cost, loops |
Boundaries between these names vary across papers and frameworks.
Source[1] Retrieval-Augmented Generation for Large Language Models: A Survey
Diagram
Advanced RAG wraps the retrieve step
This is the usual production baseline. The price is more stages to run, log and tune.
Source[1] Retrieval-Augmented Generation for Large Language Models: A Survey
Diagram
Agentic RAG: a loop with a model in charge
- Gain: handles multi-step questions over mixed sources.
- Cost: unpredictable latency and spend, possible loops, harder to evaluate and secure.
- Needs step limits, tracing and guardrails.
Diagram
HyDE: search with an imagined answer
Fixes: the question is worded unlike the documents.
The authors caution that the imagined text is made up and can contain errors. Risk: a wrong imagined answer pulls retrieval toward the wrong topic. Cost: one extra LLM call per query.
Source[2] Precise Zero-Shot Dense Retrieval without Relevance Labels
Concept
Parent-child: match small, read big
Fixes: the best-matching chunk is too small to answer from.
- Embed small child chunks, so matching stays precise.
- When a child matches, look up its parent section.
- Give the model the parent text.
Risk: bigger prompts and more tokens. Several children can share one parent, so de-duplicate before building the prompt.
Diagram
GraphRAG: for questions about the whole corpus
Fixes: “summarise everything” questions about the whole corpus, which top-k similarity handles poorly. Walking a graph is also a common way to answer multi-hop questions, but the paper’s focus is corpus-wide sensemaking.
Edge et al. build the graph and community summaries with an LLM, then combine partial answers from summaries. Cost: the project README warns that indexing can be expensive. Risks: stale graph, extraction errors that spread.
Sources[3] From Local to Global: A Graph RAG Approach to Query-Focused Summarization[4] microsoft/graphrag
Diagram
Corrective RAG: grade before you trust
Fixes: retrieval that comes back irrelevant or empty while the system answers anyway.
The paper uses the evaluator’s confidence to choose the action, and adds web search because a fixed corpus may return only weak documents. Cost: a grader on every query. Risk: the grader can be wrong.
Concept
Self-RAG: the model critiques itself
Fixes: retrieving when it is not needed, and unchecked output.
- The model is trained to emit special reflection tokens.
- They let it decide when to retrieve and reflect on retrieved passages and on its own output.
- Retrieval happens on demand, not a fixed number of passages every time.
Risk: it depends on a model trained for this, so it is not a setting you can switch on for any model.
Source[6] Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection
Diagram
Adaptive RAG: spend effort where it is needed
Fixes: wasted cost and latency when most queries are easy.
Jeong et al. use a smaller language model as the complexity classifier. Risk: a misrouted hard query takes the weak path.
Concept
Variants by data shape
The failure sometimes sits in the data, not the search.
- Multimodal RAG: images, tables, charts. Convert to text first (captions, OCR) or use multimodal embeddings. Watch table structure loss and OCR errors.
- Text-to-SQL or structured RAG: send questions about numbers and records to SQL or an API. Guardrails: read-only access, limited schema, validated queries.
- Conversational RAG: rewrite follow-ups into standalone queries and skip retrieval on chit-chat.
Compare
Failure, cost, risk in one table
| Variant | Fixes | Added cost | Main risk |
|---|---|---|---|
| Hybrid | Exact-token misses | Second index | Fusion tuning |
| HyDE | Phrasing gap | One more LLM call | Biased retrieval |
| Parent-child | Missing context | Larger prompt | Token cost |
| GraphRAG | Corpus-wide (and multi-hop) | Heavy indexing | Stale graph, extraction errors |
| Corrective | Bad retrieval | A grader | Grader errors |
| Adaptive | Cost on easy queries | A router | Misrouting |
| Self-RAG | Unneeded retrieval | A trained model | Training dependency |
| Agentic | Multi-step, multi-source | Many calls | Loops, unpredictability |
Learn this as defaults: a failure points to a first tool to try, and every tool has a price.
Worked example
Worked example: pricing a grader
Scenario: a product-support assistant over a docs set that is often incomplete, because new features reach the docs weeks late. Users ask about them and get confident answers built from loosely related pages. Failure named: weak or empty retrieval with no fallback, so a web-search fallback is the point. Variant: Corrective RAG.
Illustrative assumptions, not measurements: 5,000 queries a day, one grader call per query with an 800-token input and a 20-token output. The grader here is an LLM prompted to grade relevance; the CRAG paper uses a small fine-tuned evaluator, which would be cheaper per call.
extra tokens per day=5,000×(800+20)=4,100,000- Extra latency: one more model call on every query, before generation.
- Risk to watch: the grader marks a good page as bad, or the reverse, and a bad grade triggers an outside web search.
- Proof it worked: on a labelled set that includes questions the docs cannot answer, the share of answers judged unsupported, before and after.
Call prices vary by model, so convert the token count to money with your own provider’s current rate.
Worked example
Worked example: when HyDE is, and is not, the answer
Scenario: a medicines-information bot. Patients type “stomach pain after tablets”; the leaflets say “gastrointestinal discomfort”.
- Likely failure: phrasing gap between question and documents.
- Simplest fix first: query rewriting or synonym expansion in the baseline.
- If a labelled set still shows misses: HyDE, at the price of one more call.
- Danger: a wrong imagined answer retrieves the wrong leaflet, and in medicine that matters. Keep citations on and test with unanswerable questions.
The lesson is the order of moves: cheapest fix, then measure, then the heavier tool.
Source[2] Precise Zero-Shot Dense Retrieval without Relevance Labels
Concept
Common mistakes
- Building the most elaborate version first. Every extra call costs latency and adds a failure mode.
- Naming a variant without the failure it fixes.
- Treating agentic RAG as the upgrade for everything. It is the last resort and needs step limits, tracing and guardrails.
- Assuming every variant can be added without changing the model or the data.
- Adding two or three variants at once, so you cannot tell which one helped.
Production systems are commonly advanced RAG with one or two additions chosen from evaluation results.
Check yourself
Check: which variant?
A user-manual assistant finds the right step every time, but answers stop mid-procedure because the matching chunk is one step of a ten-step procedure. Which variant fits, what does it cost, and what would you measure?
Answer
Parent-child retrieval: keep matching on small chunks but return the parent section. Cost: a larger prompt, plus de-duplicating parents shared by several children. Measure whether answers to procedure questions become complete (for example, the share judged complete by a reviewer on a labelled set).
Check yourself
Check: what changes, what it costs
(a) A chat assistant gets many messages like “thanks” and “hello” next to real policy questions, and a fixed top-k pipeline retrieves five passages for every message. What does Self-RAG’s on-demand retrieval change, and what is the price? (b) A teammate says: “Agentic RAG is just advanced RAG with a bigger model.” What is wrong?
Answer
(a) The model decides per message whether retrieval is needed, so chit-chat skips retrieval and its tokens and latency. The price is dependence on a model trained for reflection tokens. (b) The difference is who controls the steps. Advanced RAG follows fixed stages. Agentic RAG lets a model decide whether, where and when to retrieve in a loop, bringing variable latency and cost and the need for step limits and tracing.
Summary
Recap
- Simplest thing that meets the bar, measure, add complexity for a named failure.
- Advanced RAG is the usual baseline; modular and agentic add flexibility at a cost.
- HyDE: phrasing gap. Parent-child: missing context. GraphRAG: corpus-wide. Corrective: bad retrieval. Adaptive: mixed difficulty. Self-RAG: needs a trained model.
- In an interview: failure, variant, cost, risk, metric.
References
References & Sources (1 of 2)
Retrieval-Augmented Generation for Large Language Models: A Survey (opens in a new tab)
Yunfan Gao, Yun Xiong, Xinyu Gao, Kangxiang Jia, et al.2023Preprint
arXiv 2312.10997 (opens in a new tab)https://arxiv.org/abs/2312.10997
Used for The review of RAG work organises it into Naive RAG, Advanced RAG and Modular RAG paradigms.
Precise Zero-Shot Dense Retrieval without Relevance Labels (opens in a new tab)
Luyu Gao, Xueguang Ma, Jimmy Lin, Jamie Callan2023ACL 2023Paper
arXiv 2212.10496 (opens in a new tab)https://arxiv.org/abs/2212.10496
Used for HyDE has an instruction-following model write a hypothetical document, embeds it, and retrieves real documents near it; the generated text is unreal and may contain false details.
From Local to Global: A Graph RAG Approach to Query-Focused Summarization (opens in a new tab)
Darren Edge, Ha Trinh, Newman Cheng, Joshua Bradley, et al.2024Preprint
arXiv 2404.16130 (opens in a new tab)https://arxiv.org/abs/2404.16130
Used for Graph RAG builds an entity knowledge graph with an LLM, pregenerates community summaries, and answers global questions by combining partial answers from them.
microsoft/graphrag (opens in a new tab)
Microsoft2026Repository
https://github.com/microsoft/graphrag
Used for The README warns that GraphRAG indexing can be an expensive operation.
Corrective Retrieval Augmented Generation (opens in a new tab)
Shi-Qi Yan, Jia-Chen Gu, Yun Zhu, Zhen-Hua Ling2024Preprint
arXiv 2401.15884 (opens in a new tab)https://arxiv.org/abs/2401.15884
Used for Corrective RAG uses a lightweight retrieval evaluator whose confidence triggers a retrieval action, with web search to extend weak results.
References
References & Sources (2 of 2)
Self-RAG: Learning to Retrieve, Generate, and Critique through Self-Reflection (opens in a new tab)
Akari Asai, Zeqiu Wu, Yizhong Wang, Avirup Sil, et al.2024ICLR 2024Paper
arXiv 2310.11511 (opens in a new tab)https://arxiv.org/abs/2310.11511
Used for Self-RAG trains a language model with reflection tokens that decide when to retrieve and critique passages and its own output.
Soyeong Jeong, Jinheon Baek, Sukmin Cho, Sung Ju Hwang, et al.2024NAACL 2024Paper
arXiv 2403.14403 (opens in a new tab)https://arxiv.org/abs/2403.14403
Used for Adaptive-RAG uses a smaller language model to classify query complexity and choose among no retrieval, single-step and iterative retrieval.
Keys: ← → move, Home End first and last, F full screen.