How to Approach ML System Design Interviews
An ML system design interview gives you 45 to 60 minutes and a prompt like "design a feed ranking system" or "design an LLM inference service," and then mostly lets you drive. That freedom is the hard part. Without a plan, it's easy to spend twenty-five minutes on transformer architecture and never get to labels, evaluation or serving, which is exactly where most interviewers are looking for signal.
A framework fixes that. It isn't a script to recite. It's a checklist of the questions every good ML design answers, in an order that builds on itself, with a rough time budget so you reach all of them. It also gives your interviewer a map: when you say "next I'll cover data and labels, then features," they know where you are and can redirect you if they care more about something else.
We'll cover:
- The different kinds of ML design rounds, and why the same prompt can be a modeling question or an infrastructure question.
- A step-by-step framework for applied ML rounds, with time budgets and a worked example.
- A framework for ML infra rounds (serving, training platforms, LLM systems).
- The calculations worth having ready, with the arithmetic.
- How to adapt the framework, common mistakes, and what changes by level.
Know Which Round You're In
"ML system design" covers at least three different interviews, and they reward different answers.
| Round | Typical prompts | What gets scored | Where the time goes |
|---|---|---|---|
| Applied ML (model design) | Feed or video ranking, ads CTR, fraud, ETA, search ranking, content moderation | Problem framing, labels, features, model choice, offline/online evaluation, iteration | Framing, data, modeling, evaluation |
| ML infra (platform design) | LLM inference, batch inference, feature store, training platform, model registry | Throughput, latency, GPU memory, scheduling, fault tolerance, multi-tenancy | Capacity math, architecture, deep dives |
| LLM application (hybrid) | RAG system, coding agent, chatbot, AI search, shopping assistant | Pipeline architecture, retrieval quality, evaluation, safety, cost | Architecture plus quality and evaluation |
The same words can mean different rounds. "Design a recommendation system" from a ranking team wants candidate generation, features and a multi-task model. From an infra team it wants a serving path that scores 500 candidates in 50 ms at 100,000 QPS and a pipeline that retrains daily. So ask, early and directly.
One question in the first two minutes saves the whole interview: "Would you like me to focus more on the modeling side (data, features, model, evaluation) or on the infrastructure (serving, scale, pipelines)? I'll touch on both." Interviewers almost always answer, and the answer tells you which framework below to lean on.
The structure on this site follows the same split. Model problems like Design an ML Fraud Detection System use the applied ML layout; infra problems like Design an LLM Inference System use the standard system design layout.
The Applied ML Framework
Eight steps, in order. Each one depends on the one before it: you can't choose features until you know the labels, and you can't pick metrics until you know the objective.
| Step | 45-minute round | 60-minute round | Leave this step with |
|---|---|---|---|
| 1. Clarify requirements | 5 min | 5 min | Goal, scale, latency, constraints |
| 2. Frame as an ML problem | 5 min | 6 min | Business metric, ML objective, approach |
| 3. Data and labels | 6 min | 8 min | Label definition, sources, imbalance, leakage risks |
| 4. Features | 5 min | 7 min | Feature groups, online vs batch |
| 5. Model | 8 min | 10 min | Baseline, main model, why |
| 6. Training and evaluation | 6 min | 8 min | Loss, split, offline metrics, A/B plan |
| 7. Serving | 5 min | 7 min | Architecture, latency budget |
| 8. Deep dives and monitoring | 5 min | 9 min | Cold start, feedback loops, drift |
These are guides, not rules. If your interviewer wants to spend fifteen minutes on labels, that's the interview. The budget exists so that you notice when you've spent twelve minutes on features and haven't mentioned evaluation.
We'll walk through each step with one running example: "Design a system that decides which push notifications to send to users."
Step 1: Clarify Requirements (5 minutes)
Pin down the product and the constraints before any ML. The questions that matter most:
- What's the product goal? More daily active users? Purchases? Fewer uninstalls? This becomes your north-star metric.
- What does the system decide? Rank, filter, classify, predict a number? For notifications: from the candidates other teams generate (new message, friend posted, price drop), pick at most a few per user per day, and when to send them.
- Scale. Users, items, requests per second. Say 200M daily users and 2B candidate notifications a day.
- Latency. Online (in the request path) or offline (batch)? Notifications can be scored in near-real time as candidates arrive, within seconds, not milliseconds.
- Constraints. Hard caps (at most 3 a day), quiet hours, legal restrictions, fairness or safety requirements.
- What exists today? Often there's a rules-based system to beat, plus logs you can learn from.
Write the answers down as functional and non-functional requirements, like a regular design round. Then do one quick piece of arithmetic that shapes the design: 2B candidates a day is about 23,000 per second on average, perhaps 60,000 at peak. That's a lot of model calls, so the model must be cheap per candidate.
Step 2: Frame It as an ML Problem (5 minutes)
This is the step that separates ML design from system design, and the one candidates most often skip. Three things:
The business metric versus the ML objective. You can't train on "daily active users." You train on something measurable per example that you believe moves it. For notifications, a natural objective is P(open | sent). But optimizing opens alone rewards clickbait and spamming, which drives users to disable notifications, which is terrible for the business. So the real objective has a counterweight:
value(notification) = P(open) × value_of_open − λ × P(disable or uninstall)
send if value > threshold, subject to at most 3 per day
Saying this out loud, that the proxy you can optimize can diverge from the goal and here's the guardrail, is one of the strongest signals you can send.
Inputs and outputs. Input: a (user, candidate notification, time) triple. Output: two probabilities, open and disable, combined into a value score.
The ML approach. Name the category and why:
- Binary classification (pointwise) for "will this be opened?" because each notification is decided largely on its own merits.
- Ranking when you show an ordered list (feeds, search).
- Regression for quantities (ETA, price, watch time).
- Retrieval / embedding similarity when the candidate set is huge (millions of items) and you need the top few hundred cheaply.
- Anomaly detection when labels are scarce (new fraud patterns).
- An LLM when the task is language understanding with little labeled data, or as a labeler and feature generator rather than in the hot path. At 60,000 decisions per second, an LLM per decision is far too slow and expensive; a small model trained on logs is the right call.
Step 3: Data and Labels (6 minutes)
Interviewers love this section because it's where real systems go wrong. Cover:
- Where examples come from. Logs of sent notifications with user, content and context at send time.
- How labels are defined. "Opened within 24 hours of sending" is positive; "not opened in 24 hours" is negative. A separate label: "disabled notifications within 48 hours." Note that labels are delayed: you can't train on today's sends until tomorrow.
- Implicit versus explicit labels. Opens are implicit and noisy (accidental taps). Explicit signals ("turn off this kind of notification") are rarer but stronger.
- Class imbalance. If 5% of notifications are opened, that's manageable. Disables might be 0.1%, which needs care: downsample negatives, weight positives, and recalibrate afterward.
- Selection bias. You only see labels for notifications the current system chose to send. A model trained only on those learns nothing about the ones it never sent. Fix it with a small exploration slice (send some randomly selected candidates) and log the probability each was chosen.
- Leakage. Features computed with information from after the send (the user's opens later that day) make offline metrics look great and online results terrible. Compute every feature as of the decision time.
Step 4: Features (5 minutes)
Group features into a few families and give two or three concrete examples of each, rather than listing forty:
- User: historical open rate (7 and 30 days), notifications received today, time since last app open, notification settings, device and locale.
- Item (the notification): type (message, social, promo), sender's relationship to the user, content embedding, historical open rate of this type.
- Context: local time of day, day of week, whether the user is currently in the app.
- Cross features: the user's open rate for this notification type, affinity between user and sender.
Then say where each comes from. Batch features (30-day open rates) are computed daily in Spark and loaded into an online store. Real-time features (notifications sent in the last hour, is the user active right now) come from a stream processor like Flink. A feature store serves both and, crucially, logs the exact feature values used at decision time so training sees the same values serving did, avoiding training-serving skew. Design a Feature Store covers this in depth.
Step 5: Model (8 minutes)
Always start with a baseline, then justify each step up. A typical progression:
- Heuristic baseline: send if the notification type's global open rate is above a threshold. It's what you'll compare against, and it's a fallback if the model fails.
- Logistic regression on the features above: fast, interpretable, well-calibrated, a solid first model.
- Gradient-boosted trees (XGBoost, LightGBM): handle non-linear interactions and mixed feature types with little tuning. Often the best model for tabular data at moderate scale, and fast enough at 60,000 decisions per second on CPUs.
- A multi-task neural network: shared layers with separate heads for open and disable, using embeddings for users, senders and content. Worth it when you have billions of examples, sparse ID features, and multiple related objectives.
For each step, say what you gain and what it costs (latency, complexity, interpretability). For recommendation-shaped problems, name the stages: candidate generation (retrieve ~1,000 from millions with a two-tower model and an ANN index), ranking (score them with a heavier model), and re-ranking (diversity, business rules). Common ML Models for System Design covers which family fits which problem.
Don't jump to the fanciest architecture. "I'd start with GBDT because it's strong on tabular features and cheap to serve, and move to a multi-task DNN once we have enough data and want to share signal between the open and disable objectives" is better than opening with a transformer. Interviewers are testing judgment, not your knowledge of the newest paper.
Step 6: Training and Evaluation (6 minutes)
Training. Name the loss (binary cross-entropy per head, a weighted sum for multi-task), how you handle imbalance (negative downsampling with recalibration), and the retraining cadence (daily, given delayed labels; or continuous for fast-moving domains). Split data by time, not randomly: train on weeks 1-4, validate on week 5, so you measure what serving will face.
Offline metrics, each with a reason:
- ROC-AUC or PR-AUC: how well the model ranks positives above negatives. PR-AUC is more informative when positives are rare.
- Log loss and calibration (predicted vs observed rates in buckets): the value formula multiplies probabilities, so they must be calibrated, not just well-ordered.
- Ranking metrics (NDCG, recall@k) for ranking problems.
- Slice metrics: new users, each country, each notification type. A model can win overall and lose badly on a slice.
Online evaluation: an A/B test with the business metric as primary (daily active users, sessions), plus guardrail metrics (disable rate, uninstalls, notification volume) that must not regress. Mention how long it runs and why (enough samples for the effect size, and at least a full week to cover weekly patterns), and that offline wins don't always translate online.
Step 7: Serving (5 minutes)
Draw the online path and give it a latency budget. For our example, candidates arrive on a queue, a scorer fetches features, runs the model, applies caps and quiet hours, and either sends or schedules.
Two decisions to state explicitly:
- Batch or online prediction? Batch (precompute scores nightly) is cheaper and simpler but stale. Online is fresh but needs a low-latency feature and model path. Many systems mix them: precompute user embeddings in batch, score candidates online.
- Where the time goes. For a request-path ranking system with a 200 ms budget, a typical split is ~20 ms for feature fetch, ~30 ms for candidate retrieval, ~60 ms for ranking, ~20 ms for re-ranking and rules, and the rest for network and slack.
Step 8: Deep Dives and Monitoring (5 minutes)
Pick two or three that matter for this problem, or let your interviewer choose:
- Cold start: new users (fall back to popularity and onboarding signals), new notification types (explore).
- Feedback loops: the model only learns from what it sends, so it can narrow over time. Keep exploration traffic.
- Drift and monitoring: watch feature distributions, prediction distributions, calibration and the live open rate. Alert when they move, and retrain or roll back.
- Fairness and safety: don't let promo notifications crowd out messages users actually care about; respect regulatory limits.
- Scale: 60,000 decisions a second on CPU with GBDT, horizontally scaled behind the queue.
The ML Infra Framework
ML infra rounds look like a standard system design interview with ML-specific constraints: GPU memory instead of RAM, tokens per second instead of QPS, and failure modes like a training job losing a node on day three of a two-week run. Use the standard structure, with more weight on the capacity math.
| Step | 45-minute round | What to cover |
|---|---|---|
| 1. Requirements | 5 min | Functional (what users do), non-functional with numbers: QPS or tokens/s, latency SLOs (time to first token, time per output token), availability, cost |
| 2. Capacity math | 5 min | Model memory, KV cache or activations, throughput per GPU, fleet size, storage |
| 3. Entities and API | 3 min | Core objects (model, deployment, job, request) and the interface |
| 4. High-level design | 12 min | One requirement at a time, simplest version first, then fix what breaks |
| 5. Deep dives | 15 min | 2-3 hard problems: batching and scheduling, memory, multi-tenancy, fault tolerance, rollout |
| 6. Operations and wrap-up | 5 min | Monitoring, autoscaling, failure modes, what you'd build next |
What changes compared with a regular system design round:
- The capacity math drives the design more. Whether a model fits on one GPU decides whether you need tensor parallelism. Whether KV cache fits decides your batch size, which decides your fleet size and cost. Do this math before drawing boxes, and come back to it.
- The expensive resource is the GPU. Utilization, scheduling, bin-packing and admission control matter more than they do for CPU services, because idle GPUs are very expensive and overloaded ones get slow rather than failing cleanly.
- Correctness has ML meanings. For a feature store, correctness means point-in-time joins with no leakage. For a training platform, it means reproducibility and resumable checkpoints. For inference, it means the right model version and adapter for each tenant.
- Model lifecycle is part of the system. How a new model version is evaluated, canaried and rolled back is fair game in any infra round.
Typical deep dives by prompt, so you know what to prepare:
| Prompt | Likely deep dives |
|---|---|
| LLM inference service | Continuous batching, KV cache and paging, prefill/decode split, routing, multi-tenancy |
| Batch inference | Sharding work, retries and progress tracking, GPU utilization, spot instances |
| Training platform | Scheduling and quotas, checkpointing, failure recovery, data loading, experiment tracking |
| Feature store | Point-in-time correctness, online/offline consistency, streaming features, backfills |
| RAG or agent system | Retrieval quality, freshness, permissions, evaluation, cost per request |
For the engines inside an inference design, see LLM Serving Engines.
Calculations to Have Ready
You don't need many numbers, but you need to produce them quickly and correctly. These come up again and again. Numbers to Know for ML Systems has the reference values for hardware and models.
Traffic. QPS = daily users × actions per user ÷ 86,400 seconds. Multiply by 2-3x for peak.
200M DAU × 10 feed loads / 86,400 s ≈ 23,000 QPS average, ~60,000 at peak
Ranking compute. Scored items per second = QPS × candidates per request.
23,000 QPS × 500 candidates = 11.5M scores/s
at ~10 µs of CPU per candidate: 11.5M × 10 µs = 115 CPU-seconds per second ≈ 115 cores busy
(plus headroom and peak: a few hundred cores)
Embedding and feature storage. Items × dimensions × bytes.
1B items × 256 dims × 4 bytes = 1 TB (float32), 256 GB at int8
200M users × 2 KB of online features = 400 GB in the online store
Training data volume. Examples per day × bytes per example × days of history.
2B examples/day × 1 KB = 2 TB/day; 90 days of history = 180 TB
Model weights. Parameters × bytes per parameter.
70B params: 140 GB in bf16, 70 GB in FP8, ~35-40 GB in 4-bit
8B params: 16 GB in bf16
Training memory. With mixed precision and the Adam optimizer, budget about 16 bytes per parameter before activations: 2 for bf16 weights, 2 for gradients, and 12 for the fp32 master copy and Adam's two moment estimates.
8B params × 16 bytes = 128 GB, so full fine-tuning needs sharding (FSDP or ZeRO) across GPUs
LoRA trains well under 1% of the parameters, so mostly just the frozen weights remain: ~16 GB for 8B
KV cache per token. 2 × layers × KV heads × head dimension × bytes.
Llama-3-70B-style (80 layers, 8 KV heads, 128 dims, bf16): 2 × 80 × 8 × 128 × 2 = 327,680 B ≈ 320 KiB
100 concurrent sequences × 8,000 tokens × 320 KiB ≈ 260 GB of KV cache
Decode speed upper bound. Each decode step reads all the weights, so per-sequence tokens/s ≤ memory bandwidth ÷ bytes of weights (batching shares that read across sequences).
70B in FP8 on 2 GPUs with ~3.35 TB/s each: 70 GB / 6.7 TB/s ≈ 10.4 ms per step, so ≤ ~95 tokens/s per stream
Prefill compute. About 2 × parameters FLOPs per token.
70B × 2 × 2,000 prompt tokens = 280 TFLOP
one H100 at ~990 dense bf16 TFLOPS and ~50% utilization: 280 / 495 ≈ 0.57 s, ~0.15 s with 4 GPUs
Training compute. About 6 × parameters × training tokens.
fine-tune 8B on 2B tokens: 6 × 8e9 × 2e9 = 9.6e19 FLOPs
one H100 at ~40% of 990 TFLOPS ≈ 4e14 FLOP/s: 2.4e5 s ≈ 67 GPU-hours, ~8 hours on 8 GPUs
Fleet size and cost. Required tokens/s ÷ measured tokens/s per replica, plus headroom. Prices vary widely by provider and commitment, so state your assumption.
1,000 requests/s × 300 output tokens = 300,000 output tokens/s
if one GPU replica sustains ~3,000 tokens/s at the latency target: 100 GPUs, ~130 with headroom
at an assumed $3 per GPU-hour: ~$390/hour, ~$280K/month
per token: 3,000 tok/s × 3,600 s = 10.8M tokens/hour, so ~$0.28 per million output tokens
A/B test sample size. For a conversion-style metric with base rate p and absolute effect δ, at 5% significance and 80% power, each arm needs roughly n ≈ 16 × p(1 − p) / δ².
CTR p = 5%, detect a 2% relative lift (δ = 0.001): 16 × 0.0475 / 0.000001 = 760,000 users per arm
with 1M eligible users per arm per day: about a day of traffic, but run 1-2 weeks for weekly cycles
Imbalance and recalibration. If you keep negatives at sampling rate w (say 10%), the model's predicted odds are inflated by 1/w. Correct them:
p = p' × w / (p' × w + 1 − p')
model says p' = 0.5 with w = 0.1: p = 0.05 / (0.05 + 0.5) ≈ 0.09
And for label volume: 0.1% fraud on 10M transactions a day is 10,000 positives a day, so 100,000 positives takes about ten days of data.
Latency budget. Write it as a sum and make it add up.
200 ms total = 30 network + 20 features + 30 retrieval + 60 ranking + 20 re-rank/rules + 40 slack
Round aggressively and say so. "86,400 is about 100,000, so 200M times 10 over 100K is about 20,000 QPS" is faster and just as useful as exact division. What interviewers check is that the order of magnitude is right and that you use the result to make a decision: "so we need a cheap model, or a two-stage design."
ML System Design in an Interview
Adapting the Framework
- LLM application rounds (RAG, agents, chatbots) use the infra structure, but "evaluation" becomes a first-class step: how you measure answer quality, groundedness and safety offline, and how you A/B test prompt or model changes online. Budget 5-8 minutes for it. Design a RAG System and Design an Agentic System show the shape.
- When the interviewer drives, follow them. The framework is for when you're steering; if they ask you to go deep on negative sampling at minute ten, go deep, then say where you'd pick back up.
- When to train versus use an LLM: if the task needs language understanding, has little labeled data and modest volume, prompting a hosted or open-weight LLM is a fine start. If it runs millions of times a second on structured features, train a small model. Many good designs use an LLM offline to label data or generate features, then a small model online. MLOps and LLMOps goes further.
- Shorter rounds (30-35 minutes): compress steps 1-2 into five minutes total, give features and model five minutes each, and keep a few minutes for evaluation. Evaluation is the step you can least afford to drop.
Common Mistakes
- Jumping to the model. Starting with "I'd use a transformer" before defining the objective or labels.
- Optimizing the wrong thing. Treating clicks or opens as the goal without guardrails, which builds a clickbait machine.
- Ignoring how labels are produced. No mention of delay, noise, selection bias or leakage.
- Offline metrics only. Never saying how you'd A/B test, or what guardrails would block a launch.
- No serving path. A great model with no latency budget, no feature freshness plan and no fallback.
- Numbers without consequences. Computing QPS and then never using it. Every number should change a decision.
- Forgetting the system after launch. No monitoring, retraining or drift detection.
If you're running out of time, say what you would have covered: "With more time I'd go into cold start for new users and how we monitor calibration drift." Naming the gaps shows you know they exist, which is most of the signal.
Signals by Level
Mid-level: a complete, sensible pass through the framework. Clear objective and labels, reasonable features, a baseline and a stronger model with reasons, standard offline metrics and an A/B test, a simple serving diagram. It's fine to need a nudge on subtler issues like selection bias.
Senior: drives the conversation and makes trade-offs explicit. Separates the business metric from the training objective and adds guardrails unprompted. Spots leakage, delayed labels, calibration needs and training-serving skew. Picks models for cost and latency reasons, not novelty. Produces correct capacity math and uses it.
Staff+: frames the problem in terms of the business and the organization: which metrics teams fight over, how to run experiments that don't interfere, how the model interacts with other systems (a notification model and a feed model competing for the same user's attention). Goes deep on feedback loops, exploration, long-term effects versus short-term metrics, and platform choices that make the next ten models cheaper to build. In infra rounds, reasons about fleet-level cost, utilization and failure domains.
Common Follow-ups
- "How do you know the model is working in production?" Live metrics against a holdout, calibration and prediction-distribution monitoring, slice dashboards, and alerts tied to automatic rollback.
- "Your offline AUC went up but the A/B test was flat. Why?" Offline/online mismatch: leakage, a metric that doesn't capture the goal, selection bias in the evaluation data, or a gain in a region of scores that doesn't change decisions.
- "How would you handle a new user?" Popularity and context-based defaults, onboarding signals, exploration, then switch to personalized features as data arrives.
- "How much would this cost to run?" Use the fleet-size arithmetic: traffic × work per request ÷ throughput per machine, times price per hour.
- "What would you build first?" The baseline, the logging and the evaluation pipeline, because every later model depends on them.
Summary
ML system design rounds come in two main shapes. Applied ML rounds test whether you can turn a product goal into a learnable objective and carry it through data, labels, features, models, evaluation and serving. ML infra rounds test whether you can design systems around GPUs, models and data pipelines that are fast, correct and affordable. LLM application rounds blend the two, with evaluation as a first-class concern. Ask early which one you're in.
For applied ML, walk the eight steps (requirements, framing, data and labels, features, model, training and evaluation, serving, deep dives) with a rough time budget so you reach all of them. For infra, follow the standard system design structure with the capacity math up front. In both, have the core calculations ready: QPS, compute and storage, model and KV cache memory, decode and prefill speed, training FLOPs, fleet cost and A/B sample sizes. Then use every number to make a decision. The framework's job isn't to make answers uniform. It's to make sure the parts interviewers care most about never get squeezed out.