Log inStart free
LESSON 22.17 · 5 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Agentic and corrective RAG

Watch a grader check retrieved text, and an agent search again until it can answer.


Pro lesson. Stage 1 is free to watch. Pro opens all 5 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 22.17 · RETRIEVAL BAYPLAIN RAG · TOP 2: D3, D2 · ANSWER WRONG
01
Stage 1 of 5 · Plain RAG
Plain RAG sends the top 2 docs to the generator unchecked. It answers Team Heron, which is wrong.
Explain it simply

The wiki holds 8 short documents. A keyword search scores each one, and the bars show the scores. Plain RAG hands the two best documents to the generator, even when they are off topic. Nothing checks them first.

The keyword search picks D3 and D2. The plain answer is Team Heron.

question and queryscores, grades, answergrader cutsdropped strip, wrong answer
D1Photo uploads are stored by the Atlas service.Atlas runs in two regions with daily backups.0.87D2Team Kestrel owns the Atlas service.Kestrel meets every Tuesday in the north room.2.92D3Team Heron owns the billing service.Heron also runs the status page.3.19D4Login sessions expire after 30 days.A new device asks for a code.0.00D5Photos over 20 MB hit the upload size cap.The cap was raised in May.0.00D6The office picture wall shows past teams.It hangs near the kitchen.2.88D7Invoices are sent on the first of each month.They come as PDF files.0.00D8Passwords reset from the login page.The reset link lasts one hour.0.00the wiki: 8 docs, 2 strips eachkeyword scoreR1team owns service keeps picturesD3.1D3.2D2.1D2.2context: the top 2 docs, unchecked (4 strips)D3.1 Team Heron owns the billing service.D3.2 Heron also runs the status page.D2.1 Team Kestrel owns the Atlas service.D2.2 Kestrel meets every Tuesday in the north room.plain RAG answerTeam Heronwrongthe questionWhich team owns the service that keeps pictures?D1Photo uploads are stored by the Atlas service.Atlas runs in two regions with daily backups.0.87D2Team Kestrel owns the Atlas service.Kestrel meets every Tuesday in the north room.2.92D3Team Heron owns the billing service.Heron also runs the status page.3.19D4Login sessions expire after 30 days.A new device asks for a code.0.00D5Photos over 20 MB hit the upload size cap.The cap was raised in May.0.00D6The office picture wall shows past teams.It hangs near the kitchen.2.88D7Invoices are sent on the first of each month.They come as PDF files.0.00D8Passwords reset from the login page.The reset link lasts one hour.0.00the wiki: 8 docs, 2 strips eachkeyword scoreR1team owns service keeps picturesD3.1D3.2D2.1D2.2context: the top 2 docs, unchecked (4 strips)D3.1 Team Heron owns the billing service.D3.2 Heron also runs the status page.D2.1 Team Kestrel owns the Atlas service.D2.2 Kestrel meets every Tuesday in the north room.plain RAG answerTeam Heronwrongthe questionWhich team owns the service that keeps pictures?
Toy: 8 docs, 4 questions; a synonym table stands in for the models
STAGE 1 / 5
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
s(D)=∑t∈qidf(t) tf(t,D) (k1+1)tf(t,D)+k1 (1−b+b ∣D∣/avgdl)\sy{s}{out}{s(D)} = \sum_{t \in \sy{q}{data}{q}} \mathrm{idf}(t)\,\frac{\mathrm{tf}(t,D)\,(k_1+1)}{\mathrm{tf}(t,D) + k_1\,(1 - b + b\,|D|/\mathrm{avgdl})}
s(D3)=3.19, s(D2)=2.92s(D_{3}) = 3.19,\ s(D_{2}) = 2.92

A document scores high when it holds rare query words.

Common mix-ups

MYTHA looser grader only saves a search round.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01With the two-hop question, cuts 0.4 / 0.8 and 1 agent round, what does the agent say?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 5
Unlock the full explainer
  • 4 more stages and 3 live controls
  • 2 mix-up cards and 3 predict-then-reveal checks
  • Watch it as a narrated video, in three voices
  • Every Pro lesson and capstone · 656 in total

$99 a year, or $15 a month. Cancel any time.