M1-053M1: Mathematics & Statistics Fundamentals实验设计 (A/B)Medium
⚡Flashcard Drill➔Mastery:
Define Sample Ratio Mismatch (SRM), How to Detect It via Chi-Square, and Root Cause Diagnostics
📐 Mathematical Definition
⚡ One-Sentence Core Answer
Sample Ratio Mismatch (SRM) occurs when the observed traffic split deviates significantly from the planned design ratio (e.g. 50:50), indicating severe selection bias that invalidates all experimental results.
📌 Key Takeaways
- •Detection: Evaluated using a Chi-Square goodness-of-fit test comparing observed sample sizes to expected ; flagged if .
- •Consequence: Invalidates all causal conclusions; any observed lift could be an artifact of unequal user attrition rather than true product impact.
- •Root Causes: Redirect performance lags, browser cache discrepancies, bot filtering asymmetries, and post-treatment tracking drops.
📐 Mathematical Derivations
Let planned allocation ratio be (e.g. 0.5 : 0.5) with total observed traffic . Expected counts are and . The Chi-Square test statistic is: . For example, if and (a seemingly tiny 0.4% difference), . With 1 degree of freedom, critical value at is ; since , , signaling catastrophic SRM.
🏭 Production Trade-offs
Systematic SRM troubleshooting protocol: (1) Segmented Chi-Square breakdown: Slice by Device (iOS vs Android), Browser (Chrome vs Safari), Country, and User State (New vs Returning). If SRM concentrates in a specific slice (e.g. Android only), inspect platform-specific client code. (2) Redirect vs In-line rendering: Redirect variants suffer from network drops before page load. (3) Bot filtering: If Treatment triggers bot defenses more frequently, bot scrapers are selectively removed from one variant.
⚠️ Common Interview Pitfalls
- ✕Attempting to 're-normalize' or re-weight data to salvage an experiment with severe SRM (unobserved selection bias makes results irrecoverable).
- ✕Using standard threshold for SRM checks (due to huge , use stringent to avoid false platform alarms).
🎯 Interviewer Follow-up Inquiries
- ?Why does a heavy client-side JavaScript bundle in Treatment cause selective drop-off before impression logging?
- ?How does Simpson's paradox manifest when changing allocation percentages mid-experiment?
⚡
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.
中文速览与面试要点
解释样本比例失配(SRM),如何检测与排查。
实际分组比例显著偏离预期;用卡方检验检测,通常说明分流/埋点/过滤有 bug。
核心要点
- SRM 的检测:设预期分流比例为 p_i(如 50/50),实际观测样本量为 O_i,期望 E_i=p_i·N,则卡方统计量 χ²=Σ(O_i−E_i)²/E_i 在 H₀(分流正确)下服从 χ²(k−1)。实践中 SRM 的判定阈值比常规检验更严格(通常 p 为什么 SRM 是严重信号 :若分流本身有偏,则组间差异可能来自分流偏差而非策略效果,实验结论完全不可信——所以 SRM 是'实验不可信的第一信号',任何解读都应在确认无 SRM 之后进行。
- 常见成因与排查:① 分流逻辑 ——哈希函数不均匀、盐值(salt)在不同服务间不一致、多层实验的流量冲突;② 埋点与日志 ——某组的事件上报丢失(如客户端版本差异)、曝光时机不同(处理组多一次渲染导致曝光计数不同)、日志采样不对称;③ 过滤逻辑 ——bot/爬虫过滤规则在两组执行不一致、异常值清洗依赖了组信息、重定向导致用户中途换组;④ 时序 ——两组上线时间不同导致覆盖的用户群不同(如处理组先上线,早期用户被排除)。 排查顺序 :先看原始分流日志(是否真的按预期分流)→ 再看埋点与曝光(是否对称)→ 最后检查下游过滤逻辑。发现 SRM 后的正确做法是 废弃该实验并修复基础设施 ,而不是'校正'数据。
- SRM 是实验不可信的第一信号
- 常见原因:重定向、bot 过滤、曝光时机差异
常见陷阱
- 用 p<0.05 判定 SRM(应更严格,如 p<0.001)
- 发现 SRM 后仍强行解读指标差异