4.3 A/B Testing and Iterative Improvement
What You Need to Know
Section titled “What You Need to Know”An offline eval tests a candidate change on a fixed dataset before users see it. An online A/B test splits live traffic between the current baseline and the candidate. A guard metric must not get worse. Together with the 4.1 metrics and the 4.2 datasets, offline evals, A/B tests and guard metrics form a loop. The loop converts a hypothesis into a production change that is attributable, statistically valid and reversible.
This lesson uses one made-up example throughout: a cleaning firm that uses Claude to draft customer quotes. The team wants a rewritten quoting prompt and a price-list lookup.
The Gate and the Validation
Section titled “The Gate and the Validation”Offline evals are the gate, a check that a candidate must pass. Online experiments are the validation. The offline suite is quick and repeatable enough to run on every candidate. Failing it stops the candidate. A pass is necessary but not sufficient for a change to user-facing behaviour. The eval set approximates production, and production means real users. The passing candidate proves its real-world impact in an A/B test against the live baseline, on real metrics and traffic. The firm tests its new prompt on past quote requests, then on live customers.
Anthropic’s model-selection guidance sets the same order for model changes:
- Build benchmark tests specific to your use case.
- Test with your actual prompts and data.
- Weigh the performance and cost trade-offs.
Passing the offline evals does not replace the online validation, and a rollback plan does not replace either of them.
One Variable at a Time
Section titled “One Variable at a Time”Only an isolated change can be credited with a result. If the prompt is rewritten and the model is upgraded together, a win cannot be credited. Also, the causes of a loss cannot be separated. The next decision then depends on an unproven belief, not a finding. So release the first change, establish the new baseline, then test the second change against that baseline. The firm tests its new prompt alone. Then it tests the lookup against that baseline.
This feels slower and costs less. Wins with no known cause get reverted by accident, and losses with no known cause get debugged without evidence. Adding extra changes with the reason “Since we’re touching it anyway” is how experiments become deployments.
The Evidence Bar
Section titled “The Evidence Bar”Non-deterministic outputs make measurements noisy. So any result needs more evidence before you declare it. Anthropic’s statistical approach to evals supplies the methods:
- Report the standard error of the mean and confidence intervals, not bare scores.
- When two variants answer the same questions, use a paired-difference test . Question difficulty is correlated across variants, and pairing uses that correlation to reduce variance at no cost.
- Resample non-deterministic outputs and average per question.
- Run a power analysis first, so the sample size can detect the effect you care about.
Judging by eye is not evidence, even if the firm’s new prompt “looks clearly better on these twenty cases”.
Staged Exposure for Risky Swaps
Section titled “Staged Exposure for Risky Swaps”Standard deployment practice exposes risky changes in stages. Model-version migrations need this most, because behaviour can change broadly and silently. In a shadow run, the new variant handles real traffic, and its outputs are compared offline. Users do not see these outputs. A shadow run tests behaviour on real traffic with zero risk to users. In a canary, a small slice of live traffic gets the variant first. Guard metrics are watched, and a rollback is ready. The firm shadows a newer model on live requests before any canary.
Shadow runs and canaries both need versioned prompts and configurations with clean rollback. An experiment that cannot be reversed cleanly is a deployment. After a migration is complete, set a new baseline for every downstream measurement. Comparisons against the old model’s baseline are now meaningless.
In the exam
Section titled “In the exam”Questions show a team like the firm’s that is about to do something that looks efficient but is wrong.
- bundling two changes into one test
- shipping on a passing offline suite
- declaring a winner from a handful of cases
When a question offers a clear improvement on a small sample, the right answer names sample size and significance.
Exam Traps
Section titled “Exam Traps”Practice Scenario
Section titled “Practice Scenario”A team wants to migrate a support agent to a newer model version and simultaneously rewrite the system prompt, since they are touching it anyway. They must be able to say which change caused any shift in behaviour, and no change may reach every user untested. What is the right approach?
- A. Ship both changes together once the full offline eval suite passes, since the system is being touched at the same time and one release is cheaper than two
- B. A/B test both changes combined against the current production system, so a single experiment measures the full migration exactly as users will experience it
- C. Ship immediately with a rollback plan, trusting the team to revert quickly if production metrics drop after release
- D. Shadow the new model alone against live traffic, then A/B it with success and guard metrics; test the prompt rewrite separately against the new baseline
Answer & explanation
Correct: D
- A — The question excludes this: with two variables moved at once, nobody can say which change caused a win or loss. Offline evals alone also do not validate real-world impact for a user-facing change.
- B — The question excludes this: if the combined variant wins or loses, nobody can say which change was responsible, however rigorous the online test.
- C — The question excludes this: every user gets an untested change, and a rollback plan is not evidence. Detecting the failure after the fact is the most expensive way to learn about it.
- D — Staged single-variable migration. The shadow run tests behaviour on real traffic at zero user risk. The A/B test proves impact with guards in place. The prompt rewrite gets its own attributable test against the floor set by the new baseline.
Sources
Section titled “Sources”- A statistical approach to model evaluations — Anthropic
- Define success criteria and build evaluations — Anthropic
- Choosing the right model — Anthropic
- Claude Certified Architect Professional Exam Guide (v1.0) — Domain 4 — Anthropic