Start with the decision, not the model
Clarify what the system predicts, who uses the prediction, and what action follows. Ranking a feed, estimating arrival time, and blocking a suspicious transaction have different latency requirements, error costs, and feedback loops.
Ask whether the interviewer wants an end-to-end ML system or a deeper discussion of modeling. Establish the simplest useful baseline, sketch the full architecture, then spend the remaining time on the hardest requirements rather than listing model families.
- Define the prediction unit: a user-item pair, transaction, trip, document, or session.
- Specify the output: score, probability, ordered list, class, or numeric estimate.
- Ask about traffic, dataset size, response deadlines, and acceptable feature and model age.
- Clarify whether predictions are computed offline, online, or through a hybrid approach.
- Identify hard constraints such as privacy, content eligibility, transaction safety, or regional data residency.
Separate product goals from model and service metrics
Choose a product objective before selecting a training objective. For a feed, clicks may be a useful signal but may not represent satisfaction. For an ETA service, prediction error matters, but so does whether estimates consistently understate arrival times.
Explain how you will judge the model offline, validate its impact online, and keep the serving system healthy. Improving one category does not guarantee improvement in the others.
- Product metrics: successful discoveries, completed orders, useful viewing time, or fraud loss, depending on the task.
- Offline metrics: precision and recall for classification, ranking metrics such as NDCG, or absolute error for regression.
- Service metrics: tail latency, availability, feature freshness, inference errors, and cost per prediction.
- Guardrails: complaints, abandonment, false declines, safety violations, and performance across important user groups.
- Decision thresholds: explain the cost of false positives versus false negatives rather than choosing a threshold by habit.
Design labels and data collection before training
Describe the events that create training examples. A recommendation system needs impression records showing what was displayed, not just clicks. Log the request identifier, candidate or item identifier, position, timestamp, and relevant model and experiment versions so outcomes can be attributed to the correct decision.
Define when a label becomes mature. A purchase may happen well after an impression, and a fraud label may arrive after an investigation. Missing feedback is not automatically a negative label. Training on immature outcomes can systematically mislabel examples.
A concrete data path is application events to a durable log, then validated raw storage, followed by batch or stream transformations and versioned training datasets. Define deduplication keys, schema checks, retention, access control, and how privacy deletions reach derived data.
- Specify the attribution window and rules for linking outcomes to predictions.
- Distinguish event time from processing time when events arrive late or out of order.
- Account for selection bias: observed interactions reflect what previous policies chose to show.
- Explain negative sampling if the number of unobserved or negative examples is too large.
- Monitor missing events and broken instrumentation before treating a metric change as a model problem.
Keep training and serving features consistent
Separate slow-changing features, such as account attributes or item embeddings, from fast-changing features, such as recent clicks or current traffic. Batch jobs can produce historical aggregates, while stream processors can maintain features that need low freshness lag.
Use point-in-time joins for training: each example must use only information available at its prediction time. Joining an old impression to today's user profile or a later outcome aggregate leaks future information and makes offline results misleading.
A feature store can provide historical retrieval and low-latency online lookups, but it is not mandatory. Shared transformation definitions, versioned schemas, freshness metadata, and explicit missing-value behavior matter more than adding a particular component.
- State each feature's key, computation window, update frequency, and maximum acceptable age.
- Compare precomputed features with request-time computation in terms of latency, cost, and freshness.
- Define defaults or fallback behavior for missing and stale features.
- Version feature definitions with the model and test batch and online implementations for parity.
- Prevent late backfills from overwriting newer online feature values.
Build a reproducible training and evaluation pipeline
Start with a baseline appropriate to the task: popularity ranking, a simple regression, rules, or a small classifier. Add complexity only when the expected quality gain justifies extra training cost, serving cost, and operational risk.
Use a workflow that creates a dataset snapshot, validates it, trains the model, evaluates it, and registers an immutable artifact with its feature schema and configuration. Checkpoint expensive jobs and make retries safe so failed orchestration does not publish an incomplete model.
Choose a split that matches deployment. A chronological holdout is often useful when predicting future behavior; grouping by user or entity may also be necessary to avoid inappropriate overlap. Evaluate important slices, cold-start cases, and recent data rather than reporting only one aggregate score.
- Explain the loss function and why it matches, or only approximates, the product objective.
- Keep test data separate from model and threshold selection.
- Evaluate calibration when downstream decisions rely on predicted probabilities.
- Record data versions, code, parameters, and model artifacts for reproducibility.
- Choose retraining frequency based on measured change, label availability, training time, and cost.
Draw the online prediction path and its fallback
For a recommendation example, draw: request service → candidate retrieval → feature lookup → ranking → eligibility checks → response. Candidate retrieval might combine precomputed lists, recent content, and vector search. Rank only a bounded candidate set rather than running an expensive model over the entire catalog.
For ETA prediction or fraud scoring, the path may instead be request validation → feature retrieval → model inference → decision policy. Keep model output separate from business rules, especially when the action affects money, safety, or access.
Give each stage a latency budget. Explain whether the model runs inside the application process or behind a shared inference service, and what happens when a dependency exceeds its deadline. A simpler model, cached result, or nonpersonalized ranking may be acceptable for discovery; a high-risk decision may need to fail closed or enter review.
- Batch prediction works well when outputs can be reused and freshness requirements permit it.
- Online inference supports request-specific context but adds dependencies and compute to the request path.
- Caching reduces repeated work, but keys must account for relevant context and model or feature versions.
- GPU batching can improve throughput while increasing queueing delay; bound batch wait time.
- Recheck current permissions, eligibility, and safety rules even when candidates or scores are cached.
Estimate capacity from the prediction workload
Estimate peak prediction requests, candidates scored per request, feature lookups, model memory, and event volume. Request rate alone can hide the dominant cost: scoring hundreds of candidates per request is a different workload from producing one scalar prediction.
Use explicit assumptions instead of invented benchmarks. For example, at a hypothetical 2,000 requests per second and 200 ranked candidates per request, the system evaluates 400,000 candidate scores per second before accounting for retries or auxiliary models. Whether that fits on a machine depends on model complexity, batching, hardware, and latency targets.
- Estimate raw event storage as events per second × bytes per event × retention time, then account for replication and derived datasets.
- Size feature storage from entity count, feature width, indexes, and replication.
- Estimate in-flight requests from throughput × average time in the system, then leave headroom for bursts and failures.
- Check memory during model rollout: old and new versions may need to coexist.
- Describe overload behavior, such as scoring fewer candidates or skipping an optional reranker.
Release models safely and measure actual impact
Offline evaluation is a gate, not proof of product improvement. Shadow traffic can check prediction behavior and resource use without changing user responses. A canary limits initial exposure; a randomized A/B test estimates product impact when assignment and measurement are sound.
Version the model together with its input contract and required preprocessing. Rollback must restore a compatible serving configuration, not just replace a model file. Keep a known-good version available and define who or what triggers rollback.
Monitor service health separately from model health. Infrastructure alerts can detect timeouts immediately, while quality degradation may remain invisible until delayed labels arrive. Feature drift is a reason to investigate, not proof that accuracy has fallen.
- Track feature null rates, freshness lag, category changes, and distribution shifts.
- Track prediction distributions, fallback rates, latency, errors, and resource saturation by model version.
- Join mature outcomes back to predictions to measure quality over time and across slices.
- Log experiment assignment and actual exposure so treatment effects are not confused with logging differences.
- Stop or roll back releases that breach safety or service guardrails without waiting for a final experiment result.
Be ready for failure modes and follow-up probes
Interviewers often test whether the architecture still works when the data pipeline lags, a feature service fails, a new model is incompatible, or traffic changes abruptly. Name the degraded behavior and recovery path for each critical dependency.
Also address feedback loops. A ranking policy influences which items collect labels, and repeatedly promoting popular items can reduce exploration. Explain how controlled exploration, exposure logging, and slice evaluation help, while recognizing that production experiments need safety limits.
To practice, take one prompt and walk through requirements, labels, features, training, serving, and monitoring. Then change one constraint, such as tighter latency, delayed labels, or no user history, and explain which parts of the design change.
- Feature pipeline lag: expose freshness, use bounded stale values where safe, and fall back when age exceeds the limit.
- Training pipeline failure: continue serving the last validated model and alert on model age.
- Cold start: use content, context, or population-level signals until interaction history exists.
- Feedback corruption: investigate instrumentation and attribution before automatically retraining.
- Privacy deletion: propagate deletion to feature stores and training datasets, and assess model retraining obligations under the applicable policy.
Where it comes up
Questions to practice with this guide.
- Design TikTokA personalized swipe feed connects candidate retrieval, ranking, fresh interaction features, exposure logging, and feedback loops.
- Design a news feed like FacebookRanking is a natural extension where you must balance personalized predictions with feed freshness, caching, and serving latency.
- Design an ETA and live location sharing serviceArrival prediction requires temporally correct traffic and location features, regression evaluation, and sensible behavior when observations become stale.
- Design an ads serving systemPredicted relevance or response rates must fit a low-latency selection path without bypassing campaign eligibility and strict budget enforcement.
- Design an A/B testing platformModel launches depend on consistent assignment, accurate exposure attribution, and experiments that distinguish product impact from measurement errors.
Questions people ask
How is an ML system design interview different from a regular system design interview?
Both cover APIs, storage, throughput, latency, and failure handling. An ML system design interview also requires you to explain labels, feature correctness, training and evaluation, prediction serving, and feedback loops. A reliable service can still produce poor decisions if its training data or objective is wrong.
How much machine learning theory do I need for an ML system design interview?
You should be able to justify a baseline, a model family, a loss function, and evaluation metrics for the task. The expected depth depends on the role, so clarify whether the discussion emphasizes modeling or infrastructure. Do not substitute a list of algorithms for a design that handles data quality, serving constraints, and production failures.
What is the best way to prepare for a machine learning system design interview?
Practice complete designs for a ranking problem, a classification problem, and a regression problem. For each, define labels, prevent leakage, draw training and serving paths, estimate capacity, and explain rollout and fallback behavior. Rehearse follow-up questions about delayed feedback, stale features, cold start, and disagreement between offline metrics and online results.