22.1 Corrective RAG (CRAG)
Query → Retrieve → Evaluate Relevance → ┌─ Relevant → Generate answer
├─ Ambiguous → Refine query, re-retrieve
└─ Irrelevant → Web search fallback
A “knowledge refiner” step evaluates document relevance after retrieval; if documents are irrelevant, the system triggers a web search or alternative retrieval path rather than generating from bad context — a self-correcting loop.
22.2 Self-RAG
The model itself decides when and whether to retrieve, and self-evaluates its own output:
Query → LLM decides: ┌─ "I can answer this directly" → Generate
└─ "I need more information" → Retrieve → Generate
↓
Self-evaluate: "Is my answer supported by the context?"
↓
┌─ Yes → Return answer
└─ No → Retrieve more or say "I don't know"
The model generates special critique tokens alongside its output indicating relevance, support, and utility of retrieved passages — giving transparency into its own retrieval decisions.
22.3 Graph RAG
Documents → Extract entities & relationships → Build Knowledge Graph
│
Query → Entity extraction → Graph traversal → Retrieve subgraph
│
└── Generate answer using subgraph context (merged with vector-retrieved chunks)
When Graph RAG wins:
- Multi-hop questions: “Who is the manager of the team that launched Project X?”
- Relationship queries: “What products are related to this component?”
- Cross-entity aggregate questions: “Which payers have the highest denial rate for CPT 99213, and what are the common reasons?” — requires traversing code → payer → denial-reason → appeal-strategy relationships that a flat vector search cannot connect.
When standard vector RAG is sufficient: simple factual lookups, single-document summarization, content retrieval without relationship reasoning.
22.4 Agentic RAG
The retrieval process itself becomes agentic — the agent decides WHAT to search, WHERE to search, and WHEN to stop:
Query → Agent Plan: ┌─ "Search internal KB for policy documents"
├─ "Search Confluence for process docs"
├─ "Query SQL database for metrics"
└─ "Search email archive for recent updates"
↓
Agent evaluates results
↓
┌─ Sufficient → Generate answer
└─ Insufficient → Reformulate and search again
22.5 Modular RAG Architecture
┌────────────────────────────────────────────────┐
│ Query Router │
│ (Routes to appropriate retrieval strategy) │
└──────┬──────────┬──────────┬──────────┬────────┘
│ │ │ │
┌────▼────┐ ┌──▼─────┐ ┌─▼──────┐ ┌▼────────┐
│Vector │ │Knowledge│ │SQL/API │ │Web │
│Search │ │Graph │ │Query │ │Search │
└────┬────┘ └──┬─────┘ └─┬──────┘ └┬────────┘
│ │ │ │
└──────────┼──────────┼─────────┘
▼
┌──────────────┐
│ Result Merger │
│ + Re-Ranker │
└──────┬───────┘
▼
┌──────────────┐
│ LLM Generator│
│ + Citations │
└──────────────┘
Section 22 — Interview Q&A
Q: Compare CRAG, Self-RAG, Graph RAG, and Agentic RAG — when would you reach for each? A: CRAG adds a relevance-evaluation gate after retrieval and falls back to web search or query refinement when retrieved documents don’t actually support the query — good for corpora with known coverage gaps where you want a safety net rather than a confident wrong answer. Self-RAG pushes the retrieve/don’t-retrieve and the faithfulness-check decisions into the model itself via learned critique tokens — useful when you want the system to skip retrieval for questions it can answer directly (saving latency/cost) while still self-verifying grounding on questions where it does retrieve. Graph RAG is the right choice specifically for multi-hop and relationship-heavy questions (“what’s connected to X, and what connects to that”) that flat vector similarity structurally cannot answer, since it requires traversing explicit relationships rather than finding semantically similar text. Agentic RAG generalizes furthest — the agent plans which sources to query (vector DB, SQL, web, multiple collections) and iterates until it judges the evidence sufficient — the right choice when the information need spans heterogeneous sources and a single retrieval pass structurally can’t cover it, at the cost of higher latency and less predictability than the other patterns.
Q: What’s the difference between Graph RAG and standard vector RAG, concretely? A: Standard vector RAG treats chunks as independent units and retrieves based on semantic similarity to the query — good for “find me relevant paragraphs.” Graph RAG first processes documents into a knowledge graph of entities and relationships, then at query time traverses the graph to find connected information — good for “find me all things related to X and how they connect.” A query like “what changed between version A and version B” or “who is affected if service X goes down” needs the graph’s explicit relationship structure; a query like “what is the return policy” is a simple content lookup where standard RAG is both sufficient and cheaper.