MLOps Foundations
Intermediate 15 min read MLOps Foundations

The ML Lifecycle

A continuous loop with a feedback arrow, not a one-way pipeline

An ML system is a loop, not a project: frame the problem, collect and verify data, train and evaluate, deploy, monitor and retrain. Each stage has its own failure modes and owns its own artifacts.

lifecycledata verificationdeploymonitorretrainfeedback loopML system
Prerequisites: What is MLOps?
Before we start

What you will learn

  • Model the full ML lifecycle as a loop with explicit stage boundaries
  • Identify the artifacts and tests each stage must produce
  • Locate where most production ML failures actually originate
Introduction

What is this?

The ML lifecycle is the end-to-end journey a model takes — and keeps taking: business problem framing, data collection and verification, training and evaluation, deployment, live monitoring and retraining. Google's 'Rules of ML' framing calls the last three parts 'the 95%' — because operational reality, not the clever algorithm, is where ML systems succeed or fail. Every stage is a checkpoint with artifacts: a verified dataset, a registered model with metrics, a deployed version, live signals.

Motivation

Why do you need it?

  • Thinking 'train → ship → done' hides where systems really fail: data quality, monitoring and decay.
  • Missing stage checkpoints destroy reproducibility — you cannot retrain what you didn't version.
  • The feedback arrow (monitoring → retraining) is what keeps a model honest as the world changes.
  • Framing the right problem first avoids building an excellent model for the wrong question.
Think about it

Mental model

Imagine

Farming a field season after season

Think of

The ML lifecycle

Planting (training) is one week. Soil testing (data verification), irrigation and pest watches (monitoring), and deciding next season's crop (retraining) run all year. A farmer who only thinks about planting week fails; so does an ML team that only thinks about training week.

Mechanics

How it works

  • Frame: define the business goal, success metric, and what a prediction actually changes.
  • Collect & verify data: gather raw sources, check schema, distribution, label quality; freeze dataset versions.
  • Train & evaluate: build features, train candidates, compare on holdout and business metrics, register the winner.
  • Deploy: promote through registry gates — shadow, canary, then production.
  • Monitor: track drift, latency, data quality and a label-proxy for model quality.
  • Retrain: triggered by monitors or a freshness schedule; the new candidate re-enters the loop.

The ML lifecycle as a closed loop.

Frame
Data
Train
Deploy
Monitor
Retrain
Real world

In production

  • A fraud team keeps a weekly retraining cadence driven by label arrival (disputes arrive days after transactions), with drift alerts accelerating the loop.
  • A search ranking system monitors relevance proxies hourly and backtests a candidate weekly before promotion.
  • A healthcare risk model runs the whole loop under audit control — every stage leaves a trace for regulators.
Guidelines

Best practices

  • Version the dataset and features at the data stage; every training run names its exact inputs.
  • Exit each stage only with tests: schema checks in data, metric thresholds in train, health checks in deploy.
  • Define monitoring in the deploy stage, not after an incident.
  • Make retraining trigger-driven and schedule-based hybrid — no manual 'it feels stale' refreshes.
  • Document the decision at every gate: who, what evidence, when.
Watch out

Common mistakes

  • Spending 90% of effort on training and treating monitoring as an afterthought.
  • Retraining without backtesting against past data — the new model may repeat the old failure.
  • Monitoring model quality with delayed labels and never reconciling predictions against outcomes.
  • Framing changes mid-project so the model optimizes a goal that stopped mattering.
Root cause analysis

Common issues

Error
Model confident but wrong in production
Root cause

Calibration drift, unseen input space, or label leakage in training

Fix

Track calibration and typicality on live inputs; investigate alignment between train/test and production.

Error
Retraining produces a worse model
Root cause

No backtest; training distribution or labels changed quality

Fix

Backtest every candidate against a frozen historical window before promotion.

Error
Pipeline keeps failing at the same stage silently
Root cause

Stage tests are green but not exercising the real failure (e.g., schema tests too weak)

Fix

Add data-quality assertions (value ranges, completeness, category coverage) beyond type checks.

When things break

Debugging tips

  • Check stage-boundary artifacts when something fails: did the data pass its tests, did the model register?
  • A 'sudden' production drop is usually gradual drift the monitors missed — backdate the monitoring.
  • Diff the training distribution vs the current live inputs directly; the gap explains most decay.
  • Re-run the failed stage's tests, not the whole loop, to isolate where a break is.
Interviews

Interview checkpoint

Test yourself

Quick quiz

0/2
1

What is the single most important artifact the data stage must produce?

2

Monitoring is a one-time setup you do after deployment.

Go deeper

Official documentation