SDE & MLE Prep

Recommendation System (YouTube / Netflix / TikTok)

Goal: maximize long-term engagement (e.g. watch time, satisfied sessions), not just clicks.

billions of items
   |  CANDIDATE GENERATION (recall, ~ms): two-tower ANN retrieval, co-visitation, trending,
   |                                       subscriptions, ...   -> ~1000 candidates
   v
   RANKING (precision): deep model with rich features, multi-task heads
   |                    (p(click), p(watch>30s), p(like), p(share)) -> weighted score -> ~100
   v
   RE-RANKING / POLICY: diversity, freshness, dedupe, business rules, fairness -> final ~20
   v
   logging -> training data (impressions + outcomes) -> retrain (daily / streaming)
  • Two-tower model: user tower (history, context) and item tower (content, stats) map into the same embedding space; trained with in-batch negatives / sampled softmax; item embeddings indexed in an ANN store (HNSW / ScaNN).
  • Ranking features: user–item interactions, item popularity & freshness, creator affinity, context (time, device), cross features.
  • Cold start: content-based features, popularity priors, exploration (bandits) for new items; onboarding questions for new users.
  • Pitfalls: position bias (log position, use it as a feature during training and fix it at serving), feedback loops / popularity bias, clickbait (optimize satisfaction signals), delayed labels.
  • Metrics: offline recall@k, NDCG, AUC per head; online watch time, retention, diversity, DAU.