Evaluate and operate / Lesson 18 of 24

Measure decision quality

Build labeled datasets and measure judgments, calibration, subgroups, abstention, and product actions.

After this moduleYou can design a held-out evaluation whose metrics match the decision's meaning and consequences.

Start with the decision, not a benchmark

Lesson 16 turned known limitations into hypotheses. This lesson tests them on the whole decision path. evaluation dataset: a versioned collection of representative states, reference labels, subgroup attributes, and expected application outcomes should mirror the product boundary. A routing row needs the state available at decision time, expected owner, evidence sufficiency, safe action, and attributes for important slices.

Build the dataset from real workflow categories where policy permits, then remove or tokenize unnecessary personal data. Add deliberately synthetic fixtures for rare but dangerous boundaries: no matching queue, conflicting evidence, prompt injection, missing account state, non-English text, and near-threshold cases. Mark every synthetic row. Split development and held-out sets before tuning questions or thresholds. If the same customer thread, template, or paraphrase appears on both sides, leakage makes the result look better than deployment reality.

Reference labels also need a process. Two reviewers can disagree because the policy is ambiguous rather than because one is careless. Give them the exact rubric and only the evidence the application would have had. Reconcile disagreements, record an insufficient_evidence outcome, and retain the reason. For consequential behavior, measure reviewer agreement and revisit the product policy before blaming the model.

type EvalRow = {
  fixtureId: string;
  state: unknown;
  expectedQueue: "billing" | "technical" | "other" | "review";
  expectedAction: "auto_route" | "human_review";
  language: string;
  accountTier: string;
  synthetic: boolean;
};
Trace this example from input to result
01

Customer choice

A support lead enables automatic routing only where measured risk is acceptable.

02

Request or event

A ticket enters the same state builder used by the evaluation runner.

03

Backend behavior

The runner stores raw distributions, applies a versioned policy, and compares both the answer and resulting action with references.

04

Customer sees

Tickets are auto-routed or held for review according to measured policy behavior.

05

Diagnostic reasoning

Reproduce a failure from the frozen state, question version, model IDs, distribution, and policy rather than rerunning a changed alias.

Measure answers and actions separately

Accuracy answers how often a chosen label matches the reference among evaluated rows. Precision asks, among cases assigned a label, how many truly belong there. Recall asks, among cases that belong there, how many the system found. These can move in opposite directions when a threshold changes. In an imbalanced queue, overall accuracy can hide that a rare urgent class is never detected.

Probability quality adds another dimension. calibration: the cohort-level relationship between predicted probabilities and observed frequencies means that, across suitable cases assigned about 0.8, the event should occur about 80 percent of the time. It is not a guarantee for one ticket.

Choice confidence and Noul probability are not interchangeable. Choice confidence summarizes concentration among supplied options. It does not say that the winner is an absolute fit. Score confidence similarly describes concentration across ordered rungs, while the expected Score is a semantic position, not an exact amount. Evaluate each primitive according to its meaning.

function brier(rows: Array<{ p: number; y: 0 | 1 }>) {
  return rows.reduce((sum, row) => sum + (row.p - row.y) ** 2, 0) / rows.length;
}

function action(row: { probability: number; hasEvidence: boolean }) {
  if (!row.hasEvidence) return "human_review";
  return row.probability >= 0.86 ? "auto_route" : "human_review"; // synthetic policy
}

All numbers in this example are synthetic and illustrative, not live Jev output or a production default.

Customer seesApplication doesJev returns
A ticket routed immediatelyChecks evidence, applies an evaluated threshold, and records the actionA typed answer and probability distribution
A ticket held for reviewUses an abstention policy tied to error cost and review capacityThe same judgment shape; review is a code decision
Applied diagnosis

Accuracy rises while customer harm rises

overall accuracy 92% · urgent-ticket recall 54% · synthetic fixture set

The aggregate looks good because ordinary tickets dominate the synthetic dataset. The urgent slice reveals the product failure. Inspect the confusion matrix by consequence, compare the state coverage for missed urgent cases, and calculate the downstream action error. A useful release gate may require both an aggregate floor and a minimum recall for this slice, with review when the floor is not met.

Choose thresholds from consequences

