MLOps from the ground up
Ship a model, watch it, and take it back safely
- Intermediate
- 10 chapters
- 166 min read
What happens to a model after the notebook: the inference contract, pinned environments and artefacts, online and batch serving, latency budgets and fallbacks, monitoring and drift, canaries and rollbacks, data and feature contracts, CI with evaluation gates, cost and capacity, incident response, and a release checklist that runs. Every example is dependency-free Python on a small dataset.
What You'll Learn
- Turn a notebook into a service with a typed inference contract
- Package a model with a pinned, reproducible environment
- Choose between online and batch serving and set a latency budget
- Monitor inputs, outputs, service health and delayed outcomes
- Design a canary with a pre-registered rollback rule
- Write data and feature contracts that catch skew and stale tables
- Build a CI pipeline with smoke tests, evaluation gates and slice checks
- Compute a unit cost and plan capacity for a peak
- Run an incident with severity, roles and a blameless review
- Run a release checklist with a tested rollback plan
Prerequisites
- Comfortable with Python functions, dictionaries and classes
- A rough idea of what a model training run produces
- No cloud account or ML library is needed — every example is plain Python
Vocabulary
The terms the chapters assume, in plain words.
- artefact
- A saved file a release needs, such as the model, the code that prepares its inputs or the exact package versions.
- batch
- A run that scores many rows at once on a schedule and writes the results to a table.
- canary
- A release shown to a small random slice of traffic first, so a bad model reaches few users.
- drift
- A change in the inputs a model sees, or in the link between those inputs and the outcome it predicts.
- evaluation gate
- A check before release that stops a model when its measured quality falls below a set bar.
- feature contract
- An agreed promise about one input column — its type, range, missing values, uniqueness, freshness and owner — checked as data arrives.
- incident
- An event that degrades a service beyond its agreed level and needs a coordinated response.
- inference contract
- The agreed inputs, outputs and error cases for a model's prediction service, written down and tested.
- latency budget
- The time a request may spend in the model path, after network and rendering are subtracted from what users will tolerate.
- model card
- A short document describing what a model is for, how it was trained, its limits and who owns it.
- monitoring
- Watching inputs, outputs, service health and later outcomes so a change is noticed before users report it.
- rollback
- Returning to the last known good version, using a saved copy and a command that has been rehearsed.
- serving
- Running a model to answer requests in production, either one at a time or in scheduled groups.
- training-serving skew
- When an input is computed one way for model fitting and another way at request time, so the model reads different data.
Course Content
- 01From notebook to serviceNot started
A notebook is a sequence of experiments. A service is a function with a contract, an artefact and a way to be wrong safely.
- 02Packaging and environmentsNot started
The environment is part of the model. A prediction is reproducible only when the code, the weights and every pinned dependency are.
- 03Serving and batchingNot started
Online serving spends latency per request; batch serving spends throughput per window. Most systems need both, and the boundary is a product decision.
- 04Monitoring and driftNot started
A model in production is a hypothesis under test. Monitor the inputs, the outputs, the service and the outcome, and know which one moved.
- 05Rollback and canariesNot started
A release is not finished when it deploys. It is finished when it can be undone, and the undo has been tested.
- 06Data and feature contractsNot started
A feature is a promise about a column: its type, its range, its freshness and who owns it. Training and serving must read the same promise.
- 07CI for modelsNot started
CI for a model is more than unit tests: data checks, a training smoke test, an evaluation gate and an artefact that can be deployed.
- 08Cost and capacityNot started
A model has a unit cost and a capacity plan. Batching, utilisation, queueing and warm-up decide whether the service is cheap, fast and still standing at the evening peak.
- 09Incident playbookNot started
An incident is a decision problem under time pressure. Severity, roles, mitigation before diagnosis and a blameless review are what turn a bad hour into a better system.
- 10Capstone: a release checklist with a rollback planNot started
A release checklist that runs: pre-flight checks, a canary with a decision rule, a promotion and a rollback drill with a timeline.
