Guide

A recommender system picks a handful of items from a catalog that may hold millions or billions, under a tight latency budget, for a user who has not typed a query. Netflix, YouTube, Spotify, Amazon, Instagram and news feeds share the same skeleton. They retrieve a shortlist cheaply, score it carefully, then apply business rules before the user sees a few cards.

The hard part is not training a neural net. It is choosing what to optimize, learning from feedback that is mostly silent, keeping popular items from drowning out the rest, and keeping a multi-stage system fresh as the catalog changes. The concepts below build that picture. Ranking covers how the second stage orders the shortlist, and news feed covers the systems side.

The funnel

  1. Candidate generation uses one or more retrievers, such as a two-tower model, co-visitation graphs, trending items or subscriptions. Their outputs are merged and deduplicated. The goal is high recall.
  2. Ranking scores each candidate with many features. The goal is to order the shortlist well.
  3. Re-ranking applies rules: diversity, freshness, creator fairness, age gates, ad insertion and "seen recently" filters.

A homepage usually merges several generators, such as "Continue watching," "Because you watched X," "Trending" and "Friends liked." One giant model that scores the full catalog is clean on paper, but almost never shippable at consumer scale.

Concepts in this section

Read them in order. The first two are the basis for the retrieval step.

StepConceptWhat it answers
1Implicit feedback and objectivesWhat do clicks and skips mean, and what should the system optimize?
2Matrix factorizationHow do you turn interactions into vectors and predict affinity?
3Two-tower retrievalHow do you search millions of items in milliseconds?
4Cold start and feedback loopsWhat goes wrong with new items, popular items and the model's own data?
5YouTube recommendations, 2016How did one large system put these pieces together?

Common mistakes

  • Arguing about architecture before the metric. Settle the product goal first. Clicks, watch time and satisfaction lead to different systems.
  • Reading logs without absences. Impressions, positions and items that were never shown matter as much as clicks.
  • Assuming retrieval finds everything. Retrieval can miss good items. Invest in recall until online metrics stop moving.

Key takeaways

  • Recommenders are multi-stage: cheap, high-recall retrieval, then an accurate ranker, then rules and diversity.
  • Implicit feedback is abundant and noisy. Pick objectives carefully, since watch time is not clicks.
  • Matrix factorization is the classic baseline. Two-tower models with ANN search are the modern retrieval default.
  • Cold start, popularity bias and feedback loops often hurt more than the model architecture does.
  • Large language models mostly improve item and query embeddings and content features inside this funnel. End-to-end generative ranking of the whole catalog is still early.

Further learning

Recommendation Systems course (Google)Introduction  |  Machine Learning  |  Google for DevelopersGoogle for Developers System Design for Recommendations and Search (Eugene Yan)Breaking it into offline vs. online environments, and candidate retrieval vs. ranking steps.eugeneyan.com

Devansh Tandon of YouTube talks about adapting LLMs for video recommendations at very large scale. Watch it after the 2016 paper:

Teaching Gemini to Speak YouTube: Adapting LLMs for Video Recommendations to 2B+DAU - Devansh TandonAI Engineer