Data · Guide

MLOps

Experiment tracking, model serving, and noticing when the data moves under you — the work between a notebook and a product.

— min read Data

A Notebook Is Not a Product

A model nobody can run, retrain or roll back has no value, however good its validation score. MLOps is the distance between those two states.

Machine learning systems fail in ways ordinary software does not. Normal code breaks loudly. A model degrades silently: it keeps returning confident answers while the world it was trained on drifts away underneath it.

There are also three moving parts to version, not one. Code, data and model must be reproducible together — the same code on different data gives a different model, and knowing which combination produced the artefact currently serving traffic is a basic requirement.

Most of this discipline is ordinary engineering applied to an unusual artefact: version control, CI, containers, monitoring, rollback. If you know how to run a service, you are most of the way there.

Experiment Tracking

Training runs are experiments, and experiments need records. Without one you cannot answer the question that always arrives: which run produced the model we are serving, and can we reproduce it?

Record per runWhy
Code versionThe commit, so the run can be recreated
Data versionSame code, different data, different model
HyperparametersOtherwise the best run cannot be repeated
MetricsComparison across runs, not just the last one
EnvironmentLibrary versions change results more than people expect
The artefactThe weights themselves, addressable
Set and log a random seed. Without one, two runs of identical code differ, and you cannot tell a real improvement from noise.

A model registry is the next step up: named, versioned models with a stage — staging, production, archived — so promotion and rollback are explicit acts rather than someone copying a file.

Model Serving

How predictions reach the thing that needs them. The choice is mostly about latency tolerance.

PatternShapeFits
BatchScore everything nightly, write to a tableChurn scores, recommendations refreshed daily
OnlineAn API answering one request at a timeFraud checks, search ranking, anything interactive
StreamingScore events as they arriveLive anomaly detection
EmbeddedThe model ships inside the clientOn-device, offline, privacy-sensitive

An online model is a web service with an unusual payload, so everything you know applies: containerise it, put it behind a load balancer, set timeouts, and have a fallback for when it is slow — often the previous model, or a simple heuristic.

Training/serving skew is the classic production failure: the features computed at serving time differ subtly from those computed during training. A different default, a different time zone, a column filled a different way — and accuracy quietly collapses. Share the feature code between both paths.

Ship a new model the way you ship anything risky: to a fraction of traffic first, compared against the incumbent, with a rollback that has actually been rehearsed.

Monitoring & Drift

The distinguishing problem of running models: performance decays without anything breaking. Nothing throws, no alert fires, and the metric that matters may not be measurable for weeks.

What movedNameExample
The inputsData driftA new market shifts the age distribution
The relationshipConcept driftFraud tactics change, so the same signals stop meaning fraud
The pipelineSchema skewAn upstream column starts arriving null

Because ground truth is delayed — you learn whether a loan defaults months later — monitor the inputs and the outputs rather than waiting for accuracy. A shift in the distribution of predictions is an early warning you can act on today.

WatchTells you
Feature distributions vs trainingData drift, before accuracy moves
Prediction distributionThe model's behaviour changing
Null and default ratesAn upstream pipeline breaking
Latency and error rateIt is still a service
Accuracy once labels landThe truth, late
Decide the retraining trigger in advance — a schedule, a drift threshold, or a metric floor. "When someone notices" is not a policy, and it is the one most teams actually have.

Interview Questions

Data drift versus concept drift?

Data drift is the input distribution moving — a new market, a new device mix. Concept drift is the relationship between inputs and target changing, so the same inputs now mean something different. Data drift can be harmless; concept drift always degrades the model.

What is training/serving skew?

Features computed differently at training and serving time — a different default, unit, or time window. The model receives inputs it was never trained on and accuracy drops with no error anywhere. The fix is sharing one feature implementation across both paths.

Ground truth arrives weeks late. What do you monitor?

Inputs and outputs. Feature distributions against the training baseline, the distribution of predictions, and pipeline health — nulls, defaults, volumes. Those move before accuracy does, and they are measurable immediately.

Batch or online serving?

Latency decides. If predictions can be a day old, batch is cheaper, simpler and easier to backfill. If the answer must reflect this request, you need online, and with it the availability and latency obligations of any service.

What has to be versioned to reproduce a model?

Code, data and hyperparameters, plus the environment and the random seed. Code alone is not enough — the same code on different data is a different model.

How would you deploy a new model safely?

Register the version, deploy to a fraction of traffic, compare against the incumbent on live data, and keep a rehearsed rollback. Treat it as a risky release, because a model that scores better offline can still be worse in production.

Quick Quiz

1. Fraud tactics change so the same signals no longer indicate fraud. This is…
2. Labels arrive months late. Monitor…
3. Reproducing a training run requires versioning…
4. Features computed differently in training and serving is called…
5. Predictions may be a day old. The cheaper choice is…