知行编程网知行编程网  2022-07-13 17:00 知行编程网 隐藏边栏 |   抢沙发  39 
文章评分 0 次,平均分 0.0

字节跳动Deep Retrieval召回模型笔记

今天讲讲字节的一个召回的文章:《Deep Retrieval: An End-to-End Learnable Structure Model for Large-Scale Recommendations》(后台回复【dr】可下载)

召回因为候选集个数多,一般用MIPS的思路做,这样的问题在于:

1、向量最大内积模型表达 能力有限,缺少特征交互;

2、ANN的时候会通过聚类减小候选集(IVFAQ),但是这个聚类建立索引的过程,跟召回模型的训练是分开的,效果肯定不好;可能存在召回模型学好了,但是检索不出来的情况。

召回的时间复杂度:T*N <= Bound,目前的思路是在inference阶段减小候选集N(如TDM,beam search),这样就需要确定一个item的空间划分结构,这个结构是和模型训练阶段做joint learning的。因为空间结构是离散的,所以joint learning其实是一种EM算法,将空间结构当做是latent variable。细看,其实TDM也是这种范式,M step训练item embedding,E step通过聚类得到空间结构。

回到字节这篇paper DR上来

DR在item空间结构划分上,字节的DR用了一种矩阵结构,矩阵里面的路径对应item。

结构

使用一个D x K维的矩阵来作为索引结构。模型预测需要走D步,每一步有K种选择。走到最后会有K^D可能的路径(也可以叫做编码),每一条路径可以代表一个包含多个item的集合,每个item反过来也可以同时在多条路径的集合里面。路径可以看做是一个聚类结果。

不同的路径之间可能有交叉(有交叉的应该比较类似)

字节跳动Deep Retrieval召回模型笔记

Objective

1、Structure Objective

每一层是一个MLP,输出K个概率,表示包含这个节点的概率,假设每个item对应的路径π固定。

1、emb(x)输入第一层MLP,生成K维的概率;

2、将路径上所有的embedding 全部concatenate起来,扔进去第d层的MLP内;

字节跳动Deep Retrieval召回模型笔记

最后的概率是路径上所有概率的乘积:

字节跳动Deep Retrieval召回模型笔记

如果每个节点表示一个类别,多个类别乘起来,不过这不是独立的,所以怪怪的。

损失函数是log likehood,这里用(xi, yi)表示user,item,用π表示item->K^D条路径的映射。Π(yi)表示item yi对应的path

字节跳动Deep Retrieval召回模型笔记

2、Multi-path structure Objective

每个节点属于多个路径,而不是单个,这是因为很多item都会被归到多个类里面去。比如巧克力和cake,既是food也是gift。而在TDM中,每个叶子节点只能表示一个item,一个item也只能包含在一个内部节点中。

DR将一个item对应J个path去。这个看到后面就很清楚了,其实一个item在EM算法的框架里面是可以对应K^D的路径的,但是每条路径对应的概率不同,现在是截断,取top J条。这里的π也表示item->path的路径,只不过现在有J个映射

字节跳动Deep Retrieval召回模型笔记

Learning

这里面item对应的路径是离散的,无法通过梯度下降去优化。Item->path的映射可以与聚类有点类似。所以用EM算法 train

下面是一个整体流程:

字节跳动Deep Retrieval召回模型笔记

其中:

字节跳动Deep Retrieval召回模型笔记

表示item在这个路径上所有概率的加权(item对应所有user加权)

每个item v, 通过beam search,在每一层选出J个node,最后得到J个路径。遍历所有item后就得到了item->path的map π

这里,将multi-path objective变换为遍历所有的item v,里面是item v对应的所有user->item pair

字节跳动Deep Retrieval召回模型笔记

为了保证数值稳定性,这里用凸函数求了一个上界

字节跳动Deep Retrieval召回模型笔记

其中

字节跳动Deep Retrieval召回模型笔记

表示item v对应的user->item总数

正则化

