AI Foundations0% complete
0%

Chapter 19 of 2525 chapters remaining

Saved on this device. Mark a chapter complete after reading.

MODULE 4 · LESSON 19 · 12 MIN

Evaluating AI Outputs: How to Know If Your System Is Working

By Siten Sanghvi · Published · Updated

Your system is working when it meets success criteria you wrote down in advance, on test cases that resemble real use, graded by methods you have checked, with enough cases to tell a real change from noise. That is evidence about one system on one task, not a guarantee. A few good demos or a public benchmark score (BT-L10) are not that evidence.

An eval (short for evaluation) is a test for an AI system: an input goes in and grading logic scores the output, as Anthropic's guide to agent evals puts it. A collection of such inputs is an eval set, and the logic that scores each result is a grader. Vendor facts below are dated 2026-11-09.

Why ordinary tests fall short

OpenAI's evaluation guide says generative models can give different output for the same input, so traditional testing is insufficient, and it warns against "vibe-based evals". (OpenAI's Evals platform is read-only and shuts down 2026-11-30; the ideas here do not depend on it.) A reply can be fluent and wrong. NIST's AI Risk Management Framework says accuracy measurements should use test sets representative of expected use, and be documented.

Step 1: define "working" for this task

Anthropic's success-criteria guide asks for criteria that are specific, measurable, achievable and relevant, and notes most use cases need several (accuracy, consistency, tone, privacy, latency, cost). Its examples, such as a minimum score on a held-out test set (cases kept out of tuning), show the form of a criterion, not a target; your users and risks set the numbers.

Typical dimensions: correct facts, required format, safe content, helpfulness and, for retrieval systems, whether the answer is grounded (supported by the retrieved documents). Report them separately. Scores of 80, 90, 60 and 85 average 78.75%, hiding that the 60 may be the one that matters.

