Page 1 of 8~112 min topic

Eval metrics lab

Define the lab goal and success criteria

Ship a falsifiable slice of **offline+online eval harness for grounded support answers** — success is candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10%, not a polished screenshot.

~14 min this pageLab goal

1Try it yourself

Decision drill

Eval metrics lab

Match alerts to golden signals — latency, errors, quality, saturation.

Observability fit68%

1/3p95 latency doubled.

2Learn the idea

Read

Name the operable slice

This lab builds offline+online eval harness for grounded support answers. The human in the loop is ML engineer gating a prompt change before Friday release. Scope is intentionally narrower than “make AI reliable”: you will prove one oracle — candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10% — and one invariant — release needs groundedness ≥ 0.88 and latency p95 ≤ 2.0s on fixed gold set v12. Record non-goals in your notes so a later change cannot silently expand authority. The incident mnemonic for the chapter is EVAL-LEAK-308; design as if that ticket is already written and you are filling evidence.

Read

Write the acceptance contract

Turn the oracle into a table: input fixture, expected observable, prohibited side effect, owner, latency/cost ceiling. Separate model taste from software correctness — transport, auth, parsing, and termination must be deterministic even when generated text varies. Primary metric family: groundedness, citation_precision, p95_latency_ms. Averages without a denominator or revision label do not gate release. Fake external dependencies in unit tests; live calls wait until fakes pass.

Read

Implementation artifact

GATES = {"groundedness": 0.88, "citation_precision": 0.90, "p95_ms": 2000}

Read

Freeze the first red test

Before implementation, encode a failing check that would have caught eval set leaked into few-shot examples — scores look perfect, prod drops. That failure is the pedagogical north star for later pages: contracts reject it, happy path never performs it, validation asserts it, failure-handling contains it, observability detects it, security-ops prevents privilege tricks around it, and mastery replays it in a drill. Endpoint under study: python -m eval.run --gold v12.

Read

Stage depth

Capacity note for planners: estimate peak demand on python -m eval.run --gold v12 and the cost ceiling for a failed retry storm. Write the abort conditions — unbounded spend, cross-tenant leakage, or inability to roll back — before you enjoy the first green test. Prefer synthetic fixtures shaped like production over anonymized production dumps you cannot share in class. When you are tempted to widen scope, re-read the oracle (candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10%) and cut features that do not serve it. The teaching outcome is judgment under constraints: ML engineer gating a prompt change before Friday release gets a trustworthy control, not a kitchen-sink framework. Keep the language of release decisions: promote, hold, or roll back — never “see if it gets better.”

Read

Field notes for `eval-metrics-lab` / `lab-goal`

Decide what will live in version control on day one: fixtures, contract markdown, and a failing test name. Write the cost ceiling as a hard number with currency and period. If the lab involves clusters, name the non-prod context you will use and forbid prod kubecontexts in scripts. Capture the baseline metric once before changing code so later gains are comparative. Refuse tools that hide the request path behind magic macros until the oracle is green on fakes. Your README section for this page should be five lines or fewer and still falsifiable. In this chapter the product is offline+online eval harness for grounded support answers, the human stakeholder is ML engineer gating a prompt change before Friday release, and the incident id you design against is EVAL-LEAK-308. Re-state the oracle in your notes — candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10% — and keep the invariant visible: release needs groundedness ≥ 0.88 and latency p95 ≤ 2.0s on fixed gold set v12. Track groundedness, citation_precision, p95_latency_ms as the scoreboard. Surface under change control: python -m eval.run --gold v12.

Go deeper

Before you start

Why this matters

Write the single done-definition a reviewer would accept for Eval metrics lab (EVAL-LEAK-308). Include the numeric gate hidden in this oracle: candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10%. Then name the fake success you refuse: a demo that ignores eval set leaked into few-shot examples — scores look perfect, prod drops. Keep the sentence beside your editor; every later page should make this sentence easier to prove.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Is the oracle (candidate prompt beats baseline on groundedness by ≥ 0.03 without latency regression > 10%) falsifiable from a fixture?
2. Is the invariant (release needs groundedness ≥ 0.88 and latency p95 ≤ 2.0s on fixed gold set v12) stated without hand-waving?
3. Does the contract name EVAL-LEAK-308 as a risk you design against?

All responses are required.