Design a YouTube Recommendation System

Quick Overview

Design a recommendation engine for YouTube. Cover candidate generation, ranking models, user embedding and content features, handling cold start for new videos, and balancing engagement with content diversity.

Google
System Design
Software Engineer
Google
Software Engineer
Onsite
System Design
Hard

0


Design a recommendation engine for YouTube. Cover candidate generation, ranking models, user embedding and content features, handling cold start for new videos, and balancing engagement with content diversity.

This is a classic Google onsite system design prompt, often framed around YouTube's home feed and Up Next surfaces where recommendations drive most watch time. The interviewer is checking whether you can split the problem into candidate generation and ranking, reason about serving latency at billions of users, and handle real product tensions like cold start for fresh uploads and engagement versus diversity.

What the Interviewer Expects
  • Separate the pipeline into candidate generation (retrieving hundreds of videos from billions) and a heavier ranking stage, and explain why two stages are needed for latency.
  • Describe user and video embeddings, how they are trained from watch history and content features, and how approximate nearest neighbor search serves them.
  • Choose a ranking objective beyond clicks, such as expected watch time or satisfaction signals, and explain how it avoids rewarding clickbait.
  • Propose a concrete cold start strategy for new videos and new users, such as content-based features, creator priors, and controlled exploration traffic.
  • Add a re-ranking layer that enforces diversity and freshness constraints without collapsing relevance.
  • Give rough capacity numbers and a plan for real-time feature updates, caching, and graceful degradation when a model or store is unavailable.
Key Topics to Cover
Two-stage candidate generation and ranking
User and video embeddings with ANN retrieval
Watch-time ranking objectives
Cold start and exploration
Diversity re-ranking
Real-time feature pipelines
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you measure whether recommendations are improving long-term user satisfaction rather than just short-term watch time?
  • A new video from a small creator gets almost no impressions. How do you give it a fair chance without hurting the experience for most users?
  • How do you keep user embeddings fresh within minutes of a user's behavior changing, and what does that cost?
  • How would you detect and limit feedback loops where the model keeps recommending the same narrow set of content?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Functional Requirements:
    • Generate personalized video recommendations based on user preferences and behavior.
    • Rank videos for users based on engagement metrics (click-through rate, watch ...
Capacity Estimation

Assuming YouTube has:

  • 2 billion monthly active users (MAUs)
  • Each user watches approximately 10 videos per day.
  • An average video length of 10 minutes, leading to around 1 billion videos watched d...

Submit Your Answer
Markdown supported