Let’s Get Certified
Module 09 / 14 · Evaluation, testing, and optimization

Build an evaluation that can decide a release

Turn a business outcome into a test suite, audit its grader, and compare alternatives under a budget.

A maintenance planner proposes replacing a search-and-draft pipeline. Before release, the team must decide whether technicians receive a correct, usable procedure quickly enough to finish their work.

4.1 · Detect gaps in evaluation coverage

Define the grading target first. A citation-shaped string can pass a formatting test while citing the wrong revision. For grounding, compare each material claim with an authorized passage from the applicable revision. For task completion, inspect the resulting work record. Also monitor time, cost, unsafe actions, and access-control violations. Set separate gates for severe failures that a high average cannot offset.

Grade the work record, claim and side effect

A pilot suite checks for valid JSON and a nonempty citation. Three outputs pass. One cites a superseded manual. One cites the right manual but reports the wrong part number. One produces a correct draft and unexpectedly changes the inventory record. Define the observed artifact and failure criterion for each.

Inspect the release gates

Resolve the citation under the applicable model and date, and reject a superseded revision. Compare the claimed part number with the cited passage and the fixture’s accepted part IDs. Snapshot the test inventory before and after a draft-only run and assert that its state is identical. A fluent answer and a valid ID can coexist with a failed action boundary.

Keep those gates separate from p95 and cost per accepted job. Put this triad into regression fixtures with a known expected revision, part number and final state. It lets the release reviewer identify precisely which guarantee disappeared when a configuration changed.

Measure confidence where the action depends on it

A release suite contains 100 forms with ten fields each. The extractor gets all 900 descriptive fields right but only 80 of the 100 approval amounts. Its field accuracy is 98%. A workflow that pays the amount without review would still act on 20 wrong values. Define an amount-specific gate and retain the overall result for a different question.

Inspect a held-out confidence band. If 50 amounts are each labeled about 0.95 confidence and only 40 are correct, observed accuracy is 80% and the calibration gap for that band is 15 percentage points. A self-reported score needs this empirical check. Set a review threshold on development data, then measure wrong automatic approvals and review volume on unseen cases, including the highest-stakes slice.

Further study · freeCodeCamp at 9:40:57 · calibrating field confidence against human labels

4.2 · Derive release tests from business outcomes

Turn the operating decision into a test. If a technician must identify an applicable part and procedure, a valid success criterion includes compatibility, approved procedure, and evidence. Draw representative cases across equipment age, document quality, and language, plus known edge cases. Keep a held-out set and version inputs and labels. Use deterministic checks on part numbers and state, rubric-based grading for explanations, and expert review for uncertain cases. Follow the offline gate with a limited rollout and outcome monitoring.

Construct a sample that can decide a release

The service handles 800 routine, 150 multilingual and 50 superseded-manual cases per week. A 100-case development suite contains only routine cases. A technician defines success as “I can choose a compatible part from current evidence, or the service escalates an unresolved conflict.” Design a held-out release sample that makes rare errors visible.

Check the sampling and grading plan

For a fixed 100-case budget you might sample 50 routine, 25 multilingual and 25 superseded cases. Keep duplicate requests and related document variants on the same side of the development/holdout split. Label acceptable parts, current passages and any expected escalation with an expert. Ensure the labels reflect the action the technician can safely take.

Report each slice. To estimate the typical weekly rate, combine the three slice rates with weights 0.8, 0.15 and 0.05. An unweighted average would describe the test mix. Keep a separate severe-error gate, such as any unsupported compatibility claim, so a large routine segment cannot absorb a consequential regression.

4.3 · Diagnose and calibrate a model grader

A model grader can reward the first displayed answer, longer prose, or an answer produced by a similar model. Swap candidate order, blind generator identity, and include matched answers of different lengths. Compare grader decisions with independently labeled human anchors. Use explicit rubric dimensions and examples. Pin grader configuration and recheck anchor scores after changes. Agreement among several correlated graders is weak evidence of correctness.

Audit the grader before trusting a win

Two candidates answer 20 paired cases. With model names hidden, the judge selects the first displayed answer on 17 cases. After the order is reversed, it again selects the first on 17. Independent technicians prefer A on 12, B on six, and call two ties. What observation supports a position effect, and how would you test a separate verbosity effect?

Separate two sources of disagreement

Candidate identity moved but most of the preference stayed with the display slot. Keep per-case decisions for both orders and flag order-sensitive cases for adjudication. Preserve ties. Recheck agreement with the technicians before using the judge as a release gate. A second judge from the same model family can share the original bias.

To test verbosity, construct pairs with the same supported claims and citations, varying only length. Blind the source, balance order, and grade explicit rubric dimensions. Include fixed human-labeled anchors in later runs. If their scores shift after a judge upgrade, investigate evaluator drift before attributing a change to the candidate.

Video background · freeCodeCamp at 10:36:25 · grading output in a separate context

4.4 · Design an interpretable comparison

Run candidates on the same sampled cases, under matched tool, model, and index versions. Repeat each case when responses vary. With 240 calls, two candidates, and 40 cases, three trials per candidate per case use the entire budget. Analyze differences paired by case. The independent unit is the case, so avoid treating all repeated runs as unrelated samples. State uncertainty, examine weak segments, and keep other changes fixed. In a live A/B test randomize at a unit that avoids cross-contamination, such as account.

Spend a limited experiment budget

You have 180 model calls, two candidate prompts and 30 independent customer cases. Outputs vary between runs. One proposal gives A 90 easy cases and B 90 difficult cases. A second proposal runs each prompt once on all 30 cases and spends the balance on the most promising prompt. Design a comparison whose result can be interpreted.

Set up paired trials

Use three trials per prompt per case, giving 30 × 2 × 3 = 180 calls. Randomize or interleave execution order to reduce time-related effects. Freeze source snapshots, tool results, model version, grader and sampling settings. Record the per-case difference in mean score as well as instability across repetitions.

Compare the paired case differences and estimate uncertainty by resampling cases as whole units. Treating 180 calls as independent customers makes the result look more certain than it is. Decide in advance how to handle a tie or a gain accompanied by a severe regression. Use a separate development set for any prompt revision suggested by these results.

Replay a judge with the order reversed

Two blinded answers, A and B, appeared in both orders for each case. The judge log records only the slot selected. Use Python 3 to recover its preferred candidate in each order. Predict which cases need adjudication before counting wins.

# (case, chosen slot with A first, chosen slot with B first)
observations = [
    ("valve", 1, 1),
    ("pump", 2, 1),
    ("seal", 1, 2),
    ("meter", 2, 2),
]

for case, forward, reverse in observations:
    first_run = ("A", "B")[forward - 1]
    swapped_run = ("B", "A")[reverse - 1]
    verdict = first_run if first_run == swapped_run else "adjudicate"
    print(case, verdict)
Check the output and interpret it
valve adjudicate
pump B
seal A
meter adjudicate

An unchanged slot means the chosen candidate changed. Two cases are order-sensitive. In the other two the judge is consistent, but consistency alone cannot prove correctness. Compare the stable choices with independent human labels. To test verbosity next, hold the claim and source fixed while varying explanation length, and balance positions again.

Design exercise

A pilot reports 97% success, but its only criterion is a nonempty draft. Write a release gate that could fail a fluent answer. Include a fixture with a superseded manual, a test for claim support, and an owner who can adjudicate an ambiguous revision. Explain which observed operating error each check would catch.

Further reading · Evaluation design for agents

Knowledge check

Build an evaluation that can decide a release quiz

Answer 13 questions. Check each answer for an explanation.