AI Contextual Bandits / Adaptive Experimentation Playbook
重要说明: 本文是学习、作品集和架构训练材料,不构成法律意见、合规意见、投资建议、信贷决策建议、模型验证报告或审计结论。涉及信贷、财富、保险、定价、催收、欺诈拦截、差异化营销、消费者权益、公平信贷和隐私时,正式项目必须由 Business Owner、Legal、Compliance、Model Risk、Fair Lending、Privacy、Security、Data Owner、Opera
AI Contextual Bandits & Adaptive Experimentation Playbook
适用对象: AI Product Architect、AI Platform PM、Decision Science Lead、Risk Product Manager、Experimentation PM、金融零售增长 / 风控 / 催收 / 客服 / 定价 / 个性化负责人。 核心问题: 如何把 contextual bandits、adaptive experimentation、offline policy evaluation、next-best-action 和金融零售风险治理连接成一套可上线、可审计、可回滚的决策系统。 高级定位: 本文不讲 BA 入门需求收集,也不把 bandit 简化为“更聪明的 A/B test”。重点是训练 AI + 产品 + 架构判断: 何时探索、如何记录 propensity、怎样做反事实评估、哪些场景可自适应、哪些场景必须强治理。 作品集定位: 本 playbook 可直接转化为 Contextual Bandit Decision Service 架构图、Experiment Policy Card、Decision Log Contract、OPE Review Memo、Risk Gate、Kill Switch Runbook、金融零售案例包和高级面试答案。
重要说明: 本文是学习、作品集和架构训练材料,不构成法律意见、合规意见、投资建议、信贷决策建议、模型验证报告或审计结论。涉及信贷、财富、保险、定价、催收、欺诈拦截、差异化营销、消费者权益、公平信贷和隐私时,正式项目必须由 Business Owner、Legal、Compliance、Model Risk、Fair Lending、Privacy、Security、Data Owner、Operations、Architecture Review 和 Audit 共同审查。
Source Anchors
这些来源用于校准 contextual bandits、LinUCB、exploration / exploitation、offline policy evaluation、inverse propensity scoring、doubly robust、MWT、uplift / causal comparison 和 AI 风险治理语言。正式项目必须按机构政策、数据权限、监管要求和上线日期复核。
| Anchor | Official / primary source | 本 playbook 中的用法 |
|---|---|---|
| LinUCB personalized news paper | https://arxiv.org/abs/1003.0146 | 用 personalized news recommendation 的经典 LinUCB 场景说明 contextual bandits 如何用用户 / 内容 context 做在线选择,并用记录流量做 offline evaluation。 |
| ACM DOI: Contextual-Bandit News Recommendation | https://dl.acm.org/doi/10.1145/1772690.1772758 | 用 WWW 2010 论文锚定 LinUCB、动态候选池、稀疏反馈和个性化推荐的研究来源。 |
| Unbiased Offline Evaluation paper | https://arxiv.org/abs/1003.5956 | 用 Yahoo! news replay 方法解释 partial-label feedback 下的 offline policy evaluation 纪律。 |
| Vowpal Wabbit Contextual Bandits docs | https://vowpalwabbit.org/tutorials/contextual_bandits.html | 用 VW 的 context、action、probability、reward / cost 结构组织日志和训练接口。 |
| Vowpal Wabbit OPE docs | https://vowpalwabbit.org/tutorials/off_policy_evaluation.html | 用 off-policy evaluation 语言说明如何用历史 bandit data 估计候选 policy 的价值。 |
| Vowpal Wabbit CB types | https://vowpalwabbit.org/docs/vowpal_wabbit/python/9.6.0/tutorials/python_Contextual_bandits_and_Vowpal_Wabbit.html | 用 ips、dr、dm、mtr 和 epsilon-greedy / bagging / cover 等实现语言映射到平台能力。 |
| Microsoft Multiworld Testing | https://www.microsoft.com/en-us/research/project/multi-world-testing-mwt/ | 用 MWT 说明相比传统 A/B,context-based decision rules 可以更高效地评估大量策略。 |
| Microsoft MWT Decision Service paper | https://www.microsoft.com/en-us/research/publication/multiworld-testing-decision-service/ | 用 explore、log、learn、deploy 四个抽象组织 Contextual Bandit-to-Decision 架构。 |
| EconML | https://www.pywhy.org/EconML/ | 用 heterogeneous treatment effects / CATE 解释 uplift modeling 与 contextual bandit 的边界: 前者估计谁受益,后者持续分配动作并学习。 |
| DoWhy | https://www.pywhy.org/dowhy/main/index.html | 用 causal assumptions、identification、estimation、refutation 作为 bandit 结果解释和策略因果审查的补充。 |
| Doubly Robust Policy Evaluation | https://arxiv.org/abs/1503.02834 | 用 doubly robust estimator 解释 reward model 与 propensity weighting 结合后的 OPE 价值。 |
| NIST AI RMF 1.0 | https://www.nist.gov/itl/ai-risk-management-framework | 用 Govern、Map、Measure、Manage 组织 AI 决策系统的风险识别、度量、控制、证据和持续治理。 |
1. 一句话定位
Contextual bandits 是一类在线决策学习方法: 系统在每次决策时观察 context,选择一个 action,只看到被选 action 的 reward,然后在 exploration 与 exploitation 之间持续权衡,以优化长期决策表现。
在金融零售中,它不是“按钮颜色测试工具”,而是 next-best-action、offer optimization、contact center routing、fraud friction、collections treatment、dynamic pricing 和 personalization 的自适应决策控制层。
Customer / case / channel context
-> eligibility, consent, policy and risk constraints
-> action set generation
-> exploration policy
-> selected action + propensity
-> customer / staff / system exposure
-> delayed reward and guardrail outcome
-> offline policy evaluation
-> policy update, governance review, rollout or rollback
高级产品架构要回答的不是“哪个算法更酷”,而是:
- 这个业务场景是否允许探索,允许多大 exploration budget。
- action 是否会影响价格、额度、拦截、催收、财富建议或客户权益。
- reward 是否代表真实增量价值,而不是短期点击、接通或回款的代理指标。
- 日志是否记录了 action probability / propensity,使 offline policy evaluation 可行。
- fairness / consumer harm 是否进入上线门槛、监控和 kill switch。
- 自适应系统是否能解释“为什么在这个 context 下给了这个 action”。
2. 为什么重要
传统 A/B test 假设实验组策略在实验期间相对固定,适合验证少量明确改动。金融零售的 AI 决策场景经常更复杂:
- 客户 context 每次都不同: 余额、收入波动、风险评分、渠道、语言、生命周期、设备、历史互动、负债压力不同。
- action set 动态变化: 可用 offer、费率、客服队列、催收话术、欺诈验证方式、next-best-action 会随库存、政策和风险状态变化。
- 反馈稀疏且延迟: 点击马上出现,开户、还款、欺诈 chargeback、投诉、流失、逾期、客户伤害可能数天或数月后出现。
- 错误探索有真实成本: 不合适的价格、错误拦截、过度催收、误导性 offer、偏差化路由都可能造成合规、声誉和客户信任损害。
- 手工实验速度太慢: 每个 segment、channel、message、offer、risk intervention 都单独 A/B,会让决策学习滞后于市场变化。
一句话:
Adaptive experimentation 把实验从“阶段性验证一个版本”升级为“在风险边界内持续学习哪个 context 该匹配哪个 action”。
2.1 A/B、Multi-Armed Bandit、Contextual Bandit、Uplift 的边界
| 方法 | 解决的问题 | 适合场景 | 关键限制 |
|---|---|---|---|
| A/B test | 固定 variant 哪个平均效果更好 | 新页面、新流程、单一 offer 文案 | 学习速度慢,无法天然处理大量 context-action 组合 |
| Multi-armed bandit | 多个 arms 中哪个总体 reward 更高 | 多个 banner、内容排序、低风险 offer 文案 | 不使用个体 context,容易牺牲异质性效果 |
| Contextual bandit | 在给定 context 下选择哪个 action | next-best-action、personalization、routing、offer optimization | 需要 propensity 日志、稳定 reward、探索治理和 OPE 能力 |
| Uplift / CATE | 哪些人会因 treatment 产生增量效果 | 营销 targeting、干预人群选择、收益异质性分析 | 通常不直接承担在线探索和持续策略更新 |
| Full reinforcement learning | 多步状态转移下优化长期回报 | 复杂序列决策、库存 / 定价 /运营优化 | 风险、验证、可解释和治理成本更高 |
Contextual bandit 的优势在于只处理一步决策或短期动作选择,工程和治理复杂度低于完整 RL,但比 A/B 和 multi-armed bandit 更适合个性化决策。
2.2 金融零售中的高价值场景
| 场景 | Context | Action | Reward | 主要 guardrail |
|---|---|---|---|---|
| Personalization | 客户画像、渠道、同意、生命周期、近期交易 | 内容、提醒、教育路径、产品入口 | 完成率、长期活跃、满意度 | 退订、投诉、过度触达、隐私目的限制 |
| Next-best-action | 客户状态、事件触发、风险、产品持有 | 开户补件、自动还款、预算工具、顾问预约 | 任务完成、风险降低、留存 | 误导性建议、适当性、员工覆盖质量 |
| Offer optimization | 资格、偏好、价值、成本、渠道 | fee waiver、cashback、积分、bundle | 增量转化、边际利润、留存 | 差别待遇、冲突披露、公平性 |
| Dynamic pricing | 需求、风险、资金成本、竞争、客户关系 | 费率、手续费、折扣、额度价格 | 风险调整利润、接受率、流失下降 | 公平信贷、价格歧视、解释、监管边界 |
| Fraud friction | 交易风险、设备、商户、行为异常 | 放行、OTP、step-up、人工复核、拒绝 | 损失减少、好客通过率 | 误杀、弱势群体影响、账户访问受限 |
| Collections treatment | 逾期阶段、现金流、历史响应、脆弱客户标识 | 短信、电话、还款计划、宽限、人工关怀 | cure rate、回款、复借健康度 | 过度催收、消费者伤害、投诉、合规话术 |
| Contact center routing | 意图、情绪、复杂度、客户价值、坐席技能 | 队列、坐席、脚本、AI assist | 一次解决率、AHT、CSAT | 等待时间不公平、升级失败、员工过度依赖 |
3. Contextual Bandit-to-Decision 架构
3.1 参考架构
Business decision inventory
-> decision and risk tier classification
-> data contracts and feature store
-> action catalog and eligibility policy
-> reward and guardrail definition
-> exploration policy and budget control
-> decision service
-> propensity-aware event logging
-> delayed outcome attribution
-> offline policy evaluation
-> online ramp and adaptive learning
-> monitoring, kill switch and evidence binder
3.2 核心组件
| 组件 | 责任 | 高级产品问题 | 关键证据 |
|---|---|---|---|
| Decision Inventory | 定义哪些业务决策由 bandit 支撑 | 决策是否影响价格、额度、拒绝、催收、财富建议或客户权益 | Decision card、risk tier、owner |
| Context Service | 在决策时提供稳定 context | 特征是否允许用于该目的,刷新是否足够,缺失如何降级 | Feature contract、consent proof、quality SLO |
| Action Catalog | 管理可选动作和资格条件 | action 是否可展示、可执行、可解释、可合规 | Action metadata、eligibility rules、effective dates |
| Policy Engine | 执行业务规则和约束 | 哪些动作必须禁止,哪些需要人工审批 | Policy version、rule trace、exception log |
| Exploration Controller | 控制 exploration budget 和策略 | 每个 segment / channel / risk tier 最多能探索多少 | Budget ledger、traffic cap、stop rule |
| Bandit Learner | 学习 context-action-reward 映射 | 选 epsilon-greedy、LinUCB、Thompson Sampling 还是保守策略 | Model card、training run、hyperparameters |
| Decision API | 返回 action、score、probability、reason | latency、fallback、幂等、重复请求如何处理 | API contract、SLO、decision log |
| Event Logger | 记录 exposure、propensity、reward | 是否能重建“当时看到什么、选了什么、概率多少” | Immutable log、schema version、lineage |
| OPE Workbench | 评估候选 policy | IPS、doubly robust、replay 结果是否稳定 | OPE report、confidence interval、coverage |
| Risk Monitor | 监控业务、模型、公平性和伤害指标 | 什么时候暂停探索、回滚或人工接管 | Guardrail dashboard、kill switch event |
3.3 决策调用序列
1. Channel requests decision(customer_id, surface, event_type)
2. Identity / consent / purpose policy validates eligible context
3. Context service returns feature vector and missingness flags
4. Action catalog returns eligible actions
5. Policy engine removes prohibited actions and adds constraints
6. Exploration controller selects policy mode and budget
7. Bandit policy scores actions and samples one action
8. Decision API returns action, probability, policy version and explanation
9. Exposure logger records what was actually shown or executed
10. Outcome pipeline joins delayed reward and guardrail metrics
11. OPE and monitoring evaluate candidate policies and live risk
3.4 Multi-armed bandit 到 contextual bandit 的升级路径
Stage 1: A/B test
Compare fixed variants with stable randomization.
Stage 2: Multi-armed bandit
Shift traffic toward better arms using aggregate reward.
Stage 3: Segmented bandit
Run separate bandits by coarse segment such as channel or lifecycle.
Stage 4: Contextual bandit
Use rich context to choose action for each decision.
Stage 5: Governed adaptive decisioning
Add eligibility, fairness, OPE, risk gates, kill switch and evidence binder.
成熟度判断:
- 如果团队不能稳定记录 action probability,就不应宣称具备 contextual bandit 能力。
- 如果 reward 没有延迟归因和 guardrail,就只能做低风险 engagement learning。
- 如果 action 会影响价格、额度、拒绝或催收强度,必须进入 governed adaptive decisioning。
4. 探索 / 利用权衡
Exploration / exploitation 是 bandit 的核心矛盾:
- Exploitation: 选择当前估计最优 action,最大化短期已知收益。
- Exploration: 有控制地尝试不确定 action,获得信息,改善未来决策。
金融零售中,探索不是“随机试错”,而是受风险预算、客户保护、合规约束和业务价值约束的投资。
4.1 Exploration budget 的产品定义
Exploration budget = 组织愿意为学习承担的受控机会成本和风险暴露上限。
| 预算维度 | 例子 | 控制方式 |
|---|---|---|
| Traffic budget | 某渠道最多 5% 流量进入探索 | traffic cap、segment cap、risk-tier cap |
| Customer budget | 同一客户每 30 天最多一次探索性 offer | frequency cap、customer fatigue score |
| Financial budget | fee waiver / cashback 探索月成本上限 | cost ledger、margin guardrail |
| Risk budget | fraud step-up 探索不得让损失率超过阈值 | loss guardrail、manual review reserve |
| Fairness budget | protected / proxy group 的不利影响不得扩大 | subgroup exposure and outcome monitoring |
| Operational budget | contact center routing 不得压垮某队列 | queue SLA、staff capacity cap |
4.2 风险分层探索策略
| Risk tier | 允许的探索 | 禁止或强限制 | 例子 |
|---|---|---|---|
| Low | 文案、排序、教育内容、低影响提醒 | 欺骗性暗示、过度触达 | 金融教育内容推荐 |
| Medium | fee waiver、渠道选择、客服路由、低额 offer | 不透明差异化、不记录 propensity | 信用卡权益 offer |
| High | 催收 treatment、欺诈 friction、价格、额度、财富 next-best-action | 无人工监督的激进探索 | 分期费率、还款计划、交易拦截 |
| Critical | 拒绝、关闭账户、法律行动、不可逆客户损害动作 | 在线随机探索 | 账户冻结、信贷拒绝、强制催收升级 |
4.3 常见算法选择
| 策略 | 机制 | 优势 | 金融零售注意点 |
|---|---|---|---|
| Epsilon-greedy | 以 1-epsilon 选择当前最佳,以 epsilon 随机探索 | 简单、易解释、易做预算 | 随机探索可能选到明显不合适动作,必须先做 eligibility 和 risk filtering |
| Decaying epsilon-greedy | 随时间降低 epsilon | 初期学习快,后期更稳 | 非平稳市场中可能过早停止学习 |
| UCB | 选择均值 + 不确定性上界高的 action | 显式处理不确定性 | 对 reward 噪声和置信估计敏感 |
| LinUCB | 假设 reward 对 context-action 特征近似线性 | 快、可解释、适合稀疏高维 context | 线性假设需要用分群和残差监控验证 |
| Thompson Sampling | 从后验分布采样,概率化探索 | 自然平衡探索和利用,常用于 Bayesian 更新 | 后验设定、冷启动和约束处理需要审查 |
| Conservative bandit | 新策略必须相对基线满足安全收益约束 | 适合高风险业务 | 学习速度较慢,但更符合受监管场景 |
4.4 算法不是第一决策
在产品架构评审中,优先顺序应是:
Decision risk
-> action eligibility
-> reward validity
-> logging completeness
-> exploration budget
-> OPE readiness
-> governance and rollback
-> algorithm family
算法可替换,日志和治理债务很难补救。没有 propensity 的历史数据很难支持可信的 inverse propensity scoring 或 doubly robust 评估;没有 exposure log 的实验无法区分“被分配”和“真正看到”;没有 policy version 的决策无法复盘。
5. 策略、日志、反事实评估
5.1 Policy lifecycle
Policy proposal
-> risk tier and action scope review
-> offline data readiness check
-> logging and propensity validation
-> shadow / replay evaluation
-> limited online exploration
-> OPE and guardrail review
-> ramp, freeze, rollback or redesign
-> post-decision evidence binder
每个 policy 都应被当作产品资产管理,而不是 notebook 或模型文件:
| Policy metadata | 必须回答 |
|---|---|
| Business owner | 谁对业务结果和客户影响负责 |
| Decision scope | 哪个渠道、旅程、客户群、事件触发 |
| Action set | 可选动作、资格、禁用条件、成本 |
| Reward | 主 reward、延迟窗口、负向 reward、代理指标风险 |
| Guardrails | 投诉、退订、损失、误报、等待、公平性、人工覆盖 |
| Exploration budget | 流量、成本、客户、风险、运营上限 |
| Baseline policy | 当前规则、A/B winner、人工策略或 champion model |
| Logging contract | context、action、probability、policy version、exposure、outcome |
| Rollback | 回滚到哪个基线,谁可触发 kill switch |
5.2 Decision log contract
Contextual bandit 的日志不是普通埋点。它必须支持反事实评估和审计复盘。
| 字段 | 说明 | 示例 |
|---|---|---|
| decision_id | 单次决策唯一标识 | UUID |
| customer_key / case_key | 脱敏主体或案件标识 | hashed id |
| timestamp | 决策时间 | ISO-8601 |
| channel / surface | 决策发生位置 | mobile_app_home, IVR, collections_queue |
| context_snapshot_id | 当时 context 快照 | feature vector hash + feature version |
| eligible_actions | 被策略看到的候选动作 | A, B, C |
| blocked_actions | 被规则排除的动作和原因 | high_risk_offer: ineligible |
| selected_action | 实际选择动作 | offer_12m_apr |
| action_probability | 该 action 被选择概率 | 0.18 |
| propensity_policy | 产生 probability 的 logging policy | cb_policy_v7 |
| exploration_mode | exploit / explore / fallback | explore |
| reward_definition_id | reward 口径版本 | reward_card_v3 |
| policy_version | bandit / rule / fallback 版本 | linucb_v12 |
| explanation_code | 面向业务和审计的原因码 | high_relevance_low_risk |
| exposure_confirmed | 客户或员工是否实际看到 | true / false |
| downstream_outcome_id | 延迟结果关联键 | outcome_batch_2026_06 |
| guardrail_flags | 负向事件或风险标记 | complaint, opt_out, fraud_loss |
最低要求:
- 必须记录 selected action 的 probability。
- 必须记录未被选择但可选的 action set。
- 必须区分 assignment、decision、exposure 和 outcome。
- 必须记录 policy version、feature version、reward version 和规则版本。
- 必须能追溯 fallback 和人工覆盖。
5.3 Offline policy evaluation
Offline policy evaluation 是在不上线候选策略的情况下,用历史 bandit data 估计候选 policy 表现。它的价值不是替代线上实验,而是在客户暴露前淘汰明显不稳或高风险策略。
Replay evaluation
Replay 只使用历史中候选 policy 会选择同一 action 的事件来估计 reward。它直观、保守,但样本效率可能低。
适合:
- 历史策略有随机化。
- action set 相对有限。
- 候选 policy 与历史 policy 有足够重叠。
风险:
- 如果历史探索太少,coverage 不足。
- 如果 context 或 action catalog 已变化,重放结果可能失真。
Inverse propensity scoring
Inverse propensity scoring, IPS, 用 observed reward 除以 logging policy 选择该 action 的概率,修正历史策略造成的选择偏差。
Estimated value =
average over events [
reward * indicator(candidate_policy_action = logged_action) / logged_propensity
]
产品解释:
- 如果历史策略很少选择某 action,propensity 很小,该样本权重会很大,方差会升高。
- IPS 不是“有日志就可信”,它依赖 propensity 准确、policy 重叠和 reward 口径稳定。
- 金融场景中要同时看总体 value、分群 value、低 propensity 覆盖、置信区间和 guardrail。
Doubly robust
Doubly robust 结合 reward model 与 propensity weighting。直觉上,它既利用模型预测未观察 action 的 reward,也用 propensity 修正选择偏差。
产品价值:
- 相比纯 IPS,通常能降低方差。
- 相比纯 reward model,对模型错设更有韧性。
- 适合在金融零售中做候选 policy 筛选,但不能替代高风险上线门禁。
审查问题:
- reward model 是否使用了上线时不可用的未来信息。
- propensity 是否来自真实 logging policy,而不是事后估计拼接。
- treatment overlap 是否足够,低覆盖 segment 是否单独标红。
- negative reward、投诉、误杀、逾期、人工覆盖是否进入评估。
5.4 OPE Review Memo 标准
| 审查项 | 通过标准 |
|---|---|
| Logging integrity | decision、exposure、probability、policy version 缺失率在门槛内 |
| Policy overlap | 候选 policy 的 action 在历史数据中有足够覆盖 |
| Propensity quality | probability 由线上策略产生,可复现,无非法 0 或异常集中 |
| Reward validity | reward 与业务目标、客户结果、风险成本一致 |
| Estimator triangulation | replay、IPS、doubly robust 方向一致或差异有解释 |
| Variance and confidence | 高权重样本、宽置信区间、低样本切片被显式处理 |
| Segment risk | 关键 segment 无明显伤害或不公平暴露 |
| Operations readiness | 人工复核、客服、风控、投诉处理能承接流量变化 |
| Decision outcome | 推荐进入 shadow、limited ramp、redesign、freeze 或 retire |
6. Adaptive Experimentation 产品决策
Adaptive experimentation 是产品机制,不只是统计机制。它改变了团队如何定义 hypothesis、分配流量、看指标和做上线决策。
6.1 适合 bandit 的产品条件
| 条件 | 成熟表现 |
|---|---|
| 决策频率高 | 每天有足够 exposure 支持学习 |
| action 可替换 | 多个动作都可合理展示或执行 |
| reward 可归因 | 能把 outcome 关联回 decision_id |
| 风险可控制 | 有 eligibility、guardrail、traffic cap 和 kill switch |
| context 有信息量 | 不同客户 / 案件 / 渠道对 action 的响应有异质性 |
| 反馈周期可管理 | reward 不完全滞后数月,或有可信 early signal |
| 组织能接受自适应 | PM、Risk、Legal、Ops 理解策略会随数据更新 |
6.2 不适合直接 bandit 的产品条件
| 信号 | 更合适的方法 |
|---|---|
| 决策不可逆或高伤害 | 固定策略、人工审批、规则引擎、准实验评估 |
| action 影响法定权利或信贷拒绝 | 合规规则、模型验证、公平性审查、人类监督 |
| reward 很稀疏且延迟极长 | causal uplift、surrogate validation、长期 holdout |
| action set 不稳定且无法记录 | 先建设 action catalog 和日志 |
| 无法记录 propensity | 先修复决策平台,不做 OPE 承诺 |
| 监管解释要求强 | 可解释模型、规则约束、原因码和审计抽样优先 |
6.3 产品指标树
Primary reward
-> Incremental conversion / cure / resolution / fraud prevented
Business quality
-> margin, lifetime value, retention, risk-adjusted return
Customer outcome
-> task success, complaint, opt-out, trust, hardship accommodation
Fairness and harm
-> subgroup exposure, adverse outcome, wait time, pricing dispersion
Operational health
-> queue load, manual review capacity, agent override, system latency
Learning health
-> exploration rate, propensity distribution, action diversity, OPE coverage
6.4 场景设计样例
Personalization / Next-best-action
Context:
customer lifecycle, balances, cash-flow volatility, product holdings,
channel, consent, recent events, support history
Actions:
savings nudge, autopay setup, credit education, budgeting tool,
appointment prompt, no-action
Reward:
completed action, 30-day retention, reduced overdraft, lower complaint
Guardrails:
frequency cap, opt-out, vulnerable customer rules, product suitability,
equal exposure to beneficial education
高级判断:
- no-action 必须是合法 action,避免系统为了 reward 过度触达。
- 教育内容和产品 offer 要分开治理,避免把教育伪装成销售。
- reward 应加入长期客户结果,不只看点击。
Offer optimization
Context:
eligibility, channel, relationship depth, cost-to-serve, offer history,
churn risk, profitability, consent, complaint history
Actions:
cashback offer, fee waiver, bundle, rate discount, points boost,
retention call, no-offer
Reward:
incremental acceptance, margin-adjusted revenue, retained relationship
Guardrails:
fairness, pricing dispersion, complaint, cannibalization, offer fatigue
高级判断:
- offer 成本必须进入 reward,否则 bandit 可能偏向高补贴。
- 需要 holdout 估算增量,否则会奖励本来就会转化的人。
- 对弱势或受保护 proxy group,要监控可得性、价格、条件和实际结果。
Dynamic pricing
Context:
risk, demand, funding cost, competitor signal, relationship value,
product constraints, geography, customer segment
Actions:
price / rate / fee level within approved grid
Reward:
risk-adjusted margin, acceptance, retention, default-adjusted value
Guardrails:
fair lending, price discrimination, explainability, complaint,
margin floor, customer harm threshold
高级判断:
- dynamic pricing 是高风险 bandit 场景,不应从黑箱个性化价格开始。
- 可探索空间必须被 policy grid 限制,并保留原因码和价格分布审计。
- 对信贷、保险、财富收费等场景,要由合规和模型风险确认可用特征、定价依据和客户解释。
Fraud friction
Context:
transaction risk, merchant, device, location, account history,
session anomaly, customer vulnerability, prior false positive
Actions:
approve, silent monitor, OTP, biometric step-up, manual review,
temporary decline
Reward:
fraud loss prevented, good transaction approved, friction minimized
Guardrails:
false positive, account access harm, subgroup decline rate,
manual review SLA, complaint, abandonment
高级判断:
- fraud bandit 的 reward 必须同时奖励好客通过和损失减少。
- exploration 不应直接尝试高伤害 decline,探索空间应集中在 friction 强度和路由。
- delayed chargeback 会让 early reward 偏乐观,需要多窗口 reward。
Collections treatment
Context:
delinquency stage, repayment history, cash-flow pattern, hardship signals,
contact preference, prior response, regulatory constraints
Actions:
reminder, self-service plan, hardship offer, agent call,
reduced contact, pause and review
Reward:
cure, sustainable repayment, kept promise, reduced repeat delinquency
Guardrails:
consumer harm, over-contact, complaint, vulnerable customer escalation,
script compliance, long-term re-default
高级判断:
- 催收 bandit 必须把消费者伤害和投诉作为硬 guardrail。
- 短期回款最大化可能伤害长期复原和客户信任。
- 对脆弱客户或 hardship signals,应优先触发人工关怀或保护策略。
Contact center routing
Context:
intent, language, sentiment, customer value, product, queue state,
agent skill, prior contact, case complexity
Actions:
specialist queue, self-service flow, callback, AI assist mode,
retention agent, escalation
Reward:
first contact resolution, CSAT, handle time adjusted by quality
Guardrails:
wait-time fairness, abandonment, repeat contact, complaint,
agent workload, escalation correctness
高级判断:
- routing reward 不能只优化 AHT,否则会牺牲复杂客户和弱势群体。
- 坐席技能和负载是动态 context;action 也受实时 capacity 约束。
- AI assist 建议被坐席采纳与否要记录,避免把人工判断误归因给模型。
7. 风险治理
Contextual bandit 在金融零售中最大的风险不是算法失控,而是“系统持续优化了一个狭窄 reward,同时把伤害外部化给客户、坐席、投诉团队或未来风险”。
7.1 NIST AI RMF 映射
| NIST function | Bandit governance 要点 | 证据 |
|---|---|---|
| Govern | 定义决策 owner、risk tier、探索权限、审批路径、例外机制 | Policy inventory、RACI、approval trail |
| Map | 识别客户、组织和社会层面的风险 | Harm map、decision impact assessment |
| Measure | 度量 reward、guardrail、fairness、uncertainty、OPE 质量 | Metrics catalog、OPE memo、fairness dashboard |
| Manage | 控制流量、预算、回滚、人工介入、事件响应 | Traffic cap、kill switch log、incident review |
7.2 Consumer harm taxonomy
| Harm | 表现 | Bandit 控制 |
|---|---|---|
| Financial harm | 更高费用、不合适价格、损失、重复收费 | approved price grid、cost-aware reward、price dispersion audit |
| Access harm | 合法交易被阻断、账户访问变难、服务等待过长 | false positive guardrail、routing fairness、manual override |
| Conduct harm | 误导性推荐、过度销售、暗示性文案 | content approval、reason code、sales boundary |
| Dignity harm | 催收过度、脆弱客户被强硬触达 | hardship rules、contact cap、human review |
| Privacy harm | context 超出同意目的使用 | consent check、purpose binding、feature allowlist |
| Fairness harm | 某些群体更少拿到优惠或更多遭遇 friction | subgroup exposure / outcome monitoring |
| Operational harm | 坐席负荷不均、人工复核堆积、投诉处理延迟 | capacity-aware action set、ops guardrail |
7.3 Fairness / consumer harm 审查问题
- 哪些 context 特征可能是受保护属性或其 proxy。
- action 是否影响价格、服务可得性、验证强度、催收强度或人工关注。
- 不同群体是否获得相似的有益 action 机会。
- 探索流量是否在某些群体上过度集中。
- reward 是否把投诉、退订、人工覆盖、长期违约、重复来电纳入负向信号。
- 是否存在“利润更高但客户结果更差”的策略。
- 是否能向客户、坐席、审计和监管解释策略边界。
7.4 Kill switch
Kill switch 不是上线后再补的按钮,而是 bandit 决策服务的核心控制面。
| Kill switch 层级 | 触发场景 | 回退目标 |
|---|---|---|
| Policy-level | 单个 policy guardrail 越界 | champion policy 或固定规则 |
| Segment-level | 某客户群、地区、渠道出现异常伤害 | segment fallback |
| Action-level | 某 offer、话术、friction 触发投诉或误伤 | 禁用 action |
| Exploration-level | 探索预算耗尽或 OPE 失真 | exploit-only 或固定 allocation |
| System-level | 日志、propensity、feature store、reward pipeline 异常 | deterministic safe mode |
Kill switch 运行要求:
- 独立于模型部署链路,可由授权业务 / 风险 / 技术负责人触发。
- 触发后保留 decision log、policy version、影响范围、回退时间和原因。
- 每个 high-risk policy 都有预演过的 rollback path。
- kill switch 不只针对模型错误,也针对日志丢失、propensity 异常、队列拥堵、公平性越界和投诉激增。
7.5 上线门禁
| Gate | 通过标准 |
|---|---|
| Decision risk gate | 决策影响、客户权益、监管边界、人工监督已分类 |
| Data and consent gate | context 特征有合法用途、质量 SLO、隐私控制 |
| Logging gate | propensity、action set、policy version、exposure、outcome 可追溯 |
| OPE gate | replay / IPS / doubly robust 有一致性,覆盖和方差可接受 |
| Fairness gate | 关键群体 exposure、outcome、harm 指标未越界 |
| Operations gate | 客服、复核、风控、投诉、催收容量可承接 |
| Financial gate | reward 扣除成本、损失、补贴和运营负担 |
| Rollback gate | kill switch、fallback、监控、事件响应已演练 |
8. 模板
8.1 Contextual Bandit Policy Card
| 字段 | 内容 |
|---|---|
| Policy name | 例如: mobile_next_best_action_linucb_v1 |
| Business objective | 优化客户任务完成和长期活跃,降低过度触达 |
| Decision point | mobile app home after login |
| Risk tier | Medium |
| Population | 已同意营销和服务提醒的活跃零售客户 |
| Exclusions | vulnerable customer flag、open complaint、recent opt-out、ineligible product |
| Context | lifecycle、product holding、cash-flow volatility、recent event、channel history |
| Actions | no-action、autopay prompt、savings nudge、budget tool、advisor appointment |
| Algorithm | LinUCB with capped exploration |
| Exploration budget | 总流量 3%,单客户 30 天一次,任一 action 最低 propensity 0.02 |
| Reward | 7 日任务完成 + 30 日活跃 - opt-out penalty - complaint penalty |
| Guardrails | opt-out、complaint、repeat contact、subgroup exposure、latency |
| OPE method | replay、IPS、doubly robust triangulation |
| Fallback | rule-based next-best-action champion |
| Kill switch owner | Growth PM + Risk Product + On-call Engineering |
8.2 Reward Design Card
| 问题 | 高级答案格式 |
|---|---|
| Reward 是什么 | 明确主结果、时间窗口和单位 |
| Reward 何时可观测 | 即时、7 日、30 日、90 日,多窗口如何组合 |
| Reward 是否可被 gaming | 模型是否会诱导点击、过度触达、过度摩擦 |
| 成本是否进入 reward | 补贴、人工、欺诈损失、投诉处理、资金成本 |
| 客户伤害如何惩罚 | complaint、opt-out、abandonment、hardship escalation |
| 延迟结果如何归因 | decision_id、exposure_id、outcome batch、attribution rule |
| 人工覆盖如何处理 | override 作为负向信号、单独 outcome 或审查样本 |
8.3 Decision Log Schema Brief
Decision event:
decision_id
timestamp
customer_key
channel
decision_surface
context_snapshot_id
feature_version
eligible_actions
blocked_actions_with_reasons
selected_action
action_probability
exploration_mode
policy_version
ruleset_version
explanation_code
Exposure event:
decision_id
exposed_flag
exposed_timestamp
rendered_action
staff_or_customer_surface
Outcome event:
decision_id
reward_value
reward_window
outcome_timestamp
guardrail_flags
complaint_flag
override_flag
fairness_slice_keys
8.4 OPE Review Memo
Policy under review:
Baseline policy:
Candidate policy:
Business decision:
Risk tier:
Data window:
Events used:
Coverage:
Propensity integrity:
Estimator results:
Replay:
IPS:
Doubly robust:
Segment analysis:
Guardrail analysis:
Fairness / consumer harm analysis:
Operational impact:
Decision:
shadow / limited ramp / redesign / freeze / retire
Conditions for next review:
Rollback path:
Approvers:
8.5 Risk Gate Checklist
| 检查项 | Evidence |
|---|---|
| 决策不涉及不可逆高伤害动作,或已有人工审批 | Decision impact assessment |
| 所有 action 有 eligibility 和禁用条件 | Action catalog |
| context 特征有目的限制和同意依据 | Data and consent register |
| logging policy probability 可复现 | Logging QA report |
| low propensity 样本没有主导 OPE 结论 | OPE diagnostics |
| fairness slices 没有明显不利影响 | Fairness dashboard |
| reward 没有把客户伤害排除在外 | Reward card |
| kill switch 可在 SLA 内回退 | Rollback runbook |
8.6 Executive Decision Memo
Decision requested:
Approve limited ramp of contextual bandit policy for [decision surface].
Why now:
Current fixed policy under-serves heterogeneous customer needs and slows learning.
Evidence:
OPE shows candidate policy improves risk-adjusted reward versus champion,
with acceptable variance, overlap and guardrail performance.
Risk controls:
Traffic cap, segment cap, action eligibility, fairness monitoring,
consumer harm guardrails and policy-level kill switch are active.
Decision boundary:
No autonomous changes to credit denial, account closure, legal action,
or high-impact pricing outside approved policy grid.
Scale condition:
Ramp only if reward, guardrail, fairness, operations and logging metrics
remain within thresholds for the review window.
9. 30 天训练计划
目标: 用 30 天把 contextual bandits 从算法概念转化为可落地的金融零售 AI 产品架构能力。默认学习者已经具备高级 BA / PM / 架构基础。
| Day | 主题 | 高级产出 |
|---|---|---|
| 1 | Multi-armed bandit vs contextual bandit vs A/B vs uplift | 一页方法选择矩阵 |
| 2 | LinUCB personalized news paper 精读 | LinUCB 产品架构笔记 |
| 3 | Exploration / exploitation 业务语言 | Exploration budget 模板 |
| 4 | Epsilon-greedy、UCB、LinUCB、Thompson Sampling 对比 | 算法选择备忘录 |
| 5 | Vowpal Wabbit contextual bandit 数据格式 | Context-action-probability-reward schema |
| 6 | Decision inventory for financial retail | 10 个金融零售决策清单 |
| 7 | Action catalog 和 eligibility policy | Offer / routing / friction action catalog |
| 8 | Reward design | Reward Design Card |
| 9 | Propensity-aware logging | Decision Log Contract |
| 10 | Assignment、decision、exposure、outcome 区分 | Telemetry sequence diagram |
| 11 | Offline policy evaluation 基础 | OPE capability map |
| 12 | Replay and IPS | IPS 风险解释 memo |
| 13 | Doubly robust OPE | DR 审查问题清单 |
| 14 | Microsoft MWT / Decision Service | Explore-log-learn-deploy 架构图 |
| 15 | EconML / DoWhy uplift 对比 | Uplift vs bandit 边界说明 |
| 16 | Personalization / next-best-action | 移动银行 NBA policy card |
| 17 | Offer optimization | 成本感知 offer reward tree |
| 18 | Dynamic pricing | Pricing bandit risk gate |
| 19 | Fraud friction | Fraud friction exploration design |
| 20 | Collections treatment | Consumer harm guardrail matrix |
| 21 | Contact center routing | Capacity-aware routing design |
| 22 | Fairness and consumer harm | Harm taxonomy and subgroup metrics |
| 23 | NIST AI RMF 映射 | Govern / Map / Measure / Manage evidence table |
| 24 | Kill switch and rollback | Kill Switch Runbook |
| 25 | OPE Review Memo 演练 | 候选 policy review pack |
| 26 | Ramp plan and stop rules | Limited ramp decision memo |
| 27 | Architecture review | Contextual Bandit Decision Service ADR |
| 28 | Model risk / audit evidence | Evidence binder outline |
| 29 | 高级面试演练 | 8 道 STAR-T 答案 |
| 30 | Capstone | 金融零售 adaptive experimentation portfolio case |
30 天结束时应能产出:
- Contextual Bandit Decision Service 架构图。
- Policy Card、Reward Card、Decision Log Contract、OPE Memo。
- 三个金融零售案例: offer optimization、fraud friction、contact center routing。
- 一个高风险治理案例: collections treatment 或 dynamic pricing。
- 一套面试答案: 算法、产品、架构、风险、合规、OPE、fairness、kill switch。
10. 面试答案
10.1 Contextual bandit 和 multi-armed bandit 的区别是什么
30 秒版本:
Multi-armed bandit 在多个 arms 中学习哪个总体效果最好;contextual bandit 会在每次决策时使用用户、渠道、产品、风险等 context,学习“什么 context 下该选什么 action”。金融零售中的 next-best-action、offer optimization、fraud friction 和 routing 更接近 contextual bandit,因为客户和案件差异决定了最优动作。
2 分钟版本:
Multi-armed bandit 适合低风险、context 不重要或 action 效果差异主要体现在总体平均值的场景,例如几个 banner 文案或内容卡片。Contextual bandit 则把每次决策表示为 context、action、probability、reward 四件事。它只观察被选 action 的 reward,因此必须记录 propensity,才能做 offline policy evaluation。
在金融零售里,contextual bandit 的关键不是算法本身,而是治理: 先用 eligibility 和 policy engine 限制 action set,再用 exploration budget 控制流量和成本,最后用 IPS、doubly robust、guardrail 和 fairness monitoring 判断策略是否能 ramp。对于影响价格、信贷、催收、欺诈拦截的场景,不能把它当普通增长实验处理。
10.2 为什么 LinUCB 适合解释 contextual bandit
30 秒版本:
LinUCB 是 contextual bandit 的经典算法,它假设 reward 可以由 context-action 特征线性解释,并用不确定性上界做探索。它适合向业务解释“模型为什么既利用当前最佳估计,又会探索不确定但有潜力的动作”。
2 分钟版本:
LinUCB 来自 personalized news recommendation 的经典研究。它把用户和内容特征作为 context,用线性模型估计每个 action 的 reward,同时给不确定性更高的 action 一个 upper confidence bound。这样系统不是纯随机探索,而是在高潜力和高不确定之间权衡。
金融零售中,LinUCB 的优势是速度快、可解释、对稀疏场景友好,适合做低到中风险的 next-best-action 或 offer optimization 起点。限制是线性假设可能无法捕捉复杂交互,且它仍然需要高质量 action catalog、propensity logging、reward design 和 fairness guardrail。我的设计会把 LinUCB 放在 governed decision service 内,而不是让模型直接越过资格和风险规则。
10.3 Epsilon-greedy 和 Thompson Sampling 如何选择
30 秒版本:
Epsilon-greedy 简单、透明、容易预算,但探索比较粗;Thompson Sampling 用后验采样自然平衡探索和利用,通常更高效,但对后验建模、约束和解释要求更高。金融零售先看风险和治理成熟度,再选算法。
2 分钟版本:
Epsilon-greedy 的产品优点是容易向业务解释: 大多数流量走当前最佳策略,一小部分流量用于探索。它适合早期平台、低风险内容、文案和入口排序。但它的探索可能不够聪明,所以必须用 eligibility policy 排除明显不合适 action。
Thompson Sampling 更像概率化的 uncertainty-aware 决策。它从每个 action 的后验分布采样,天然让更不确定但潜力高的 action 获得探索机会。它适合样本较多、reward 稳定、团队能解释 posterior 和监控漂移的场景。
在 dynamic pricing、fraud friction、collections 等高风险场景,我会先限制 action grid、加保守探索、设置 segment cap 和 kill switch,而不是单纯追求 Thompson Sampling 的效率。
10.4 Offline policy evaluation 为什么是 bandit 平台的核心
30 秒版本:
Contextual bandit 只看到被选 action 的结果,天然缺少其它 action 的标签。Offline policy evaluation 用带 propensity 的历史日志估计候选策略表现,是上线前过滤风险策略的核心能力,但不能替代线上受控 ramp。
2 分钟版本:
OPE 的前提是历史日志记录了 context、eligible action set、selected action、action probability、policy version、exposure 和 reward。没有 probability,就很难做 inverse propensity scoring;没有 exposure,就无法判断客户是否真的受到策略影响;没有 action set,就无法判断候选 policy 是否有 coverage。
我会用 replay、IPS 和 doubly robust 做三角验证。Replay 保守但样本效率低;IPS 修正选择偏差但可能高方差;doubly robust 结合 reward model 和 propensity weighting,通常更稳。OPE report 不能只给平均 reward,还要给 coverage、置信区间、低 propensity 诊断、分群 guardrail、fairness 和 consumer harm 指标。高风险场景仍需要 shadow、limited ramp 和 kill switch。
10.5 Bandit 和 uplift modeling 如何配合
30 秒版本:
Uplift / CATE 估计“谁会因为 treatment 产生增量效果”,contextual bandit 解决“在每次 context 下选择哪个 action 并持续学习”。前者更偏因果估计和 targeting,后者更偏在线决策和 adaptive experimentation。
2 分钟版本:
EconML / DoWhy 类工具帮助团队声明因果假设、估计 heterogeneous treatment effects,并回答哪些客户真正因干预受益。这对 offer targeting、催收干预、教育提醒非常重要,因为高响应不等于高增量。
Contextual bandit 则把这些洞察放入在线决策循环。比如先用 uplift model 识别最可能从预算工具受益的客户,再让 bandit 在合规 action set 内学习不同渠道、文案、时点和 next-best-action 的组合。成熟做法是让 uplift 提供先验和策略约束,让 bandit 负责持续学习和分配,同时用 OPE 和 holdout 验证长期增量。
10.6 如何设计金融零售 offer optimization bandit
30 秒版本:
我会先建立 action catalog 和资格规则,再设计成本感知 reward,记录 propensity,用 limited exploration 优化不同客户 context 下的 offer,同时把 fairness、价格分布、投诉、退订和 margin 作为上线门禁。
2 分钟版本:
Offer optimization 的 action 不只是“给哪个优惠”,还包括不给 offer、给教育内容、给顾问回访、给 bundle 或 fee waiver。Context 包括资格、渠道、关系深度、历史 offer、客户价值、风险、同意和投诉历史。
Reward 不能只看接受率,因为高补贴会天然提高转化。我会用 margin-adjusted incremental value,扣除补贴、资金成本、运营成本和投诉惩罚。实验上,先用低风险流量和保守 exploration budget,上线前做 OPE,线上用 segment cap 和 fairness dashboard。对可能涉及差别待遇的价格或费用,必须走 legal、compliance、fair lending 和 model risk gate,并保留原因码与审计证据。
10.7 Fraud / collections 场景为什么更难
30 秒版本:
因为 reward 延迟、客户伤害高、错误成本不对称。Fraud 要同时优化损失和好客通过;collections 不能只优化短期回款,还要控制过度触达、脆弱客户伤害、投诉和长期复原。
2 分钟版本:
Fraud friction 的 action 包括放行、OTP、人工复核和拒绝。短期 reward 可能看不到 chargeback,因此要有多窗口 reward。系统必须监控 false positive、账户访问伤害、人工复核 SLA 和分群误杀率。
Collections treatment 的 action 包括提醒、自助还款计划、人工关怀、宽限和降低触达。短期 cure rate 可能掩盖消费者伤害或 repeat delinquency。我的设计会把 hardship signals、contact cap、script compliance、complaint 和 vulnerable customer escalation 作为硬约束,并把 aggressive treatment 排除在普通探索之外。对这两类场景,bandit 更适合优化 friction / treatment 强度和路由,而不是自主决定高伤害动作。
10.8 Kill switch 应该怎么设计
30 秒版本:
Kill switch 必须是 contextual bandit decision service 的一级能力,可以按 policy、segment、action、exploration 或系统级别回退到 champion / rule-based safe mode,并记录触发原因、影响范围和恢复证据。
2 分钟版本:
我会把 kill switch 设计成独立控制面,而不是依赖模型发布流程。触发条件包括 reward 崩坏、guardrail 越界、fairness 异常、投诉激增、propensity 日志异常、feature store 错误、人工队列拥堵和外部风险事件。
回退目标要提前定义: policy-level 回到 champion policy,action-level 禁用问题 offer,segment-level 对特定群体走固定规则,exploration-level 暂停探索,system-level 进入 deterministic safe mode。每次触发都进入 evidence binder,包括 policy version、decision count、客户影响、恢复动作和复盘结论。金融零售里,不能只有“停止模型”,还要确保客户服务、风险处理和人工补救同步启动。
11. 高级总结
Contextual bandits 在金融零售 AI 中的真正价值,不是让实验更自动,而是让高频决策在明确风险边界内持续学习。成熟方案必须同时具备:
- 产品层: decision inventory、action catalog、reward design、exploration budget。
- 架构层: decision API、policy engine、feature store、propensity logging、outcome attribution。
- 评估层: replay、inverse propensity scoring、doubly robust、OPE review、online ramp。
- 治理层: fairness / consumer harm、NIST AI RMF evidence、kill switch、audit trail。
- 业务层: personalization、next-best-action、offer optimization、dynamic pricing、fraud / collections / contact center routing 的场景化边界。
高级 AI PM / Product Architect 的判断标准是:
不是“我们用了 contextual bandit”,而是“我们能证明每一次自适应决策在当时 context、当时 action set、当时 probability、当时约束和后续 outcome 下是可解释、可评估、可治理、可回退的”。