In online A/B testing, CUPED reduces metric variance by replacing the outcome with , where is a pre-experiment covariate unaffected by treatment. How do you show that (unbiasedness), derive the variance-minimising , and prove that the minimum variance is where ?
ML systems and evaluation, Online experiments
Level L3 Intermediate. Length Long. Nature Mat Mathematical.
What's being asked
Whether you can derive the CUPED estimator from first principles and understand its equivalence to OLS residualisation.
Key idea
Because is measured before randomisation, (where is the treatment indicator), so subtracting leaves the average treatment effect untouched while removing the component of linearly explained by .
Steps
- Prove unbiasedness: by linearity of expectation, ; because is pre-treatment, , so .
- Write the variance as a quadratic in (using pooled data across both arms): .
- Differentiate with respect to and set to zero: , yielding (the second derivative confirms a minimum).
- Substitute back: .
- Interpret: if pre-experiment spend correlates with experiment spend at , variance falls to of its original value, cutting required sample size or test duration by nearly two-thirds (estimate on pooled data to preserve unbiasedness).
Common mistakes
- Using a post-treatment covariate for (such as concurrent session count), which can be affected by the treatment and bias the treatment effect estimate.
- Expecting a large gain from a weakly correlated covariate; the variance falls only by the factor , so cuts variance by just .
How long your answer should be
Half a page of clean algebra; 5–7 minutes.
Last checked on 4 December 2026.
Read this
Previous in ML systems and evaluation: What are the Shapley value formula and its four uniqueness axioms, and for a 3-feature model with coalition values , , , , , , and , what are the exact Shapley attributions (verifying efficiency)?
Next in ML systems and evaluation: Under covariate shift, how do you derive the importance-weighted loss and estimate using a domain classifier? Given training points and unlabelled test points, four training examples receive calibrated domain probabilities and per-example losses : what are their importance weights, the weighted loss, and the ESS (effective sample size), and why does this fail under concept drift?