Skip to content
mentoor

Topic 4 of 5 · 5 min read

A/B testing AI features honestly

Goal: Design an A/B test for an AI feature with sample size, duration, holdout and guardrails, and spot a flawed result.

An honest A/B test of an AI feature decides the metric, the sample size, the duration and the guardrails before it starts, and treats a win on clicks as unproven until the quality guardrails agree. AI features make this harder than usual, because outputs vary and people behave differently when something is new.

Check yourself · 1 of 3

Why should an A/B test run for at least one to two full weeks even if the result looks clear after two days?

Choose one answer

Why it matters

In an A/B test, users are split at random into a control group (the old experience) and a variant group (the new one). If the groups differ only by the change, any gap in the result is caused by the change. The idea is simple. The ways to fool yourself are many, and AI features add a few of their own.

What to settle before the test

  1. One primary metric from your metric tree, such as task success rate. Write it down first, so you cannot pick the best-looking number afterwards.
  2. Guardrails with limits: cost per task, response time, complaint rate, and a quality score from a sampled human review.
  3. Sample size. Decide the smallest improvement worth shipping, then calculate how many users you need to detect it. A test with too few users shows noise and calls it a result.
  4. Duration of at least one to two full weeks, covering weekday and weekend behaviour. Do not stop the moment the result looks good; stopping early on a good-looking number inflates false wins.
  5. Randomise by user, not by request. Otherwise one person sees both versions and their experience mixes.
  6. A holdout group. Keep a small share of users on the old experience for a long time, to see whether the gain lasts.

AI-specific traps

  • Novelty effect. People try a new AI feature because it is new. Early numbers are high and then fall. Run long enough to see the curve flatten, and compare new users against existing ones.
  • Variable outputs. The same prompt can give different answers, so one good or bad example proves nothing. Judge by rates over many cases.
  • Wins on clicks, losses on quality. A chattier assistant may be used more and be wrong more. Only a guardrail on correctness catches this.
  • Cost and latency shifts. A bigger model may raise success by 2 points and cost four times as much.

Before and after

Before: "After two days, the variant has 12% more accepted suggestions. Ship it."

After: "After 14 days and 18,000 users per group, task success is up 1.8 points, cost per task is flat, and a reviewed sample of 200 shows the wrong-answer rate unchanged at 4%. The holdout will stay at 5% for a month to check the gain lasts."

What goes wrong

  • Peeking. Checking daily and stopping at the first win.
  • Too many metrics. Test twenty and one will look significant by chance.
  • Skipping the quality review. Click metrics reach everyone; correctness needs a person reading outputs.

Examples

A test plan for an AI reply-suggestion feature

Item Decision
Primary metric Tickets resolved without human edits to the policy answer
Smallest effect worth shipping 2 points
Users per group Calculated from the baseline rate and that 2 points; 18,000 each
Duration 14 days
Guardrails Cost per ticket under 3 cents; p95 response under 6 s; wrong-answer rate under 5% in a 200-ticket sample
Holdout 5% of users stay on the old flow for 30 days after launch

Optional: randomise by user

import hashlib

def bucket(user_id: str, experiment: str) -> str:
    h = int(hashlib.sha256(f"{experiment}:{user_id}".encode()).hexdigest(), 16)
    return "variant" if h % 100 < 50 else "control"

The same user always lands in the same group for this experiment.

Key points

  • Fix the primary metric, guardrails, sample size and duration before the test starts.
  • Run for at least one to two full weeks and do not stop the moment the result looks good.
  • Novelty can inflate early results, so watch the curve and compare new users with existing ones.
  • Output varies, so judge by rates over many cases and add a sampled human review for quality.
  • A holdout group on the old experience shows whether a gain lasts.

Common mistakes

  • Stopping the test as soon as the primary metric looks good, which inflates false wins.
  • Judging an AI feature from a few good or bad example outputs instead of rates over many cases.
  • Shipping on a click win with no check of correctness, cost or latency.
  • Splitting by request instead of by user, so people see both versions.

Check yourself · 2 of 3

A variant of an AI assistant raises accepted suggestions by 12% but its wrong-answer rate in a reviewed sample goes from 4% to 9%. What is the right call?

Choose one answer

Check yourself · 3 of 3

What is a holdout group used for?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic