KatInterview

Design a Real-Time Sequential Music Slate Recommender

Machine LearningModel answer
MediumModel answerMachine Learningrecommendation-systemssequential-recommendationreal-time-ml

Last updated

Design an end-to-end sequential music recommendation engine that adapts dynamically to real-time user actions while delivering 10-track slates within 200ms P99 latency.

Context

You are tasked with designing the machine learning architecture and backend infrastructure for a real-time, personalized music streaming recommendation engine. The core objective is to generate an ordered 10-track playlist chosen from an active candidate pool of 10,000 tracks based on a user's current listening session.

The system must continuously adjust to immediate feedback signals (e.g., fast skips, full plays, track saves) while maintaining overall alignment with the user's long-term preferences.

Core Requirements

  1. Functional:

    • Output a cohesive sequence of 10 tracks tailored to the user's active context.
    • Update recommendations dynamically whenever a user skips, completes, or explicitly interacts with a track.
  2. Non-Functional & Constraints:

    • Latency: P99 end-to-end request latency must stay strictly under 200 milliseconds.
    • Scale: Support 10 million Daily Active Users (DAU).
    • Slate Constraints & Diversity: No artist may appear more than twice within any single 10-track slate.

Required Deliverables

Address each of the following components in detail:

  1. Pipeline & System Architecture: Describe the multi-stage recommendation funnel (candidate generation, coarse ranking, deep reranking, dynamic slate decoding) and real-time state storage.
  2. Feature Representation: Detail how sequential session history, interaction types, temporal gaps, and candidate track features are encoded and utilized.
  3. Model Strategy: Formulate models for capturing sequential intent (e.g., Transformers vs. fast sequence baselines) and multi-objective slate ranking.
  4. Latency Budget & Optimization: Provide a realistic step-by-step latency budget and concrete techniques to meet the 200ms P99 performance target.
  5. Evaluation Strategy: Define appropriate offline metrics (e.g., NDCG, Hit Rate) and online metrics/guardrails (e.g., skip rate, session duration).
  6. Popularity Bias & Fair Exposure: Detail methods to prevent head-item bias and ensure systematic exposure for long-tail artists without degrading user experience.