MODULE 19 ยท Middle ยท 2.5 hours

A model without monitoring is an incident that has not happened yet

A model somebody runs by hand on Mondays is not a product. We turn it into a service with an API, versions, drift monitoring and a rollback plan.

Open this module in the simulator All 23 lessons

The first two modules are free, no card. The rest are $20/month.

๐Ÿข The situation

The churn model (modules 5โ€“10) still lives as "a notebook Igor runs on Mondays". Lena:

"Embarrassing to admit, but that's the truth of half the industry. Time to grow up: the model must become a service โ€” with an API, versioning, monitoring and a plan for 'everything is broken'. Wrap it in FastAPI + Docker, set up drift monitoring. This is the last skill separating you from a middle: a model that can't be operated reliably doesn't exist."

๐ŸŽฏ Your task

  1. Wrap the model in a REST API (FastAPI) and a container (Docker).
  2. Understand model versioning and reproducibility.
  3. Set up monitoring: service metrics, data drift, quality.

๐Ÿ“š Theory

Maturity levels of ML systems

  1. A notebook + manual runs ("us, today").
  2. Model as a service: API, container, CI/CD, versions.
  3. An automated pipeline: retraining on schedule/trigger, validation gates.
  4. Full MLOps: feature store, model registry, automatic rollback, model A/B.

Most teams only need levels 1โ€“2. Don't build level 3 for the badge.

The model as an artifact

The three layers of ML service monitoring

  1. Service (like any backend): p50/p99 latency, RPS, 5xx errors.
  2. Data drift: the input feature distribution has drifted from training (a new customer segment, a broken field in a source). Metrics: PSI, KS test per feature. Prediction drift โ€” a shift in the score distribution โ€” is the cheapest early signal.
  3. Quality (concept drift): true labels arrive late (we learn about churn 30 days later) โ†’ compute delayed quality, compare with the offline estimate.

The rule: a model without monitoring is an incident that hasn't happened yet. Data always changes.

A feature's PSI by week: drift caught before quality dropped 0.10 โ€” watch closely 0.25 โ€” alert ๐Ÿ”” PSI = 0.31 wk 1wk 2wk 3wk 4wk 5wk 6wk 7wk 8 cause: an auto-login release zeroed out the days_since_last_login feature
The Population Stability Index weekly per feature and per model score: drift is visible weeks before the business notices the degradation.

Model rollout strategies


What to remember

  • A model in production = code + artifact + data + versions pinned together.
  • Input validation (Pydantic) is cheap and saves you from garbage predictions.
  • Monitoring: service metrics + drift (PSI on features and scores) + delayed quality.
  • Shadow โ†’ canary โ†’ rollout; rollback by config in a minute.

Next in this module: Practice

Open the module โ†’

Nearby lessons

18 The interview in reverse: ML System Design 20 Finale: defending your project before the CTO

The whole program โ€” 23 lessons