Step 2: build a small eval set

  • Start from real material: the manual checks you already run, your bug tracker and support queue (Anthropic), and logged traffic (OpenAI). Tickets and logs can hold personal or confidential data: remove or replace personal details first (NIST lists de-identification among data-minimizing methods), limit access, and check what a judge's provider keeps (OpenAI's abuse-monitoring logs are retained up to 30 days by default, with exceptions). BT-L20 covers why logged content should be the exception.
  • Mix typical, edge and adversarial cases, such as missing input, very long input, and cases people would disagree on (Anthropic).
  • Test both directions: an eval that only checks an agent searches when it should can yield one that searches for everything (Anthropic). Include cases where it should not, and count needless refusals as well as wrong answers.
  • Write pass criteria first. Anthropic's test: two domain experts would independently reach the same verdict.
  • Keep the set stable and versioned, adding cases when users find failures. Hold some back from prompt tuning (this course's advice).

No source here sets a minimum size; Miller (Step 4) shows how to derive one from the smallest difference that matters. Anthropic says 20 to 50 tasks from real failures is a good start while each change has a large effect; mature systems need more. Vendor examples run from 50 to 10,000 cases.

Step 3: choose a grader for each criterion

Grader Strength Watch for
Code (exact match, tests, checking final state) Fast, cheap, repeatable Brittle: Anthropic describes rigid grading that penalized "96.12" against an expected "96.124991…"
Human review Quality reference; calibrates other graders Slow and costly, and people disagree: MT-Bench's experts agreed with each other on 81% of first-turn votes where both picked a winner
LLM judge Scales to open-ended output Biases, next section

LLM judges: useful, but measure yours

An LLM judge is a model given the question, the answer or answers and a rubric (written scoring rules), asked to score it or pick the better of two answers (pairwise). What the research shows:

  • It can track humans. In the MT-Bench paper (2023) GPT-4 agreed with expert humans on 85% of decided votes, versus 81% between humans (66% versus 63% when ties and order-flipped votes count). A later study of 13 judges on trivia questions found only the best aligned reasonably, up to 5 points from human scores, and that percent agreement can hide scoring differences.
  • Position bias. On near-identical answer pairs, 2023-era GPT-4 gave the same verdict after swapping the order in 65% of cases, and Claude-v1 in 24%. Another paper found reordering alone let Vicuna-13B "beat" ChatGPT on 66 of 80 queries.
  • Verbosity bias. Padding list answers with a rephrased repeat fooled Claude-v1 and GPT-3.5 in 91.3% of 23 cases and GPT-4 in 8.7%.
  • Self-preference. GPT-4, GPT-3.5 and Llama 2 favored their own summaries on two summarization tasks. MT-Bench's data could not settle it.

Practices the sources support: write a specific rubric; prefer pass/fail or pairwise comparison, which OpenAI says are more reliable; count a pairwise win only if it holds in both orders (MT-Bench); where you can, use a different model from the one that wrote the output (Anthropic calls this generally best practice), allow "Unknown" and grade each dimension separately; consider a panel of smaller, varied judges, which beat one large judge in that paper's tests. Then calibrate: have a person grade a sample you can read, compare, and recheck when the rubric, judge model or output style changes.

Step 4: compare versions against a baseline

The baseline is the current version's score on the same eval set; a change is an improvement only relative to it. Every score carries noise: cases are a sample and outputs vary. Evan Miller's Adding Error Bars to Evals treats an eval as an experiment: report the number of questions and a standard error (the typical size of sampling error), and compare models question by question. For pass/fail scores the standard error is the square root of p(1-p)/n, and a 95% interval is about 1.96 times that either side.

Worked example (illustrative). On 20 cases graded by a person, version 1 passes 14 (70%) and version 2 passes 16 (80%). The standard errors are 10.2 and 8.9 points, so the 10-point gap has a standard error of 13.6 and a 95% interval of roughly -17 to +37 points. That interval, the range of gaps this sample is consistent with, includes zero, so the data cannot separate the versions from no difference. With the same rates on 100 cases the interval is -1.9 to +21.9, still including zero; on 200 it is +1.6 to +18.4. This treats the versions as independent. Comparing them case by case (paired) is tighter when they tend to pass and fail the same cases; here it gives about the same range. Re-running the same cases mostly averages out model variation without adding new questions.

Regression testing reruns the same set after every change to a prompt, model or retrieval setting and compares the scores to the baseline; OpenAI recommends this on every change. Compare per dimension and segment, not just overall: NIST notes results may be broken down by data segment, and an average can rise while one segment falls. Anthropic expects regression evals to pass nearly everything, so a drop signals breakage.

Retrieval systems: grade two stages

A system that retrieves documents before answering (RAG, BT-L13) can fail in retrieval or generation; grade them separately.

  • Retrieval: for questions where you know the source passage, was it retrieved? A survey of RAG lists hit rate (was it in the top results), MRR and NDCG (rank-aware scores) as common metrics.
  • Generation: is the answer faithful (supported by the retrieved passages) and relevant to the question? The Ragas paper scores faithfulness as the share of the answer's statements an LLM judge finds inferable from the context. On its 50-page WikiEval set, agreement with human pairwise preferences was 0.95 for faithfulness, 0.78 for answer relevance and 0.70 for context relevance (does the retrieved text relate to the question): one small set, not typical accuracy.

Faithful does not mean correct: an answer can match an outdated passage. This course's diagnostic: wrong passage retrieved, check retrieval; right passage contradicted, check generation; faithful but wrong, check the source or question.

Agents: grade the outcome, then read the runs

An agent (BT-L15) takes many steps, so Anthropic separates the transcript (the full record of a run) from the outcome (the final state): "Your flight has been booked" is a transcript line; whether a reservation exists in the database is the outcome. It advises grading what the agent produced, not an exact tool sequence (valid paths vary), giving partial credit, and reading transcripts to confirm failures are fair.

One run proves little. pass^k is the chance that all k trials of a task succeed. At 75% per trial, three trials all succeed about 42% of the time (0.75 x 0.75 x 0.75, Anthropic's example, assuming independent trials); pass@k, the chance of at least one success, answers a different question. τ-bench, which graded by final database state, introduced the metric; BT-L15 reports its numbers. Production tracing is in BT-L20.

Try it

On paper: write pass criteria for 20 real inputs before running anything. Grade by hand, change the prompt, regrade, and compute the interval on the difference. Self-check: 14 passes against 16 of 20 is not enough to call version 2 better. A 10-to-20-prompt spot check (BT-L10) can expose big gaps, not rank versions 10 points apart.

The exhibit uses 20 synthetic cases and two made-up versions. Switch graders: with these paraphrased answers, exact match reverses the human ranking (it suits answers that are one fixed string), and a judge's verdict depends on answer order.

EXHIBIT 19 / EVALUATION

Explore the mechanism

One eval set, different graders.

See how the grader and the presentation order change the conclusion.

One eval set, different graders.1234567891011121314151617181920V1✓✓—✓✓✓—✓✓—✓✓✓—✓✓✓—✓—V2✓✓✓✓✓✓—✓✓✓✓—✓✓—✓✓✓—✓Allowed / not allowed · illustrative grid
V1 passes14 / 20
V2 passes16 / 20
V2 minus V110.0 pp
Illustrative 95% interval-16.7 to 36.7 pp

Human: difference within the illustrative interval’s noise

The interval assumes independent versions. With human labels, the paired interval at ×1 is −17.4 to +37.4 points. Exact match fits fixed answers and can miss valid variations. Repetition supplies no new evidence.

Inspect the example data and reasoning
One eval set, different graders. — current illustrative state
CaseV1V2
1PassPass
2PassPass
3FailPass
4PassPass
5PassPass
6PassPass
7FailFail
8PassPass
9PassPass
10FailPass
11PassPass
12PassFail
13PassPass
14FailPass
15PassFail
16PassPass
17PassPass
18FailPass
19PassFail
20FailPass

Synthetic fixture. Repeating cases changes the arithmetic illustration but supplies no new evidence.

Read the mechanism without interacting
Rubric
Define observable criteria and representative cases before scoring.
Dimensions
Report accuracy, grounding, format, usefulness and safety separately.
Regression
Compare the same cases; investigate weak slices rather than hiding them in one average.

Grade the same 20 synthetic cases by hand, by exact match and with a scripted judge in both answer orders.

Try explaining it: Which conclusion survives changing the grader or reversing the answer order?

The takeaway

A system is working, as far as you can show, when it meets criteria written before testing, on cases that resemble real use, graded by methods you have checked, with enough cases to see past noise. Calibrate any LLM judge, compare to a baseline with its uncertainty, rerun the set on every change, and grade retrieval, generation and agent outcomes separately. This shows how one system did on these cases, not that it will always work.

Up next

Observability and Monitoring for AI Applications: an eval set tests what you thought of; monitoring shows real traffic.

VISUAL FIELDNOTES / 19

Keep the big picture.

A one-page visual companion. Save it, print it, or explain it to someone else.

See how the grader and the presentation order change the conclusion. Synthetic fixture. Repeating cases changes the arithmetic illustration but supplies no new evidence.View the full-size sheet ↗

One eval set, different graders.

See how the grader and the presentation order change the conclusion.

One US Letter page · Vector artwork · Fits A4 when printed to fit

Read the key points as text
Rubric
Define observable criteria and representative cases before scoring.
Dimensions
Report accuracy, grounding, format, usefulness and safety separately.
Regression
Compare the same cases; investigate weak slices rather than hiding them in one average.

Remember: Define observable criteria and representative cases before scoring.

Try it: Grade the same 20 synthetic cases by hand, by exact match and with a scripted judge in both answer orders.

Recall: Which conclusion survives changing the grader or reversing the answer order?

OPTIONAL CHECK

Check your understanding.

The optional check requires JavaScript. You can continue reading the lesson.

YOUR LEARNING

Keep your place.

Your progress is saved on this device.