Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 19: Evaluation and Observability

Week 19 / Lesson 1

Designing representative evaluation sets

Build versioned task cases with labels, slices, and objective checks.

Section 1.1 1 of 7

Overview

Focus

Build versioned task cases with labels, slices, and objective checks.

Your route through the lesson

  • 1.2 Golden sets, provenance, and realistic negative cases
  • 1.3 Agent outcomes and tool-call accuracy
  • 1.4 Slice metrics, leakage, and failure analysis
  • 1.5 Put it into practice
  • 1.6 Guided comparison
  • 1.7 High aggregate success hiding a failed slice

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 1.2 2 of 7

Golden sets, provenance, and realistic negative cases

Focus

Construct a versioned set whose expected behavior represents both useful work and required refusals.

A golden set is a small, deliberately maintained collection of tasks with expected behavior. Golden means reviewed and versioned, not infallible. Each case needs an identifier, source provenance, permitted identity, input, expected evidence, expected actions, and a checkable outcome. Provenance records where the case came from and what permissions allow its use. Synthetic examples avoid exposing real customer data while preserving the failure mechanism.

Consider four tasks: look up a public part count, answer a question absent from the manual, request another tenant's balance, and find a fact buried in a long document. Their desired outcomes differ. The first should answer with evidence. The second should admit missing evidence. The third should be denied before retrieval. The fourth should select the correct distant passage. A benchmark containing only answerable questions rewards systems that confidently guess.

Freeze the case file as version one before changing the system. Keep tuning examples separate from reserved evaluation cases. When a label changes because the underlying policy changed, record the reason and new version; otherwise an apparent model improvement could simply be a moving answer key.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A test asks for a tenant balance without permission. Which outcome belongs in its golden label?
2. A team changes expected answers while tuning a prompt. What enables a fair comparison?
3. A manual lacks the requested warranty date. What should its case expect?

Section 1.3 3 of 7

Agent outcomes and tool-call accuracy

Focus

Separate final success from planning, selection, argument, and authorization correctness.

An agent outcome measures whether the requested work was completed within its constraints. Tool-call accuracy is narrower: did the system choose an allowed tool and supply valid arguments? A correct final answer can conceal an unsafe intermediate action. Conversely, a failed dependency can prevent a good plan from completing. Preserve both the outcome and the component checks.

Suppose the task is to read stock for part Z. The expected tool is lookup with the argument {"item":"Z"}. A prediction using lookup with {"item":"A"} passes tool selection and fails argument correctness. If the final answer happens to match Z's stock, that coincidence does not repair the incorrect lookup. Authorization is another independent check: a permitted lookup for Alice does not establish permission for Bob.

Represent results as a Python dictionary of named Boolean checks. Braces create a mapping, and each key names one property. The expression all(checks.values()) is true only when every property is true. Keep the individual values alongside that conjunction. For plans, store expected observable milestones rather than requiring one hidden reasoning transcript; several valid paths may complete the same safe task.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A request needs item Z; lookup receives item A. Which component fails?
2. A final answer is correct after an unauthorized lookup. What is the overall result?
3. Checks contain tool=True, args=False, allowed=True. What does all(checks.values()) return?

Section 1.4 4 of 7

Slice metrics, leakage, and failure analysis

Focus

Calculate slice results and use the first observable divergence to classify failures.

A slice is a subset sharing a relevant property, such as language, identity boundary, document length, or absent evidence. Report its numerator and denominator. Eight successes out of ten long-context cases means eighty percent for that slice; it does not describe short questions. A zero-case slice is unmeasured, not perfect.

Aggregate success can hide risk because common cases dominate. If ninety public requests pass and ten private-boundary cases fail, overall success is ninety percent while the security slice is zero percent. A release rule can require all unauthorized requests to be denied even when the aggregate exceeds a product target. Avoid averaging percentages from unequal slice sizes without explaining the weighting.

