KatInterview

Build an Internal Platform to Train, Register, and Serve ML Models

System DesignModel answer
MediumModel answerSystem Designmlopsmodel-servingmodel-registry

Last updated

Design an internal ML platform covering experiment tracking, a model registry, online and batch serving, and monitoring, including the API and the trade-off between containers and serverless.

Context

You are the tech lead for an internal machine learning platform at a large online retailer. Data scientists across many teams need one shared system for training models, keeping track of versions, and putting those models into production. Production use includes live, low-latency predictions as well as scheduled bulk scoring jobs.

What the platform must do

  1. Run tracking: Record hyperparameters, metrics, and the exact data used for each training run so any result can be reproduced later.
  2. Model registry: Provide one central place to store model artifacts and manage versions, including pre-release labels such as a canary build.
  3. Serving:
    • Online inference with a tail latency target of roughly 50 ms at p99.
    • High-throughput batch inference over very large datasets.
  4. Monitoring: Detect shifts in input data and degradation in prediction quality once models are live.

Quality attributes

  • Support several frameworks (for example PyTorch, XGBoost, scikit-learn).
  • Serving must be highly available and scale with demand.
  • Frequent retraining means new versions must roll out with little or no downtime.

What you should deliver

  • A high-level architecture, described in words or text-art.
  • An API design for registering models and deploying them.
  • A walkthrough of how a trained model travels from training output to serving traffic.
  • A comparison of container-based microservices and serverless functions as the serving substrate, with a recommendation.

State your scale assumptions up front and call out anything you are deliberately leaving out of scope.

Hints

Hint 1

Start by fixing scale numbers (teams, models, QPS, retraining frequency) and split the 50 ms budget between feature lookup, inference, and network.

Hint 2

Decouple training from serving through an immutable artifact store plus a registry, and let a controller reconcile a declarative deployment spec instead of having training jobs push to production.

Hint 3

Think about training-serving skew: how are features computed identically offline and online, and how do you roll out safely (shadow, canary, automatic rollback) and monitor drift?