MSD0006 Video Recommendation System



How would you design a scalable and personalized video recommendation system for a platform like YouTube, Netflix, or TikTok that can recommend relevant videos in real time to billions of users?

Line-art scene: a user with a phone facing a huge wall of video thumbnails labeled billions of videos, with a question mark leading to a clean top twenty feed on the phone

The Problem: billions of videos, billions of users, one feed request at a time. Pick the top-20 most relevant videos for this user in milliseconds.

Answer

A modern recommendation system uses a multi-stage pipeline to narrow billions of videos down to a top-20 list for a user in milliseconds. It typically consists of Candidate Generation (filtering down to hundreds), Ranking (scoring those hundreds with deep learning), and Re-ranking (applying business logic for diversity, freshness, and safety). The full path is: Data Logging → Candidate Generation → Ranking → Re-ranking → Serving.

(1) Multi-Stage Pipeline: No single model can score a billion items per request. The funnel makes it affordable: retrieve ~500 candidates cheaply, then rank precisely, then polish.
(2) Data & Features: User signals (watch history, watch time, likes, skips, follows), video features (visual/audio/text embeddings, popularity, freshness), and context (time of day, device, network).
(3) Candidate Generation: Multi-source retrieval (collaborative filtering / two-tower, content-based, seed-based co-watch, trending), merged and deduplicated to ~100-500.
(4) Ranking: A deep model scores the candidates: DNNs on hundreds of features, Multi-Task Learning heads (click, watch time, like, share), and sequence models for session context.
(5) Re-Ranking: Business and quality constraints: remove seen/unsafe items, inject diversity and freshness, fight filter bubbles.

Funnel diagram: billions of videos narrow through candidate generation to about five hundred, through ranking to a top twenty list, then re-ranking and serving to the user feed

Figure 1: The recommendation funnel: each stage trades breadth for precision: cheap retrieval cuts billions to hundreds, the ranking model orders them precisely, and re-ranking applies the final business logic before serving.

Clarify Before Designing:
(1) Scale: how many videos, daily active users, and feed requests per second?
(2) Latency Budget: how many milliseconds for a feed request, end to end?
(3) Objectives: what are we optimizing (clicks, watch time, long-term satisfaction), and are there multiple conflicting goals?
(4) Cold Start Volume: how many new users and new videos arrive daily?
(5) Constraints: ads insertion, content safety, regional/legal rules that override relevance?


Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *