Math & Statistics FoundationsIntermediate19 min read5 questions

Statistics & A/B Testing for ML Engineers

Shipping a model means running an experiment. Learn how to size it, read it honestly, avoid peeking, and explain why offline AUC gains vanish online.

Covers: Hypothesis testing, p-values, confidence intervals, power & sample size, multiple testing, online experiment pitfalls

At most companies, an ML engineer's model does not count as 'shipped' until an A/B test says it moved a business metric. That makes experimentation statistics a core ML-engineering skill, not a data-science speciality — and it is the single most common place where strong modellers give weak interview answers.

Filter
0/5 mastered
Intermediatehypothesis-testingp-valueexperimentationAsked at Airbnb, Booking.com

30-second answer

A p-value is the probability of observing data at least as extreme as yours, assuming the null hypothesis is true. It is not the probability the null is true, not the probability your result is a fluke, and not a measure of effect size. A p-value of 0.04 with a 0.01% lift is statistically significant and commercially worthless.

Intermediatepowersample-sizepeekingAsked at Netflix, Uber

30-second answer

Sample size comes from four inputs: baseline rate, minimum detectable effect, α and power. For proportions, n ≈ 16·p(1−p)/MDE² per arm for 80% power at α=0.05. Peeking inflates the false-positive rate dramatically — checking daily for two weeks pushes a nominal 5% α above 20% — unless you use sequential testing or always-valid confidence intervals.

Advancedexperimentationrecsysfeedback-loopsAsked at Google, Meta

30-second answer

Most likely: the offline metric is a poor proxy for the business metric; the training data was logged under the old policy so the new model is evaluated off-distribution; there is a position/selection bias feedback loop; the gain sits in a segment that gets little traffic; or the test is underpowered for the true effect size. Also check for training/serving skew and latency regressions.

Advancedmultiple-testingfdrexperimentationAsked at Microsoft, Airbnb

30-second answer

100 comparisons at α = 0.05 yield about 5 false positives even when nothing works. Pre-register one primary metric, treat the rest as guardrails or exploratory, and apply Benjamini–Hochberg FDR control to the exploratory family. Segment findings must be pre-registered or treated as hypothesis-generating and confirmed in a follow-up test.

Intermediateconfidence-intervalsbootstrapevaluationAsked at Google Search, Bing

30-second answer

A 95% CI is a procedure that captures the true parameter in 95% of repeated experiments — not a 95% probability that this particular interval contains it. For metrics without an analytic variance, like NDCG@10 or a custom business metric, use the bootstrap: resample your evaluation units with replacement, recompute the metric thousands of times, and take the 2.5th and 97.5th percentiles.

Showing 5 of 5 questions for statistics-and-ab-testing-for-ml.

Check your understanding

5 questions · no sign-up, nothing stored

0/5 answered
Question 1

1.A p-value of 0.03 means:

Question 2

2.Baseline conversion is 5% and you want to detect a 0.5 percentage-point absolute lift at 80% power, α = 0.05. Roughly how many users per arm?

Question 3

3.You check an A/B test daily for two weeks and stop as soon as p < 0.05. Your true false-positive rate is approximately:

Question 4

4.Offline AUC improved 3% but the A/B test is flat. Which check should come FIRST?

Question 5

5.When bootstrapping a confidence interval for per-user engagement, you should resample:

Hands-on challenge

Build it — this is what you talk about in a deep-dive round.

Build an experiment analysis toolkit

Write a small library that takes raw assignment/outcome logs and produces a trustworthy readout.

Requirements

  • `sample_size(baseline, mde, alpha, power)` for proportions and for continuous metrics.
  • SRM check via a chi-square test on assignment counts, failing loudly if p < 0.001.
  • Paired/unpaired bootstrap CIs at the user level, with a configurable number of resamples.
  • Benjamini–Hochberg correction across a supplied family of secondary metrics.

Stretch goals

  • Implement CUPED using a pre-period covariate and report the achieved variance reduction.
  • Add an always-valid confidence sequence (mSPRT) and compare its stopping time to a fixed-horizon test on simulated data.