TExcelTAD
Home › Deployment & MLOps: Serving, Pipelines, Monitoring › Deployment & MLOps: Introduction

Deployment & MLOps: Introduction

A trained model in a notebook is a promise, not a product. To be useful it must leave the notebook: be saved in a form another process can load, answer requests from other programs fast enough, run on hardware someone pays for, and keep giving good answers for months while the world it describes changes. Deployment is getting the model to where predictions are needed. MLOps (machine learning operations) is the set of practices that make this repeatable: tracking how every model was made, versioning data and models, testing and releasing them through pipelines, and watching them in production so that problems are noticed and fixed.

Most of the work in a real ML system is not the model. The training code is a small box in the middle of data collection, validation, feature computation, serving, monitoring, configuration and release tooling. A team that builds only the box ships a model that nobody can reproduce, nobody can roll back and nobody notices when it quietly gets worse.

The lifecycle this course covers

dataversion, validate trainpipeline, tracking registryversions, gates packageONNX, Docker servebatch, API, edge monitorservice, data, quality drift foundretrain or roll back rollback to an earlier version

The loop never ends. A deployed model is the start of its own maintenance, and the retraining it triggers needs the same data versions, pipelines and gates as the first training run. That is why the course spends as much time on tracking, versioning, testing and monitoring as on serving.

Why a good test score is not enough

The model you evaluated was tested on data that looked like its training data. Production data does not promise that. Here is the course's running example, a small credit-risk-style classifier: a scikit-learn pipeline (scaler + logistic regression) trained on 1,500 generated applications and tested on 500 held-out ones. Then "six months later" the applicant mix changes: two features shift, and the relationship between one feature and the label weakens.

python · try it yourself
import numpy as np
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

X, y = make_classification(n_samples=2000, n_features=8, n_informative=5, random_state=0)
X_tr, X_te, y_tr, y_te = train_test_split(X, y, test_size=500, stratify=y, random_state=0)
model = make_pipeline(StandardScaler(), LogisticRegression()).fit(X_tr, y_tr)
print(f"test accuracy (500 held-out rows): {model.score(X_te, y_te):.3f}")

# Six months later: same generator, but the population moved.
rng = np.random.default_rng(1)
X_new, y_new = X_te.copy(), y_te.copy()
sd0 = X_tr[:, 0].std()
X_new[:, 0] += sd0                      # feature 0 shifts by one training standard deviation
X_new[:, 3] *= 1.5                      # feature 3 spreads out
flip = rng.random(len(y_new)) < 0.10    # 10 % of labels now follow a different rule
y_new[flip] = 1 - y_new[flip]
print(f"accuracy six months later:          {model.score(X_new, y_new):.3f}")
print(f"feature 0: train mean {X_tr[:, 0].mean():.2f} (sd {sd0:.2f}), new mean {X_new[:, 0].mean():.2f}")
test accuracy (500 held-out rows): 0.856
accuracy six months later:          0.790
feature 0: train mean -0.50 (sd 1.52), new mean 1.05

Nothing in the code changed, and nothing crashed: the service would keep answering every request with HTTP 200. Accuracy fell from 0.856 to 0.790 because the data moved under the model. The input shift (feature 0's mean went from −0.50 to 1.05, one training standard deviation of 1.52) is visible without any labels, so a monitor can catch it on the first day; the label change is only visible once the true outcomes arrive. The data drift and concept drift lessons build monitors for both, and retraining and rollback are what you do when they fire.

Course map

Section You learn to Main tools
Getting started name the parts of a production ML system and what can go wrong in each
Packaging models save and load models safely, export to a portable format, describe inputs and outputs pickle, joblib, ONNX, Pydantic
Serving predictions choose batch or real-time, build and test a prediction API, reason about latency, batching and GPUs FastAPI (runs in your browser), NumPy
Optimising models make models smaller and faster with a known accuracy cost NumPy, ONNX Runtime
Shipping models package a service in Docker, run it on Kubernetes or a device, release it safely Docker, Kubernetes
Experiments, data and model versions record every run, version data and models, build cached pipelines, use a registry MLflow, DVC
Testing and CI/CD test data, code and models, and automate training and release GitHub Actions
Monitoring, drift, retraining monitor service and model, detect drift, retrain and roll back NumPy, SciPy, the drift lab
Security and governance close the ML-specific attack paths and keep an audit trail

The course does not re-teach Docker, Kubernetes or CI systems: it links to the Docker, Kubernetes, CI/CD, Observability and SRE courses for the general machinery and covers what is different for models. Training itself is in the earlier courses of the track: Training Mechanics & Evaluation and Training Strategies, whose online learning, concept drift and replay and rollback lessons this course builds on.

How mature is an ML system?

A common way to describe MLOps maturity uses three levels, from Google Cloud's MLOps guide ("MLOps: Continuous delivery and automation pipelines in machine learning"):

Level Training Release Monitoring
0: manual a person runs a notebook a person copies a model file to a server logs, if anyone looks
1: ML pipeline automation a pipeline retrains on new data (continuous training) the pipeline validates and deploys each new model (continuous delivery of the prediction service); the pipeline itself is still deployed by hand data and quality monitors trigger retraining
2: CI/CD pipeline automation the pipeline code itself is built, tested and delivered by CI/CD new pipeline versions reach pre-production automatically; production is often behind a manual approval full loop with rollback

Level 0 is fine for a first model that is retrained once a year. The higher levels pay off when models are retrained often, when several teams share infrastructure, or when a bad model costs real money. Most of this course is about the pieces that level 1 needs.

How examples run in this course

  • In your browser: NumPy, pandas, SciPy and scikit-learn, and also FastAPI with Pydantic: you build a prediction service and send it real HTTP requests without leaving the page (the requests go through an in-memory transport instead of a network socket). Drift statistics, quantization, pruning, distillation, batching simulations, data validation and the from-scratch versions of tracking and versioning all run here, and you can edit and re-run them.
  • Recorded: examples that use MLflow, DVC, ONNX and ONNX Runtime, or PyTorch cannot run in a browser. They carry a Recorded badge and show the output of a real run in a Docker image on CPU, with pinned versions (MLflow 3.17.2, DVC 3.67.1, ONNX 1.23.2, ONNX Runtime 1.31.1). Each one uses a fresh working directory and small data, so you can repeat it on a laptop with the same versions.
  • Lab: the drift monitor in the data drift lesson shows a feature drifting over 60 days and the alarms of three detectors.

Nothing here starts a real server or container: commands like uvicorn main:app, docker build and kubectl apply are shown as files and commands to run on your own machine.

Test yourself

A deployed model's accuracy falls from 0.86 to 0.79 although no code changed and every request still returns HTTP 200. What is the most likely cause?

  1. A bug in the web framework
  2. The production data changed (drift), so the model's assumptions no longer hold
  3. The model file was corrupted
  4. The server ran out of memory

What distinguishes MLOps maturity level 1 from level 0?

  1. Level 1 uses a GPU
  2. Level 1 retrains models automatically with a pipeline instead of by hand
  3. Level 1 has no monitoring
  4. Level 1 serves predictions in batch only

In the example, which change could a monitor detect on the first day, before any true labels arrive?

  1. The 10 % of labels that follow a new rule
  2. The shift of feature 0's mean from -0.50 to 1.05
  3. Neither
  4. Both