Applied ML systems
YouTube recommendations, 2016
A case study of the 2016 YouTube paper. Two stages, candidate generation then ranking, with embeddings for videos and a watch-time objective. It is still the clearest public blueprint.
The 2016 paper Deep Neural Networks for YouTube Recommendations by Covington, Adams and Sargin is still the clearest public picture of a large feed recommender. The setup was hundreds of millions of users and millions of videos, with recommendations needed in a fraction of a second. The paper's answer is the two-stage design this section has been building toward.
Stage 1: candidate generation
The first network turns the user's watch history, search history and demographics into one vector. Each video has an embedding learned like a word vector, similar to word2vec.
Training treats recommendation as extreme multiclass prediction. Given the user's context, predict the next video watched, out of millions, using sampled softmax. At serving time, a nearest-neighbor search over video embeddings returns a few hundred candidates.
The paper also lists practical tricks:
- Average the embeddings of the videos a user watched, rather than using one at a time.
- Feed the age of each example, so the model learns that fresh content matters.
- Do not underweight new videos, which would starve them of exposure.
Stage 2: ranking
A deeper second network scores each candidate with hundreds of features. These include the candidate video itself and the user's history relative to that video.
The ranking objective weighted examples by watch time. Plain click probability favored misleading thumbnails. Optimizing for expected watch time pushed the feed toward videos people actually watched.
Walking through the funnel
For one user request:
- The first stage collects a few hundred videos from embedding search.
- The second stage scores each of them with the richer features.
- The list is sorted by predicted watch time and returned.
Each stage has a different job. Retrieval must be fast and must not miss good videos. Ranking must be accurate on a short list.
What still holds
- Offline metrics guide iteration, but live A/B tests decide launches.
- Some features that look odd, such as example age, matter a lot.
- Separating retrieval from ranking lets each stage use its own features and loss.
- Watch time beats clicks as a target for long-form video.
A later talk describes how the platform adapted large language models for recommendations at very large scale. It is worth watching after the 2016 paper, to see what changed:
Common mistakes
- Copying the architecture without the objective. The watch-time target did as much work as the network.
- Treating the paper as current. The ideas last, but the models and scale have changed. Read it as a blueprint, not a recipe.
Check yourself
- Why did the paper prefer expected watch time over click probability? Answer: click-optimized models favored misleading thumbnails, while watch time rewarded videos people finished.
- What is the job of the first stage? Answer: to return a few hundred candidates quickly, with high recall.
Key takeaways
- The 2016 design was two stages: embedding-based candidate generation, then a deeper ranker.
- Video embeddings were learned like word vectors and searched with nearest neighbors.
- The objective, expected watch time, mattered as much as the architecture.
- Retrieval favors recall and speed. Ranking favors precision on a short list.
Further learning
Read the original paper:
Deep Neural Networks for YouTube Recommendationsresearch.google
The section overview, with the full funnel, is recommender systems.
Related
Two-tower retrieval
A two-tower model embeds users and items separately, so item vectors can be indexed in advance and a nearest-neighbor search finds candidates fast.
Ranking and learning to rank
Second-stage ranking for search, feeds and ads. Learning to rank, ranking metrics, LambdaMART, CTR models, position bias and calibration. Start here for the map.
Implicit feedback and objectives
Most recommender training data is implicit, such as clicks, watches and skips. Those signals are plentiful but noisy, and the objective you choose decides what the system learns.