A-B Testing

A-B testing is a randomized experiment comparing a control experience with one or more variants. This page is the evaluation concept: it focuses on planning, sample size, metric choice, and analysis before and after exposure. The production lifecycle counterpart is MLOps A-B testing, which focuses on feature flags, versioned telemetry, guardrails, and rollback; the underlying test-statistic mechanics — z-tests, p-values, and confidence intervals — are derived in hypothesis testing. A valid test needs a named decision, a randomization unit, primary and guardrail metrics, a minimum meaningful effect, and an analysis plan before traffic is exposed.

Sample size and the test statistic

For a binary metric, the planning problem is often “how many users per variant are needed to detect ?” A normal approximation for equal-sized arms is

where . Here is the baseline conversion rate, is the smallest treatment rate worth detecting, is the false-positive rate, and power is the probability of detecting that effect under the planning model. Hypothesis testing defines z-statistics and p-values; statistical significance interprets the observed effect after launch; online experiments add assignment integrity, logging, interference, and guardrails.

Worked calculation

Suppose the baseline conversion rate is and the smallest useful target is , a 1.2 percentage-point lift. With , 80 percent power, , , and :

That means about 10,330 users per arm, or 20,660 users total before losses and guardrail exclusions. If that traffic takes six weeks, a paired evaluation or stronger offline gate may be cheaper before running the live test.

Caveats

Do not change the primary metric after seeing results. Sample-ratio mismatch, delayed events, bot traffic, novelty effects, and repeated peeking can invalidate otherwise clean formulas. Report practical significance separately: a statistically detectable lift may be too small once latency, support load, or risk-weighted errors are included.

References