Part III · Building and operating AI/Chapter 14 of 20/8 min read

Evaluating an AI Product

How to define quality, build representative evaluation sets, inspect agent traces, avoid grader bias and use evals to make real release decisions.

An AI component is tested against representative cases before a release control.
An AI component is tested against representative cases before a release control.Plate 14
On this page8 sections
  1. 01Start from the failure you cannot afford
  2. 02Build datasets from real work, not clean fantasies
  3. 03Choose grading methods that match the check
  4. 04Work through a real rubric refinement
  5. 05Inspect the trajectory as well as the final output
  6. 06Read sliced results, never aggregate averages
  7. 07Wire production traces back into the eval suite
  8. 08Try it: draft and calibrate your first eval cases

Five clean demo runs prove nothing about a probabilistic product. Before exposing real users to an AI workflow, a team needs to know what happens on malformed inputs, missing fields, conflicting sources and requests the system should refuse outright.

An evaluation (eval) is a repeatable test harness for asking those questions. It combines representative cases, an explicit quality rubric, a grading method and a versioned record of results. Your first eval does not need elaborate tooling: twenty real cases in a spreadsheet graded by a PM and a domain expert beat waiting two months for an automated platform. Its job is to inform a product decision, not produce an impressive vanity score.

Start from the failure you cannot afford

Before collecting test cases, write down the exact decision the eval must settle: are you validating basic feasibility, comparing two model providers, gating a prompt change in CI or checking whether an exception path is safe for a bounded pilot?

Anchor the rubric on the task's actual failure modes with a domain specialist in the room. For an invoice-preparation tool that extracts fields for finance review (with payment approval staying human), quality is not just "accurate extraction." It means returning the right supplier and total, pointing to the exact source passage, and explicitly flagging arithmetic mismatches or missing tax fields instead of smoothing them over.

Build datasets from real work, not clean fantasies

Curate test cases from four sources:

  1. Ordinary production work reflecting real formatting messiness, varied phrasing and segment mix.
  2. Known failures and incidents captured from internal dogfooding, shadow runs and customer corrections.
  3. Domain-expert edge cases targeting subtle rules that trip up newcomers.
  4. Abstention and adversarial cases where the only passing behaviour is to ask for clarification, decline, refuse untrusted instructions or escalate cleanly.

Use synthetic data carefully. Generating 200 synthetic test cases with an LLM helps stress-test formatting variations, yet synthetic inputs inherit the model's own blind spots and rarely match real-world messiness. Always verify synthetic cases with a domain expert and replace them with permitted production examples as soon as live traces arrive.

Split your suite into two distinct sets so you stop fooling yourself:

  • Regression set: Core behaviours and past bugs that must stay green on every prompt, context or model change.
  • Capability / holdout set: Harder cases and unseen examples held out from active prompt tuning so you measure real generalisation rather than overfitting to familiar tests.

Choose grading methods that match the check

No single grader covers every dimension of quality. Combine three layers:

Grader typeBest used forMain blind spot
Deterministic code checkJSON schema validity, arithmetic totals, tool permissions, citation link presence, latency and token capsCannot evaluate open-ended tone, nuance or semantic accuracy
Human expert reviewDefining the initial rubric, grading ambiguous edge cases, auditing production samples and calibrating automated gradersSlow, expensive and subject to inter-reviewer disagreement when rubrics are vague
LLM-as-a-judge (model grader)Scaling rubric grading across hundreds of open-ended outputs in CISystematic biases: position bias (favouring the first option in pairwise comparisons), verbosity bias (rewarding longer answers) and self-preference (a model scoring its own family higher)

Keep LLM judges honest by grading binary pass/fail criteria rather than vague 1–5 scales, shuffling pairwise order, supplying reference evidence in the judge prompt and checking agreement against human expert labels regularly. Whenever two human reviewers disagree on a case, treat the disagreement as gold: either the rubric is underspecified or the underlying business rule is genuinely ambiguous. Fix the rule before trusting any automated score.

Work through a real rubric refinement

Take an internal invoice-preparation workflow where the system extracts fields and flags exceptions for a finance reviewer.

  • Case 1 (ordinary): Clear supplier, invoice number and total matching the line items. A deterministic check verifies the extracted dollar figure against the labelled ground truth; a reviewer confirms the source highlight points to the right line.
  • Case 2 (discrepancy): The printed invoice total reads $110, while the line items sum to $100. The system extracts $110 accurately with the right source link, yet fails to flag the mismatch.

