System design interview guide
MLOps System Design Interview: Design an ML Platform for Training, a Model Registry, Safe Rollout and Monitoring
Short answer
A machine learning model is a program that learns a rule from examples, and an MLOps platform is the shared system many teams use to train, store, release and watch their models. Every training run reads a fixed copy of the data and runs in a container with fixed library versions, so the model can be rebuilt later. Each trained model is saved as a version that never changes in a model registry, a catalogue of trained models. Live serving loads an alias, a movable name such as champion that points at one version, so a rollback just points the alias back at the last good version. A new version must beat the current one on test rows kept aside from training, then run in shadow (it answers, but nobody uses its answers) and then as a canary (it serves a small share of users). Monitoring watches for drift, meaning the live inputs no longer look like the training inputs, and checks real accuracy once the true answers arrive, because drift alone does not prove the model got worse.
Want the short-answer question list instead? See the MLOps interview questions guide
Two courses by the author of this page:
214 lessons · 10 free to read
₹1,333 in India · $35 elsewhere, once
Get Generative AI and Agentic AIYou own this course
770 lessons · 18 free to read
₹1,111 in India · $25 elsewhere, once
Get System DesignYou own this course
Save your progress and get the AI Engineering cheat sheet PDF
A machine learning model is a program that learns a rule from examples instead of being told the rule. For example, it looks at a million past card payments and learns which ones were fraud. This learning step is called training. Training one model can take a few days of work. Running three hundred of them for thirty teams is a much bigger job. Each model needs fresh data, a training run that someone can repeat next month, a safe way to reach real users, and a way to undo a bad release in seconds. Each model can also get worse with no error message at all, because the world it learned from keeps changing. MLOps means running machine learning models in real products with the same care as any other software. An MLOps platform is one shared set of tools for all the teams. With it, a team puts its model live by filling in a form. It does not have to build its own pipeline (the chain of steps that trains a model), its own registry (the catalogue of trained models), or its own dashboards (the screens of charts that show if a model is healthy). Google's well-known paper on this problem says the model's own code is only a small part of a real machine learning (ML) system. This page designs the rest.
MLOps means running machine learning models in real products with the same care as any other software. An MLOps platform is the shared system a company uses to train, store, release and watch many models. Design it as one loop with five parts. First, data: every training set is a fixed, named copy, so a model can be rebuilt later. Second, a training pipeline: a chain of steps (check the data, build the inputs, train, test) that runs on a schedule or when an alarm fires. Each step runs inside a container image, a sealed package that holds the code, Python and every library. The library versions are pinned, which means fixed. Third, a model registry: a catalogue where every trained model becomes a version that never changes. It also holds aliases, which are movable names such as champion that point at one version. Serving means answering live requests with a model, and serving loads the alias, so a rollback just points the alias back. Fourth, rollout. A new version must beat the current one on held-out rows: examples kept aside and never used in training, so they give a fair test. The rule for winning is written down in advance. Then the new version runs in shadow: it answers live requests, but nobody uses its answers. Then it runs as a canary: it really answers a small share of requests. Fifth, monitoring. Input drift means the live inputs no longer look like the training inputs. Drift alarms are cheap and fast, but they do not prove harm. So the platform also checks real accuracy on a small labelled sample: rows where the true answer is now known. A feature is one input value for a model, such as a customer's purchases in the last 30 days. A feature store gives training and serving one definition of each feature. Its point-in-time join gives each training row only the values that existed at that row's own time, so training never sees the future. Around it all sit multi-tenancy (many teams sharing one platform safely) and quotas (a cap on how much each team may use, especially of GPUs, the costly chips that speed up training).
Where it shows up
This question is asked for ML platform engineer, MLOps engineer and ML infrastructure roles, and for senior or staff backend roles on teams that build tools for data scientists. It comes in several forms: design an MLOps platform, design an ML platform, design a model registry, design a system to retrain and deploy models, or how would you take a model from a notebook to production. Companies that run many models and have written about their own platforms, such as Uber with Michelangelo, show the shape of the answer. We do not list which companies ask it, because we could not find a public source we trust that says so.
Spec sheetan MLOps Platform
- 01Teams and models (interview assumption)
- 30 teams, 300 models in production, 100 of them answering live requests
- 02Training runs
- about 3,300 runs a week, about 470 a day (arithmetic)
- 03GPU time
- about 3,300 GPU-hours a week, so about 20 GPUs busy on average and about 60 at the nightly peak (arithmetic)
- 04Model files in the registry
- about 3 TB a year (arithmetic)
worked through below, with the maths
Why this question is asked
The question tests whether a candidate has looked after models for months after their first release. A weak answer draws 'train', an arrow and 'serve'. To serve a model means to answer live requests with it. That answer breaks on the next question: which data trained the model that is live right now, and how do you go back to last week's model in one minute? A strong answer treats the model as the smallest part of the system. It names the four things that must be versioned together (data, code, environment and settings), because a model file alone cannot be rebuilt. It knows that a model can fail silently: latency (the time to answer one request) stays low, no error appears, and accuracy falls. It treats rollout as a statistics problem, because two equally good models score differently on any test by chance. It treats the platform as a product for other engineers. Each team is a tenant with its own quota. And the path is self-serve, which means teams do the work themselves without waiting on the platform team.
This page is the free part.
The course goes deeper on the MLOps Platform design
₹1,333 in India$35 everywhere elseonce, for the whole course
The Generative AI and Agentic AI course covers the MLOps Platform design across a run of lessons, not one page. These 4 alone are about 266 minutes of step-by-step reading, every one with code you run in the browser, all with a quiz.
- A Model Registry, Hands On: An Alias Is a Pointer, and a Rollback Moved One Row
What does a model registry record, and how does 'load the production model' actually work? I ran MLflow 3.16.1 locally with three versions of the features chapter's model. Loading models:/shop-buyers@champion gave predictions identical to the trained model, to the bit. A rollback changed 1 of 320 rows in 1 of 18 files. Moving the alias to a model that takes other columns raised no error and scored test AP 0.1731, below all 20 random orders. The default save refused the model, and deleting a version left its alias behind.
- Point-in-Time Joins: A Latest-Value Join Promised 0.714 and Delivered 0.301
Real feature tables keep every version of a value with the time it became true, and a training row must read the version that existed at its cutoff. On 44,521 real training rows from a UK online shop, I joined the same feature table three ways and trained the same model on each. Joining each customer's latest values put the future into 70.7 percent of the rows, a median of 334.6 days ahead. Offline, on a random hold-out, that table promised an average precision of 0.714. On later months, scored the way a live system sees them, the same model gave 0.301, closer to a random guess at 0.196 than to the point-in-time model's 0.522. A team that built its table earlier, in April 2011, was fooled worse: 0.828 offline, a random guess on later months. A one-day timestamp slip leaked into 576 rows and flattered only the offline score.
- Online/Offline Consistency: Do Two Correct Implementations Agree?
Teams compute a feature twice: in pandas over history for training, and event by event for serving. I wrote both for lesson 1's six features on 26,851 real test rows from a UK online shop. With every choice made the same way, 17,670 rows still differed, in the last digits of money only, and 20 scores moved. Then I changed one defensible choice at a time. A UTC clock changed 20,796 rows by an hour with no measurable effect on the score. Ignoring returns in money was the only single choice that moved test AP measurably, by -0.000490 on 0.5450, and four choices at once by -0.000612. That is by a rule I added after seeing the results; by the rule I first declared, none did. One customer's score moved by 0.2366 for one choice, and 0.2395 for four at once. A parity test with exact equality flagged even the version with every choice the same; a loose tolerance passed it and the two other ways of adding, and flagged every choice that changed a non-money value.
- Canary and Shadow: How Much Live Traffic It Takes to See a Worse Model
A new model goes live in one of two ways: a canary, where a share of real requests goes to it, or shadow, where it answers every request silently next to the old one. I measured both on electricity prices, with the right answer arriving half an hour later. On a known 4.09-point regression, shadow raised the alarm in all 20 starts (median 241.5 half-hours) and a 20% canary in 12. Checking after every half-hour turned a 1% false-alarm rate into 6 to 10% for a canary. What a rollout is, why comparing the same rows needs fewer of them, what shadow costs, and two faults in my own first design, kept on the record.
all part of
Generative AI and Agentic AI Engineering
214 lessons · about 224 hours · 10 free to read
₹1,333in India, by UPI
$35everywhere else, by PayPal
pay once,
yours for life
Live from the course bench
Before you design MLOps, try the questions it rests on.
Real interview questions, live diagrams and measured lab results, pulled at random from the lessons. A new set every time you come back.
Requirements
Always clarify these in the first 5 minutes of the interview. Do not start drawing boxes until both lists are agreed.
Functional requirements
- Register datasets as fixed, named versions, and record which version every training run used
- Let a team define a training pipeline as configuration (data source, feature list, training code, compute size) and run it on a schedule, on new data, or on an alarm
- Track every run: settings, the random seed (the starting number that fixes all random choices in training), scores, the code commit (the exact saved version of the code), the data version, the container image and the files it produced
- Keep a model registry where each trained model becomes a version that never changes, with movable aliases such as champion (the live version) and challenger (the new version being tested)
- Gate promotion: a new version only replaces the current one if it wins on the same held-out rows by a rule set in advance
- Roll out in steps (shadow, then canary, then everyone), and roll back (return to the last good version) by moving an alias, in seconds, with no rebuild
- Serve features (the input values a model reads) from one definition for both training (history) and live requests (latest value)
- Monitor inputs, outputs and real accuracy per model, and open a retrain proposal when a check fails
- Give each team its own space with GPU and CPU quotas, and show each team its own cost
- Control who may move the champion alias: an automatic gate for low-risk models, a named person's approval for high-risk ones, both logged in alias_events
Non-functional requirements
- Reproducible: any registered version can be rebuilt from its record, or at least loaded and checked against stored answers
- Auditable: every promotion and rollback is logged with who, when, which versions and why
- Safe by default: a bad version reaches only a small share of traffic before a check can stop it
- Fast rollback: under a minute, because it is a pointer move, not a training run or a new build
- Isolated: one team's runaway training job cannot take every GPU in the cluster
- Cheap to watch: monitoring runs off the request path and adds no latency to predictions
- Private: prediction logs hold user inputs, so they have access controls, a retention limit and a way to delete one person's rows
- Self-serve: a new model reaches production through templates, not through tickets to the platform team
Back-of-envelope scale estimates
Show your math. Pulling numbers from thin air signals you have not thought about the load.
Teams and models (interview assumption)
30 teams, 300 models in production, 100 of them answering live requests
Say these out loud first. Everything below is arithmetic on them.
Training runs
about 3,300 runs a week, about 470 a day (arithmetic)
Assume each production model retrains once a week: 300 runs. Assume each team also runs 10 experiments for every production retrain: 3,000 more. 300 + 3,000 = 3,300 runs a week. 3,300 / 7 = 471 a day. Most start at night, so the scheduler must handle a burst.
GPU time
about 3,300 GPU-hours a week, so about 20 GPUs busy on average and about 60 at the nightly peak (arithmetic)
Assume half the runs need one GPU for 2 hours: 1,650 x 2 = 3,300 GPU-hours. A week has 168 hours, so 3,300 / 168 = 19.6 GPUs busy all the time on average. If runs bunch into a few night hours, the peak is about 3 times the average, about 60 GPUs.
Model files in the registry
about 3 TB a year (arithmetic)
300 models x 52 weekly versions = 15,600 registered versions a year. At an assumed 200 MB per model file, 15,600 x 200 MB = 3.12 TB. Run metadata is a few kilobytes per run, so the registry is a small database plus a large object store.
Prediction logs
about 1.7 TB a day if every prediction is logged (arithmetic)
Assume the 100 online models answer 20,000 requests a second in total, and each log row (inputs, output, model version, request id) is 1 KB. 20,000 x 1 KB = 20 MB a second. 20 MB x 86,400 seconds = 1.73 TB a day. It goes to a queue and cheap object storage, never to the serving database.
Drift checks
about 290,000 small checks a day (arithmetic)
300 models x 40 input columns = 12,000 columns to watch. Checked every hour: 12,000 x 24 = 288,000 checks a day. Each compares two histograms of about 10 bins, so the compute is tiny. The hard part is deciding which alarm means harm.
Rows a canary sees
measured: a 5% canary saw 110 labelled rows in 2,000 half-hours
Measured in our canary and shadow lesson on Elec2, a public electricity price dataset where one labelled row arrives every half-hour. A 20% canary saw 419 rows and a 50% canary saw 1,007. The rule: rows seen = labelled traffic x canary share x time. Work it out before you pick the share.
High-level architecture
Draw the platform as a loop of five parts on top of one shared compute cluster. The figure groups them into four bands: data, train, register, and serve-and-watch. Data. Object storage is a cheap store for large files, and Amazon S3 is the best-known one. Every training set is a named, fixed version there. It can be a tag on a snapshot (a frozen copy of a table at one moment). Or it can be a set of files named by their hash, a short fingerprint computed from the bytes, which changes if even one byte changes. Next to it sits a feature store. The feature store keeps each feature's definition once and serves it two ways: an offline store with full history for training, and an online store with the latest value for live requests. Training. A pipeline orchestrator is a scheduler program that runs steps in the right order. Airflow and Kubeflow Pipelines are two common ones. Each model's pipeline is a DAG, a directed acyclic graph: steps joined by arrows, with no loops. The steps: check the data, build the training set, train, evaluate against the current model, and register if it wins. Each step runs in a container image built from a lock file, a file that lists the exact version of every library. Kubernetes, the system that runs containers across many machines, runs each step in the team's own namespace: a walled-off space with its own quota. Registry. The model registry, such as MLflow's, stores each trained model as a version that never changes, with its lineage: which data version, code commit, image and seed produced it. Aliases such as champion point at one version. CI (continuous integration: the system that builds and tests code automatically, such as GitHub Actions) builds one serving image per model type, and that image loads whichever version the alias points at. A rollback then needs no new image. Serving and rollout. A deployment controller reads the alias and runs the model on Kubernetes. Online means the model answers each request as it arrives. A batch job scores a large set of rows at once, for example every night. New versions go through shadow and then canary, and promotion and rollback both move the alias. Monitoring. Every prediction is logged to a queue and then to object storage, off the request path. Scheduled jobs compute input drift, output drift, and real accuracy when labels arrive, and push the numbers to Prometheus, a database for numbers over time. Grafana draws dashboards from those numbers. A failed check opens a retrain proposal that goes back to the pipeline, through the same gate. That arrow back is what makes it a loop.
In a real interview, sketch this on the whiteboard before diving into any single box.
One fraud model, from a nightly training run to live traffic, and back
Follow version 7 of a fraud model through the platform. This is a good order to explain the design in an interview.
- 1
Triggered
The weekly schedule fires, or a monitoring check failed. The orchestrator starts the fraud team's pipeline in the team's namespace, with the team's GPU quota.
- 2
Data pinned
The first step resolves the training data to a fixed version, for example the tag train-week-51, and records its hash.
- 3
Data checked
A validation step checks row counts, column types and value rules. Broken data stops the run before any GPU time is spent.
- 4
Training set built
The pipeline asks the feature store's offline store for each labelled row's features as they were at that row's time: a point-in-time join. No row sees a value whose event time is after its own time. To also block values that were written later but stamped with an old time (backfills), the join must filter on the time each value was written, which Feast does only when asked.
- 5
Trained
Training runs in a container built from a hash-locked dependency file, with a fixed seed. The tracking server records settings, metrics, the data hash, the code commit and the image digest (the image's own hash).
- 6
Gated
The new model and the current champion are scored on the same frozen held-out rows. A rule written down before the run decides: promote only if the new model wins by a set margin, or by a paired test, which compares the two models row by row on the same rows.
- 7
Registered
Version 7 is added to the registry with its lineage, its input signature (the expected column names and types), and its answers on a stored set of rows. The alias challenger moves to version 7.
- 8
Shadowed
Serving sends every live request to both models. Only the champion's answer is used. The platform counts the rows where they disagree.
- 9
In canary
A small random share of requests is answered by version 7. The platform compares live metrics at checkpoints fixed in advance, and stops the rollout on a clear loss.
- 10
Promoted
The alias champion moves from version 6 to version 7. The move is logged. Version 6 stays in the registry, unchanged.
- 11
Watched
Prediction logs flow to monitoring. Drift checks run hourly, and accuracy is checked as labels arrive. If version 7 turns out worse, rollback moves champion back to version 6 in seconds.
Core components
Walk through each service. The interviewer wants to hear what each one owns, not just the names.
Dataset versioning
Turns 'the sales table' into 'the sales table as it was at tag train-week-51'. DVC keeps a small pointer file in Git and the bytes in object storage. Iceberg keeps table snapshots you can tag. Delta Lake keeps numbered table versions you can read back, so record the version number. In both, set file cleanup so it never deletes files that a recorded version still needs.
Feature store
Holds each feature's definition once, as code with an owner. The offline store keeps every past value with the time it became valid, for training. The online store keeps only the latest value per entity (the thing a feature describes, such as one customer), for fast lookups at serving time. A scheduled job copies the latest values from offline to online. Feast is the common open-source example.
Pipeline orchestrator
Runs each team's pipeline as a DAG of steps, on a schedule or on an event, with retries per step. Airflow runs steps as tasks through a scheduler and workers. Kubeflow Pipelines runs each step as a container on Kubernetes. The orchestrator decides what runs and when; Kubernetes decides where.
Experiment tracking and lineage store
Records every run: settings, seed, metrics, files produced, the data version and hash, the code commit, and the container image digest. Google's MLOps guide calls this the metadata store.
Model registry
A catalogue of registered models. Each model has numbered versions that never change, and aliases that can move. It is a small database plus pointers to model files in object storage.
Promotion gate and rollout controller
Decides whether a new version may move forward. It scores the new and current versions on the same rows by a rule fixed in advance, runs shadow and canary stages, and moves the alias. It refuses a version with no lineage record or no input signature.
Serving layer
Runs models as online services on Kubernetes or as batch jobs. It loads the version an alias points at, checks incoming requests against the version's signature, and logs every prediction with its model version.
Monitoring and retrain trigger
Reads the prediction log off the request path. It computes input drift per column, output drift, and real accuracy on labelled rows, and pushes them to Prometheus for Grafana dashboards. A failed check opens a retrain proposal, which goes back through the gate.
Tenancy, quotas and cost
Gives each team a Kubernetes namespace with a ResourceQuota, which caps the CPUs, memory and GPUs that team can request. Training jobs wait in a queue with priorities. The platform tags every run and every serving pod with its team, so each team sees its own GPU bill.
Data model
Pick the right store per table. Justify each choice with the access pattern, not by reflex.
dataset_versionsdataset_version_iddataset_nametag (e.g. train-week-51)snapshot_id or file hashesrow_hashrow_countcreated_atOne row per named version. row_hash is a hash over every row that ignores their order, so it catches a changed value but not a harmless reordering. Build it by adding the row hashes, not by XOR, which cancels out duplicate rows. Retention must never delete a snapshot that a tag still names.
runsrun_idteam_idpipeline_iddataset_version_idgit_commitimage_digestparams (incl. seed)metricsstatusstarted_at, finished_atOne row per training run, including the ones that lost. image_digest pins the whole environment: the operating system, Python and every library.
model_versionsmodel_nameversion (1, 2, 3 ...)run_idartifact_urisignature (columns and types)answers_hashcreated_atNever updated after it is written. artifact_uri points to the model file in object storage. answers_hash is a hash of the model's predictions on a stored set of rows: loading the file later and getting the same hash proves the model is the same one. (model_name, version) is the key.
model_aliasesmodel_namealias (champion, challenger ...)versionupdated_byupdated_atOne small row per alias. Promotion and rollback each update exactly one row here. Before deleting a version, clear any alias that points at it: in our registry lesson, deleting a version on MLflow 3.16.1 with a SQLite store could leave its alias pointing at nothing.
alias_eventsevent_idmodel_namealiasfrom_versionto_versionreasongate_resultactoratAn append-only audit log. Every promotion and rollback writes one row, with the gate's result and the reason.
deploymentsdeployment_idmodel_namealiasresolved_versionmode (online, batch, shadow)traffic_sharenamespacereplicasupdated_atWhat is actually running, which can lag the alias for a few seconds while serving reloads. resolved_version is the version the pods really loaded.
feature_definitionsfeature_viewentity (e.g. customer_id)columns and typessourcefreshness targetttlowner_teamversionThe feature store's registry. ttl is how far back a point-in-time join may look for a value. A change of meaning creates a new version, not an edit.
monitoring_metricsmodel_nameversionmetric (psi, accuracy, latency_p99 ...)column (nullable)window_startvalueA time series, best kept in a metrics or time-series store such as Prometheus. Each point carries the model version.
Deep dives
These are the conversations the interviewer is steering you toward. Practice each one until you can talk through it without notes.
Reproducibility: a model version is a receipt for data, code and environment
Reproducible means you can build the same model again, or at least prove that a file is the same model. A model file alone cannot do this. Four things decide what a training run produces: the data, the code, the environment (Python and every library), and the settings, including the random seed. The platform records all four for every run, with every setting, not only the ones you changed. Every number marked measured on this page comes from a lab in our AI Engineering course, and most of those labs come with a script you can run yourself. Data. Training tables change after a model has used them, because late corrections rewrite old rows. Measured in our data versioning lesson on the UCI Online Retail II shop data: 1,047,877 sale lines were changed 16,675 times by real returns. 26.5% of those returns changed a sale that was more than 28 days old. So 'the data as of last Monday' cannot be rebuilt by filtering on a date. You need a stored copy with a name. Environment. A pickle file, the default way Python saves a scikit-learn model, holds the names of Python objects, not their code. So loading it depends on the libraries installed. Library version skew means the library versions used to save a model differ from the ones used to load it. Measured in our library version skew lesson: of 30 loads of a saved model into a different scikit-learn or numpy version, 22 failed. Two loaded and then failed only at the first prediction, so a health check that only loads the file is not enough. Our pinning lesson found that a five-line, unpinned requirements file resolved to 11 packages, and between 4 and 9 of them changed version every three months. A lock file lists the exact version of every package with a hash of its file. Installed twice, the hash-locked file gave a bit-identical model. So the platform builds every training and serving image from a hash-locked file. It records the image digest, the hash that names one exact image. The check. Store a hash of the model's answers on a fixed set of rows. Measured in our lineage and rollback lesson: when the seed was not recorded, 19 guessed seeds rebuilt models that agreed with the original on 92% to 97% of rows, and none was exact. The data hash stayed the same, so it could not see the problem. Only the answers hash caught all 19. Some wrong rebuilds even scored higher accuracy than the real model. Judge a rebuild by whether it agrees with the original, never by whether it scores well.
The model registry: fixed versions and movable aliases
A model registry answers three questions: which version is live, what produced it, and how to get back to the last good one. The design keeps the things that never change apart from the names that point at them. A version is fixed. Once version 7 is written, its model file, its signature (the input columns and types it expects) and its lineage (the record of what produced it) never change. If you retrain, you get version 8. An alias is a movable name. MLflow's documentation describes model aliases as a mutable, named reference to a particular version, and serving loads the model by an address such as models:/fraud@champion. Serving never knows a version number. Promotion moves champion to the new version. Rollback moves it back. Both are the same small write. Measured in our registry lesson on MLflow 3.16.1 with a local SQLite store: a rollback changed one row out of 320 in the registry's database and touched no model file, and the unchanged loader returned predictions identical to the earlier version, bit for bit. Older MLflow tutorials use stages (None, Staging, Production, Archived) instead of aliases. MLflow's workflow docs say that as of MLflow 2.9.0, model stages are deprecated and will be removed in a future major release. Design with aliases. The same lab found two failures that a platform should guard against. First, an input signature built from a plain array only checked the shape and the number type. A version that expected different columns became champion with no error, and it ranked cases worse than random guessing. A signature built from named columns refused the wrong input. So the registry should require named-column signatures. Second, in some cases deleting a version left its alias pointing at nothing, and the next load failed. So the platform clears aliases before any delete, or refuses to delete a version that an alias points at. Each model version must also record the feature definitions it was trained with. If a feature's meaning changed after version 6 was trained, moving champion back to 6 is not a full rollback: serving must also give version 6 the old feature version. After every alias move, run the new target on a stored set of rows and compare with its recorded answers hash.
from mlflow import MlflowClient
import mlflow.pyfunc
client = MlflowClient()
NAME = "fraud"
# Serving loads once at start-up, and reloads when the alias moves.
model = mlflow.pyfunc.load_model(f"models:/{NAME}@champion")
def serve(rows):
# The serving side never names a version number.
return model.predict(rows)
# Promote: the gate passed, so point champion at version 7.
client.set_registered_model_alias(NAME, "champion", "7")
# Roll back: the same call, pointing at the last good version.
client.set_registered_model_alias(NAME, "champion", "6")
# Check what the alias resolves to before and after every move.
print(client.get_model_version_by_alias(NAME, "champion").version)
Train/serve skew and the point-in-time join
Train/serve skew means the model sees different numbers in production from the numbers it learned on. Google's Rules of Machine Learning define it as a difference between performance during training and performance during serving. A common cause, they say, is data handled differently in the training and serving pipelines. It raises no error. The model just gets worse. The first fix is one definition per feature. If training computes 'purchases in the last 30 days' in SQL and serving computes it in application code, the two will drift apart. The feature store keeps one definition and serves it two ways. Even one definition written twice can disagree. Our online/offline consistency lesson built the same features twice: once in batch over the history, and once event by event, as live serving does. Every choice was made the same way. Measured: the money column still differed on 65.8% of test rows. The largest difference was 0.000000002 pounds. The cause was that pandas adds numbers with a more careful method than a plain loop. That noise did not measurably move the model's score. The only change that did was a change of meaning, one side counting returns and the other ignoring them, and even that moved it only a little. The lesson's advice has two parts. First, run a parity test (a check that both versions give the same values) with a tolerance per column: counts must match exactly, times within one second, money within a tiny relative error. Second, check the model's score, because a parity test finds differences but only the score says which ones matter. The second fix is the point-in-time join. A training row has a time, such as 'did this customer buy in the 30 days after 1 June?'. Its features must be the values that existed on 1 June, not today's values. A feature table that keeps only the latest value leaks the future into training. Feast's historical retrieval does the right thing: it rebuilds the features as they were at a point in the past, looking back from each row's time up to a limit called the TTL. By default Feast filters on the event time only. Late backfills still leak unless the join also filters on the time each value was created. To read the next result you need one score. Average precision is a score from 0 to 1 for how well a model puts the true cases at the top of its list. Here, random ranking scores about 0.196. Measured in our point-in-time joins lesson on the UCI shop data: a model trained with a latest-value join scored 0.714 offline and 0.301 on later months. The same model with a point-in-time join scored 0.540 offline and 0.522 on later months. The leak made the offline number look better and the real number much worse. 70.7% of training rows had read a value written after their own cutoff.
import pandas as pd
rows = pd.merge_asof(
labels.sort_values("cutoff"), # one row per (customer, cutoff)
features.sort_values("valid_from"), # every version of every value
left_on="cutoff", right_on="valid_from",
by="customer_id", # match within one customer
direction="backward", # newest value before the cutoff
allow_exact_matches=False, # here a value stamped AT the cutoff is not known yet; choose on purpose
)
# Customer 7, cutoffs 2011-03-01 and 2011-06-01, values written on
# 2011-01-10 (2), 2011-04-02 (5) and 2011-09-15 (9):
# point-in-time join gives 2 and 5
# a "latest value" join gives 9 and 9, a number from the futureSafe rollout: the promotion gate, shadow and canary
A new version reaches users in steps, and each step can stop it. Engineers call a new model that is worse than the old one a regression; on this page the word means only that. Step one is the offline gate. Score the current champion and the new challenger on the same frozen held-out rows, and decide by a rule written down before you look. 'Higher score wins' is a bad rule, because two models of equal quality score differently by chance. Our promotion gate lesson tested this on Elec2, where each half-hour's label says whether the electricity price went up or down. It made two models exactly equal: on every row, a coin flip decided which model got the other's right-or-wrong result. Measured: 'higher score wins' promoted the equal challenger in 43% to 51% of test windows. A fixed margin did better on large windows. McNemar's test, a paired test that counts only the rows where exactly one of the two models was right, promoted it about 2% of the time. Even a small error rate adds up. Between two equal models, a test set to be wrong 5% of the time, run every week, ships up to about 52 x 0.05 = 2.6 models a year that are not better. Step two is shadow. Serving sends each request to both models but uses only the champion's answer. The shadow model's calls must never write anything or trigger actions (no emails, no blocked cards); only its scores are logged. Both models answer the same rows, so the comparison is paired. Measured in our canary and shadow lesson on Elec2, against a challenger about 10 points worse: shadow raised the alarm in 18 of 20 starts, after a median of 115.5 half-hours (about 2.4 days). A 5% canary raised it in 14 of 20, after a median of about 21 days. On every regression in that lab, shadow alarmed in more starts than any canary. Shadow costs double compute, and it cannot show how users react to the new answers. Step three is the canary. A random share of requests gets the new model's answers. This is the only step that shows real user effects, such as clicks or complaints. Assign the canary by a hash of the user or account, so one user does not switch between models from one request to the next. For fraud, labels arrive weeks late, so the canary can only be judged on proxy metrics until they arrive. Its other weakness is size. In the same lab a 5% canary saw only 110 labelled rows in 2,000 half-hours, so its first allowed test came very late. Count labelled rows, not hours. Another trap is looking too often. In that lab, checking the canary after every half-hour, instead of once at the end, raised the false alarm rate from about 1% to between 6% and 10%. Fix the checkpoints in advance, or use a test built for repeated looks. Step four is the alias move. When the canary holds, champion moves to the new version and the move is logged.

Monitoring: a drift alarm is not the same as harm
A model can fail with no error at all. Latency stays flat, error rates stay at zero, and accuracy falls. So the platform watches three signals from the prediction log: the inputs (did the data change?), the outputs (did the model's answers change?), and real accuracy (is it wrong more often?). The first two are fast and need no labels. The third is slow, because true answers, such as fraud chargebacks, arrive weeks late. The common input check is PSI, the Population Stability Index. Split the training values of one column into 10 bins. For each bin, find two shares: the share of training values in it, and the share of live values in it. Subtract the training share from the live share. Multiply that by the natural log of the live share divided by the training share. Add up the 10 results. A common habit, not a proven rule, reads under 0.10 as stable, 0.10 to 0.25 as a moderate shift, and above 0.25 as a big shift. Yurdakul's 2018 thesis on PSI notes these lines are used without any stated rate of false alarms (Type I errors) or missed changes (Type II errors). Measured in our monitoring lesson on 33,937 sentences of writing: 40% of a sample was swapped for a different kind of text. At 20,000 samples, PSI on sentence length read 0.081, under even the 'stable' line. A KS test, which compares the whole shape of two sets of numbers, caught it. The bigger lesson is that a drift alarm measures movement, not harm. Our drift alarm versus harm lesson used California housing data, in 100 batches of 500 rows each. Measured: batches from busy districts moved one column that the model hardly uses. PSI rang on all 100 batches. Yet the model's error on those batches was 9% lower, not higher. Concept drift means the link between the inputs and the right answer changes, even when the inputs look the same. The lab simulated it with a 20% price rise. PSI rang on 0 of 100 batches, and the KS test on 4, the same as on ordinary data. Meanwhile the error rose 64%. Only data from a region the model had never seen made every alarm ring together with real harm. So design two paths and word them differently. The fast path watches inputs and outputs and says 'the data moved: look at which column', ranked by how much the model uses each column. The slow path checks real accuracy on a small labelled sample and says 'the model is worse'. In the same lab, a 50-row labelled check per batch caught the price rise in 99 of 100 batches, but also rang falsely on 23 of 100 ordinary batches, so test its threshold on ordinary data first. Only the slow path should wake an engineer with an urgent alert at night.
import numpy as np
def psi(expected, actual, buckets=10):
edges = np.quantile(expected, np.linspace(0, 1, buckets + 1))
edges[0], edges[-1] = -np.inf, np.inf # catch values outside the old range
e = np.histogram(expected, bins=edges)[0] / len(expected)
a = np.histogram(actual, bins=edges)[0] / len(actual)
e, a = np.clip(e, 1e-4, None), np.clip(a, 1e-4, None) # no log of zero
return float(np.sum((a - e) * np.log(a / e)))
rng = np.random.default_rng(0)
ref = rng.exponential(scale=40.0, size=20000) # amounts at training time
psi(ref, rng.exponential(scale=40.0, size=20000)) # about 0.001: same world
psi(ref, rng.exponential(scale=68.0, size=20000)) # about 0.23: amounts grew 70%,
# still under the 0.25 lineWhen to retrain, and stale pieces that never raise an error
Retraining has three common triggers: a schedule, new labelled data, and an alarm. Google's MLOps guide calls automatic retraining continuous training, and lists a drop in performance among the triggers. Our labs add three warnings. First, a schedule is a strong baseline. Measured in our when-to-retrain lesson on Elec2: a model never retrained scored 0.6610 accuracy over about 15 months of served data. Monthly retraining scored 0.7516 with 16 retrains. Weekly scored 0.7636 with 67 retrains, using 4.1 times the training rows of monthly. The lesson's follow-up found most of that gain came from one input, the date, which the frozen model had never seen go so high. With the date removed, retraining gained 1.94 points (monthly) and 3.19 (weekly). Second, do not compare against a bar that is set too low. That lab's trigger compared each model with its own first week. One model started badly, so its bar was low, and it was never retrained again: the triggered policy scored 0.6812 with only 8 retrains. Compare against a fixed floor or the previous champion instead. Third, check that the model is needed at all. In that lab, a naive guess, repeating the last half-hour's answer, scored 0.8622, better than every model policy. Late labels matter too. In our late-labels lesson, weekly retraining beat never retraining by a wide margin when labels arrived within a day, by only a little when they were one or four weeks late, and it scored lower when they were twelve weeks late (0.6954 against 0.7077). Every retrain goes through the same gate as a new model, because some retrains in that lab made a month worse. Then there are stale pieces. A pipeline has more parts than the model, and each one can go out of date with no error. Measured in our stale pieces lesson on Elec2, two cases. A lag feature is an input that holds a recent past value, here the last half-hour's answer. It was served from a cache (a fast copy of data) refreshed once a day. Accuracy dropped from 0.8193 to 0.7489, and the model's answers looked normal. A scaler is the step that rescales inputs before the model. One left over from an old training run dropped accuracy from 0.6491 to 0.4512, and the model said 'price goes UP' for every row. Different checks caught each one. A 'stuck input' check, which notices that a value that should move has held still all day, caught the cache. A range check on the numbers the model actually received caught the scaler. The fix: store each cached value's age and refuse old values. Ship the scaler inside the model file, for example as one scikit-learn Pipeline, so the two are versioned together.
Multi-tenancy, GPU scheduling and cost
Multi-tenancy means many teams share one platform without hurting each other. On Kubernetes, the usual unit is the namespace: one per team. A ResourceQuota object limits the total resources a namespace may use. If a request would break the quota, Kubernetes refuses it with a 403 Forbidden error, which means 'not allowed'. Kubernetes treats GPUs as an extended resource: a resource added by a plugin rather than built in like CPU and memory. Each container states a request (what it needs to be scheduled) and a limit (the most it may use). Kubernetes' GPU guide says GPUs are set in the limits, and a request, if given, must equal the limit. So two containers are never promised the same GPU card. A GPU quota uses the requests. prefix, for example requests.nvidia.com/gpu. Quotas stop one team from taking everything. Quotas do not keep the GPUs in use. Our estimate above had an average of about 20 busy GPUs but a nightly peak near 60. Three ideas fix this. A queue with priorities lets production retrains go first while experiments fill the gaps. Preemption, stopping a low-priority job to free its GPU, becomes safe when training jobs save checkpoints. A checkpoint is a saved copy of the model's weights and training state, written every few epochs (an epoch is one full pass over the training data). A stopped job then resumes where it stopped. And jobs that do not need a GPU, such as data checks, stay off GPU machines. Tag every run and every pod (the small group of containers Kubernetes runs as one unit) with its team and model, so each team sees its own GPU-hours. In our capstone lesson, an illustrative cost split puts compute at about two thirds of the bill (training GPUs 46% and serving 18%), and the lesson says the split changes with the workload. The last part of tenancy is ownership. The platform team owns the plumbing: pipelines, registry, rollout, monitoring and the cluster. Model teams own their features, training code, gate thresholds and business metric. A team should ship a model by writing configuration, not by filing tickets. That self-serve path is what makes it a platform.

Trade-offs to discuss
Every senior interviewer expects you to surface at least 3 of these. Pick the decisions, state the alternatives, and justify your choice.
Build the platform, or buy a managed one
A managed service (a cloud ML platform) gets a few teams to production fast, with no cluster to run. Building on open tools (Airflow or Kubeflow, MLflow, Feast, Kubernetes) gives control over cost, data location and the serving path, at the price of a platform team. Decide per layer, not all at once: many teams buy orchestration and monitoring first, and build the parts that need many GPUs once GPU costs grow.
Retrain on a schedule, or on an alarm
A schedule is simple and, in our lab, beat never retraining, though much of that gain came from one input, the date. An alarm saves runs, but if it compares against a bar set too low it stops firing. Use a schedule as the floor, add an alarm compared against a fixed level, and send both through the same gate.
Shadow, or go straight to a canary
Shadow is paired, so it sees a regression with fewer rows, and no user gets the new answer. It costs double compute and is blind to user reactions. A canary shows real user effects but sees few labelled rows at a small share. Shadow first, then a short canary, is the usual answer.
One shared feature store, or features inside each model's code
Features inside the code are simple for one model with batch scoring. A feature store pays off when features are shared between teams, needed both in training and in low-latency serving, or hard to join point in time. It gives consistency, not a better model, so do not add it for a single batch model.
Store whole copies of each dataset version, or only changes
Whole copies are simple to read but grow fast: 52 times the final size over 110 versions in our lesson. Change files are cheap to store but slower to read and need compaction.
Hard GPU quotas, or a shared pool
Hard quotas protect each team but leave cards idle when a team is quiet. A shared pool with priorities keeps cards busy but needs preemption and checkpoints, so a low-priority job can be stopped and resumed. A common design gives each team a small guaranteed quota and lets it borrow idle GPUs from a shared pool. Plain ResourceQuota cannot lend, so this needs a job queue such as Kueue (its cohorts allow borrowing).
Free PDF · 12 pages
Get the free AI Engineering Cheat Sheet
What our labs measured about tokens, prompting, RAG, evals, agents, serving, cost and fine-tuning, and the rule each result teaches.
Follow-up questions to expect
After the main design, the interviewer usually picks one part and asks more. Here is what to say.
A model went live yesterday and the fraud loss doubled overnight. What do you do first?
Roll back first, investigate second. Move the champion alias back to the previous version, which is one row change and takes seconds, and log the move. Then use the lineage record of the bad version to compare its data version, code commit, image digest and settings with the last good one.
The drift dashboard is red for a week, but the business metric is fine. Is the model broken?
Not necessarily. A drift alarm shows that the inputs moved, not that the model got worse. Check which column moved and how much the model uses it. In our lab, a column the model hardly used moved on every batch while the error went down. Confirm with a small labelled sample before you retrain or send anyone an urgent alert.
Offline the new model scores much better, but online it is worse. What is the likely cause?
Look for leakage or skew. A latest-value feature join leaks the future into training and inflates the offline score: in our lab it gave 0.714 offline and 0.301 on later months. Check that training used a point-in-time join, and run a parity test between the offline and online feature values with a tolerance per column.
How do you rebuild the exact model that was live three months ago?
From its record: the tagged data version, the code commit, the container image digest built from a hash-locked file, and every setting including the seed. Retrain, then compare the new model's answers on the stored rows with the recorded answers hash. If they do not match exactly, either something in the record is missing or the training is not deterministic. GPU training often is not, unless deterministic settings are switched on, so for GPU models compare against a stored tolerance, or keep the original model file and reload it instead of retraining.
Ten teams share 40 GPUs and one team's experiments block everyone's nightly retrains. How do you fix it?
Give each team a namespace with a ResourceQuota on requests.nvidia.com/gpu, so one team cannot take the cluster. Put training jobs in a queue with priorities, so production retrains run before experiments. Make jobs save checkpoints, so a low-priority job can be stopped and resumed.
How an MLOps Platform actually does it
Three public sources describe the shape of this design well. Google's 2015 NeurIPS paper, Hidden Technical Debt in Machine Learning Systems, argues that ML systems carry hidden costs that grow over time, much like a debt. Two of the risks it names are easy to picture: a model depends on data that other teams can change without warning, and the outside world changes after the model was trained. Most of this platform exists to keep those costs down. Google Cloud's guide, MLOps: Continuous delivery and automation pipelines in machine learning, describes three levels: level 0 is manual, level 1 automates the training pipeline with data and model checks, triggers and a metadata store, and level 2 also builds, tests and releases the pipeline's own code automatically, which is called CI/CD (continuous integration and continuous delivery). It says only a small fraction of a real ML system is the ML code. Uber's 2017 post, Meet Michelangelo, describes a platform Uber began building in mid 2015. It covers the whole workflow: manage data, train, evaluate, deploy, predict and monitor. Its shared feature store held about 10,000 features, and its busiest models served more than 250,000 predictions a second. A model was found by an id plus an optional tag or alias, much like the aliases on this page. Predictions were logged and later joined to real outcomes to measure live accuracy. The open-source tools named on this page (MLflow, Feast, Airflow, Kubeflow Pipelines, DVC and Kubernetes) each cover one of these parts, and their documentation is listed below. The measured numbers on this page come from labs in our AI Engineering course. They were run on one laptop with scikit-learn and public datasets. Each lesson states its own limits, and each number here says which lesson it came from.
Sources
- Sculley et al., Hidden Technical Debt in Machine Learning Systems (NeurIPS 2015)
- Google Cloud: MLOps: Continuous delivery and automation pipelines in machine learning
- Uber Engineering: Meet Michelangelo, Uber's Machine Learning Platform (2017)
- MLflow Model Registry (versions, aliases, tags)
- MLflow Model Registry Workflows (aliases; stages deprecated as of 2.9.0)
- Feast: Introduction (offline store, online store)
- Feast: Point-in-time joins
- Kubeflow Pipelines: Overview
- Apache Airflow: Architecture Overview
- DVC: Versioning Data and Models
- Kubernetes: Schedule GPUs
- Kubernetes: Resource Quotas
- Kueue: Cohort (sharing and borrowing quota between queues)
- Google: Rules of Machine Learning (training-serving skew)
- Yurdakul, Statistical Properties of Population Stability Index (2018)
Lessons to study before this interview
If any of these topics are fuzzy, the interviewer will catch it. Each lesson is 15 to 60 minutes with diagrams, code, and a quiz.
A Model Registry, Hands On: An Alias Is a Pointer, and a Rollback Moved One Row
ml-intermediate / packaging and registry
Point-in-Time Joins: A Latest-Value Join Promised 0.714 and Delivered 0.301
ml-intermediate / features and feature stores
Online/Offline Consistency: Do Two Correct Implementations Agree?
ml-intermediate / features and feature stores
Canary and Shadow: How Much Live Traffic It Takes to See a Worse Model
ml-foundation / ml lifecycle
The Promotion Gate: How Often a New Model That Is Not Better Gets the Job
ml-foundation / ml lifecycle
When to Retrain: A Schedule, a Trigger, and What Each Retrain Buys
ml-foundation / ml lifecycle
When the Answers Arrive Late: What a Label Delay Costs a Model, and How Late You See Its Mistakes
ml-foundation / ml lifecycle
Stale Pieces in a Pipeline: A Cached Input, an Old Scaler, and What Each One Hides
ml-foundation / ml lifecycle
Lineage and Rollback: Rebuilding Last Month's Model Exactly, and What Breaks When You Cannot
ml-foundation / ml lifecycle
Drift Alarms Against Real Harm: When the Alarm Rings, Is the Model Worse?
ml-intermediate / data engineering for ml
Data Versioning: Reproducing the Exact Data That Trained a Model
ml-intermediate / data engineering for ml
Library Version Skew: Old Model Files Broke on Upgrade, and Retraining Made a Different Model
ml-intermediate / packaging and registry
Pinning Dependencies: The Same Requirements File Installed Something Else Every Season
ml-intermediate / packaging and registry
Training Pipelines and Orchestration: Retraining That Runs Itself
ml-foundation / core
The Full ML Platform: Assembling Every Piece Into One Golden Path
ml-foundation / core
Frequently asked questions
Go deeper
This guide is built on these 6 lessons. Each one teaches one piece of the MLOps Platform design above, step by step.
- A Model Registry, Hands On: An Alias Is a Pointer, and a Rollback Moved One RowAI Engineering · packaging and registry · 67 min
- Point-in-Time Joins: A Latest-Value Join Promised 0.714 and Delivered 0.301AI Engineering · features and feature stores · 64 min
- Online/Offline Consistency: Do Two Correct Implementations Agree?AI Engineering · features and feature stores · 61 min
- Canary and Shadow: How Much Live Traffic It Takes to See a Worse ModelAI Engineering · ml lifecycle · 74 min
- The Promotion Gate: How Often a New Model That Is Not Better Gets the JobAI Engineering · ml lifecycle · 69 min
- When to Retrain: A Schedule, a Trigger, and What Each Retrain BuysAI Engineering · ml lifecycle · 71 min
Practice with 214 AI Engineering lessons
Lifetime access for ₹1,333 in India or $35 elsewhere. Real labs with measured numbers, RAG, agents, evals and serving, and an AI tutor beside every lesson.
This one question is not enough for the interview.
Get all 150 questions in the ML Engineering and MLOps pack
Each question has why it is asked, a full answer, what the interviewer listens for, the follow-ups, the common mistakes and a diagram (193 diagrams in all). A PDF you keep, junior to staff level.
India: UPI, cards or netbanking through Razorpay. Elsewhere: card or PayPal. Download at once from My packs.

