Design a Lens Recommendation System
Company: Snapchat
Role: Machine Learning Engineer
Category: ML System Design
Difficulty: medium
Interview Round: Onsite
Design a recommendation system for augmented-reality lenses in a social camera application.
Your design should cover:
- product goals and success metrics,
- candidate generation and ranking,
- training data, labels, and features,
- online serving and feedback loops,
- cold start for new lenses and new users,
- how to use weighted logistic regression when engagement actions have different value levels,
- a training platform that lets engineers discover, version, and retrieve features and models consistently.
### Constraints & Assumptions
- Lens recommendations are interactive, so latency matters.
- Raw opens are not enough; creation, sharing, saving, repeat use, and negative feedback have different values.
- Safety, device compatibility, content policy, freshness, and creator ecosystem health are in scope.
- Logged data has position and exposure bias.
- The ML platform should support reproducibility and offline/online feature consistency.
### Clarifying Questions to Ask
- Which surface is being ranked: camera carousel, lens explorer, chat, or creation flow?
- What is the primary objective: opens, creations, shares, retention, or creator distribution?
- What latency budget and device constraints exist?
- Are lenses user-generated, curated, or both?
- How much exploration traffic is allowed for new lenses?
### What a Strong Answer Covers
- Multi-stage recommender architecture: filtering, candidate generation, ranking, and post-processing.
- Candidate sources such as popularity, collaborative filtering, content embeddings, creator graph, context, and freshness.
- Features across user, lens, context, and interactions.
- Weighted logistic regression baseline and why multi-task or expected-utility ranking may be better.
- Cold-start strategy for new users and new lenses.
- Online serving path, feedback logs, A/B tests, and guardrails.
- Feature store, model registry, versioned training specs, lineage, and offline/online parity.
### Follow-up Questions
- How would you correct for position bias?
- How would you avoid overexposing only popular lenses?
- How would weighted labels affect probability calibration?
- What would you put in a feature store schema?
Quick Answer: Design a Snapchat lens recommendation system for AR camera experiences. Covers product goals, candidate generation, ranking features, weighted logistic regression, multi-task expected utility, cold start, serving, feedback loops, and ML feature/model platform.