Rubric
Contents — domains, guide and mocks

A/B testing and iterative improvement

CCAR-P 4.311 min read · checked 21 September 2026

Task statementConduct A/B testing and iterative improvements

The improvement loop

  1. Hypothesisone change, one expected effect
  2. Offline evalscapability + regression suites
  3. Live A/B testrandom split, pre-set metrics
  4. Decide and recordship, roll back, or iterate

Failures found live become new eval cases; the next hypothesis starts from the new baseline

Every change passes the cheap, fast gate before it reaches the slow, expensive one. Anything learned in production goes back into the eval set.

Offline first, online second

Anthropic's prompt-engineering guide assumes three things before you touch a prompt: clear success criteria, a way to test empirically against them, and a first draft. Iteration without those is guessing. The offline eval suite (4.2) is where most iteration happens, because it is fast, repeatable and exposes no customer to a bad version.

Offline evals can't tell you everything. They measure what you thought to test, on inputs you collected. Anthropic's engineering team describes A/B testing as the layer that validates significant changes once you have enough traffic, measuring real user outcomes such as retention and task completion — at the cost of taking days or weeks, and only testing changes you have already deployed.

Offline evalLive A/B test
AnswersDoes it do the task on our test cases?Do real users get better outcomes?
SpeedMinutes to hours; runs on every changeDays to weeks; needs enough traffic
Risk to usersNoneSome users see the worse version
MeasuresAccuracy, safety, security, cost per task on known casesResolution, retention, escalations, satisfaction, real latency
Blind spotInputs you didn't think to includeRare failures too infrequent to show up in the split

Designing a fair A/B test

  1. Change one thing. A new prompt, or a new model, or a new retrieval setting — not all three. If you must bundle, accept that you are testing the bundle.
  2. Write down the decision rule first. One primary metric (for example, tickets resolved without escalation), the minimum improvement worth shipping, and guardrail metrics that must not get worse (p95 latency, cost per resolved ticket, safety flags).
  3. Randomise the right unit. Usually the user or conversation, not the individual request, so one person doesn't bounce between versions mid-conversation.
  4. Log the variant on every request. Version of prompt and model, alongside the outcome, so results can be sliced later.
  5. Size and time it in advance. Decide how many conversations you need and run the full period. Stopping the moment the graph looks good is how noise gets shipped.

Sample size matters more than most teams expect. A lift from 62.0% to 64.5% resolution looks meaningful. With 200 conversations per arm, it is well within noise. With 4,000 per arm, it is unlikely to be chance. The same arithmetic applies offline: an agent's per-task success varies between runs, so compare versions over several trials per task, not one lucky pass.

Is the difference bigger than noise? (two-proportion z-test)python
from math import sqrt, erf

def ab_test(success_a, n_a, success_b, n_b):
    p_a, p_b = success_a / n_a, success_b / n_b
    pooled = (success_a + success_b) / (n_a + n_b)
    se = sqrt(pooled * (1 - pooled) * (1 / n_a + 1 / n_b))
    z = (p_b - p_a) / se
    p_value = 2 * (1 - 0.5 * (1 + erf(abs(z) / sqrt(2))))  # two-sided
    return round(p_b - p_a, 3), round(p_value, 3)

print(ab_test(124, 200, 129, 200))      # (0.025, 0.604) — can't tell
print(ab_test(2480, 4000, 2580, 4000))  # (0.025, 0.02)  — likely real

You don't need to be a statistician for the exam, but you do need the instinct: the same observed lift can be noise or signal depending on how much data sits behind it, and a decision rule set in advance protects you from reading what you hoped for into the result.

Which test does this change need?

What kind of change is it?
  • Small prompt fix
    Offline regression suitethen ship and monitor
  • Major prompt or model
    Offline evals, then A/Bprimary + guardrail metrics
  • Low traffic, high stakes
    Offline + expert reviewA/B would take too long
  • Security or safety fix
    Red-team set, then shipdon't wait weeks on a split
Match the evidence to the size of the change and the traffic available. Whatever the branch, every change runs the regression suite first.

Iterating without going in circles

Iterative improvement is a loop with memory. Each round starts from a hypothesis (“the bot is quoting the old refund window because the policy excerpt is buried below the examples”), makes one change, runs the capability suite to see whether the target moved and the regression suite to see whether anything else broke, and records the result against a prompt version. Without the record, teams re-try ideas that already failed and cannot say which change caused a regression three weeks later.

Iterating by feel vs iterating by evidence

By feel

  • Edit the prompt, try three inputs, looks better
  • Several changes bundled into one release
  • No stored baseline to compare against
  • Production complaints handled one by one

By evidence

  • One change per version, scored on the full suite
  • Regression suite must stay near 100%
  • Each version's scores stored with its prompt and model
  • Each production failure becomes a test case

Model upgrades are the iteration teams most often under-test. Anthropic's engineering article makes the business case: when a stronger model ships, teams without evals face weeks of testing while teams with evals can find the model's strengths, tune prompts and upgrade in days. The migration guides show why it can't be a blind swap. Moving to Claude Sonnet 5, for example, brings a new tokenizer producing roughly 30% more tokens for the same text, adaptive thinking on by default, and rejected non-default sampling parameters — and the checklist ends by telling you to re-baseline cost on your typical workload before production deployment.

