Retrieval & RAG

CRAG

Add a lightweight retrieval evaluator that grades each retrieved document and triggers corrective web search on poor retrievals.

Problem

A naive retrieve-then-generate pipeline passes every retrieval — good or bad — straight into the generator without judging it. When the retrieval is poor, the generator either ignores it and falls back to parametric knowledge that may itself be wrong, or it incorporates it and produces an answer corrupted by irrelevant chunks. Either way, the user sees no signal that the retrieval was weak, and the system has no correction step that could fall back to a web search, refine the query, or refuse to answer when the evidence is insufficient.

Solution

After retrieval, a lightweight evaluator (T5-based or similar) grades each document as Correct, Ambiguous, or Incorrect. Correct documents go forward as-is. Ambiguous documents trigger a web search for additional evidence. Incorrect documents are discarded and replaced via web search. The generator receives the corrected document set.

When to use

  • Naive RAG passes bad retrievals through to the generator and corrupts outputs.
  • A lightweight evaluator (e.g. T5-class) can grade documents as Correct, Ambiguous, or Incorrect cheaply.
  • Web search is available as a corrective fallback for ambiguous or incorrect retrievals.

Open the full interactive page

Diagram, neighbourhood map, code examples, related patterns and full provenance.

Related