概述
逆倾向评分通过行动概率重新衡量结果,但可靠的估计需要足够的政策重叠、正确的倾向以及仔细处理高方差和选择性反馈。
深入探讨
A policy maps context, such as a user and current page, to an action such as which item to display. Off-policy evaluation (OPE) estimates a target policy's expected outcomes using logs generated by a different behavior or logging policy. It can help screen a candidate before deployment, especially in recommendation, advertising and contextual bandits. Inverse propensity scoring (IPS) weights each logged reward by the ratio between the target policy's probability of choosing that action and the logging policy's probability. For deterministic policies, only records where the logged action matches the target contribute, scaled by the inverse logging propensity. This corrects selection under assumptions, but small logging propensities create large weights and high variance. Clipping weights can stabilize estimates while introducing bias. Self-normalized IPS divides by the sum of weights, and doubly robust methods combine propensity and reward models, each with distinct assumptions. Support or overlap is crucial. If the logging policy never chose an action in a context, the log contains no direct evidence of its outcome there. No weighting formula can recover that missing counterfactual without additional assumptions. Propensities must be logged accurately, and the reward outcome must be observed. Selective labels, delayed outcomes and interference can also undermine estimates. Use OPE as evidence, not a guarantee. Report effective sample size, weight distribution, overlap diagnostics and sensitivity to estimators. A large estimate driven by a few extreme weights should be treated cautiously. Candidate policy changes that move far outside historical support may require randomized exploration or a controlled online experiment. OPE complements offline predictive metrics but does not replace experimentation for every decision. Evaluation assumptions should be documented with the logging policy version, context features, action set and reward definition.
现实世界的实施
推荐者记录了它显示的项目、上下文、点击结果以及选择该项目的概率。分析师利用这些倾向从旧日志中估计候选策略的预期回报。
目标策略选择日志记录策略几乎从未选择过的操作。少数匹配结果会获得较大的逆权重,从而产生嘈杂且可能不稳定的估计。
团队将原始 IPS 与自归一化估计器和双稳健估计器进行比较,报告假设和敏感性,而不是选择最有利的数字。
策略评估缺乏记录的行动概率。分析师不会声称 IPS 结果无偏见,而是收集更好的随机日志或运行受控实验。
根据记录数据进行离策略评估的未来
OPE 可以通过在现有日志的支持下筛选策略并识别证据薄弱的地方来帮助团队降低风险。未来的数据收集应该用稳定的政策版本记录行动倾向、暴露、背景和结果。团队可以将 OPE 与小型随机实验结合起来,以改善支持并验证估计。仪表板应显示权重尾部和有效样本量以及政策价值。当候选人大幅改变行为时,适当的反应可能是收集新证据,而不是超越日志进行推断。
付诸实践
为什么这很重要
- 成本与预算. 多年来,架构决策决定着性能和运营成本。
- 更清晰的判决. 技术教育帮助团队选择正确的堆栈,而不仅仅是最新的堆栈。
- 质量控制. 更好的工程选择可以减少生产中的可靠性事故。
留意
- 优化一项基准测试可以隐藏更广泛的系统弱点。
- 基础设施和维护成本常常被低估。
- 随着系统变得更加复杂,安全性和可观察性差距可能会扩大。
后续步骤
- 在实施之前定义延迟、质量和成本目标。
- 在实际负载和数据条件下进行基准测试。
- 仪器监控错误、漂移和用户影响。
- 在扩展之前准备回滚和事件响应路径。
不断探索
常见问题
什么是根据记录数据进行离策略评估?
离策略评估使用旧策略记录的数据来估计新决策策略的执行情况,而无需先部署新策略。逆倾向评分通过行动概率重新衡量结果,但可靠的估计需要足够的政策重叠、正确的倾向以及仔细处理高方差和选择性反馈。
离策略评估估计什么?
OPE 使用记录的行为和结果来评估不同策略下的性能。
为什么 IPS 除以日志记录倾向?
逆倾向权重补偿了假设下的伐木政策的行动选择。
当日志记录策略为所选操作分配非常小的概率时会发生什么?
较小的倾向会导致较大的逆权重,从而使估计不稳定。
缺乏支持对于目标行动意味着什么?
如果记录器从未在上下文中执行过操作,则 OPE 无法直接从这些日志中了解其结果。
为什么要通过加权估计来报告有效样本量?
权重集中可以使大型原始数据集表现得像小得多的有效样本。