M3-014Medium干涉与替代设计 · Interference & designs
什么是 switchback 实验?什么时候用它?
What is a switchback experiment and when do you use one?
💡 考场高分一句话答案:
按时间切片交替分配处理与对照(如奇偶小时),适用于同一市场内供需实时互相干涉的场景。
Treatment and control alternate over time blocks (odd and even hours, for instance). It suits settings where supply is shared in real time within one market.
📌 核心考察要点 (Key Points)
- 适用:打车、外卖、竞价、库存分配——供给在同一时刻被共享
- 设计要点:切片长度要大于“效应传导时间”(如司机接单后 15 分钟内仍在服务);切片数要足够多以估计方差
- 分析:以时间片为单位做配对比较或回归(含时间固定效应)
- 风险:结转效应(上一片的影响延续到下一片)、时间趋势混淆
- Applies to: rides, delivery, auctions, inventory allocation — supply shared at the same moment
- Design: block length must exceed the effect propagation time (a driver still serving for 15 minutes); enough blocks to estimate variance
- Analysis: paired comparison across blocks, or regression with time fixed effects
- Risks: carryover from the previous block, and confounding with time trends
📐 第一性原理与数理推导机理
switchback 的有效样本量是时间片数而非用户数。若每天 48 个半小时片、跑 14 天,则每臂约 336 片。功效取决于片间方差,而不是片内用户数——这一点与用户级 A/B 完全不同,容易算错。
⚖️ 业务权衡与取舍 (Trade-offs & Calibration)
判断切片长度的方法是看自相关:如果相邻时间片的指标高度相关,说明结转效应强,需要更长的切片或加洗脱期(washout)。实务中常用“切片长度 = 2–4 倍平均服务时长”。
⚠️ 常见高频面试陷阱与避坑指南
- 切片太短,处理效应还没显现就切换了
- 用用户数当样本量算功效(严重高估功效)
🔍 大厂面试官连环追问 (Follow-ups)
- 如何检测结转效应?
- switchback 与 cluster randomization 各自的优劣?
嫌字多看太累?进入苏格拉底式对话推演实验室
零打字负担,以大厂考官真实困境切入,通过点选直觉选项暴露思维盲区,手把手推导 Why。
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.