Design a Short-Video Recommendation System
ByteDanceSoftware Engineer · OnsiteLast updated
This problem tests the ability to design a multi-stage recommendation pipeline that balances real-time personalization, system latency, and content diversity.
Problem: Designing a Short-Video Recommendation Engine
Design the architecture for a short-video feed platform similar to TikTok. The system must provide personalized content to millions of concurrent users with sub-100ms latency for candidate retrieval and ranking.
Functional Requirements
- Personalized Feed: Users receive a continuous stream of videos based on historical interactions (likes, skips, watch time).
- Low Latency: The system must handle high request volumes while maintaining a fast time-to-first-frame.
- Freshness: New content must be surfaced to users quickly after ingestion.
Non-Functional Requirements
- Scale: Support 100M+ DAU and 1M+ uploads per day.
- Diversity: Prevent filter bubbles by injecting varied content types.
- Safety: Ensure policy filters (e.g., copyright, prohibited content) are applied effectively.
Expectations
Your design should cover:
- Architecture Overview: A high-level diagram illustrating the path from request to response.
- Candidate Retrieval: How to efficiently narrow down millions of videos to hundreds of relevant candidates (e.g., collaborative filtering, embedding-based retrieval).
- Ranking Pipeline: The usage of multi-stage models (e.g., lighter models for initial filtering vs. heavy deep learning models for final reranking).
- Feedback Loop: How real-time interactions (clicks, watch-time) are ingested and incorporated back into the retrieval layer.
- Cold Start: How to handle new users and new videos without historical data.
Hints
Hint 1
Consider a funnel approach: use fast retrieval methods like Vector Search for candidate generation before applying complex ranking models.
Hint 2
Address the cold start problem by using content-based features (e.g., visual/audio embeddings, metadata tags) rather than relying solely on interaction logs.
Hint 3
Think about how to separate the 'Nearline' processing of user engagement signals from the 'Offline' training of recommendation models to keep the latency low.
Follow-up questions
- How would you measure the success of your recommendation system? What metrics would you track in an A/B test?
- If the latency spikes due to a viral video, how would you implement an effective caching strategy for the retrieval layer?
- How do you ensure the system doesn't over-promote 'clickbait' content while still maximizing user session duration?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.