About 7 of the 60 scored questions come from this domain. It has 3 skills:
Lessons
Skill
Evaluation System Design
Designing an offline evaluation system that stays valid
An offline evaluation is a set of tasks, a way to run them, and grading logic. Its job is to tell you, before users see a change, whether a prompt, model, or agent change made things better or worse. This lesson covers the decisions that decide whether that answer can be trusted.
Two suites with two jobs
Anthropic's guidance on agent evals separates two kinds of suite.
| Suite | Question it answers | Expected pass rate | Use |
|---|
| Regression | Does it still do what it used to do? | Close to 100% | Gate merges and releases |
| Capability | What can it not do yet? | Starts low | Measure progress |
A suite at 100% still catches regressions, but it can no longer show improvement. That is saturation. Near saturation, a large real improvement shows up as a fraction of a point, so the suite makes two different systems look the same. The fix is to add harder tasks, usually taken from recent production failures, and track them separately. Do not delete the saturated suite: capability tasks that pass reliably graduate into the regression suite.
Choose the grader the task allows
- Code-based (exact match, string match, tests, state checks): fastest, cheapest, reproducible. Use it wherever the answer can be checked by a rule.
- LLM-based: for judgments a rule cannot express. Validate it against human labels before relying on it.
- Human: the reference standard, slow and expensive. Use it to calibrate the other two.
For agents, grade the outcome, the state of the environment at the end of the trial, in preference to what the agent says it did or the exact path it took. Exact tool-sequence checks fail valid solutions.
Golden sets and contamination
A golden set is only useful while the system under test has not seen it. Contamination has three common routes:
- Tuning on the set. Dozens of prompt revisions selected by the same cases fit those cases. Keep a held-out split that is scored only at release decisions.
- Leakage into the prompt. Few-shot examples copied from the golden set make those cases pass for the wrong reason. Score only cases that do not overlap.
- Leakage into retrieval. If the reference answers are indexed in the corpus the application searches, the score measures lookup of the answer key.
The signal is the same in each case: the offline score rises while an independent measure, such as an audit of live outputs, does not.
CI/CD gates and release criteria
Model output varies between runs, so a single run of a small suite has noise of several points. A gate with a fixed threshold inside that noise band fails unchanged code and trains engineers to re-run until green. Options, in order of preference:
- Run several trials per task and use the per-task mean.
- Compare candidate and baseline on the same tasks (a paired comparison removes task-difficulty variance).
- Report an interval with the score, and size the suite for the smallest regression you need to detect.
Write release criteria per slice, not only overall. An aggregate can rise while a regulated or high-harm slice falls. A typical rule: no critical slice may regress beyond its noise band, and the overall score must not drop.
Retrieval-grounded systems: measure by stage
| Metric | Stage it isolates |
|---|
| Recall of the labeled passage in the top k | Retrieval |
| Share of answer claims supported by retrieved text (groundedness) | Generation |
| Answer correctness | End to end |
Low recall with high groundedness means the model is faithful to the wrong passages: fix retrieval. High recall with low groundedness means the model adds unsupported claims: have it find a supporting quote for each claim and retract claims without one, and add a groundedness check to the suite.
Keep the suite honest
- Convert user-reported failures into test cases. This closes coverage gaps as usage shifts.
- Test both directions of a behavior (when it should happen and when it should not).
- Start each trial from a clean environment. Shared state causes correlated failures or inflated scores.
- Read transcripts. A 0% pass rate on a task across many trials usually means a broken task or grader. A reference solution that passes all graders proves the task is solvable.
Raising the pass threshold on a saturated suite does not restore its signal. The suite still contains only tasks the system already passes; the higher bar only narrows the margin for noise.
Sources
Demystifying evals for AI agents
Define success criteria and build evaluations
A statistical approach to model evaluations
Writing effective tools for agents
Reduce hallucinations
Introducing Contextual Retrieval
Skill
LLM-as-Judge Engineering
Engineering and validating an LLM judge
An LLM judge is a measuring instrument. Before its scores gate a release or feed a dashboard, you need evidence that it measures what human experts would measure. Anthropic's documentation puts it briefly: LLM-based grading is fast and flexible, and you should test it for reliability first, then scale.
First decide whether you need a judge
If the check can be written as a rule (a field equals a verified value, a test passes, a record exists), use code. A judge adds cost, latency, and run-to-run variation. Use one where the judgment needs interpretation: tone, completeness, whether a claim is supported by a source.
Rubric design
- Explicit criteria. Write what earns each verdict. A vague rubric produces inconsistent verdicts, in humans and in models.
- Constrained output. Ask for a fixed label such as correct or incorrect, or a defined scale. Free-form assessments cannot be aggregated.
- One dimension per judge call. A single score for accuracy, compliance, and tone lets a warm tone offset a policy violation. Grade each dimension with its own isolated judge.
- Reasoning before the score. Let the judge reason before it produces the verdict, for example with thinking enabled. This improves grading on cases that need several steps.
- A way out. Give the judge a verdict such as Unknown for cases where its input lacks the evidence. Without it, the judge invents grounds for a verdict.
Calibrate against human labels
Collect a set of outputs labeled by domain experts and compare the judge's verdicts with theirs. Read the result as a confusion matrix, not as one number.
| Measure | What it tells you | Limit |
|---|
| Raw agreement | Share of items where judge and human match | Inflated when one class dominates |
| Cohen's kappa | Agreement corrected for chance | One number; hides direction of error |
| Recall on the fail class | Share of real failures the judge catches | Needs enough failures in the set |
| Precision on the fail class | Share of judge failures that are real | Same |
If 92% of items are passes, a judge that passes everything agrees with humans 92% of the time and catches nothing. When the judge is a gate, recall on the fail class is the number that matters.
Check the humans first
Have two experts label the same items independently and compute their agreement. That figure is the ceiling for the judge. If the experts agree weakly, the guideline is ambiguous, and tuning the judge prompt against those labels fits noise. Rewrite the guideline with anchored criteria, relabel, then calibrate the judge. A good task is one where two domain experts independently reach the same verdict.
Bias and position effects
| Bias | Evidence | Control |
|---|
| Position | Win rate changes when the order of the two responses is swapped | Judge both orders; count only consistent verdicts, or randomize order per item |
| Length | Judge prefers the longer output; blind human reviewers do not | Criteria that score content independently of length; validate on unequal-length pairs |
| Scale compression | Scores cluster on one or two values | Binary criteria or anchored scale points |
The test for any suspected bias is the same: change only the suspect property, hold the content fixed, and see whether the verdict moves.
Judge drift
A judge is a prompt plus a model version. Change either and the instrument changes. Scores from different judge versions are not comparable, even when the new judge is better.
- Pin the judge's model version and version its prompt.
- Keep a frozen human-labeled calibration set. Run every judge version on it.
- When changing the judge, re-score the previous baseline with the new judge so both sides of a comparison use one instrument.
- Re-derive gate thresholds from the new baseline.
Calibration also ages when the product changes. A judge calibrated on last year's traffic can fail on a new product line while the overall agreement figure still looks acceptable. Measure agreement per slice and refresh labels when the mix shifts.
A score that jumps when nothing in the application changed is a finding about the measuring instrument. Check the judge's configuration history before reporting a quality gain.
Sources
Define success criteria and build evaluations
Demystifying evals for AI agents
Define outcomes
Skill
Online Quality Measurement
Measuring quality on live traffic
Offline suites test the cases you thought of. Live traffic contains the cases you did not. Online quality measurement answers two questions: how good is the system on real usage right now, and did a change make real outcomes better?
What each online method gives you
| Method | Strength | Weakness |
|---|
| Production monitoring | Real behavior at scale | Reactive; no ground truth for grading |
| A/B testing | Measures user outcomes and controls for confounds | Slow; needs enough traffic |
| User feedback | Real examples of problems you did not anticipate | Sparse and self-selected; skews to severe issues |
| Transcript review | Finds subtle failures; builds intuition | Does not scale |
No single layer catches everything. Combine them, and use each for what it is good at.
Sampling live traffic
Decide what the sample is for.
- Estimating a rate across all traffic needs a uniform random sample. Conversations that received feedback are a small and unrepresentative share, so a rate measured on them does not describe the whole.
- Watching a rare, high-harm slice needs oversampling. A uniform sample gives too few cases from a slice that is 0.4% of traffic.
- Doing both means stratified sampling: fix a share of the review budget for the rare slice, then weight each stratum by its traffic share when you compute the overall rate. Pooling the oversampled reviews without weights biases the overall figure.
Feedback-triggered review is still valuable for finding failures. It is a discovery tool, not an estimator.
A/B testing
- Fix the plan before launch: primary metric, guardrail metrics, sample size, and when you will analyze.
- Choose the randomization unit to match the experience. For multi-turn products assign the user or session, not the request. Per-request assignment mixes both variants inside one conversation, which harms users and makes the arms indistinguishable.
- Size the test. With few sessions the interval on the difference is wide, so the result can exclude neither a real gain nor an unacceptable loss. Work out the sample size needed to detect the smallest effect you care about.
- Do not stop on a peek. Checking significance repeatedly and stopping the first time it crosses the line produces false positives. Analyze at the planned point, or use a method designed for sequential looks.
A result with an interval of minus 9 to plus 5 points is not evidence of no difference. It is an inconclusive test.
Feedback loops
Explicit feedback and outcome signals can disagree. A friendlier variant can raise the thumbs-up rate while more tickets reopen. Decide in advance which metric states the purpose of the product and treat the others as supporting evidence. Implicit measures such as task completion usually sit closer to the purpose than ratings do.
Close the loop into the offline suite. Triage reported failures, reproduce them, and add them as graded cases. A failure fixed by hand and not added to the suite can return with the next model or prompt change, because nothing checks for it.
Match the metric to the task type
| Task type | Fitting metric | Poor fit |
|---|
| Extraction, classification | Field-level or label-level correctness against corrections or delayed ground truth, by segment | A holistic 1 to 5 quality rating |
| Agentic | Outcome in the system of record; turns, tool errors | Rating of the final message |
| Retrieval-grounded | Share of claims supported by retrieved passages; retrieval recall | Number of passages retrieved |
| Open-ended generation | Calibrated rubric judge; how much humans edit before use | Exact match against one reference |
A metric that stays flat while users report a problem is measuring something else. Break it out by segment, such as document template, intent, or customer tier, before concluding that quality is stable.
Reporting a failure rate measured only on thumbs-down conversations as the product's failure rate. The sample was selected by the failure it is meant to estimate.
Sources
Demystifying evals for AI agents
Define success criteria and build evaluations
A statistical approach to model evaluations