Design a Recommendation System - ML System Design
Complete ML system design walkthrough: from problem framing to production deployment.
For ML systems, focus on data availability, business objectives, and model constraints.
What type of recommendations are we building? (products, content, ads, etc.)
E-commerce product recommendations, similar to Amazon's 'Customers who bought X also bought Y' and personalized homepage.
What's the scale? Number of users and items?
50 million active users, 100 million products, 1 billion interactions per day.
What user interactions do we have access to?
Views, clicks, add-to-cart, purchases, ratings (1-5 stars), search queries, time spent on page.
What's the business objective we're optimizing for?
Primary: Increase conversion rate (purchases). Secondary: Increase average order value and user engagement.
Real-time or batch recommendations?
Both. Real-time for homepage when user logs in, batch for email campaigns.
How fresh do recommendations need to be?
Should reflect inventory changes within 1 hour, user behavior within 5 minutes.
Any constraints on recommendation diversity or fairness?
Yes, avoid filter bubbles, ensure category diversity, and give new products a chance.
What's the latency requirement for serving?
P99 < 100ms for API calls, including all personalization logic.
🎯 ML System Design Interview Tips
- ✅ Frame the business problem as ML objective
- ✅ Discuss data quality and availability
- ✅ Compare multiple model architectures
- ✅ Address training-serving skew
- ✅ Plan for model monitoring and retraining
- ✅ Consider fairness and bias
- ❌ Jumping to complex models too quickly
- ❌ Ignoring data pipeline complexity
- ❌ Forgetting about feature engineering
- ❌ Not discussing offline vs online metrics
- ❌ Overlooking model versioning
- ❌ Missing production challenges