Failure analysis starts with the first observable divergence: wrong retrieved document, wrong tool, malformed argument, denied permission, failed effect, or unsupported final claim. Several symptoms can share one cause. Preserve a primary category and secondary symptoms rather than pretending the categories are mutually exclusive. Prevent leakage by grouping related source documents and customer identities across tuning and testing. Repeated paraphrases of the same source fact are still related evidence.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Ninety public cases pass; ten private-boundary cases fail. What is private-slice success?
2. No Spanish cases were evaluated. How should Spanish quality be reported?
3. Two paraphrases from one manual enter tuning and testing. What risk remains?

Section 1.5 5 of 7

Put it into practice

Focus

Run the supplied component scorer and interpret its deliberately incorrect fixture.

Save the downloadable week19.py in your working folder and run python week19.py --lesson 1. It uses the Python standard library, so no package installation is needed. argparse reads the command-line selection; json converts dictionaries into readable structured output. A dictionary comprehension creates one prediction record for each synthetic case. These predictions are supplied fixtures, not model-generated answers.

The lab deliberately changes the long-context case's item argument from Z to A. Read its separate checks before the overall success field. Expected invariants are three successful tasks out of four, a correct tool name on the long case, and an incorrect argument on that same case. An assert statement raises AssertionError when its condition is false; this is a failed local check, not a grade recorded by the academy.

The weekly extension adds a synthetic planning-milestone field to this same harness and one fresh unsupported request. Update the expected counts before running. Keep identifiers unique and preserve the original four cases as a baseline. This extends the evaluation artifact without creating an unrelated project or requiring written reflection.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A supplied scorer prints three successes among four fixture cases. What does it establish?
2. A new fifth case is unsupported. Which label is appropriate?
3. A local assert finds an incorrect expected count. What follows?

Section 1.6 6 of 7

Guided comparison

Focus

Explain why component evidence gives a more actionable comparison than one score.

The supplied output contains four rows because each row is a task, not a tool call. The normal lookup, missing-evidence response, and authorization denial pass their respective expected behavior. The long-context row fails only its argument check. Its answer fixture remains correct intentionally: this demonstrates why answer matching alone can reward a broken path.

A second system could score the same three of four while failing authorization instead. The aggregate ties, but release implications differ sharply. The argument failure suggests inspecting evidence selection and item extraction. The authorization failure requires repairing the trusted executor boundary before promotion. A component score helps locate work; it does not itself explain the underlying cause without traces.

When comparing versions, run the same frozen cases under both manifests, retain per-case outcomes, and report changed cases. If an index update repairs the long-context lookup while introducing an unauthorized read, calling the update an improvement would conceal a critical regression. Keep a separate release gate for security invariants and declare which checks are mandatory.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Two versions both pass 3 of 4 cases; one leaks private data. What decides release safety?
2. A long-case answer matches while its item argument is wrong. Why retain the failure?
3. An index update fixes one case and breaks denial. What should a comparison preserve?

Section 1.7 7 of 7

High aggregate success hiding a failed slice

Focus

Recognize and repair an aggregate metric that conceals a failed operational slice.

A service desk evaluates one hundred requests: ninety routine password-policy questions and ten requests from contractors for restricted incident reports. The candidate answers all routine questions and reveals eight restricted reports. Counting only useful-looking final answers gives ninety-eight apparent successes. The correct constrained evaluation counts those eight disclosures as failures, and the contractor-boundary slice passes only two of ten.

The repair begins with labels describing identity and permitted evidence, not with a new average. Each contractor case expects a denial before retrieval. Capture an executor-side retrieval counter so a superficially polite refusal after a private read still fails. Require the boundary slice to pass before release, then compare routine answer quality separately.

This transfer shows why representative means relevant to deployment decisions. Rare critical requests can deserve more evaluation coverage than their traffic share. Oversampling them is legitimate when slice counts and weighting are explicit. It becomes misleading only when the report presents the resulting aggregate as an estimate of ordinary traffic without describing how the sample was constructed.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Ten contractor cases include eight private disclosures. How many pass the boundary slice?
2. A service refuses after privately retrieving a restricted report. Which check exposes it?
3. Rare critical cases are oversampled. What makes the report interpretable?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Calibrating model-based evaluation →