KatInterview

Design a Scalable Video Recommendation Architecture and Logging Engine

Machine LearningModel answer
MediumModel answerMachine Learningmachine-learningsystem-designrecommendation-systems

Last updated

Architect a low-latency video feed and next-up system with focus on feature pipelines, stream joins, impression logging, and multi-objective ranking.

Design an end-to-end Machine Learning system for a personalized video streaming service that supports both a continuous Home Feed and a contextual Next Video (Autoplay) feature.

System Requirements & Constraints

  • Latency Budget: Provide personalized recommendations within a tight server-side deadline ($p99 \le 200\text{ ms}$).
  • Throughput & Scale: Support tens of thousands of requests per second across hundreds of millions of daily active users and a catalog of over 100 million videos.
  • Dual Surface Support:
    • Home Feed: Long-term preferences, user history, and dynamic interest tracking.
    • Next Video: Immediate session context, short-term user transition history, and co-viewing affinities.
  • Observability & Logging Infrastructure:
    • Define exact payload schema and impression-tracking architecture.
    • Join outcome events (clicks, watch time, reactions) to serving features reliably without data leakage or bias.
  • Pipeline Architecture: Design both streaming and batch feature generation strategies with online-offline consistency.
  • Modeling & Optimization: Outline candidate generation, multi-task ranking objectives, and offline/online evaluation techniques.

Hints

Hint 1

Distinguish clearly between a server-side impression and a client-side viewed impression. Training on items never seen by the user introduces significant noise.

Hint 2

Log features directly at inference time rather than recomputing them asynchronously from feature stores later to prevent point-in-time snapshot leaks.

Hint 3

Address position bias during model training using shallow position towers or explicitly logged position features, then set the position parameter to zero (or top slot) at inference.