M7-004Hard排序与推荐 · Ranking & recsys
什么是位置偏差?如何在训练和评估中处理?
What is position bias, and how do you handle it in training and evaluation?
💡 考场高分一句话答案:
用户倾向点击靠前位置,与内容质量无关;训练时用 IPS/点击模型校正,评估时用随机曝光或 interleaving。
Users click higher positions regardless of quality. Correct with inverse propensity weighting or a click model in training, and evaluate on randomised exposure or with interleaving.
📌 核心考察要点 (Key Points)
- 训练侧:把位置作为特征(让模型学到位置效应再剥离)、或用 IPS 加权、或训练一个“仅位置”的点击模型做除偏
- 评估侧:用随机曝光的一小部分流量做无偏评估;或用 interleaving 做在线比较
- 指标侧:报告“位置归一化后的 CTR”
- 注意:完全去掉位置特征会让模型无法解释线上分布,通常保留但做校正
- Training: include position as a feature then strip its effect, or use IPS weights, or fit a position-only click model and divide it out
- Evaluation: hold out a small randomised-exposure slice, or compare online with interleaving
- Metrics: report position-normalised CTR
- Caution: removing position entirely leaves the model unable to explain the production distribution
📐 第一性原理与数理推导机理
IPS 权重:$w_i=\frac{P(\text{exposure})}{P(\text{exposure}\mid \text{policy})}$。若旧策略把位置 $k$ 的曝光概率记为 $\pi_k$,则加权后的点击率估计无偏。代价是方差变大(尤其 $\pi_k$ 很小时),需要权重截断。
⚖️ 业务权衡与取舍 (Trade-offs & Calibration)
工业界更常用的是点击模型(click model):先估“位置 $k$ 被查看的概率”$\theta_k$,再用 $\text{CTR}_{\text{true}}=\text{CTR}_{\text{obs}}/\theta_k$ 校正。这比 IPS 方差小,但依赖“查看概率只与位置有关”的假设。
⚠️ 常见高频面试陷阱与避坑指南
- 训练时直接用原始点击率,模型学到的是位置而非相关性
- 评估集也来自有偏曝光,形成闭环
🔍 大厂面试官连环追问 (Follow-ups)
- IPS 权重截断怎么选?
- Interleaving 相比 A/B 有什么优势?
嫌字多看太累?进入苏格拉底式对话推演实验室
零打字负担,以大厂考官真实困境切入,通过点选直觉选项暴露思维盲区,手把手推导 Why。
⚡
Test muscle memory on this topic via 3-Layer Flashcards
Active Recall: Mentally formulate Prompt ➔ Math Derivation ➔ Benchmark Implementation in 3 minutes.