放出了两篇论文:Top-K Off-Policy Correction for a REINFORCE Recommender System和Reinforcement Learning for Slate-based Recommender Systems: A Tractable Decomposition and Practical Methodology。本文不想做论文讲解,已经有同学做的不错了:wd1900.github.io/2019/0(http://wd1900.github.io/2019/06/23/Top-K-Off-Policy-Correction-for-a-REINFORCE-Recommender-System-on-Youtube/)。
有一些基本的 RL 知识,我们得先了解一下,首先是场景的四元组结构:
RL 最大的特点是和环境的交互,是一种 trial-error 的过程,通常我们会用 MDP 来描述整个过程,结合推荐场景,四元组数学定义如下:
• S: a continuous state space describing the user states;
• A: a discrete action space, containing items available for recommendation;
• P : S × A × S → R is the state transition probability;
• R : S × A → R is the reward function, where r(s, a) is the immediate reward obtained by performing action a at user state s;
RL在推荐场景的Label特点
众所周知,RL 是典型的需要海量数据的场景,比如著名的 AlphaGo 采用了左右互博的方式来弥补训练数据不足的问题。但是在推荐场景,用户和系统的交互是动态的,即无法模拟。举个例子,你不知道把一个没有推荐过的商品 a 给用户,用户会有什么反馈。
老生常谈Bias
好在推荐场景的样本收集成本低,量级比较大,但问题是存在较为严重的 Bias 。即只有被系统展示过的物料才有反馈,而且,还会有源源不断的新物料和用户加入。很多公司会采用 EE 的方式去解决,有些童鞋表示 EE 是天问,这个点不能说错,更多的是太从技术角度考虑问题了。
EE 要解决是的生态问题,必然是要和业务形态结合在一起,比如知乎的内容自荐(虽然效果是呵呵的)。这个点估计我们公司是 EE 应用的很成功的一个了,前阵子居然在供应商口中听到了准确的 EE 描述,震惊于我们的业务同学平时都和他们聊什么。
In particular, the fact that we collect data with a periodicity of several hours and compute many policy parameter updates before deploying a new version of the policy in production implies that the set of trajectories we employ to estimate the policy gradient is generated by a different policy.
Moreover, we learn from batched feedback collected by other recommenders as well, which follow drastically different policies.
A naive policy gradient estimator is no longer unbiased as the gradient in Equation (2) requires sampling trajectories from the updated policy πθ while the trajectories we collected were drawn from a combination of historical policies β.
常见的是引入 importance weighting 来解决。看下公式
从公式看,和标准的 objective 比,多了一个因子,因为这个因子是连乘和 rnn 的问题类似,梯度容易爆炸或消失。论文中用了一个近似解,并有人证明了是 ok 的。
(1) While the main policy πθ is effectively trained using a weighted softmax to take into account of long term reward, the behavior policy head βθ′ is trained using only the state-action pairs;
(2) While the main policy head πθ is trained using only items on the trajectory with non-zero reward 3, the behavior policy βθ′ is trained using all of the items on the trajectory to avoid introducing bias in the β estimate.
The immediate reward r is designed to reflect different user activities; videos that are recommended but not clicked receive zero reward. The long term reward R is aggregated over a time horizon of 4–10 hours.
论文[2]中没有细讲。
两篇论文中还有很大的篇幅来讲 Simulation 下的结果,[1]的目的是为了证明作者提出的 correction 和 topK 的作用,做解释性分析挺好的,[2]做了下算法对比,并且验证了对 user choice model 鲁棒,但我觉得对实践帮助不大。
One more thing:
TopK在解决什么问题?
listwise 的问题
主流的个性化推荐应用,都是一次性给用户看一屏的物料,即给出的是一个列表。而目前主流的个性化技术,以 ctr 预估为例,主要集中在预估单个物料的ctr,和真实场景有一定的 gap 。当然,了解过 learning to rank 的同学,早就听过 pointwise、pairwise、listwise,其中 listwise 就是在解决这个问题。
通常,listwise 的 loss 并不容易优化,复杂度较高。据我所知,真正在实践中应用是不多的。RL在推荐场景,也会遇到相同的问题。但直接做 list 推荐是不现实的,假设我们一次推荐 K 个物料,总共有 N 个物料,那么我们能选择的action 就是一个排列组合问题,C_N_K * K!个,当 N 是百万级时,量级非常夸张。
这种情况下,如果不做些假设,问题基本就没有可能在现实中求解了。
youtube 的两篇论文,都将问题从 listwise(他们叫slatewise)转化成了itemwise 。但这个 itemwise 和我们常规理解的 pointwise 的个性化技术还是有区别的。在于这个 wise 是 reward 上的表达,同时要引申出 user choice model 。
user choice model
pointwise 的方法只考虑单个 item 的概率,论文中提出的 itemwise,虽然也是认为最后的 reward 只和每个被选中的 item 有关,且 item 直接不互相影响,但它有对 user choice 做假设。比如论文[2]还做了更详细的假设,将目标函数的优化变成一个多项式内可解的问题:
这两个假设也蛮合理的,SC 是指用户一次指选择一个 item,RTDS 是指reward 只和当前选择的 item 有关。
有不少研究是专门针对 user choice model 的,一般在经济学中比较多。推荐中常见的有 cascade model 和 mutilnomial logit model,比如 cascade model,会认为用户选择某个 item 的概率是 p,那么在一个 list 下滑的过程中,点击了第 j 个 item 的概率是 (1-p(i))^j * p(j).
论文[1]中最后的 objective 中有一个因子,表达了 user choice 的假设:
简单理解就是,用 π 当做用户每次选择的概率,那上面就是 K-1 不选择 a 概率的连乘。而论文[2]中,RL 模型和现有的监督模型是融合在一起的,直接用 pCTR 模型预估的 pctr 来当这个 user choice 的概率。
最后
这篇写的有点长,但就算如此,看了本文也很难让大家一下子就熟悉了 RL,希望能起到抛砖引玉的作用吧。从实践角度讲,比较可惜的是 long term reward 的建模、tensorflow 在训练大规模 RL 应用时的问题讲的很少。最后,不知道 youtube 有没有在 mutil-task 上深入实践过,论文[2]中也提到它在 long term 上能做一些事情,和 RL 的对比是怎么样的。
参考
[1] Top-K Off-Policy Correction for a REINFORCE Recommender System
[2] Reinforcement Learning for Slate-based Recommender Systems: A Tractable Decomposition and Practical Methodology*
[3] slideslive.com/38917655
[4] zhuanlan.zhihu.com/p/72
[5] 强化学习中on-policy 与off-policy有什么区别?zhihu.com/question/5715
[6] wd1900.github.io/2019/0
原文链接:
https://zhuanlan.zhihu.com/p/77494496
(*本文为 AI 科技大本营转载文章,转载请联系原作者)