What are the main parts of a machine learning system in production, and how do they connect in a loop?
ML system design, Framework
Level L1 Beginner. Length Short. Nature Th Theoretical.
What's being asked
Whether you see a production ML (machine learning) system as a full lifecycle rather than just a model trained in a notebook.
Key idea
Training a model is only one box in the diagram. Data pipelines feed training, a model registry versions approved models, a serving service answers user requests, monitoring watches health, and new production data feeds back into the next training run.
Steps
- Start with data collection and pipelines: raw events and labels are gathered, cleaned and turned into features. Doing this reliably ensures the model sees consistent inputs.
- Move to training and evaluation: a training job fits the model on historical data and checks its metrics on a held-out validation set. Only models that beat the current benchmark should move forward.
- Explain the model registry: approved models are saved with their version number, code, hyperparameters and evaluation scores. This makes deployments repeatable and rollbacks easy if something breaks.
- Describe serving: a prediction service loads the registered model and answers live requests via an API (application programming interface) or runs scheduled batch jobs. This is where users actually experience the model.
- Cover monitoring and the feedback loop: logging and dashboards track latency, error rates, input shifts and real user outcomes, and those new labelled examples flow back into the data pipeline to retrain the model. Harder questions build on these boxes to examine training–serving skew, data drift and canary rollouts.
Common mistakes
- Drawing only 'data -> train -> predict' and leaving out monitoring and the feedback loop, because real-world data changes over time.
- Skipping the model registry and overwriting model files by hand, which makes it hard to roll back a bad release.
- Using different feature code in training and serving, which silently degrades live accuracy.
How long your answer should be
About 2 minutes; six boxes in order with one sentence each.
Read this
Previous in ML system design: none
Next in ML system design: How should you structure an answer to a machine learning system design question, and how should you pace it in a 45-minute interview?