Contents
Key concepts
Experiment design
State a hypothesis and a decision rule before launch. Pick the randomisation unit (user, session, account, region, time slot) so that units do not affect each other and analysis uses the same unit. Define one primary metric (or an overall evaluation criterion) tied to long-term value, secondary metrics that explain why, and guardrails that must not degrade (latency, errors, complaints, cost per request, revenue). Run whole weekly cycles and fix the sample size or a sequential plan in advance.
Flow · 5 stepsHow an experiment is designed
- State the hypothesis State a hypothesis and a decision rule before launch.
- Pick the unit Pick the randomisation unit so units do not affect each other.
- Define the metrics Define one primary metric, secondary metrics and guardrails.
- Fix the plan Fix the sample size or a sequential plan in advance.
- Run the cycle Run whole weekly cycles.
Data
| Step | Title | What happens |
|---|---|---|
| 1 | State the hypothesis | State a hypothesis and a decision rule before launch. |
| 2 | Pick the unit | Pick the randomisation unit so units do not affect each other. |
| 3 | Define the metrics | Define one primary metric, secondary metrics and guardrails. |
| 4 | Fix the plan | Fix the sample size or a sequential plan in advance. |
| 5 | Run the cycle | Run whole weekly cycles. |
Source: This page's text
| Box | Group | Detail |
|---|---|---|
| Hypothesis + decision rule | Plan | before launch |
| Randomisation unit | Plan | units do not affect each other |
| Metrics and guardrails | Plan | one primary metric |
| Sample size or plan | Plan | fixed in advance |
| Weekly cycle | Run | whole weekly cycles |
Source: This page's text
Power and minimum detectable effect
For two proportions, n per arm ≈ (z₁₋α/₂ + z₁₋β)² × [p₁(1−p₁) + p₂(1−p₂)] / δ²; with α = 0.05 two-sided and 80% power the multiplier (1.96 + 0.84)² ≈ 7.85. Required n scales with variance and with 1/δ², so halving the MDE quadruples the sample. Keep percentage-point and relative lifts distinct: a 1% relative lift on a 10% baseline is 0.1 pp and needs about 100× the users of a 1 pp lift.
Variance reduction
CUPED regresses the metric on a pre-experiment covariate (often the same metric before the test): Y_adj = Y − θ(X − mean X) with θ = cov(Y, X)/var(X). Variance falls by a factor (1 − ρ²), so a correlation of 0.7 roughly halves the required sample; Microsoft reported ~50% reductions on Bing. Stratification, capping outliers and choosing more sensitive metrics also help. ML or LLM predictions can serve as covariates in regression adjustment; 2026 work shows how to do this with a ‘do no harm’ guarantee (falling back to the difference in means when predictions are uninformative), with modest but real gains.
Peeking and sequential testing
Checking a fixed-horizon test repeatedly and stopping at the first p < 0.05 inflates false positives: about 14% with 5 looks, 19% with 10 and 25% with 20. Valid alternatives are group sequential designs with alpha spending (best power when the maximum sample is known; data arriving in batches), always-valid inference such as mSPRT (any number of looks, streaming data), or simply committing to the horizon. Bayesian dashboards are not immune if stopping rules are not designed in.
Compare · 3 variantsFalse positives rise with repeated looks
Data
| Variant | Looks | False-positive rate (%) | Computed as |
|---|---|---|---|
| 5 looks | 5 | 14 | 14 |
| 10 looks | 10 | 19 | 19 |
| 20 looks | 20 | 25 | 25 |
Source: This page's text
Validity threats
Sample ratio mismatch (observed split differs from design, tested with chi-square) signals broken assignment, logging or bot filtering and invalidates results until explained. Novelty and primacy effects make early weeks unrepresentative; look at effects by cohort and exposure day. Interference violates SUTVA in marketplaces and social products: a dispatch model given to some riders changes couriers available to control riders, so use switchback (time-slot) or geo/cluster randomisation. Multiple metrics and segments need correction or pre-registration; very surprising results usually mean a bug (Twyman’s law).
Ratio metrics and unit mismatch
If you randomise users but analyse per-session or per-query metrics (click-through per query), observations are correlated within users and naive standard errors are too small. Use the delta method or a user-level bootstrap. The same applies to LLM experiments measured per message when assignment is per user.
Selection bias and feedback loops
When a model gates outcomes, you only observe labels for what it lets through: blocked transactions never get a chargeback, rejected loan applicants never default. Retraining on these labels teaches the model its own past decisions. Remedies: a small randomised holdout or exploration rate that approves some would-be-blocked cases (with risk limits), logging propensities, and reweighting by inverse propensity.
Off-policy evaluation
To estimate a new policy π₁ from logs of an old policy π₀, inverse propensity scoring weights each logged reward by π₁(a|x)/π₀(a|x). It is unbiased if π₀ gave every action π₁ might take a non-zero probability and the propensities were logged, but variance explodes when weights are large. Self-normalised IPS and weight clipping reduce variance; doubly robust estimators combine a reward model with IPS and stay consistent if either part is right. When you cannot randomise at all, use quasi-experimental designs: difference-in-differences, synthetic control, regression discontinuity or instrumental variables.
Worked examples
Sample size for a 10% → 11% conversion test, and the effect of CUPED
Baseline conversion is 10%. How many users per arm detect a 1-percentage-point lift at α = 0.05 (two-sided) and 80% power? What if the lift were 1% relative, and what does CUPED with ρ = 0.5 buy?
1 pp lift (10% → 11%): n = 7.85 × (0.10 × 0.90 + 0.11 × 0.89) / 0.01² = 7.85 × (0.0900 + 0.0979) / 0.0001 = 7.85 × 1,879 ≈ 14,750 per arm (~29.5k users in total).
1% relative lift (10% → 10.1%): δ = 0.001, so n ≈ 7.85 × (0.0900 + 0.0908) / 0.000001 ≈ 1.42 million per arm. Confusing pp with relative lift is a 100× planning error.
CUPED with ρ = 0.5: variance × (1 − 0.25) → n ≈ 14,750 × 0.75 ≈ 11,060 per arm.
Duration: if 4,000 eligible users arrive per day split 50/50, 14,750 per arm takes ~7.4 days; round up to a full 7- or 14-day cycle to cover weekday effects.
Diagnosing a 52/48 split
A 50/50 test shows 52,000 users in control and 48,000 in treatment. In a separate small test the split is 520 vs 480. Which is a sample ratio mismatch, and what do you do?
Expected 50,000 each. χ² = (52,000 − 50,000)² / 50,000 + (48,000 − 50,000)² / 50,000 = 80 + 80 = 160, p ≈ 1e-36. This is a definite SRM.
Small test: χ² = 400/500 + 400/500 = 1.6, p ≈ 0.21. Same percentages, but consistent with chance.
For the large test do not interpret the metrics. Look for the cause: treatment crashes or slower pages losing users before logging, redirects, bot filters that interact with the treatment, assignment bugs, or triggering conditions that differ between arms. Slice the SRM by platform, browser and day to localise it; fix and re-run.
Off-policy estimate from logged propensities
An old recommender showed item A with probability 0.8 and item B with 0.2, and logged propensities. In 10 logged impressions, A was shown 8 times (4 clicks) and B twice (2 clicks). Estimate the click rate of a new policy that always shows B, and comment on reliability.
Weights: π₁/π₀ = 0/0.8 = 0 for A impressions; 1/0.2 = 5 for B impressions.
IPS = (1/10) × Σ wᵢ rᵢ = (1/10) × (5 × 1 + 5 × 1) = 1.0 (predicted 100% click rate).
SNIPS = Σ wᵢ rᵢ / Σ wᵢ = 10 / 10 = 1.0 here too.
The estimate rests on just two impressions; had one B impression not been clicked, IPS would be 0.5. With realistic data the same logic applies at scale: the effective sample size is (Σw)² / Σw², which collapses when the new policy concentrates on actions the old policy rarely chose. Use doubly robust estimation with a reward model, clip weights, report confidence intervals, and confirm promising policies with a live A/B test.
What changed recently
LLM-simulated A/B tests as a surrogacy problem
A 2026 paper by Persson, Schultzberg and Ankargren framed ‘LLM users instead of A/B tests’ as surrogate-outcome inference: raw LLM outputs recovered only 39% of the human treatment effect on the Upworthy headline archive, and calibration against human data was needed to close the gap, with a falsification test and a worst-case bias bound. Simulated users can screen variants, but their effects are correct only under assumptions you must test.
AI predictions as covariates for variance reduction
A 2026 paper showed how to use ML or LLM predictions as covariates in regression adjustment, CUPED-style, with a ‘do no harm’ property: the estimate falls back to the plain difference in means when predictions are uninformative, unlike some prediction-powered inference variants. The reported gains are real but modest. Interviewers who ask about variance reduction now expect you to discuss model-based covariates and their guarantees.
Offline evals and online experiments: a funnel, not a fork
Spotify described LLM evals as a filter in front of experiments: offline judges check output quality cheaply, and online tests check user impact, which judges cannot. It reported that about 12% of its tests ship a win while about 64% yield valid learning (a caught regression, a ruled-out idea), arguing that the win rate understates the value of experimentation. Expect product questions on how an eval suite and an A/B programme divide the work.
OpenAI buys an experimentation platform
OpenAI agreed to acquire Statsig, an A/B testing and feature-flagging platform, and its founder became OpenAI’s CTO of Applications. AI product companies now treat feature flags and controlled experiments as core infrastructure for shipping model and prompt changes, so candidates for applied roles are expected to know experimentation, not only offline evals.
AgentA/B: LLM agents as simulated shoppers
AgentA/B ran a between-subjects test with 1,000 persona-driven LLM agents navigating Amazon.com web pages, proposing simulated users for faster UI testing. It is the reference point for the question ‘could we replace A/B tests with agents?’, which strong candidates answer with validation against past experiments and clear limits on external validity.
Pitfalls
- Confusing percentage-point and relative lifts, or forgetting that both arms need n.
- Stopping the first day p < 0.05 appears on a fixed-horizon test.
- Interpreting metrics from a test with a sample ratio mismatch.
- Randomising users but computing naive per-session standard errors.
- User-level randomisation in a two-sided marketplace where treatment and control compete for the same supply.
- Treating offline gains as proof of online value; offline–online gaps often come from leakage, feedback loops or metric mismatch.
How interviewers probe it
- Design the experiment that decides whether to launch a new savings-nudge model: unit, metrics, guardrails, duration, decision rule.
- Compute the sample size for a given baseline and MDE, then name levers to reduce it.
- A PM peeks daily and stops at p < 0.05: what is wrong and what valid alternatives exist?
- Week-one uplift fades and control holds 52% of users: interpret both.
- How do you estimate a new recommendation policy’s value from logs of the old one?
- A/B testing an LLM prompt or model: primary vs guardrail metrics (resolution, re-asks, latency, cost), and why per-message metrics need care.
Quiz
Three questions from this guide. Answer each in your head or out loud, show the model answer, then rate yourself. The cards join your practice deck and come back when they are due.
You built a new savings-nudge model. Design the experiment that decides whether to launch it.
Model answer, written in a candidate's voice
- Hypothesis: nudge raises savings contribution/balance without hurting retention; primary metric is incremental saved amount or savings rate, with guardrails for complaints, opt-outs, churn and support contacts.
- Randomise at the user level, log exposure and actual nudge delivery, and prevent cross-user leakage.
- Choose the smallest lift worth launching as MDE, estimate baseline variance from production, compute sample size/power, and run long enough to cover weekly cycles and seasonality.
- Pre-register metrics, exclusions, analysis and decision rule before launch; run A/A and SRM checks.
- Decision rule: launch only if the primary metric clears MDE with confidence, guardrails stay within tolerance, and net benefit after cost is positive; otherwise iterate or stop.
Baseline conversion is 10%. How many users per arm do you need to detect a 1-percentage-point lift at α=0.05 and 80% power? What levers reduce it?
Model answer, written in a candidate's voice
- n ≈ 14.7k per arm under two-sided α=0.05, 80% power, equal allocation, independent users.
- Formula: n ≈ (z1-α/2 + z1-β)^2 [p1(1-p1)+p2(1-p2)] / δ^2 ≈ (1.96+0.84)^2 (0.09+0.0979)/0.0001 ≈ 14.7k.
- Levers: variance reduction (CUPED), a more sensitive/lower-noise metric, a larger MDE, one-sided test only if pre-specified and justified.
- Trade-off: larger n means longer duration and more drift/novelty risk; aggressive levers can shorten the test but may miss smaller lifts or depend on assumptions.
A PM checks the dashboard daily and stops when p < 0.05. What is wrong, and what valid alternatives exist?
Model answer, written in a candidate's voice
- Repeated daily p-value checks make the nominal 5% invalid; optional stopping inflates type-I error.
- Pre-specify a fixed horizon/sample size and one final test, or use group-sequential designs with alpha spending.
- Use always-valid sequential methods such as e-values/confidence sequences or mSPRT for continuous monitoring.
- Use Bayesian decision rules with explicit priors, loss, and honest stopping/reporting rules rather than p < 0.05.
- Keep guardrails monitored with pre-specified harm-stopping rules, separate from efficacy claims.
You have finished this topic.
Reading
- How Not To Run an A/B TestShort, memorable demonstration of how peeking inflates false positives.
- Trustworthy Online Controlled Experiments: A Practical Guide to A/B TestingThe standard practitioner reference; prioritise chapters on metrics, SRM, variance and pitfalls.
- Improving the Sensitivity of Online Controlled Experiments by Utilizing Pre-Experiment DataThe CUPED paper: variance reduction with pre-period covariates.
- A Dirty Dozen: Twelve Common Metric Interpretation Pitfalls in Online Controlled ExperimentsReal Microsoft examples of SRM, ratio-metric and novelty mistakes.
- Always Valid Inference: Bringing Sequential Analysis to A/B TestingTheory behind p-values and intervals that stay valid under continuous monitoring.
- Doubly Robust Policy Evaluation and LearningCombines reward models with inverse propensity weighting for off-policy evaluation.
- Causal Inference: The RemixFree text; read potential outcomes, DAGs and difference-in-differences for non-randomised settings.
- Better Experiments with LLM Evals — A funnel, not a forkHow a large experimentation team combines offline LLM judges with online tests, and why judges cannot replace them.
Practise this topic
- You built a new savings-nudge model. Design the experiment that decides whether to launch it.
- Baseline conversion is 10%. How many users per arm do you need to detect a 1-percentage-point lift at α=0.05 and 80% power? What levers reduce it?
- A PM checks the dashboard daily and stops when p < 0.05. What is wrong, and what valid alternatives exist?
- You want to test a new rider-dispatch model at Deliveroo. Why might user-level randomisation give biased results, and what designs help?
- How can you estimate a new recommendation policy’s performance from logs collected by the old policy?
- Your test shows a big uplift in week one that fades. Also, control has 52% of users instead of 50%. Interpret both.
- Transactions your model blocks never get a true label. How does that bias retraining, and how do you correct it?
- How would you A/B test a new model or prompt in a chat product? Which metrics are primary, secondary and guardrails?
- A model shows a big offline improvement but the A/B test is flat. What might be happening?
- A vendor offers to replace part of your A/B testing with LLM agents that role-play user personas and click through your site, as in the AgentA/B research. What could such simulations legitimately tell you, what can they not, and how would you validate them before trusting them?
- A model update passed offline evals, and an A/B test showed users preferred it, but within days it was criticised as ‘sycophantic’ and rolled back. Explain how this gets through a launch process and what you would change.
- Your engineers say coding agents make them much faster, and leadership wants to cut hiring on that basis. METR’s 2025 trial found experienced developers 19% slower with AI while believing they were faster, and its 2026 follow-up struggled to measure the effect at all. How would you establish what AI is actually doing for your team?
- You are A/B testing a new LLM model and prompt for a customer-support assistant. Outputs are non-deterministic, the provider may update the model mid-test, and your main quality metric comes from an LLM judge. Design the experiment so the result is trustworthy.