What you will be able to do
- Set a baseline and a numeric target before comparing a prompt or model change
- Run a fair offline comparison on a held-out eval set, choosing a grader that fits the task
- Decide when a live A/B test is worth running and what it can and cannot tell you
- Break results down by segment to catch regressions an aggregate score hides
- Use pinned versions to canary, promote and roll back prompt changes
Key concept
Baseline comparison — A change only counts as an improvement if it beats the current production version on the same measurement. Without that measurement, a prompt edit is a guess. The baseline is the version you would keep if the change failed, and the target is how far the change has to beat it.
1.Baselines and targets come before the change
Iterative improvement is a loop: change one thing, measure it against what you already have, then keep the change or drop it. The "what you already have" is the baseline, which is usually the prompt, model or configuration serving production today. A candidate counts as better only when it beats that baseline on the criterion you set in advance. Feeling better to the person who wrote it doesn't count. Anthropic's guidance lists A/B testing among the quantitative methods for exactly this: comparing performance against a baseline model or an earlier version.
A target turns the comparison into a decision. The sentiment-classification example in Anthropic's success-criteria guidance does not stop at "F1 of at least 0.85". It also says that this figure is a 5% improvement over the current baseline. Each target is anchored to something real: industry benchmarks, prior experiments, AI research or expert knowledge. A prior experiment is itself a baseline. Setting the bar before you run the comparison stops you from moving it once the numbers come in. Choosing which metrics to track is its own skill, covered under defining evaluation metrics. Here the point is that every metric you iterate on needs both a starting value and a finish line.
Baselines get cheaper once you have them. An eval suite run against the production version records latency, token usage, cost per task and error rates on a fixed bank of tasks. Every later candidate is scored against that record. Teams without one end up in a reactive loop: they wait for complaints, fix one failure, and cannot tell a real regression from noise.
Checkpoint 1 of 9· Check yourself
A team revises its ticket-routing prompt. The author says the new wording reads much more clearly, and the revised prompt scores 88% accuracy on the team's eval set. What does the team still need before it can call the revision an improvement?
A candidate counts as better only when it beats the baseline (the version now in production) on the same measurement, by a target set in advance. A score on its own, a reviewer's impression, or a test set changed to suit the candidate cannot show that it beats what is already running.
“A/B testing: Compare performance against a baseline model or earlier version.”Source: platform.claude.com
2.Offline comparisons on a held-out eval set
The fastest fair comparison is offline. Run the baseline and the candidate over the same held-out, labelled set and score both with the same grader. Real users are never exposed to the candidate, the run can be repeated, and it finishes in minutes. Building that set belongs to evaluation dataset design. For the comparison, two things matter: which grader you use and how many cases you have.
Pick the most objective grader the task allows. A ticket classifier that outputs urgent, normal or low has a clear-cut categorical answer, so exact match against human-labelled ground truth is the right score. It checks whether the output equals the predefined correct label, usually after normalising whitespace and case. Asking Claude to rate its own confidence in each label does not do this, because confidence is not correctness and nothing is checked against the labels. Having two colleagues read samples and vote on which version "feels" more accurate is slower and less objective than a score both versions earn on the same answers.
Open-ended output needs a different score. When a summarisation prompt is compared against human-written reference summaries, exact string match fails almost every case, because two good summaries rarely share wording. ROUGE-L scores a candidate by the longest common subsequence it shares with the reference. A summary that keeps the reference's key information in a similar order scores high, and the F1 can be tracked across prompt variants at scale. Latency is a separate, operational criterion: a faster variant has not shown that its summaries are better.
| Task output | Score to compare variants on | Why |
|---|---|---|
| Categorical label (sentiment, ticket priority) | Exact match against human-labelled answers | Unambiguous and cheap to re-run on every candidate |
| Free-text summary with a reference summary | ROUGE-L F1 against the reference | Rewards keeping the reference's key information in order, which exact match cannot |
| Response speed | Response time (ms) | An operational criterion, tracked alongside quality rather than in place of it |
Volume beats hand-polished quality. Anthropic's rule is that more questions with slightly lower-signal automated grading are better than fewer high-quality, hand-graded ones. The reason is economic. Writing questions is mostly a one-time cost, but grading is paid every time the eval is re-run, and iteration means re-running it constantly. Eighty carefully hand-labelled cases that someone must re-grade by hand after every prompt edit will slow you down. An automatically graded set of several hundred cases gives the same comparison every time you run it, at no extra effort.
Checkpoint 2 of 9· Check yourself
Two versions of a support-ticket prompt each label every ticket urgent, normal or low. You have 400 tickets that humans have already labelled. Which offline score gives a fair comparison of the two versions?
Ticket priority is a clear-cut categorical answer. Exact match against the labelled ground truth checks correctness directly and costs nothing extra to re-run. Confidence ratings are never checked against the labels, colleague votes are slow and subjective, and ROUGE-L is meant for free-text output like summaries, not single labels.
“It's a simple, unambiguous metric that's perfect for tasks with clear-cut, categorical answers like sentiment analysis (positive, negative, neutral).”Source: platform.claude.com
Checkpoint 3 of 9· Exam question
A support-ticket triage team maintains a categorical labeling eval (urgent/normal/low, with human-labeled ground truth) used to compare successive versions of their Claude-based classification prompt. Before promoting a revised prompt candidate, they want the fastest, most objective way to confirm it outperforms the current production prompt on this task. Which approach should they use?
Correct answer: A — Run both prompt versions against the same held-out labeled set and compare exact-match accuracy against the ground-truth category labels
- A. Correct. Since ground-truth labels already exist for this categorical task, exact-match accuracy on a held-out set gives an objective, scalable, and directly comparable score between prompt versions before rollout.
- B. Incorrect. Manual agent voting is slow, inconsistent across raters, and does not scale the way automated grading against existing ground truth does.
- C. Incorrect. Self-reported confidence is not a validated accuracy measure and can be miscalibrated, so it does not substitute for grading against known correct labels.
- D. Incorrect. Shipping to all traffic without a controlled held-out comparison risks degrading production quality and conflates classification accuracy with an indirect proxy metric.
Checkpoint 4 of 9· Exam question
A documentation team is iterating on a prompt that generates article summaries. They have 250 articles paired with human-written reference summaries and want an automated score that rewards a candidate summary for preserving the key information from the reference in a similar order, so they can compare prompt variants at scale during iteration. Which evaluation method best fits this need?
Correct answer: A — Score each candidate summary against its reference using ROUGE-L and track the F1 score across prompt variants
- A. Correct. ROUGE-L measures the longest common subsequence between candidate and reference text, capturing whether key information appears in a similar order, and it is well suited to scoring summarization quality across many articles automatically.
- B. Incorrect. Exact string match is appropriate for short categorical answers, not free-text summaries, since two good summaries will rarely match a reference word-for-word.
- C. Incorrect. A binary PHI check evaluates a safety property, not whether the summary preserves the reference's key information and ordering.
- D. Incorrect. Latency measures response speed, not whether the generated content faithfully reflects the reference summary's content.
Checkpoint 5 of 9· Exam question
A data science lead is designing an eval suite to compare prompt candidates before an A/B test, and a colleague suggests spending the team's limited time hand-labeling 80 carefully reviewed examples rather than building an automated grader over a larger set. Following the recommended approach to eval volume versus grading quality, how should the lead respond?
Correct answer: A — Favor a larger automatically graded set even with somewhat lower per-item signal, since more questions with automated grading generally outweigh fewer high-quality hand-graded ones
- A. Correct. The recommended practice is to prioritize volume with automated grading, since more questions with slightly lower-signal automated grading give a more reliable read on performance than a small number of high-quality hand-graded examples.
- B. Incorrect. Hand-grading quality does not automatically outweigh the statistical benefit of testing across a larger, automatically graded sample.
- C. Incorrect. Shrinking the eval set to enable full manual review sacrifices coverage and volume, working against reliable prompt comparisons.
- D. Incorrect. Relying on subjective impressions with no test set removes the empirical basis needed to compare prompt versions objectively.
3.Keeping the comparison fair
A comparison is fair when the variable you changed is the only one that differs. Anthropic's support-desk prompt audit shows the discipline. Six system prompts were each built by adding a single pattern, such as "verify twice" or "be maximally thorough", to the same clean prompt. All six ran on the same 44 tickets with deterministic grading. Because each prompt differed from the clean one by one pattern, each result could be attributed. Removing "verify twice" cut cost per ticket by a third. Removing contradictory rules and a hand-rolled scratchpad each restored 7 to 11 points of accuracy. If all six edits had shipped together, only their sum would be visible.
Repeated runs are part of being fair, because the same configuration does not give the same score every time. In a data-file benchmark, three identical Claude Sonnet 5 runs answered 6, 7 and 7 of 25 questions correctly. A one-question difference between two variants in a single run is inside that spread. The prompt audit reports its results with this in mind: the Opus 5 accuracy gain carried a 95% confidence interval of 3 to 8 points, while the Sonnet accuracy differences were described as within noise. Before you call a candidate better, check that its margin is bigger than the baseline's own variation.
Pin everything except the variable under test. That means the same eval set, the same grader, the same model and effort setting, and an explicit version of each prompt. In Managed Agents, passing a bare agent ID gets whatever version is latest. Passing an object with a version pins the session to an exact version, which the prompt-versioning cookbook calls what you want for a controlled comparison. When the variable is the model itself, run your actual prompts and data through each candidate model rather than relying on general benchmarks.
Checkpoint 6 of 9· Check yourself
Your eval harness opens every Managed Agents session using only the bare agent ID. Colleagues publish new prompt versions throughout the day. You now want to compare the production prompt with one candidate. What should change in the harness first?
A bare agent ID resolves to whatever version is newest when the session starts. If a colleague publishes mid-run, your 'baseline' or 'candidate' can silently become a different prompt. Pinning an explicit version keeps the prompt fixed, so the only difference between the two runs is the change you are testing. Repeating runs, fixing the model or changing the grader does not stop the prompt itself from drifting.
“Passing a plain string (agent=AGENT_ID) gets you whatever the latest version is. Passing {"type": "agent", "id": ..., "version": ...} pins to an exact version”Source: platform.claude.com
4.When to run a live A/B test
A live A/B test splits real traffic between the baseline and the candidate and measures what users actually do. It can measure things an offline set cannot, such as retention and task completion, and the random split controls for confounds. Task completion rate is one of the implicit user-feedback measures in Anthropic's success-criteria guidance. The cost is time and exposure: reaching significance takes days or weeks, it needs enough traffic, and the candidate is already in front of users.
| Method | Strength | Limitation |
|---|---|---|
| Automated offline eval | Fast, fully reproducible, no user impact, can run on every commit | Can create false confidence if it doesn't match real usage patterns |
| Live A/B test | Measures actual user outcomes and controls for confounds | Slow to reach significance, needs traffic, only tests changes you deploy |
| Production monitoring | Catches issues synthetic evals miss | Reactive: problems reach users before you know about them |
The order follows from that table. Automated evals are the first line of defence on every change and model upgrade. A/B testing is for validating significant changes once you have the traffic to support it. Neither is a reason to skip the other. Pushing a revised prompt to all traffic and watching a proxy such as ticket resolution time is not an A/B test either: with no control group, a change in the proxy cannot be attributed to the prompt. A/B results also carry less signal on *why* a metric moved, so pair them with transcript review when a variant wins or loses unexpectedly. Ongoing production monitoring is a separate discipline, covered in monitoring with logging and observability.
Checkpoint 7 of 9· Match them up
Match each way of judging a prompt revision to the role it plays, or its main flaw, in an iterative improvement loop.
Tap a term, then the definition that fits it.
Run the offline eval first on every change. Use a live A/B test to confirm significant changes, because its random split controls for confounds, but it needs traffic and time. Monitoring is reactive. A full rollout with no control group can't separate the prompt's effect from anything else that changed.
“A/B testing validates significant changes once you have sufficient traffic.”Source: www.anthropic.com
5.Reading results per segment
An aggregate score is an average, and averages hide where the losses landed. A candidate can gain on the segment it was written for and lose on a neighbouring one, and the overall number may still go up. Real task distributions are mixed, and most use cases are judged on several criteria at once. Score every comparison per category, per input type or per team, as well as overall.
api-platform
v1: 5/5
v2: 5/5
auth
v1: 5/5
v2: 5/5
billing
v1: 4/5
v2: 2/5 <-- regressed
dashboard
v1: 5/5
v2: 5/5The change targeted API tickets, and the team that paid for it was billing. On this 20-ticket set the regression also shows in the total, which falls from 19 to 17. Now picture the same rule on a set where many API tickets had been misrouted before. The rule would fix those, the total would rise, and billing's drop would vanish into the improvement. The per-team view finds the problem either way. The support-desk audit used the same approach along a different axis: the averaged result said accuracy went up, and only the per-pattern breakdown showed which edits caused it.
Checkpoint 8 of 9· Check yourself
Version 3 of a support-ticket router adds a rule aimed at refund requests. On the same 300 labelled tickets, overall accuracy rises from 82% to 86%, which clears the pre-set target. Broken down by category, refund tickets go from 36/60 to 57/60, but shipping tickets fall from 54/60 to 42/60. What should the team conclude?
An aggregate is an average and can hide where the losses landed. Here a gain on the targeted segment covered up a 12-ticket drop on a neighbouring one, which a broad rule can cause just as the API rule took tickets from billing. Scoring per segment catches that kind of regression even when the total goes up, and rerunning only the total would still hide it.
“Most use cases need multidimensional evaluation along several success criteria.”Source: platform.claude.com
6.Promote, canary and roll back by version
Comparing a candidate with the baseline is only safe when both can be referred to by version. Otherwise the baseline is overwritten the moment you ship the change. Managed Agents makes the prompt a server-side resource. Every agents.update creates a new immutable version, and each session chooses which version to run by number. Version 1 still exists after version 2 is created, so the earlier version can always be compared against and returned to, and client.beta.agents.versions.list(AGENT_ID) lists every version.
Three moves, all done by changing which version is referenced:
- Canary: route a fraction of traffic to the new version and compare before promoting fully, so the version works like a feature flag.
- Promote: update the config that tells production callers which version to pass. That config change is what goes through review.
- Roll back: callers go back to passing the old version number. No deploy is needed, and the regressed version stays on the server for further iteration.
The safety of all three depends on production callers pinning to an explicit version. agents.update has no built-in approval workflow, and any key in the workspace can call it. A caller passing the bare agent ID picks up the new prompt on its next session, so an unreviewed v2 is live straight away. With explicit pins, anyone can create v2, v3 or v10 as experiments that get no traffic. The pinned number becomes the change-control gate. In the routing example, the billing regression was fixed by re-pinning to version 1, which brought billing back to 4/5, while v2 stayed available to keep working on before a v3 goes through the same comparison.
Checkpoint 9 of 9· Match them up
A support team's routing agent runs on Managed Agents, and every production caller pins an explicit version. Match each action to what it actually does to production.
Tap a term, then the definition that fits it.
When callers are pinned, creating a version changes nothing in production. Only changing the pinned number does that, so the pin change is the release and the step that goes through review. Canary and rollback both work by changing which version callers reference, and neither one edits a prompt in place.
“Treat the pinned version number as the gate for changing prompts. Creating versions is exploratory; updating the production pin is what goes through review.”Source: platform.claude.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“A/B testing: Compare performance against a baseline model or earlier version.”
↩︎ Baselines and targets come before the change“which is a 5% improvement over the current baseline (Achievable).”
↩︎ Baselines and targets come before the change“Base your targets on industry benchmarks, prior experiments, AI research, or expert knowledge.”
↩︎ Baselines and targets come before the change“perfect for tasks with clear-cut, categorical answers like sentiment analysis (positive, negative, neutral).”
↩︎ Offline comparisons on a held-out eval set“Prioritize volume over quality: More questions with slightly lower signal automated grading is better than fewer questions with high-quality human hand-graded evals.”
↩︎ Offline comparisons on a held-out eval set“User feedback: Implicit measures like task completion rates.”
↩︎ When to run a live A/B test“Most use cases need multidimensional evaluation along several success criteria.”
↩︎ Reading results per segment“Design evals that mirror your real-world task distribution.”
↩︎ Reading results per segment“A/B testing: Compare performance against a baseline model or earlier version.”
↩︎ Promote, canary and roll back by version“A/B testing: Compare performance against a baseline model or earlier version.”
↩︎ Key concept“Exact match evals measure whether the model's output matches a predefined correct answer”
↩︎ Exam trap 1“Prioritize volume over quality: More questions with slightly lower signal automated grading is better than fewer questions with high-quality human hand-graded evals.”
↩︎ Exam trap 2“It's a simple, unambiguous metric that's perfect for tasks with clear-cut, categorical answers like sentiment analysis (positive, negative, neutral).”
↩︎ Checkpoint - 2.
“Once evals exist, you get baselines and regression tests for free”
↩︎ Baselines and targets come before the change“Teams can't distinguish real regressions from noise”
↩︎ Baselines and targets come before the change“Measures actual user outcomes (retention, task completion)”
↩︎ When to run a live A/B test“A/B testing validates significant changes once you have sufficient traffic.”
↩︎ When to run a live A/B test“Slow; days or weeks to reach significance and requires sufficient traffic”
↩︎ Exam trap 3 - 3.https://platform.claude.com/cookbook/misc-building-evalsSecondary source
“Grading on the other hand is a cost you will incur every time you re-run your eval, in perpetuity”
↩︎ Offline comparisons on a held-out eval set - 4.https://platform.claude.com/docs/en/about-claude/models/optimizing-for-cost-and-intelligenceOfficial docs
“each adding to the same clean prompt one pattern common in prompts written for Claude Opus 4.8 and Claude Sonnet 4.6.”
↩︎ Keeping the comparison fair“removing "verify twice" cut the cost per ticket by a third”
↩︎ Keeping the comparison fair“The in-context arm's three Claude Sonnet 5 runs answered 6, 7, and 7 of the 25 questions correctly”
↩︎ Keeping the comparison fair“The Opus 5 accuracy gain has a 95% confidence interval of 3 to 8 points; the Sonnet accuracy differences are within noise.”
↩︎ Keeping the comparison fair - 5.https://platform.claude.com/cookbook/managed-agents-cma-prompt-versioning-and-rollbackSecondary source
“Passing {"type": "agent", "id": ..., "version": ...} pins to an exact version, which is what we want for a controlled comparison.”
↩︎ Keeping the comparison fair“Billing regressed. Version 1 is still sitting on the server.”
↩︎ Reading results per segment“Every agents.update produces a new immutable version, and sessions choose which version to use by ID.”
↩︎ Promote, canary and roll back by version“route a fraction of traffic to a new version and compare (as this notebook does) before promoting fully.”
↩︎ Promote, canary and roll back by version“Promotion means updating whatever config tells production callers which version to pass”
↩︎ Promote, canary and roll back by version“Rolling back isn't a deploy; callers just go back to passing version: 1.”
↩︎ Promote, canary and roll back by version“There's no built-in approval workflow on agents.update. Any key in the workspace can call it.”
↩︎ Promote, canary and roll back by version“Treat the pinned version number as the gate for changing prompts.”
↩︎ Promote, canary and roll back by version“The new rule is broad, and on a usage-billed API product the billing tickets talk about API usage too.”
↩︎ Exam trap 4“Have production callers pin to an explicit version, not the bare agent ID.”
↩︎ Exam trap 5“Passing a plain string (agent=AGENT_ID) gets you whatever the latest version is. Passing {"type": "agent", "id": ..., "version": ...} pins to an exact version”
↩︎ Checkpoint“The new rule is broad, and on a usage-billed API product the billing tickets talk about API usage too.”
↩︎ Prediction“Treat the pinned version number as the gate for changing prompts. Creating versions is exploratory; updating the production pin is what goes through review.”
↩︎ Checkpoint - 6.
“Test with your actual prompts and data.”
↩︎ Keeping the comparison fair