A threshold is policy, not a model property. List the cost of each result: wrong automatic route, unnecessary review, delayed urgent ticket, and service fallback. Estimate those costs in product terms, then test candidate policies on held-out data. A review band can reduce costly errors but creates workload. Measure abstention rate and whether the review team can absorb it during peak traffic.

Subgroups matter because aggregate calibration does not imply calibration for overlapping populations. Inspect language, ticket type, state length, missing-evidence status, customer plan, and other legitimate operational slices. Do not invent sensitive attributes solely to improve a dashboard. Require enough observations to interpret a slice, show uncertainty intervals, and avoid presenting tiny samples as stable findings.

Use temporal splits when production changes over time. A random split can distribute the same new template across training and test data; a later-time holdout asks whether the policy survives drift. After launch, join predictions with eventual outcomes such as reassignment, reviewer correction, and resolution, while recognizing that each proxy is imperfect. Human overrides may reflect new evidence unavailable at inference time.

Dig deeperCalibration can be good while discrimination is useless

A constant predictor that emits the base rate for every ticket can be calibrated in aggregate and still fail to rank useful cases. Conversely, a model can rank positives above negatives while systematically overstating probabilities. Report discrimination and calibration separately. For binary judgments, include precision-recall behavior when positives are rare, Brier or log loss, reliability bins with counts, and downstream policy outcomes. For Choices, report confusion by class, coverage after abstention, and error severity. For Scores, test rung confusion and the actual code decision built from the score.

A Brier score averages squared error between probability and a binary outcome; lower is better. Log loss penalizes confident mistakes more heavily. Reliability plots show grouped behavior, while common expected calibration error changes with binning and sample size. Report the method and sample counts rather than a naked ECE.

Make evaluation reproducible

Each run should capture dataset version, fixture identifier, safe state hash, retrieval version, exact questions, question order, requested and returned model IDs, raw answers and distributions, latency, usage, policy version, action, and reference outcome. Preserve API failures separately from semantic errors. Excluding failed calls from the denominator quietly turns reliability defects into apparent quality.

When comparing a candidate, run both systems over the same frozen inputs. Do not tune on held-out cases after seeing the result. Review disagreements by failure boundary: missing evidence, ambiguous label, model judgment, threshold, or downstream execution. Promote only after the candidate meets product gates, then use a small canary and retain rollback.

Publishing original service benchmarks may be contractually restricted. Internal measurement is still required for safe engineering, but public claims need legal and contract review. Vendor cookbook results can teach a method when clearly attributed and dated; they cannot substitute for your dataset.

Saved locally

Specify an evaluation plan

Your answers stay in this browser. Write enough that another engineer could continue the investigation.

Knowledge check

Check your understanding

Evaluate Jev as part of a versioned product decision: measure typed judgments, probability quality, abstention, subgroup behavior, and downstream actions on held-out data.

Module quiz

0/4 answered

01What does calibration at about 0.8 mean?
02Why keep a held-out set?
03Overall accuracy rises but urgent-ticket recall falls. Which result matters?
04How should API failures appear in evaluation?
Sources and verification notes 7
AI SDK evaluation documentationpublic-contract

Experimental evaluation interface. One example uses jev-latest while Gateway catalog lists jev; course uses the catalog ID.

Guo et al.: neural network calibrationhistorical

Defines and studies calibration and post-hoc temperature scaling on tested models; no Jev validation.

Dimitriadis, Gneiting and Jordan: reliability diagramshistorical

Reliability diagrams, bin instability and proper-score decomposition; general evaluation methods.

Kull et al.: beta calibrationhistorical

Post-hoc probability calibration methods and limitations; not evidence that Jev needs or benefits from a particular calibrator.

Nixon et al.: measuring calibrationhistorical

ECE depends on measurement choices and can obscure error; no Jev-specific experiments.

Hebert-Johnson et al.: multicalibrationhistorical

Aggregate calibration does not ensure calibration across relevant subgroups.

Probability and confidencepublic-contract

Distribution concentration is distinct from empirical correctness. The exact native confidence formula is not published.

Further learning

Optional references

These resources provide public documentation and examples for readers who want them.

DocsConfidencePaperOn Calibration of Modern Neural Networks