youtube_recommender_system/solution_approach

Solution Approach


We will approach this problem using a structured framework. A framework-based approach ensures we cover all aspects of the problem statement. Any ML system design solution can typically be divided into four sections. The diagram below highlights these four steps in sequence, and we will discuss our solution accordingly.
YouTube Video Recommendation System Design Steps
1. Requirements Clarification:

  • Clarifications related to the problem statement

    Since the problem statement mentions building a system for both new and existing users, it's important to note that the "cold start" problem applies to new users. The solution for new users could differ significantly from that for existing users. If this is not clearly mentioned, it's a good idea to clarify this point at the beginning of the interview.

  • Scale of the problem

    How many active users are on the platform? How many videos will be available? Let's assume there are 1 million active users per day and 100 million videos. If each user visits the platform at least 5 times a day, we need to design a solution that operates at scale.

  • Latency requirements of the system

    Will the system be deployed in an online (real-time inference) or offline setting? This is something you should clarify with the interviewer. In general, recommender systems are deployed in online settings. For this case, we will consider a real-time inference scenario.

2. Final Problem Statement

Design a YouTube video recommendation system that serves millions of users and handles millions of videos. The system should cater to both existing and new users and be deployable in a real-time environment.

3. High-Level Solution and Life Cycle of the End-to-End System

Before diving into the solution details, it's helpful to draw an end-to-end system diagram to clarify the full picture. The diagram below illustrates the high-level overview of the system. The life cycle of the complete system can be described as follows:

  • The user visits the YouTube homepage
  • The user ID is fetched and sent to the ML model API
  • Based on the user ID, data is retrieved from the user feature datastore and video feature datastore
  • The ML model processes the user and video features and generates the top 10 most relevant video recommendations
  • The list of recommended videos is sent back to the YouTube homepage

YouTube Video Recommendation System
4. Detailed Solution

Once we have covered the first three steps, it's time to discuss the low-level design of the ML system. In the next section and onwards, we will dive into the detailed solution.