Eval, Testing, and Debugging
Evaluation Design
Exam objective: Constructing an evaluation that measures a stated quality goal for a Claude application or component, including LLM-as-judge harnesses calibrated against human-labeled data, golden sets, regression tests, and behavioral checks, and selecting defensible metrics.
What the exam tests
Whether you can turn a stated quality goal into an evaluation that really measures it. Expect a scenario with a classifier, assistant or agent, a goal or a misleading score, and a choice of dataset, grader, metric or harness change.
Key rules
Start from success criteria. They should be specific, measurable, achievable and relevant. "Classifies well" is not a criterion; "F1 of at least 0.85 on a held-out set of real inputs" is. Most applications need several criteria at once (task quality, safety, latency, price).
Build a representative golden set. Mirror the real task distribution and include edge cases. A few dozen simple tasks from real failures, manual release checks and the support queue are a good start. Each task should be clear enough that two experts reach the same verdict, with a reference solution that passes the graders.
Pick the cheapest grader that can judge the goal.
| Grader | Good for | Weakness |
|---|---|---|
| Code (exact or string match, tests, state checks) | Clear-cut answers, verifiable outcomes | Brittle to valid variation |
| LLM judge | Tone, groundedness, open-ended output | Non-deterministic; needs calibration |
| Human | Reference labels, subjective quality | Slow and expensive |
Calibrate the judge. Compare its verdicts with human expert labels before trusting it. Give a detailed rubric, ask for a constrained verdict, let it reason first, allow "Unknown", and grade each dimension with a separate call.
<rubric>Pass only if every policy claim is supported by <policy>.</rubric>
<policy>{policy}</policy>
<answer>{answer}</answer>
Output 'correct', 'incorrect' or 'unknown' in <result> tags.
Grade agents on outcomes. The final environment state matters more than what the agent says. Add transcript or tool checks for real constraints (identity verified before a refund, turn limits). Consider partial credit for multi-step tasks.
Handle non-determinism. Run several trials per task. pass@k asks whether at least one of k attempts succeeds; pass^k asks whether all succeed. At 75% per trial, pass^3 is about 42%.
Behavioral checks go both ways. Test when a behavior should happen and when it should not (searching, refusing, escalating). Avoid class-imbalanced sets.
Separate capability from regression. Capability evals target what the system struggles with and start low. Regression evals protect what already works and should pass nearly 100%; run them on each change and model upgrade. Saturated capability tasks can graduate into the regression suite.
Keep the harness honest. Isolate each trial in a clean environment, keep the eval agent close to production, and prevent shortcuts that pass without solving the task.
Traps
- Raising the pass threshold on a grader nobody has validated.
- Requiring an exact tool-call sequence when several paths are valid.
- Passing a trial because the reply claims success.
- A set containing only positive cases, which rewards doing the behavior always.
- Reading a 0% task as model weakness before checking the task and grader.
- Rigid numeric or format matching that rejects correct answers.
- Trusting scores without reading transcripts.
- Relying on offline evals alone; production monitoring, user feedback, A/B tests and human review catch other failures.
Decide quickly
| Situation | Choice | Why |
|---|---|---|
| Fixed labels with known answers | Exact match, accuracy or F1 | Fast and objective |
| Paraphrases should get alike answers | Embedding cosine similarity | Measures meaning, not wording |
| Summaries with references | ROUGE-L | Sequence overlap with the reference |
| Tone or empathy | Calibrated LLM judge with a scale | Needs nuance |
| Agent changes data | State check | Verifies the outcome |
| Users expect success every time | pass^k | Measures consistency |
| Any one good attempt is enough | pass@k | Measures reachability |
| Scores swing or look odd | Read transcripts, fix rubric or task | Separates grader bugs from agent bugs |