The ML lifecycle & MLOps maturity
From problem framing to data, training, evaluation, deployment and monitoring — why it is a loop, why baselines come first, where technical debt hides, and Google's MLOps levels 0–2.
Training a model in a notebook is maybe 10% of the work. The rest is deciding what to predict and why, getting trustworthy data, proving the model is better than something simple, shipping it safely, and noticing when it silently gets worse. MLOps is the set of practices that makes this whole loop repeatable and automated[3][4].
The loop, stage by stage
- Problem framing — the business goal, the prediction target, how a prediction becomes an action, and what “good enough” means (metric + target value + cost of errors).
- Data — collection, labelling, cleaning, validation, splitting into train/validation/test and versioning.
- Training & experimentation — feature engineering, model selection, Hyperparameter tuning, all logged with Experiment tracking.
- Evaluation — offline metrics against a Baseline, slice analysis (per segment), fairness and robustness checks, then online tests such as A/B testing.
- Deployment — packaging, Model serving (batch or online), gradual rollout (shadow, canary).
- Monitoring — system health, Data drift, prediction quality once labels arrive. Findings feed back into step 1 or 2: the loop closes.
Framing: tie the ML metric to a business metric
| Product goal | ML task & offline metric | Online / business metric |
|---|---|---|
| Reduce customer churn | Binary classification; PR-AUC, recall@top-10% | Retention rate of contacted customers |
| Faster support replies | Ticket routing (multi-class); macro-F1 | Median time to resolution |
| Better delivery ETAs | Regression; MAE in minutes | Late-delivery complaints |
| LLM support assistant | Task-specific Evals (answer correctness, groundedness) | Deflection rate, CSAT |
Baselines first — and maybe no ML at all
Google's *Rules of Machine Learning* open with Rule #1: “Don't be afraid to launch a product without machine learning” and Rule #4: “Keep the first model simple and get the infrastructure right”[1]. A Baseline — a heuristic, the majority class, last week's value, or a logistic regression — tells you whether a fancy model is worth its complexity, and it tests your whole pipeline end to end.
from sklearn.dummy import DummyClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import HistGradientBoostingClassifier
from sklearn.model_selection import cross_val_score
for name, clf in [
("majority class", DummyClassifier(strategy="most_frequent")),
("logistic reg.", LogisticRegression(max_iter=1000)),
("grad. boosting", HistGradientBoostingClassifier()),
]:
s = cross_val_score(clf, X, y, cv=5, scoring="average_precision")
print(f"{name:15s} PR-AUC = {s.mean():.3f} ± {s.std():.3f}")Where the real cost hides: technical debt
Sculley et al. showed that in real ML systems only a small fraction of the code is the model; most is configuration, data collection, feature extraction, verification, serving and monitoring[2]. They name typical debts: CACE (“Changing Anything Changes Everything” — features are entangled), glue code and pipeline jungles, undeclared consumers of a model's outputs, hidden feedback loops (the model influences the data it is later trained on), and configuration debt.
MLOps maturity levels (Google Cloud)
| Level | What it looks like | Main risk / benefit |
|---|---|---|
| 0 — Manual process | Notebooks, manual hand-off of a model file to engineers, rare releases, no monitoring | Models go stale; hard to reproduce |
| 1 — ML pipeline automation | The training pipeline itself is deployed; continuous training (CT) on new data or triggers; data & model validation; metadata store | Fresh models automatically; pipeline changes still manual |
| 2 — CI/CD pipeline automation | Pipeline code itself is built, tested and deployed by CI/CD; many experiments shipped quickly and safely | Fast iteration at scale; higher setup cost |
- What it is
- How much labelled data goes to fitting, to model selection, and to the final untouched estimate.
- ↑ If you increase it
- A larger validation/test share gives tighter, more trustworthy metric estimates but leaves less data to learn from.
- ↓ If you decrease it
- A tiny validation/test set makes metrics noisy — differences of 1–2% may be pure chance.
- Typical values
- 70/15/15 or 80/10/10 for medium data; time-based splits for anything that evolves over time.
- What it is
- The pre-agreed bar a new model must pass to replace the current one, e.g. “PR-AUC ≥ champion + 0.01 and no slice drops more than 2 points”.
- ↑ If you increase it
- A stricter gate prevents regressions but may block genuine small improvements and slow iteration.
- ↓ If you decrease it
- A looser gate ships faster but lets noisy “improvements” (or slice regressions) reach users.
- Typical values
- Beat the champion by more than the metric's run-to-run noise; check key slices separately.
- What it is
- Percentage of live traffic routed to a new model version during a gradual rollout.
- ↑ If you increase it
- More traffic gives statistically clearer signals sooner, but more users are exposed if the model is bad.
- ↓ If you decrease it
- Less exposure (safer), but you must wait longer to collect enough evidence.
- Typical values
- 1–5% → 25% → 50% → 100% in steps.
- What it is
- How long (how many users or events) an online experiment runs before deciding.
- ↑ If you increase it
- Detects smaller effects and averages out weekday/weekend cycles; costs time and keeps users on the worse variant longer.
- ↓ If you decrease it
- Fast decisions but high risk of false positives, especially if you “peek” and stop as soon as results look good.
- Typical values
- Compute the sample size from the minimum effect you care about; run at least one full weekly cycle.
▸Go deeper: roles and principles in MLOps
Kreuzberger et al. surveyed the field and distilled MLOps into principles — CI/CD automation, workflow orchestration, reproducibility, versioning of data/model/code, collaboration, continuous training & evaluation, metadata tracking, continuous monitoring and feedback loops — and roles such as data scientist, data engineer, ML engineer/MLOps engineer, DevOps engineer and software engineer[4]. Huyen's book treats the same lifecycle from a systems-design angle, with many examples of data distribution shifts and deployment trade-offs[5].
Quiz
DummyClassifier before anything else?References
- [1]Rules of Machine Learning: Best Practices for ML EngineeringArticleZinkevichdevelopers.google.com
- [2]Hidden Technical Debt in Machine Learning SystemsPaperSculley et al.2015papers.nips.cc
- [3]MLOps: Continuous delivery and automation pipelines in machine learningArticleGoogle Clouddocs.cloud.google.com
- [4]Machine Learning Operations (MLOps): Overview, Definition, and ArchitecturePaperKreuzberger et al.2022arxiv.org
- [5]Designing Machine Learning SystemsBookChip Huyen2022oreilly.com