ML SYSTEM DESIGN & MLOPS Β· INTERVIEW QUESTION
Design a real-time ML serving system for a recommendation engine handling 10k QPS.
π‘ intermediate Β· System Design Patterns
Hint: Think about model serving, caching, feature stores, and latency requirements.
Answer
Architecture:
- Feature Store: pre-computed user features (offline), real-time event features (streaming).
Use Redis for serving, Feast/Tecton for management.
-
Model Serving: TensorFlow Serving or Triton for GPU inference, ONNX for portability. Batch pre-compute for popular items.
-
Candidate Generation: retrieve ~1000 candidates via ANN (FAISS/ScaNN) from item embeddings.
-
Ranking: score candidates with a neural ranker, ~100ms budget.
-
Caching: cache results per user with TTL, cache popular recommendations.
-
A/B Testing: traffic splitting at the API gateway.
-
Monitoring: track latency p99, model staleness, prediction distribution drift. Scale horizontally with load balancers, use circuit breakers for graceful degradation.
Related questions
- What are ML design patterns? Explain the Feature Store pattern.
- Design a fraud detection system. What ML and engineering challenges arise?
- When should you train/fine-tune your own LLM vs use a 3rd-party API?
- What is LLMOps and how does it differ from traditional MLOps?
- What is data drift and concept drift? How do you detect and handle them?