DR这里的EM step貌似和我理解的是反的。我理解E step是得到隐含变量的概率(也就是item对应的top J path的概率);而M step是优化参数。字节的DR在E step是优化参数,M step是得到隐含变量的概率。在E step,优化的structure model可能出现overfit,导致某个path的概率很大;所以在M step,所有的item都到这个path去,导致无法聚类。所以在M step引入了path对应的item总数作为正则。

字节跳动Deep Retrieval召回模型笔记

讨论

其实有几点的还是比较迷惑的,作者最后也说了

1、structure model的probability只是用了user侧的特征,没有用item的特征;

2、只是用了positive example来做;

还有一点是这个模型没法用item侧的特征,类似于YouTubeDNN,属于单侧建模。


<section data-brushtype="text" style="padding-right: 0em;padding-left: 0em;white-space: normal;letter-spacing: 0.544px;color: rgb(62, 62, 62);font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;widows: 1;word-spacing: 2px;caret-color: rgb(255, 0, 0);text-align: center;"><strong style="color: rgb(0, 0, 0);font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;letter-spacing: 0.544px;"><span style="letter-spacing: 0.5px;font-size: 14px;"><strong style="font-size: 16px;letter-spacing: 0.544px;"><span style="letter-spacing: 0.5px;">—</span></strong>完<strong style="font-size: 16px;letter-spacing: 0.544px;"><span style="letter-spacing: 0.5px;font-size: 14px;"><strong style="font-size: 16px;letter-spacing: 0.544px;"><span style="letter-spacing: 0.5px;">—</span></strong></span></strong></span></strong></section><pre style="padding-right: 0em;padding-left: 0em;letter-spacing: 0.544px;color: rgb(62, 62, 62);widows: 1;word-spacing: 2px;caret-color: rgb(255, 0, 0);text-align: center;"><pre><section style="letter-spacing: 0.544px;white-space: normal;font-family: -apple-system-font, system-ui, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", Arial, sans-serif;"><section powered-by="xiumi.us"><section style="margin-top: 15px;margin-bottom: 25px;opacity: 0.8;"><section><section style="letter-spacing: 0.544px;"><section powered-by="xiumi.us"><section style="margin-top: 15px;margin-bottom: 25px;opacity: 0.8;"><section><section style="margin-bottom: 15px;padding-right: 0em;padding-left: 0em;color: rgb(127, 127, 127);font-size: 12px;font-family: sans-serif;line-height: 25.5938px;letter-spacing: 3px;"><span style="color: rgb(0, 0, 0);"><strong><span style="font-size: 16px;font-family: 微软雅黑;caret-color: red;">为您推荐</span></strong></span></section><section style="margin-top: 5px;margin-bottom: 5px;padding-right: 0em;padding-left: 0em;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;opacity: 0.8;line-height: normal;">一文了解深度推荐算法的演进</section><section style="margin-top: 5px;margin-bottom: 5px;padding-right: 0em;padding-left: 0em;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;opacity: 0.8;line-height: normal;">干货 | 算法工程师超实用技术路线图</section><section style="margin-top: 5px;margin-bottom: 5px;padding-right: 0em;padding-left: 0em;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;opacity: 0.8;line-height: normal;"><span style="font-size: 14px;">13个算法工程师必须掌握的PyTorch Tricks</span></section><section style="margin-top: 5px;margin-bottom: 5px;padding-right: 0em;padding-left: 0em;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;opacity: 0.8;line-height: normal;"><span style="font-size: 14px;">吴恩达上新:生成对抗网络(GAN)专项课程</span><br  /></section><section style="margin-top: 5px;margin-bottom: 5px;padding-right: 0em;padding-left: 0em;min-height: 1em;font-family: sans-serif;letter-spacing: 0px;opacity: 0.8;line-height: normal;">拿到2021灰飞烟灭算法岗offer的大佬们是啥样的<span style="font-size: 14px;">?</span></section></section></section></section></section></section></section></section></section>

字节跳动Deep Retrieval召回模型笔记

本篇文章来源于: 深度学习这件小事

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

知行编程网
知行编程网 关注:1    粉丝:1
这个人很懒,什么都没写

发表评论

表情 格式 链接 私密 签到
扫一扫二维码分享