Patterns
๐Ÿ”ง

Corrective RAG (CRAG)(CRAG)

RAG system that automatically detects and corrects poor retrieval results through quality assessment and re-retrieval

Complexity: highKnowledge Retrieval (RAG)

๐ŸŽฏ 30-Second Overview

Pattern: Enhanced RAG with explicit retrieval quality evaluation and corrective actions based on confidence scoring

Why: Reduces hallucinations and improves accuracy through quality assessment and adaptive correction strategies

Key Insight: Three-tier correction strategy: refine high-confidence, supplement medium-confidence, re-retrieve low-confidence results

โšก Quick Implementation

1Initial Retrieval:Retrieve candidate documents using dense/sparse/hybrid search
2Quality Assessment:Evaluate retrieval quality with confidence scoring (high/medium/low)
3Corrective Action:Refine, supplement, or re-retrieve based on confidence band
4Knowledge Refinement:Decompose and recompose evidence for optimal context
5Generate & Verify:Generate response with citations and optional verification
Example: query โ†’ retrieve โ†’ evaluate_quality โ†’ [correct/supplement/re-retrieve] โ†’ refine โ†’ generate

๐Ÿ“‹ Do's & Don'ts

โœ…Implement explicit retrieval quality evaluator with calibrated confidence thresholds
โœ…Use knowledge refinement with decompose-then-recompose for evidence processing
โœ…Apply web search supplementation for medium confidence retrieval results
โœ…Enforce strict citation requirements with provenance tracking
โœ…Cache evaluator outputs and refined knowledge for efficiency
โŒAllow evaluator miscalibration without regular confidence score validation
โŒSkip query drift prevention during corrective re-retrieval
โŒCreate unbounded correction loops without cost and latency controls
โŒMix outdated and fresh sources without temporal reconciliation
โŒNeglect abstention mechanisms when confidence remains persistently low

๐Ÿšฆ When to Use

Use When

  • โ€ข High-stakes applications requiring verified accuracy and provenance
  • โ€ข Rapidly changing domains with frequent content updates
  • โ€ข Noisy or heterogeneous knowledge bases with quality variation
  • โ€ข Long-tail queries where initial retrieval often fails
  • โ€ข Regulated environments requiring explicit evidence grounding

Avoid When

  • โ€ข Real-time applications with strict latency requirements
  • โ€ข Closed-book tasks where parametric knowledge suffices
  • โ€ข High-quality homogeneous corpora with consistent recall
  • โ€ข Environments prohibiting external web access for supplementation
  • โ€ข Simple factual queries with reliable standard RAG performance

๐Ÿ“Š Key Metrics

Answer Faithfulness
Factual correctness and groundedness in retrieved evidence
Evaluator Calibration
Accuracy of quality confidence predictions (ROC-AUC, ECE)
Correction Effectiveness
Quality improvement from corrective actions
Retrieval Precision
Relevance of documents after correction
Citation Coverage
Percentage of claims supported by evidence
Action Distribution
Balance of use/supplement/re-retrieve decisions

๐Ÿ’ก Top Use Cases

Legal Research: Case law analysis requiring verified sources and temporal accuracy
Medical Q&A: Clinical decision support with evidence-based recommendations and safety checks
Financial Analysis: Market research combining real-time data with historical knowledge
Policy Research: Government and regulatory information requiring up-to-date accuracy
Technical Documentation: Software and API documentation with version-specific corrections

References & Further Reading

Deepen your understanding with these curated resources

Contribute to this collection

Know a great resource? Submit a pull request to add it.

Contribute

Patterns

closed

Loading...

Built by Kortexya