Design the YouTube Recommendation System

    A video recommendation system (YouTube home feed) picks the best few videos from a corpus of billions, optimizing for long-term engagement (watch-time). The standard architecture is two-stage: candidate generation then deep ranking.

    AI & Machine Learning, 7 components, about 40 min

    The full guide covers requirements, estimates, the API, the data model, deep dives, trade-offs, failure modes and the follow-up questions interviewers ask.

    Read the full guide on Substack

    Key points

    • Two Towers: Candidate generation (millions → hundreds) using user/video embeddings.
    • Ranking: Deep Neural Network (hundreds → tens) using 100s of features (history, context).
    • Watch-time objective: Model predicts duration of watch, not just click probability.
    • Online Features: Real-time signals (last 5 videos watched) fetched from Redis.
    • Offline Training: Billions of examples processed on Spark; models updated hourly.

    Sign in to track this guide in your curriculum progress.