AI Agentic Handbook
Evaluation & Metrics

Oracle experiment

Staff levelReviewed Oct 2026In 1 interview question

Cheat on purpose: hand one stage perfect input and see how good the answer gets. The jump tells you which stage to fix.

In plain English

When a Retrieval-Augmented Generation (RAG) system gets answers wrong, the first question is whether retrieval missed the evidence or the model fumbled it. An oracle experiment settles it by cheating deliberately: hand the model the known-correct passages from your Golden set.

If accuracy jumps, your problem is retrieval. If it barely moves, your problem is generation. Half a day of work, and it saves weeks of guessing.

Analogy

A mechanic swapping in a known-good part to see whether the car runs. If it does, you have found the broken one.

Common pitfall

Reaching for a bigger model when answers are wrong is the expensive reflex. If the oracle score sits far above production, a better model on the same retrieval buys you very little.

How it actually works

Run the same golden set under controlled substitutions: (a) closed-book, no context, measuring Parametric knowledge; (b) production retrieval; (c) oracle context: gold passages only; (d) oracle + distractors: gold passages mixed with production noise at production length; optionally (e) oracle with the reranked order, or an oracle rewritten query. Gaps localise error: (c) − (b) is the retrieval gap; 100% − (c) is the generation gap (prompt, model, reasoning); (c) − (d) is the distractor cost, which shows whether Context assembly or Lost in the middle effects matter. Liu et al. (2023) used closed-book and oracle baselines in exactly this way. The method generalises to agents: give the planner the correct tool, or the correct tool result, and see where success jumps. It requires labelled gold evidence, which is the main cost.

What I'd ship on day one

Four-arm run on the golden set every quarter and before any major investment: closed-book, production, oracle, oracle + distractors; same model, prompt and judge across arms; report gaps with paired bootstrap CIs.

Worked example

Legal research assistant, 250 golden questions with gold passages. Closed-book 41%, production retrieval 68%, oracle 89%, oracle + production distractors 83%. Retrieval gap = 21 points, generation gap = 11, distractor cost = 6. The team had planned a model upgrade (worth at most ~11 points); they spent the quarter on statute-citation-aware retrieval instead, closing the retrieval gap to 8 points.

In the interview

This answer makes you sound like you plan roadmaps, so use it: before choosing what to fix, run closed-book, production, oracle, and oracle-plus-distractors on the golden set — the gaps say whether to invest in retrieval, assembly or the model, and give leadership a ceiling for each. Expect 'what if you do not have gold passages?' Label the evidence for 100 questions first; it is a few days of work and it decides a quarter of roadmap.

Closed-book
41 % correct
Production RAG
68 % correct
Oracle + distractors
83 % correct
Oracle passages
89 % correct
Accuracy
Retrieval gap 21 points, generation gap 11, distractor cost 6: fix retrieval first
GapComputed asValueOwner
Retrievaloracle − production21Search team
Distractororacle − oracle+noise6RAG app team
Generation100 − oracle11Prompt / model
Each gap maps to a team and a ceiling on what its work can buy

Numbers worth knowing

Gold-evidence labelling
4–8 min per questiondomain-literate labeller marking supporting passages
Minimum useful set
~100–150 questionsgaps > 8 points detectable with paired tests
Run cost
4× a normal eval runfour arms, same items

How to decide

WhenDo this
Retrieval gap > generation gapInvest in retrieval: hybrid, rewriting, chunking, reranker
Oracle score itself is low (< 80%)Model, prompt or task framing problem; consider decomposition or a stronger model
Distractor cost > 5 pointsTighten context assembly: fewer chunks, better ordering

Cost maths

Labelling 150 questions × 6 min = 15 hours ≈ $900. Four arms × 150 items × ~$0.02 = $12 per run. Against one quarter of a three-person team (~$150k loaded) pointed at the wrong component, the experiment is the cheapest decision tool available.

Operating it

Time to scale up when…
  • Roadmap debate between 'better model' and 'better retrieval'
  • Production accuracy plateaued for two releases
  • New model generation available: re-run the oracle arm to see the new ceiling
What to monitor
  • Quarterly four-arm results; track each gap as a trend
  • Retrieval gap; alert if it grows > 5 points between runs (corpus or index drift)

When it goes wrong

What users saw

A team spent six weeks and a 3× cost increase migrating to a larger model; accuracy rose 2 points

How it was caught

Post-launch review asked why the gain was small; a retroactive oracle run explained it

Root cause

The oracle arm scored 91% with the old model; production was 66%. Retrieval was missing evidence in most failures, which no model can fix

Fix

Reverted to the cheaper model, invested in retrieval, and made a four-arm oracle run a required input to model-upgrade proposals

Sources

  1. Lost in the Middle: How Language Models Use Long Contexts — Liu et al., 2023paper
  2. Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks — Lewis et al., 2020paper

Check yourself

Three questions. Every option is explained once you answer.

1ConceptIn an [[oracle-experiment]], what does oracle-context score minus production score measure?
2ScenarioClosed-book 30%, production 62%, oracle 88%, oracle + distractors 85%. Leadership wants a bigger model. What do you advise?
3CalculationLabelling gold evidence for 150 questions at ~6 min each, at $60/hour. What does it cost?