AI EngineeringInterview preparation
Intermediate·Concept·2 min read

Corrective RAG, self-reflective RAG, and context compression

Practice this question

Overview

  • Corrective RAG detects inadequate retrieval and applies a correction, such as reformulating search.
  • Self-reflective RAG checks whether evidence or an answer is sufficient and supported.
  • Context compression reduces retrieved text to the parts useful for the current question.

Why this matters

First retrieval may be weak, and bulky evidence can distract the model or exceed budgets.

An everyday example

An employee checks whether the selected page actually answers the question, tries another page once, and highlights relevant lines.

A technical example

If required clause IDs are absent, run one alternative search; preserve exact evidence excerpts rather than summarizing away exceptions.

How it works

  1. Retrieve
  2. Check coverage/support
  3. Apply one bounded correction
  4. Select or compress evidence
  5. Answer
  6. Validate support
  7. Abstain if still insufficient.

Architecture and flow

Retrieve → evidence check → corrective branch → compressed evidence → answer check.

The insurance assistant example

A coverage response fails if it cites a brochure instead of the policy; the workflow retrieves policy wording or escalates.

When to use it

When evaluations show recoverable retrieval failures or context clutter.

When to avoid it

Do not trust model self-approval as proof of correctness or allow compression to remove monetary limits and exceptions.

Interview answer

“These patterns add bounded evidence and answer checks. I measure whether they improve outcomes and use abstention when correction cannot find support.”

Benefits, trade-offs, and production considerations

  • Critic models can repeat the original model's mistake.
  • Prefer extractive compression where possible, preserve source offsets, and independently test the checker's false acceptance rate.
Adapted from 13_AI.MD · “Corrective RAG, self-reflective RAG, and context compression”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.