召回模型:Youtube

文章目录

  • Deep Neural Networks for YouTube Recommendations(2016)
    • 1. Candidate generation
      • 1.1 Recommendation as Classification
      • 1.2 Model Architecture
      • 1.3 Heterogeneous Signals
      • 1.4 Label and Context Selection
    • 2. Ranking
      • 2.1 Feature Representation
      • 2.2 Modeling Expected Watch Time
    • 3. 问题与思考

Deep Neural Networks for YouTube Recommendations(2016)

Deep Neural Network for YouTube Recommendationr

参考文章:
Deep Neural Network for YouTube Recommendation论文精读

重读Youtube深度学习推荐系统论文,字字珠玑,惊为神文

YouTube深度学习推荐系统的十大工程问题

揭开YouTube深度推荐系统模型Serving之谜
召回模型:Youtube_第1张图片

  • candidate generation model:输入user history,候选视频集合由百万(millions)降低到了百(hundreds)的量级
  • ranking model

The candidate generation network only provides broad personalization via collaborative filtering. The similarity between users is expressed in terms of coarse features such as IDs of video watches, search query tokens and demographics.

1. Candidate generation

1.1 Recommendation as Classification

将推荐问题建模成一个“超大规模多分类”问题。即在时刻t,为用户U(上下文信息C)在视频库V中精准的预测出视频 i 的类别(每个具体的视频视为一个类别,i 即为一个类别),即:
P ( w t = i ∣ U , C ) = e v i u ∑ j ∈ V e v j u P\left(w_{t}=i \mid U, C\right)=\frac{e^{v_{i} u}}{\sum_{j \in V} e^{v_{j} u}} P(wt=iU,C)=jVevjueviu

而这种超大规模分类问题上,至少要有几百万个类别,实际训练采用的是Negative Sampling

1.2 Model Architecture

召回模型:Youtube_第2张图片
整个模型架构是包含三个隐层的DNN结构。输入是用户浏览历史、搜索历史、人口统计学信息和其余上下文信息concat成的输入向量;输出分线上和离线训练两个部分。

离线训练阶段输出层为softmax层,而线上则直接利用user向量查询相关商品。我们利用类似局部敏感哈希(Locality Sensitive Hashing paper)的算法为用户提供最相关的N个视频。

主要特征:

(1)用户历史搜索query:把历史搜索的query分词后的token的embedding向量进行加权平均,能够反映用户的整体搜索历史状态
(2)用户观看视频:对用户历史观看的视频信息生成embedding向量进行加权平均(如文本|类目|品牌等),反映出视频的信息
(3)用户基本信息:年龄、性别、地域等,使用 x 2 x^2 x2等增加数值型特征的非线性
(4)其他上下文信息:设备、视频上架时间(example age)

A user’s watch history is represented by a variable-length sequence of sparse video IDs which is mapped to a dense vector representation via the embeddings. The network requires fixed-sized dense inputs and simply averaging the embeddings performed best among several strategies (sum, component-wise max, etc.)

  • Question:何时把embedding和DNN分开训练?何时联合训练?
  • Question:为什么在online serving的时候不直接用这套网络进行预测而要使用nearest neighbor search 的方法?

1.3 Heterogeneous Signals

We consistently observe that users prefer fresh content, though
not at the expense of relevance.

由于ML在训练阶段都是利用过去的行为预估未来,因此通常对过去的行为有个隐式的bias。视频网站视频的分布是高度非静态(non-stationary)的,但我们的推荐系统产生的视频集合的分布,基本上反映的是训练所取时间段的平均的观看喜好的视频。因此我们我们把样本的 “age” 作为一个feature加入模型训练中。从下图可以很清楚的看出,加入“example age” feature后和经验分布更为match。
召回模型:Youtube_第3张图片

1.4 Label and Context Selection

  • 使用更广的数据源:不仅仅使用推荐场景的数据进行训练,其他场景比如搜索等的数据也要用到,这样也能为推荐场景提供一些explore。

Training examples are generated from all YouTube watches(even those embedded on other sites) rather than just watches on the recommendations we produce. Otherwise, it would be very difficult for new content to surface and the recommender would be overly biased towards exploitation.

  • 为每个用户生成固定数量训练样本:如果为每个用户固定样本数量上限,平等的对待每个用户,避免loss被少数active用户domanate,能明显提升线上效果。

Another key insight that improved live metrics was to generate a fixed number of training examples per user, effectively weighting our users equally in the loss function. This prevented a small cohort of highly active users from dominating the loss.

  • 抛弃序列信息:对过去观看视频/历史搜索query的embedding向量进行加权平均。

