Table of Contents
- Structured Answer Framework: Six Layers
- Problem Framing: Translating Business Goals to ML Objectives
- Data Pipeline: Collection, Labeling, Validation
- Feature Engineering: Feature Store and Online/Offline Separation
- Model Training & Selection
- Serving: Batch vs Real-time
- Monitoring: Data Drift and Model Degradation
- Common Question Types and Pacing
- Practice Question
- References
ML System Design is the highest-weighted round in senior+ AI engineer interviews. What sets it apart from traditional software system design isn't "there's a model" — it's an entire chain of uncertainty from data to model quality degradation. Interviewers want to see not whether you can draw an architecture diagram, but whether you're aware of tradeoffs at each layer and can articulate why.
Structured Answer Framework: Six Layers
After receiving the problem, walk through these six layers. You don't need equal time for each — spend 5 minutes aligning on the problem in the first two layers, 15 minutes on the technical core in the middle two, and 5 minutes wrapping up the last two. The most common interviewer complaint is candidates jumping straight to "I'll use a Transformer," skipping problem definition entirely.
- Problem Framing
- Data Pipeline
- Feature Engineering
- Model Training & Selection
- Serving
- Monitoring & Iteration
Problem Framing: Translating Business Goals to ML Objectives
This step is most easily underestimated, but it determines the direction of everything that follows. When the interviewer says "Design a recommendation system," your first move isn't drawing architecture — it's clarifying three things:
What's the business objective? "Improve engagement" is too vague. Is the goal to increase click-through rate, watch time, or completion rate? Different objectives lead to different ML objective functions — optimizing for CTR and optimizing for watch time result in completely different model and feature designs.
How is success defined? There's a gap between offline metrics (AUC, NDCG) and online metrics (CTR, revenue per session). Being able to say "I'd use NDCG@10 for offline evaluation, but ultimately defer to session watch time from online A/B tests" demonstrates production experience.
What are the constraints? Latency budget (p99 < 100ms? < 500ms?), QPS, cold start problems, privacy restrictions. These constraints directly affect your model complexity and serving strategy.
Data Pipeline: Collection, Labeling, Validation
The quality ceiling of an ML system is data quality, not model architecture. Mentioning data design in interviews signals you're not someone who only trains models in Jupyter notebooks.
Data sources: User interaction logs (implicit feedback), explicit ratings, third-party data. Implicit feedback is high-volume but noisy (viewing doesn't mean liking); explicit feedback is precise but sparse.
Labeling strategy: Human annotation (high quality, high cost, slow), heuristic labeling (rule-based weak labels like "user stayed over 30 seconds = positive sample"), active learning (having the model pick the most uncertain samples for annotation). Being able to choose strategies for specific scenarios and explain tradeoffs is far more valuable than reciting textbooks.
Data validation: Schema validation (field types, null rate), distribution monitoring (feature distribution drift), freshness checks (data delay exceeding SLA). Mentioning tools like Great Expectations or TFX Data Validation earns bonus points, but the key is knowing why validation matters.
Feature Engineering: Feature Store and Online/Offline Separation
This is a high-frequency topic in ML system design interviews because it's the primary source of training-serving skew.
Feature store dual-track architecture: Offline store (data lake, batch historical joins, for training) and online store (low-latency KV, for serving). Both sides use the same feature computation logic to avoid skew.
Point-in-time joins: During training, you must ensure each sample only uses feature values available before that time point — otherwise it's label leakage. This concept is frequently probed in interviews — if you don't know why it's needed, interviewers will conclude you haven't worked with real training data.
Feature taxonomy:
| Type | Example | Update Frequency | Computation |
|---|---|---|---|
| Static features | User age, country | Daily/weekly | Batch |
| Slowly changing | User preference embedding | Hourly | Batch + backfill |
| Real-time features | Clicks in past 5 minutes | Seconds | Streaming (Flink/Kafka) |
Being able to draw this taxonomy and explain each type's computation path already puts you ahead of most candidates.
Model Training & Selection
The interview trap is jumping straight to the most complex model. The correct narrative is: baseline first, then iterate.
Baseline: Start with the simplest method to establish a lower bound. A recommendation system's baseline can be popularity-based ranking; a fraud detection baseline can be a rule-based system. The baseline's value is showing how much ML actually adds.
Model evolution: Using recommendation systems as an example, from logistic regression → gradient boosted trees → two-tower neural model → deep model with cross-attention. At each step you must explain "why the upgrade was needed" — not because more complex is better, but because the previous model was insufficient in some dimension (e.g., cold start, long-tail item coverage).
Training infrastructure: Model versioning (each training run produces a traceable artifact), experiment tracking (MLflow, W&B), reproducibility (fixed seeds, recorded hyperparameters). You don't need deep knowledge of every tool, but should be able to explain "how I'd manage multiple experiments."
Serving: Batch vs Real-time
Serving strategy depends on latency budget and data freshness requirements.
Batch inference: Run all predictions periodically and store them; look up results at request time. Suitable for recommendation "You might like" sections — updating hourly is sufficient. Advantages: simple, cheap, low latency (table lookup); disadvantages: can't reflect real-time behavior.
Real-time inference: Compute on every request. Suitable for search ranking, fraud detection, and other scenarios requiring real-time features. Considerations include model serving frameworks (TensorFlow Serving, Triton, vLLM), model optimization (quantization, ONNX conversion, batching), and fallback strategies (what if the model service goes down — fall back to heuristic rules, use recent cached results, or degrade to a simpler model).
Two-stage retrieval + ranking: The standard architecture for large-scale recommendation systems. First stage uses a cheap model (e.g., ANN retrieval) to narrow millions of candidates to hundreds; second stage uses a complex model for precise ranking. Being able to draw this funnel and explain latency budget allocation per layer is a strong bonus.
Monitoring: Data Drift and Model Degradation
The biggest difference between ML systems and traditional software: code unchanged, model still breaks. User behavior changes, data distribution shifts, upstream data source issues — all silently degrade model quality.
Three-layer monitoring:
- Data layer: Input feature distribution drift (PSI, KL divergence), null rate anomalies, data latency
- Model layer: Prediction distribution drift, confidence calibration degradation, latency anomalies
- Business layer: CTR, conversion rate, revenue, and other downstream metrics
Retraining triggers: Not fixed schedules ("retrain weekly") but metric-based triggers — data drift exceeds threshold, offline metrics drop by X%, or business metrics decline three consecutive days. Being able to articulate this logic is more convincing than saying "I'd use Kubeflow for automatic retraining."
A/B Testing: New models must be A/B tested before going live. You should be able to explain how to estimate sample size (power analysis), how long to run (at least one business cycle, typically one to two weeks), and how to handle network effects (if users interact, simple random assignment creates interference).
Common Question Types and Pacing
| Question Type | Core Test Points | Commonly Overlooked |
|---|---|---|
| Design a recommendation system | Two-stage retrieval, cold start, diversity | Exploration vs. exploitation, filter bubble |
| Design fraud detection | Extreme class imbalance, real-time requirements | False positive business cost, adversarial attacks |
| Design content moderation | Multi-modal, human-in-the-loop | Latency SLA (pre-publish vs. post-publish), cultural differences |
| Design search ranking | Query understanding, learning to rank | Position bias, clicks ≠ satisfaction |
Time allocation (45-minute interview):
- 0-5 min: Problem framing, ask clarifying questions
- 5-10 min: High-level data pipeline and feature engineering design
- 10-30 min: Deep dive into model + serving, draw architecture diagram
- 30-40 min: Monitoring and iteration strategy
- 40-45 min: Interviewer's follow-up questions
Most important: don't get defensive when probed. Follow-ups usually test your depth, not reject your design. "You're right, there is X risk here — I could mitigate it with Y" is much stronger than "That won't be an issue."
Practice Question
Question
"Design a real-time fraud detection system that returns a risk score within 200ms of a user initiating a transaction."
Source: Stripe MLE onsite Difficulty: Advanced Round: onsite system design
Solution Framework
- Clarify the problem: Ask — QPS? Business cost of false positives? Business cost of false negatives? Need to explain risk scores? How much historical data?
- Build a framework: Use the six-layer structure — Problem Framing → Data Pipeline → Feature Engineering → Model → Serving → Monitoring.
- Go deep: The 200ms latency constraint is the key design driver. Features and model inference must run online — no batch pipeline. Core tradeoff is feature freshness vs. latency, and model complexity vs. inference speed.
- Close: Emphasize monitoring importance — fraud patterns constantly evolve (concept drift), requiring continuous retraining strategy and adversarial monitoring.
Sample Answer (as you'd say it in an interview)
Problem framing. Business goal is "reduce fraud losses"; ML goal is "predict a 0-1 risk score per transaction." Transactions above the threshold go to manual review or are blocked. Key metrics are precision (false blocks lose users) and recall (missed fraud is direct loss). Based on business needs, recall is usually more important since one fraud loss far exceeds one false block's experience cost.
Data + Features. Features split into two types. Static features (account age, historical transaction frequency, device fingerprint) precomputed in the feature store's online store (Redis), lookup latency <1ms. Dynamic features (total transaction amount in past 5 minutes, distinct IPs in past hour) computed via Flink streaming pipeline, written to Redis. Each feature has a freshness SLA — device fingerprint can update hourly, but "transactions in past 5 minutes" must be <5 seconds fresh.
Model + Serving. Version one uses gradient boosted trees (XGBoost/LightGBM), inference latency <5ms, plus feature lookup totaling <50ms — well within 200ms budget. Not using deep learning because GBDT typically matches or beats DNN on tabular data and offers better interpretability. Serving via model server (Triton or custom), horizontally scaled. Fallback reserved: if model server goes down, rule-based system takes over (simple rules like "amount > $10,000 → send to manual review").
Monitoring. Fraud patterns evolve, making monitoring especially critical. Track three layers: feature drift (a feature's distribution suddenly changes), prediction drift (risk score distribution shifts), label delay (fraud labels are typically confirmed 1-30 days later, requiring a delayed labeling pipeline). Retraining frequency starts weekly, adjusting based on observed drift.
Self-Check Rubric
| Checkpoint | Mentioned? |
|---|---|
| Translated business goal to ML objective (precision/recall tradeoff) | |
| Static + dynamic feature dual-track design | |
| 200ms latency budget allocation (feature lookup + inference) | |
| Model selection rationale (GBDT vs DNN tradeoff) | |
| Fallback strategy (what if model server goes down) | |
| Monitoring: feature drift + prediction drift + label delay | |
| Bonus: mentioned adversarial adaptation (fraudsters learn in reverse) |
References
- Chip Huyen — Designing Machine Learning Systems — Complete ML system design framework covering data pipeline, feature engineering, and monitoring — core interview topics
- CalibreOS — ML System Design Interview Guide 2026 — Structured interview answer framework with Google, Meta, and Uber real question breakdowns
- Stanford CS 329S: Machine Learning Systems Design — ML system design course covering the six-layer structure from problem framing to monitoring in this post
- Feast — Open Source Feature Store — Feature store implementation reference for online/offline separation architecture; mentioning Feast or Tecton in interviews earns bonus points
- Made With ML — ML System Design — End-to-end ML system design tutorials from data pipeline and model serving to A/B testing
Loading...