← All questions
RAGHard· Advanced RAG Patterns

What is CRAG (Corrective RAG), and how does it improve...

Standard RAG has no way to notice when retrieval failed — it hands whatever came back to the generator and trusts it. CRAG adds a grading step in between: a lightweight evaluator scores each retrieved document as correct, ambiguous, or incorrect relative to the query.

What happens next depends on the grade. Correct documents flow straight through to generation. Ambiguous ones get decomposed into smaller knowledge strips so the useful fragments can be kept and the noise dropped. Incorrect ones are discarded outright, and the system falls back to a web search rather than forcing an answer from bad context.

The part worth calling out unprompted is the fallback path — it’s what makes CRAG genuinely corrective rather than just an extra filter. When the internal knowledge base simply doesn’t have the answer, CRAG has a defined next move instead of hallucinating from irrelevant chunks, which matters especially for queries about things outside the indexed corpus.

Code playground (Python)