Unsurpisingly, reproducing the user’s last search page as homepage recommendations performs very poorly. By discarding sequence information and representing search queries with an unordered bag of tokens, the classifier is no
longer directly aware of the origin of the label.

注:sequence方法应用得当模型效果会更好,该点不推荐。

  • 不对称的共同浏览(asymmetric co-watch)问题:asymmetric co-watch是指用户在浏览视频时候,往往都是序列式的,开始看一些比较流行的,逐渐找到细分的视频。图(a)是held-out方式,利用上下文信息预估中间的一个视频;图(b)是predicting next watch的方式,则是利用上文信息,预估下一次浏览的视频,避免引入future information,产生与事实不符的数据穿越。召回模型:Youtube_第4张图片

2. Ranking

Ranking架构和Candidate generation保持高度一致,主要不同点在于特征和最后的输出层。
召回模型:Youtube_第5张图片

主要特征

  • impression video ID embedding: 当前要计算的video的embedding
  • watched video IDs average embedding: 用户观看过的最后N个视频embedding的average pooling
  • language embedding: 用户语言的embedding和当前视频语言的embedding
  • time since last watch: 自上次观看同channel视频的时间
  • #previous impressions: 该视频已经被曝光给该用户的次数

2.1 Feature Representation

特征工程中最难的是如何建模用户时序行为(temporal sequence of user actions),并且关联这些行为和item。

最重要的Signal是描述用户与商品本身或相似商品之间交互的Signal,这与Facebook在14年提出LR+GBDT模型的paper中得到的结论是一致的。比如我们要度量用户对视频的喜欢,可以考虑用户与视频所在频道间的关系:

  • 数量特征:浏览该频道的次数?
  • 时间特征:time since last watch

We observe that the most important signals are those that describe a user’s previous interaction with the item itself and other similar items, matching others’ experience in ranking ads.

其次,可以将candidate generation阶段的信息传入ranking。

which sources nominated this video candidate? What scores did they assign?

另外,一些负反馈signal也同样重要,比如曝光未点击。

众所周知,NN对输入特征的尺度和分布都是非常敏感的,实际上基本上除了Tree-Based的模型(比如GBDT/RF),机器学习的大多算法都如此。

2.2 Modeling Expected Watch Time

揭开YouTube深度推荐系统模型Serving之谜

为预测观看时长,训练阶段网络最后一层用的是 weighted logistic regression。将watch time作为正样本的weight,在线上serving中使用 e W x + b = o d d s e^{Wx+b}=odds eWx+b=odds做预测可以直接得到expected watch time的近似。

由于在视频推荐场景中,用户打开一个视频的概率p往往是一个很小的值,因此
O d d s ( i ) = w i p 1 − w i p ≈ w i p = T i p = E ( T i ) O d d s(i)=\frac{w_i p}{1-w_i p} \approx w_i p=T_i p=E\left(T_i\right) Odds(i)=1wipwipwip=Tip=E(Ti)

一般来说,有两种办法训练Weighted LR:

  • 将正样本按照weight做重复sampling,然后输入模型进行训练;
  • 在训练的梯度下降过程中,通过改变梯度的weight来得到Weighted LR。

Question:两种方法有何不同?还有其他方法吗?

3. 问题与思考

  1. 文中把推荐问题转换成多分类问题,在next watch的场景下,每一个备选video都会是一个分类,因此总共的分类有数百万之巨,这在使用softmax训练时无疑是低效的,这个问题Youtube是如何解决的?

  2. 在candidate generation model的serving过程中,Youtube为什么不直接采用训练时的model进行预测,而是采用了一种最近邻搜索的方法?

  3. Youtube的用户对新视频有偏好,那么在模型构建的过程中如何引入这个feature?

  4. 在对训练集的预处理过程中,Youtube没有采用原始的用户日志,而是对每个用户提取等数量的训练样本,这是为什么?

  5. Youtube为什么不采取类似RNN的Sequence model,而是完全摒弃了用户观看历史的时序特征,把用户最近的浏览历史等同看待,这不会损失有效信息吗?

  6. 在处理测试集的时候,Youtube为什么不采用经典的随机留一法(random holdout),而是一定要把用户最近的一次观看行为作为测试集?

  7. 在确定优化目标的时候,Youtube为什么不采用经典的CTR,或者播放率(Play Rate),而是采用了每次曝光预期播放时间(expected watch time per impression)作为优化目标?

  8. 在进行video embedding的时候,为什么要直接把大量长尾的video直接用0向量代替?

  9. 针对某些特征,比如#previous impressions,为什么要进行开方和平方处理后,当作三个特征输入模型?

  10. 为什么ranking model不采用经典的logistic regression当作输出层,而是采用了weighted logistic regression?

你可能感兴趣的:(推荐系统,深度学习,人工智能)