Online Experiments and Production Evaluation › A/B tests

Michael BrenndoerferDecember 1, 20265 min read
Language AI HandbookAll chapters
Part 57 of 67Dynamic, Interactive, and Agentic Evaluation
Chapter 439Online Experiments and Production Evaluation › A/B tests
Reading section 6 of 15 · A/B tests · 5 minSection 6 of 15 · 5 min

Section 6 of 15 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Random assignment balances pre-assignment characteristics in expectation. Once you assign a unit, keep its assignment in the analysis even if it receives the other model. Record the unit key, assignment, actual receipt, outcome window and follow-up status as distinct fields.

Assignment unit

Choose a unit that matches the effect you want to estimate and the way exposure can spill over. Randomizing requests can make sense for a stateless response policy. Persistent memory or an interface that users learn can call for stable user assignment. Shared treatment within a tenant can call for tenant assignment.

For equal cluster size mm, common outcome variance, common pairwise intracluster correlation ρ\rho and independence across clusters, the variance inflation of the mean relative to treating all outcomes as independent is

DEFF=1+(m−1)ρ.\mathrm{DEFF} = 1 + (m-1)\rho.

Each cluster has mm variances and m(m−1)m(m-1) ordered covariance terms. Positive ρ\rho inflates the standard error by DEFF\sqrt{\mathrm{DEFF}} under these conditions. Unequal sizes, a small number of randomized clusters or cross-cluster interactions call for an analysis that matches the design.

Intention-to-treat and the effect among compliers

Let ZZ indicate assignment, with 1 for candidate and 0 for baseline. Let DD indicate actual candidate receipt and YY be the outcome in the specified window. The intention-to-treat effect measures assignment:

ITT=E[Y∣Z=1]−E[Y∣Z=0].\mathrm{ITT} = \mathbb{E}[Y \mid Z=1]-\mathbb{E}[Y \mid Z=0].

The first stage is the assignment effect on candidate receipt, E[D∣Z=1]−E[D∣Z=0]\mathbb{E}[D\mid Z=1]-\mathbb{E}[D\mid Z=0]. Random assignment, a nonzero first stage, an exclusion restriction, monotonic receipt, and well-defined treatment with no interference identify the complier average causal effect:

CACE=E[Y∣Z=1]−E[Y∣Z=0]E[D∣Z=1]−E[D∣Z=0].\mathrm{CACE} = \frac{\mathbb{E}[Y\mid Z=1]-\mathbb{E}[Y\mid Z=0]} {\mathbb{E}[D\mid Z=1]-\mathbb{E}[D\mid Z=0]}.

Exclusion means assignment affects the outcome only through receipt. Monotonicity means there are no users who would receive the candidate only under baseline assignment. Under these conditions the first stage is the fraction of compliers, and the ratio pertains to users whose receipt changes with assignment. Two-sided crossover can include users who receive the candidate in either arm. ITT stays useful when the routing policy itself is the intervention. Angrist, Imbens and Rubin, 1996.

Statistical power and the metric you are testing on

For equally sized independent arms, common per-unit variance σ2\sigma^2 and a fixed-horizon two-sided normal approximation, the approximate number of units per arm for detecting absolute effect Δ=τμ≠0\Delta=\tau\mu\ne0 is

n≈2σ2(z1−α/2+z1−β)2(τμ)2.n \approx \frac{2\sigma^2(z_{1-\alpha/2}+z_{1-\beta})^2}{(\tau\mu)^2}.

Here μ\mu is the baseline mean, τ\tau is the target relative lift, α\alpha is the test size and 1−β1-\beta is the target power. Halving ∣Δ∣|\Delta| quadruples the approximation with variance held fixed. With a Bernoulli baseline, substituting p(1−p)p(1-p) as the common variance gives nn proportional to (1−p)/(τ2p)(1-p)/(\tau^2p). For feasible fixed positive relative lift, required sample size in this approximation increases as pp falls. For rare outcomes or appreciably different arm variances, use a power calculation matched to the intended test.

Choose the primary outcome before inspecting results. Define the size of benefit worth acting on, and check whether assigned units have had time to reach the end of their outcome windows. Use secondary and segment estimates for diagnosis, with planned inference when claiming a difference. Sample ratio mismatch is a discrepancy between observed and expected allocation. An assignment count check is an early diagnostic. Compare later count changes against eligibility, logging and outcome maturity before interpreting a difference. Fabijan et al., 2019.

Novelty, primacy, and repeated exposure

An immediate reaction can differ from the effect after users have adapted. Plot estimates by exposure age and report the contributing cohort and its uncertainty. A calendar-day contrast can move because the cohort mix changed or because of sampling variation. When the long-run comparison matters, a maintained randomized holdout can preserve a baseline, with an explicit operating cost and review horizon.

Interference and carryover

One unit's outcome can depend on other units' exposure. A more expensive candidate can slow the baseline through a shared queue. A cache keyed without the variant can return an output from the wrong arm. A user assigned by request can carry state from an earlier exposure. These mechanisms can move an estimated contrast in different directions.

Separate caches or capacity where the serving question permits, or use assignment groups that capture the relevant interaction. A switchback, in which the assignment changes by time block, needs a carryover model and a matching analysis. Bojinov, Simchi-Levi and Zhao.

Peeking and sequential error inflation

If KK independent tests each reject with probability α\alpha under the null, the probability of any rejection is exactly 1−(1−α)K1-(1-\alpha)^K. At α=0.05\alpha=0.05 and K=10K=10, it is about 0.40130.4013. The union bound min⁡(1,Kα)\min(1,K\alpha) remains valid with dependence if each look's marginal rejection probability is at most α\alpha. Daily cumulative data are usually dependent because they reuse observations.

For efficacy, prespecify a single final look or use a design with calibrated interim boundaries. A test calibrated for arbitrary stopping or a time-uniform confidence sequence requires its own assumptions. A separate policy can pause traffic for safety without presenting a paused fixed-horizon efficacy analysis as an ordinary final test. Johari et al., 2022. Howard et al., 2021.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy