RAG, measured

Measure it

Every number in this course comes from a check that called each answer right or wrong. Change the check and the number moves, even when the answers stay the same.

How an answer gets its verdict

Answerthe model's wordsCode checkbare-number referencesLLM judgeeverything elseVerdictright or wrongAnswerthe model's wordsCode checkbare-number referencesLLM judgeeverything elseVerdictright or wrong
When the reference is a bare number, code compares the figures. Everything else goes to an LLM judge.

Three judges, the same answers

JudgeHow it decidesRight answers, 5 passagesRight answers, every right pageGain of the planning step
First promptAn LLM, told that rounding is fine45.3%74.0%+12.7 points
Prompt with a 1% toleranceThe same LLM, told to accept 1%43.3%72.7%+11.3 points
Numbers in codeCode checks bare numbers, within 1% or at the reference's precision; the LLM judges the rest46.7%75.3%+14.7 points
FinanceBench: the same 900 answers by Qwen3-8B (150 questions in six settings), judged three ways. The LLM judge is Gemini Flash-Lite.

Five right answers marked wrong

Every right page was in the context, and each answer gives the reference figure, rounded or written another way. The first judge failed all five.

QuestionReferenceThe answerFirst judgeTold 1%Code
Amazon, days payable, FY201793.8693.85WrongWrongRight
General Mills, free cash flow, FY2020$3215.00$3,215.4 millionWrongWrongRight
Nike, inventory turnover, FY20213.463.45WrongWrongRight
3M, net property and equipment, FY2018$8.70$8.738 billionWrongRightRight
AES, return on assets, FY2022-0.02-1.53%WrongRightRight
From the runs of 4, 5 and 6 October 2026: the model's real figures and each judge's verdict.

Told to accept 1%, the judge still failed 93.85 for 93.86, a gap of 0.01%, and gave its reason: the difference falls outside the acceptable rounding tolerance. A small judge model repeats the rule and does not do the arithmetic.

One run is not a measurement

6 points

I let the model think on the questions it failed, with as many right answers as a control, and projected the result over all 150 questions under each judge: about 82%, then 76%, then 82% again, from the same answers. Three verdicts on the controls moved it 6 points.

FinanceBench, Qwen3-8B with every right page; 37 to 41 failures and as many controls per judge. A projection, not a result: I stopped projecting and measured all 150 questions (lesson 7).

Three rules came out of it. Compare numbers in code, not in a prompt. After any change to a judge, count the verdicts that moved in both directions: a change of wording moved 21 of 900. And a tolerance is a decision: 4 verdicts here hang on the 1% itself.

One question to ask your team

When the score moves, do we know whether the assistant changed or the check did?
For engineers

The settings behind the lesson.

  • Code check: when the reference is a bare number (51 of 150 questions), the result is read from the answer's first sentence and its last sentence holding a figure. Right within 1%, or equal once rounded to the reference's precision. Percent against ratio, and thousands, millions or billions, are tried. When the code cannot decide, the LLM judges.
  • Against the code, the LLM judge failed 21 of 354 numeric answers that were right (5.9%), and never passed one the code fails. The size of the gap did not matter: it failed 0.01% and passed 1.6%.
  • Limits of the rule: unit words are not read, so “$5,466.312 billion” passes for 5,466 in millions (2 answers). The 99 prose references are still judged by the LLM alone.
  • Differences under about 3 points between two judge prompts are not findings: a change of wording moved 2.3% of verdicts, 12 of the 21 not about a number.
  • Cost: one free Gemini project runs about 500 judge calls a day; the code check makes no call.