When two reviewers grade Case 2, one marks it Pass (the printed figure was copied accurately) and the other marks it Fail (the workflow hid a $10 error the finance team exists to catch).

Both reviewers noticed something real, which exposes a broken rubric. The fix is to split the rubric into two independent binary checks: field_extraction_accurate (Pass) and discrepancy_flagged (Fail). The finance specialist confirms missed discrepancies are unacceptable for automated routing, so the team fixes the check, adds this case plus missing-tax and partial-line-item variants to its regression suite, and keeps conflicting-total invoices on the manual path until retested.

Inspect the trajectory as well as the final output

Separate inspection stations evaluate an AI system's execution trace and final outcome.

For single-call tasks, grading the final output is enough. For agents that retrieve documents and call tools, grading only the final answer hides dangerous behaviour: an agent can arrive at a correct reply after reading a restricted record, burning six redundant API calls or attempting a forbidden write that happened to fail.

Grade final state and execution trace separately. On the trace, check tool selection accuracy, permission adherence, retry discipline, recovery from simulated tool timeouts, escalation triggers, latency and total token cost. (Security-specific adversarial and prompt-injection tests sit in Agent Security Boundaries.)

Read sliced results, never aggregate averages

An overall pass rate hides catastrophic slices. Suppose a team compares two versions across 50 deliberately selected test invoices (45 routine cases and 5 conflicting-total exceptions):

SliceVersion AVersion B
Routine invoices passed45 / 45 (100%)45 / 45 (100%)
Conflicting-total exceptions flagged0 / 5 (0%)3 / 5 (60%)
Combined total45 / 50 (90%)48 / 50 (96%)

Looking only at "96% accuracy" makes Version B look ready to ship. Reading the slices reveals it still misses 40% of financial discrepancies, and five test exceptions is far too small a sample to trust for unsupervised automation.

Interactive comparison

Why aggregate pass rates hide release blockers

Toggle between the executive summary and the sliced failure reality for Version B across 50 invoices.

Routine invoices (45 cases)45 / 45 (100%) · pass^3: 100%
Conflicting-total exceptions (5 cases)3 / 5 (60%) · pass^3: 21.6%

On 3 repeated trials, a 60% single-pass rate on financial discrepancies delivers only 21.6% consistent pass-all reliability (versus 88.5% aggregate). Keep conflicting totals manual until fixed.

Because models vary across runs, run high-stakes slices multiple times (e.g. 3–5 trials per case) and track pass-all consistency (pass^k) rather than celebrating a single lucky pass. Set release thresholds before viewing results, grounded in the real consequence of failure and human review capacity: 92% might be plenty for an internal draft helper while 99% is still unsafe for an autonomous account update.

Wire production traces back into the eval suite

An eval suite built before launch goes stale within weeks of shipping. Real users phrase requests differently, upstream policies evolve and unexpected edge cases appear immediately.

Close the loop with a weekly trace-to-eval ritual:

  1. Pull a stratified sample of production traces (failed runs, user-edited outputs, escalations and a random slice of apparently clean runs).
  2. Inspect failures with the PM, engineer and domain expert to separate context bugs, tool failures and true model gaps.
  3. Scrub sensitive data, verify the ground-truth label and promote the sharpest new failure modes straight into the regression set.
  4. Prune obsolete cases so the suite stays fast, legible and owned rather than bloating into a slow museum nobody trusts.

Try it: draft and calibrate your first eval cases

Use this prompt to generate a starting set of candidate cases for a workflow you own, then calibrate them immediately with a domain expert.

Prompt template
Draft an initial set of 12 evaluation cases for this AI workflow.

Workflow and user: [describe who uses it and the job to be done]
Allowed reads and actions: [list actual permissions]
Quality standard: [what makes an output genuinely useful]
Costliest failure modes: [what must never slip through]
Permitted rules or sample inputs: [paste or summarise]

Include:
- 5 ordinary cases covering common variations
- 4 difficult exception cases (missing data, conflicting rules, messy formatting)
- 3 abstention/escalation cases where the system must ask, refuse or hand off

For each case, output: input, required context, binary pass/fail rubric checks,
the reason it is included and the best grading method (deterministic code, human or LLM judge).
Flag any expected answer that requires domain-expert sign-off. Label all generated cases as synthetic.

Take two generated cases and one real output to a domain specialist. Grade the output independently, compare where you disagreed and sharpen the rubric until both of you grade identically. Replace the synthetic placeholders with real permitted examples as soon as your first pilot runs.

Handbook v4.0 · Ch. 14Updated Nov 2026