Chapter 15 of 16: Measure the outcome

How do we know it helped?

Arun MalikSeriesAIFoundations
Table of Contents
Builds on chapter 14. Specific dependencies are in the concept map.

Our assistant produced a pleasant menu description. Did it use the current recipe? Did it invent an ingredient? Did it quietly edit a live menu instead of saving a draft? “Sounds good” checks only a small part of the job.

Write down what success means

An evaluation, or eval, measures an AI system's behavior against defined criteria. It can examine a model answer, a sequence of actions, or the final state left by an application. An eval measures behavior; running one does not by itself train the model.

An evaluation dataset is a collection of tasks and the information needed to judge their outcomes. Include ordinary requests, missing notes, conflicting recipes, and failures of connected tools. One easy demonstration is not a representative evaluation.

An expected outcome describes what should happen for a case. For a draft-only request, the description should match the supplied recipe, a draft should exist, and the live menu should remain unchanged.

A rubric is a set of criteria for judging work that may have several acceptable answers. “Accurate ingredients, plain wording, no unsupported claims” is more useful than “good response.” Make the criteria specific enough that two reviewers can discuss a disagreement.

EvalExpected: a correct draft exists and the live menu is unchanged. Actual state and answer quality both matter.ExpectedActualCompare
Expected: a correct draft exists and the live menu is unchanged. Actual state and answer quality both matter.

Check parts and the whole

Software tests check specified behavior of code or a system. A unit test checks a small part, such as quantity validation. An integration test checks connected parts, such as an application talking to the menu service. An end-to-end test follows a user task through the full application.

Evals and tests overlap. An AI eval may use ordinary assertions, human judgments, or model-based grading. For our assistant, check both the answer and the stored draft. A correct sentence does not prove the save operation worked.

Test levelsTests can inspect a small function, connected components, or a whole user task. No single level replaces the others.End-to-endIntegrationUnit
Tests can inspect a small function, connected components, or a whole user task. No single level replaces the others.

An offline evaluation runs on prepared cases outside ordinary live use. An online evaluation studies behavior in live operation, with appropriate safeguards and consent. “Offline” need not mean disconnected from the internet; it describes the evaluation setting.

Choose a judge for the job

A model judge uses a model to grade outputs against criteria. It can help review varied wording, but can favor style over substance, share errors with the system being judged, or react to misleading content.

Compare judge decisions with human review, especially on disagreements and consequential tasks. Use exact checks for exact facts and stored state when possible. A model saying “pass” is not a substitute for checking whether a record exists.

Regression evaluation checks that changes have not broken previously working behavior. Keep development cases separate from a final held-out check, and refresh coverage as tasks change. Repeatedly optimizing to a fixed test bank can leak its answers into development.

Run more than one trial when behavior varies. Report the cases, conditions, and failures, not only the most flattering attempt.

JudgesUse code to check exact properties where possible. Calibrate model-based judgments against people, and rerun cases to detect regressions.Exact checksDid it save?JudgmentIs it clear?Compare with human review
Use code to check exact properties where possible. Calibrate model-based judgments against people, and rerun cases to detect regressions.

Two fractions that ask different questions

Precision asks what fraction of items predicted positive are actually positive. Recall asks what fraction of all actual positives were found.

Here is a made-up fruit check. Six fruits are actually apples. The sorter selects five fruits as apples: four apples and one pear. It misses two apples. Precision is 4/5 because four of its five selections are apples. Recall is 4/6 because it found four of the six apples available.

PrecisionInvented counts: four true positives, one false positive, and two false negatives. Precision and recall use different denominators.Selected as applesMissedPrecision 4/5Recall 4/6Six actual apples, five selections
Invented counts: four true positives, one false positive, and two false negatives. Precision and recall use different denominators.

The denominator is the important difference. A system that selects nothing has no positive selections, so its ordinary precision fraction divides by zero and needs an explicit reporting convention. These fractions do not describe every kind of AI quality.

Correctness is not the only test

Reliability and security checks test continued operation under failures and resistance to unauthorized behavior. Can the assistant recover from a timeout? Can one customer access another's draft? Does a malicious note redirect a tool call?

Keep these checks distinct from whether the prose is accurate. A system can write correct text while crossing a privacy boundary. Record both successes and failures so one attractive average does not hide a serious problem.

  • CorrectnessDoes the description match the authorized recipe?
  • ReliabilityDoes a timeout leave recoverable, nonduplicated state?
  • SecurityAre other customers' records inaccessible?
Separate questions deserve separate checks. A strong result in one category cannot cancel a failure in another.
The assistant says “saved,” but no draft exists. Pass?

No. The expected outcome includes persistent state, not just reassuring language. Inspect the draft store or its authoritative response, then diagnose the failed step from the trace.