What to log so that each variant's results can be compared in production is covered in 4.6; diagnosing why a variant lost is 4.4.

Traps the wrong answers are built from

Tempting but wrongDo this instead
Shipping a prompt change because a few outputs look betterScore it on the capability and regression suites, and A/B test significant changes.
Changing the prompt and the model in the same releaseChange one variable per version so the effect can be attributed.
Stopping an A/B test as soon as the new version is aheadFix the sample size, duration and decision rule before starting, and run the full period.
Judging a test only on the primary metricSet guardrail metrics — latency, cost per task, safety — that must not get worse.
Treating a model upgrade as a config changeRe-run evals, fix breaking changes, re-baseline cost, then roll out gradually.

You should now be able to

  • Sequence a change through offline evals before a live A/B test.
  • Design an A/B test with one variable, a pre-registered primary metric, guardrails, user-level randomisation and a fixed duration.
  • Judge whether an observed difference is likely real given the sample size.
  • Choose between regression-only, A/B, expert review or red-team testing for a given change.
  • Run a model upgrade as a controlled experiment, including a cost re-baseline.

Practice questions

Original questions written for this lesson, in the exam’s style. Answer first, then open the reasoning — every option is explained, including why the wrong ones are tempting.

  1. Question 1

    Three days into a planned two-week A/B test, a new support prompt leads the old one by five points on resolution rate. The product manager wants to ship it today.

    What should the architect recommend?

    1. AShip now; a five-point lead is large enough to be real.
    2. BContinue for the planned period and apply the pre-set decision rule.
    3. CStop the test and rerun it offline on the eval set instead.
    4. DShip now but keep the old prompt available as a fallback.
    Show answer and reasoning
    1. AIncorrect. Early leads are often inflated by noise and uneven traffic; the pre-set duration exists to prevent this.
    2. BCorrect. The sample size, duration and rule were fixed in advance precisely so an early lead doesn't decide the outcome.
    3. CIncorrect. Offline evals were the earlier gate; the live test measures user outcomes they can't.
    4. DIncorrect. Having a rollback is good practice, but it doesn't make an under-powered result trustworthy.
  2. Question 2

    A team plans to move their claims assistant to a newer Claude model and, in the same release, rewrite the system prompt and add a reranker to retrieval.

    What is the main problem with this plan?

    1. ANewer models can't be A/B tested against older ones.
    2. BRerankers require a separate evaluation framework.
    3. CPrompt rewrites should only be tested in production.
    4. DAny change in results can't be attributed to a single cause.
    Show answer and reasoning
    1. AIncorrect. They can; model versions are a common A/B variable.
    2. BIncorrect. Retrieval changes can be scored with the same suite; the issue is bundling, not tooling.
    3. CIncorrect. Prompt changes should go through offline evals first.
    4. DCorrect. Changing three variables at once means a gain or regression can't be traced to the change that caused it.
  3. Question 3

    An internal legal-drafting tool serves about 40 lawyers. The team has a significant prompt redesign ready and wants evidence it's better before rolling it out.

    Which two approaches are most appropriate? (Select 2.)

    1. ARun the redesign against the offline capability and regression suites.
    2. BRun a two-week A/B test split by request across the 40 users.
    3. CHave senior lawyers blind-review paired outputs from both versions.
    4. DShip it and watch for complaints.
    5. ETest on five hand-picked contracts.
    Show answer and reasoning
    1. ACorrect. Offline evals are fast, repeatable and expose no one to a worse version — the first gate for any change.
    2. BIncorrect. Traffic is too low for a meaningful A/B result, and per-request randomisation mixes versions within one user's work.
    3. CCorrect. With low traffic and high stakes, expert human comparison gives trustworthy evidence an A/B test can't.
    4. DIncorrect. User feedback is sparse and skewed to severe issues; it's a monitoring layer, not a pre-release test.
    5. EIncorrect. Too few, hand-picked cases can't distinguish improvement from noise or cover edge cases.
  4. Question 4

    A team moves from Claude Sonnet 4.6 to Claude Sonnet 5 because the per-token price is lower. What should they do before full production rollout?

    1. ARe-run the eval suites and re-baseline cost per task on real workload.
    2. BNothing beyond swapping the model ID; it is a drop-in upgrade.
    3. CLower temperature to keep outputs consistent with the old model.
    4. DEstimate the saving from the per-token price difference alone.
    Show answer and reasoning
    1. ACorrect. The new tokenizer and default thinking change token counts, so cost per task and behaviour must be measured, not assumed.
    2. BIncorrect. The migration guide lists breaking changes and asks you to re-baseline cost before production deployment.
    3. CIncorrect. Non-default sampling parameters return a 400 error on Claude Sonnet 5.
    4. DIncorrect. Roughly 30% more tokens for the same text means the saving is smaller than the price ratio suggests.

Sources

Drafted with AI assistance and checked against the sources above; expert review is in progress. Spotted an error? Tell us and it gets fixed, dated and listed on how this is written.