Design a short-video recommender for short-term interest
SnapchatMachine Learning Engineer · Technical ScreenLast updated
This problem tests your ability to design a real-time recommendation system that captures dynamic user intent over short sessions, balancing latency, feature freshness, and algorithmic relevance.
Problem: Real-time Short-Video Recommendation
Design a recommendation system for a short-video platform (similar to Snapchat Spotlight) that prioritizes user interest based on their most recent interactions (last 5-10 minutes) rather than long-term historical preferences.
Requirements
- Functional: Recommend a feed of videos that updates based on the user's current session activity (e.g., likes, skips, dwell time).
- Non-Functional:
- Latency: Sub-100ms inference time for the ranking service.
- Freshness: User feedback must influence the next recommendation within seconds.
- Scale: Support 10 million DAU with high request throughput.
Deliverables
- High-level Architecture: Describe the pipeline from user action ingestion to feed display.
- Feature Engineering: Explain how to handle 'real-time' features versus 'batch' features. How do you construct a session-based embedding?
- Candidate Generation & Ranking: Propose a two-stage approach. How do you select candidates while incorporating the short-term context?
- Handling Cold Starts: How does the system handle new videos or users with no session history?
Hints
Hint 1
Consider using an event-driven architecture, such as a message queue (e.g., Kafka) to stream user engagement events to a real-time feature store.
Hint 2
Think about session-based neural architectures, such as GRUs or Transformers (e.g., SASRec), that can encode a sequence of user interactions into a dynamic state vector.
Hint 3
For the two-stage pipeline, evaluate how approximate nearest neighbor (ANN) search could be combined with a fast-ranking model that processes both static user embeddings and dynamic session context.
Follow-up questions
- How would you measure the performance of your system? Specifically, what metrics track 'freshness' versus 'long-term satisfaction'?
- If you notice the feed is becoming 'echo-chamber' like due to the focus on recent interactions, how would you introduce exploration or serendipity into the recommendations?
- How would you ensure the system remains robust if a user suddenly engages with content that is outside their typical interest profile (e.g., a momentary click on a news link)?
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.