M1-054M1: Mathematics & Statistics Fundamentals实验设计 (A/B)Medium
⚡Flashcard Drill➔Mastery:
Explain CUPED (Controlled-experiment Using Pre-Experiment Data) and Why It Achieves Massive Variance Reduction
📐 Mathematical Definition
⚡ One-Sentence Core Answer
CUPED removes predictable pre-experiment user variance by subtracting linear projections: , reducing metric variance by factor and slashing required sample sizes.
📌 Key Takeaways
- •Core Mechanism: Uses historical pre-experiment data as a control variate; since , the treatment effect estimate remains completely unbiased.
- •Optimal coefficient: ; identical to the ordinary least squares slope of on .
- •Variance reduction factor: , where .
📐 Mathematical Derivations
Let be the experiment metric and be a pre-experiment metric measured before user exposure (hence strictly independent of treatment assignment: ). Define adjusted metric . The treatment effect estimate is . Taking expectations: , preserving exact unbiasedness. The variance is . Differentiating with respect to and setting to 0 gives optimal . Substituting back: .
🏭 Production Trade-offs
Industrial impact: In e-commerce and streaming where user engagement is highly stable (e.g. Past 2-week spend predicts future 2-week spend with ), CUPED variance reduction is . This cuts the required experiment duration and sample size in half! If a user is brand new (cold start with no pre-experiment history), set so , gracefully falling back to unadjusted .
⚠️ Common Interview Pitfalls
- ✕Using covariates that are measured after the user received treatment (which can be influenced by treatment, causing post-treatment conditioning bias).
- ✕Computing separately for Treatment and Control groups (must compute a pooled across both to preserve exact unbiasedness).
🎯 Interviewer Follow-up Inquiries
- ?Why is CUPED mathematically equivalent to ANCOVA (Analysis of Covariance) linear regression ?
- ?How does CUPAC (CUPED with Machine Learning Predictions) generalize pre-experiment feature sets using Gradient Boosted Trees?
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.
📚
Associated Knowledge Base Guides & Mindmaps
Explore the comprehensive technical article, exam cards, and global architecture tree.
中文速览与面试要点
什么是 CUPED?它为什么能降方差。
用实验前协变量(如历史同指标)做回归调整,扣掉可解释方差。
核心要点
- CUPED(Controlled-experiment Using Pre-Experiment Data)的构造:取实验前的协变量 X(通常是同一用户的历史同指标,如实验前 7 天的点击率),构造调整后的指标 Y^cv=Y−θ(X−X̄),其中 θ=Cov(Y,X)/Var(X) 是最优系数。 为什么降方差 :Var(Y^cv)=Var(Y)−Cov(Y,X)²/Var(X)=Var(Y)(1−ρ²),即方差降低比例为 相关系数的平方 ρ²。若历史指标与实验期指标相关系数为 0.7,则方差降低 49%——等效于样本量翻倍。 为什么无偏 :由于随机分流使 X 在两组间分布相同(E[X|T=1]=E[X|T=0]),减去 θ(X−X̄) 不改变两组期望之差,故 ATE 估计仍无偏。
- 实践要点:① 协变量的选择 ——首选实验前同指标(相关性最高);也可用多个协变量的回归调整(CUPED 的推广,等价于用实验前数据预测实验期指标再取残差);② 前提条件 ——协变量必须在随机化 之前 测量(否则可能被处理影响),且与处理独立;实践中还要注意协变量缺失(新用户无历史)时退化为原指标;③ 与其他降方差方法的对比 ——分层随机化/后分层(Post-stratification)在离散协变量上有效,CUPED 在连续协变量上更灵活且常更强;两者可叠加;④ 实现的坑 ——θ 必须用实验数据估计(可能引入微小偏差,可用样本分割消除)、协变量需做异常值处理(重尾协变量会削弱效果)、新用户群体需单独处理。
- 方差降低比例 ≈ ρ²
- 不引入偏差(协变量与处理独立)
- 是工业界 A/B 的标准降方差手段
常见陷阱
- 用实验期间的数据作为协变量(引入偏差)
- 忽略新用户无历史协变量的退化情形