Online Experiments and Production Evaluation › A/B tests
Language AI HandbookAll chapters 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 , common outcome variance, common pairwise intracluster correlation and independence across clusters, the variance inflation of the mean relative to treating all outcomes as independent is
Each cluster has variances and ordered covariance terms. Positive inflates the standard error by 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 indicate assignment, with 1 for candidate and 0 for baseline. Let indicate actual candidate receipt and be the outcome in the specified window. The intention-to-treat effect measures assignment:
The first stage is the assignment effect on candidate receipt, . Random assignment, a nonzero first stage, an exclusion restriction, monotonic receipt, and well-defined treatment with no interference identify the complier average causal effect:
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 and a fixed-horizon two-sided normal approximation, the approximate number of units per arm for detecting absolute effect is
Here is the baseline mean, is the target relative lift, is the test size and is the target power. Halving quadruples the approximation with variance held fixed. With a Bernoulli baseline, substituting as the common variance gives proportional to . For feasible fixed positive relative lift, required sample size in this approximation increases as 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 independent tests each reject with probability under the null, the probability of any rejection is exactly . At and , it is about . The union bound remains valid with dependence if each look's marginal rejection probability is at most . 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!