MLOps course · lesson 2 of 24
- 1What Is MLOps? From Notebooks to Reliable Production
- 2MLOps Principles and Maturity: From Manual to Automated
- 3ML Fundamentals for MLOps: Splits, Leakage, and Metrics
- 4A Reproducible ML Project: Layout, Seeds, and Data Code
- 5Data Engineering Basics for ML: Ingestion, SQL, and Skew
- 6Pipeline Orchestration: Apache Airflow and Kubeflow
- 7Batch vs Streaming: Spark, Kafka, and Flink
- 8Data Versioning and Lineage: DVC and Beyond
- 9Data Validation and Quality in ML Pipelines
- 10Experiment Tracking with MLflow
- 11Reproducible Training Pipelines
- 12Model Evaluation and Validation Gates
- 13Model Registry and Versioning
- 14CI/CD for Machine Learning
- 15Containers and Kubernetes for ML
- 16Infrastructure as Code: Terraform and Ansible
- 17Cloud ML Platforms: AWS, Azure, GCP, and Self-Built
- 18Model Serving Patterns: Batch, Online, and Streaming
- 19Inference Engineering Basics: Latency, Batching, and Cost
- 20Monitoring and Observability for ML Models
- 21Drift Detection and Retraining for ML Models
- 22Explainable AI: LIME, SHAP, and Model Interpretability
- 23Edge AI Deployment: Jetson, TFLite, and Mobile ML
- 24Capstone: An End-to-End MLOps Pipeline
In the foundational overview on what MLOps is and why production models fail, we established that machine learning in production requires far more than training algorithms in isolated notebooks. Moving models into reliable, long-term operations requires clear engineering principles and an understanding of where your team sits on the automation spectrum.
In this lesson, you will learn the six core principles that govern sound machine learning operations. You will examine the three-level MLOps maturity framework established in industry architecture standards, identify which operational capabilities to automate first, and use a practical checklist to assess any machine learning project. We will also evaluate StayWell, our running case study, to establish its baseline maturity before building out its production pipeline.
The six core principles of MLOps
Every engineering team uses different cloud providers, frameworks, and programming languages. Regardless of the specific technology stack, dependable machine learning operations rest on six foundational principles:
1. Reproducibility
A machine learning run is reproducible if another engineer can take the identical code, dataset, configuration, and environment, run the training routine, and produce an identical model artifact. An artifact is any durable digital output produced during the ML lifecycle, such as trained model weights, feature scalers, tokenizers, or evaluation reports.
Reproducibility requires locking four distinct components simultaneously:
- Code: tracked through Git commits.
- Data: referenced by immutable versions or cryptographic hashes.
- Environment: pinned through package lockfiles or container images.
- Randomness: controlled by explicit pseudo-random number generator seeds across libraries like NumPy, PyTorch, and scikit-learn.
If any of these four elements fluctuates, replicating model behavior or diagnosing production bugs becomes guessing.
2. Automation
Manual handoffs between data scientists, software engineers, and system operators slow down iteration and introduce human error. MLOps prioritizes automating repetitive operational workflows, including data extraction, schema validation, model training, evaluation checks, packaging, and deployment.
Automation does not require replacing human judgment entirely. It means that routine tasks execute predictably without manual intervention, freeing teams to focus on problem framing, feature discovery, and safety reviews.
3. Multi-modal versioning
In traditional software engineering, Git handles version control because code and configuration files are plain text. In machine learning, versioning code alone is insufficient.
Machine learning requires multi-modal versioning across three synchronized dimensions:
- Code and configuration: versioned in Git repositories.
- Datasets: tracked through data versioning tools or immutable object storage snapshots with cryptographic content hashes.
- Model artifacts: registered with semantic version numbers, hyperparameter logs, evaluation metrics, and pointers back to their source data and code commits.
This three-way link establishes complete lineage. Lineage is the recorded historical trail that connects a running model back to the exact training dataset, code revision, and configuration parameters used to generate it.
4. Continuous testing
Testing in machine learning extends beyond traditional unit tests. Because model behavior depends heavily on data inputs, testing must verify three separate layers:
- Code testing: standard unit and integration tests verifying that feature transformations, data parsers, and inference endpoints execute without syntax or logic bugs.
- Data testing: automated schema validation, range checks, null value assertions, and distribution checks that verify incoming data satisfies a formal data contract before training or scoring begins.
- Model testing: evaluation suites that verify candidate model performance against historical baselines, slice checks across distinct user cohorts, latency benchmarks, and fairness criteria.
5. Continuous monitoring and feedback
Deploying a model to production begins an active monitoring loop. Because the real-world environment changes constantly, models inevitably decay through data drift (covariate shift) and concept drift. Data drift is a shift in the statistical distribution of input features over time, while concept drift is a change in the statistical relationship between input features and target outcomes.
MLOps systems track operational metrics (latency, error rates, CPU and memory utilization) alongside statistical metrics (feature distributions, prediction distributions, and delayed ground-truth accuracy). When drift metrics cross defined thresholds, monitoring alerts engineers or automatically triggers retraining workflows.
6. Collaboration and governance
Machine learning systems touch data engineers, data scientists, software engineers, product managers, and compliance officers. MLOps establishes shared interfaces and auditable documentation so these groups collaborate without friction.
Governance mechanisms include model cards (standardized short documents explaining a model's intended use, architecture, training data, evaluation results, and operational limitations), role-based access controls for model deployment, and auditable approval records before models reach live user traffic.

As visualized above, an MLOps architecture links these six principles together. Version control and data storage feed automated orchestration pipelines, which log runs to an experiment tracker, publish validated models to a registry, deploy inference services, and feed telemetry back into monitoring systems.
The three levels of MLOps maturity
To help organizations assess their operational capabilities, cloud architecture frameworks define standard maturity models. The most widely referenced framework, published by Google Cloud in their architecture guidelines, classifies machine learning systems into three distinct levels: Level 0, Level 1, and Level 2.
Level 0: Manual process
At Level 0, machine learning workflows are completely manual and script-driven. This level is common in organizations beginning their machine learning journey or running proof-of-concept projects.
Key characteristics of Level 0 systems:
- Interactive, disconnected steps: Data preparation, model training, and evaluation are performed manually in interactive notebooks or ad-hoc scripts. Transitions between steps require human intervention.
- Disconnection between data science and operations: Data scientists develop models independently and hand trained weights or serialized files to software engineers, who write custom API wrappers to serve predictions.
- Infrequent releases: Because the process is manual, releasing a new model version takes weeks or months. Teams only retrain when severe performance degradation becomes impossible to ignore.
- No continuous training (CT): Continuous training (the automated process of retraining, evaluating, and validating models on new data without manual developer intervention) does not exist. Each retraining cycle is treated as a new project.
- Limited monitoring: Monitoring covers basic server uptime and latency, but feature drift, concept drift, and prediction distributions are not tracked systematically.
Level 0 is acceptable for experimental research, initial prototyping, or models retrained only once or twice a year. However, when applied to production systems that face changing customer behavior, Level 0 systems accumulate technical debt and frequently break.
Level 1: ML pipeline automation
Level 1 introduces automation to the training process. Instead of executing isolated notebook cells by hand, the entire training workflow is orchestrated as an automated pipeline.
Key characteristics of Level 1 systems:
- Orchestrated pipelines: Pipeline orchestration (the automated coordination of multi-step computing tasks, scheduling dependencies, executing workloads, and handling retries) manages data extraction, validation, feature engineering, training, and evaluation as a single Directed Acyclic Graph (DAG).
- Continuous training (CT) in production: The pipeline retrains the model automatically based on fresh data arrival, predefined schedules, or drift alerts triggered by monitoring systems.
- Automated data and model validation: The pipeline validates incoming data against schema contracts before training starts. After training, automated evaluation gates compare candidate models against the active production model (champion vs challenger testing). Only candidate models that pass all thresholds advance to the registry.
- Feature consistency: Feature engineering logic is unified across training and serving, often through shared modules or a feature store, reducing training-serving skew.
- Modular pipeline components: Each pipeline step is containerized and reusable across multiple experiments.
At Level 1, the model is retrained automatically, but the pipeline code itself is still tested and deployed to production through manual or semi-automated processes.
Level 2: CI/CD pipeline automation
Level 2 represents a mature operational state where both model retraining and pipeline code delivery are fully automated. When data scientists develop new feature transformations or modeling architectures, changes flow through continuous integration and continuous delivery (CI/CD) pipelines into production environments.
Key characteristics of Level 2 systems:
- Automated CI/CD for pipelines: Committing new pipeline code to Git triggers automated linting, unit tests, integration tests, and container builds. If tests pass, continuous delivery pipelines deploy the updated pipeline DAG directly to target production environments.
- Rapid experimentation to production: Data scientists can test novel feature transformations or algorithms in development, commit the code, and see the updated pipeline safely deployed to staging and production in hours rather than weeks.
- Continuous monitoring with automated feedback: Production inference telemetry connects directly to orchestration triggers. When data drift or performance degradation crosses policy thresholds, automated pipelines initiate retraining, run evaluation gates, and execute gradual canary releases.
- Complete auditable lineage: Every model serving live traffic is linked to its container build hash, source Git commit, training data snapshot, and evaluation test suite records.

What to automate first: a practical roadmap
A common mistake is attempting to jump directly from Level 0 to Level 2 in a single quarter. Trying to install distributed pipeline orchestrators, automated CI/CD releases, and automated canary deployments all at once overwhelms teams and delays product launches.
The most practical path is incremental. Start with the steps that remove the most friction:
| Phase | Focus | Practices |
|---|---|---|
| 1 | Environment and code hygiene | Git version control for all code; pinned package lockfiles and isolated environments; fixed random seeds for determinism |
| 2 | Data validation and logging | Schema assertions on incoming data; lightweight experiment tracking for parameters and metrics; centralized storage for model artifacts |
| 3 | Pipeline orchestration and gates | Modular training pipelines (DAGs) replacing notebooks; automated evaluation gates (champion versus challenger); semantic versioning in a formal model registry |
| 4 | Telemetry and continuous delivery | Production latency, error and drift monitoring; automated CI/CD for tests and pipeline DAGs; continuous retraining triggers |
Phase 1: Environment and code hygiene
Before introducing specialized MLOps platforms, establish basic software engineering discipline:
- Move exploratory code from notebook cells into structured, modular Python scripts.
- Pin every library dependency using lockfiles (such as pip-tools, Poetry, or Conda environment files).
- Fix random seeds across all scripts to guarantee that running the same script on the same dataset yields identical parameters.
Phase 2: Data validation and experiment tracking
Next, protect the system from bad data and unrecorded experiments:
- Add automated schema assertions to feature generation scripts, verifying column types, missing value bounds, and acceptable ranges.
- Implement lightweight experiment tracking (such as local or hosted MLflow) to record hyperparameters, execution timestamps, training metrics, and artifact locations automatically.
- Store model artifacts in structured cloud object storage rather than local folders.
Phase 3: Pipeline orchestration and evaluation gates
Once experiments are tracked, automate the training workflow:
- Convert sequential scripts into an orchestrated DAG pipeline where each step runs independently with explicit inputs and outputs.
- Build automated evaluation gates that compare candidate models against the currently deployed baseline across accuracy, precision, recall, and critical data slices.
- Establish a formal model registry to track deployment stages (such as Staging, Production, and Archived).
Phase 4: Telemetry and continuous delivery
Finally, close the operational loop:
- Deploy monitoring dashboards tracking real-time inference latency, system error rates, and statistical feature distributions (using tests like Kolmogorov-Smirnov and Population Stability Index).
- Configure CI/CD pipelines to run automated unit and integration tests on pull requests before deploying updated pipeline code.
- Connect drift alert webhooks to orchestration triggers to automate continuous retraining.
Assessing StayWell: baseline maturity
To see how this framework applies in practice, let us assess StayWell, our fictional subscription fitness and wellness application.
StayWell wants to deploy a machine learning model to predict customer churn within thirty days. When we examine how StayWell currently operates, we find:
- A data scientist previously explored customer data in a local Jupyter notebook, testing logistic regression and random forest models.
- Training data was exported as an unversioned CSV file from the production PostgreSQL database using a manual SQL query.
- The notebook contains hardcoded file paths pointing to a developer's desktop directory.
- Model hyperparameters were adjusted manually across several cells without an experiment tracking tool.
- The final model was serialized using Python's standard pickle utility and stored in a shared folder with the filename
churn_model_v2_final.pkl. - Backend developers must write custom API code to load the pickle file and serve real-time predictions on the membership cancellation page.
- There are no automated tests checking whether incoming customer data matches the schema expected by the model.
Under the MLOps maturity framework, StayWell is operating strictly at Level 0.
If StayWell deployed this setup directly to production, the system would face severe risks:
- Silent feature corruption: If the database engineering team alters the format of member activity logs, the model will receive corrupted features without warning.
- Untracked lineage: If customer success reports that the model is misidentifying long-term subscribers as churn risks, nobody can trace the exact dataset, parameters, or Git commit that produced
churn_model_v2_final.pkl. - High operational friction: Updating the model when February subscriber behavior diverges from January requires repeating the entire manual export, cleanup, and serialization process by hand.
Over the next several lessons, we will lift StayWell systematically from Level 0 to Level 1, establishing reproducible data generation, automated schema validation, experiment tracking, pipeline orchestration, and evaluation gates.
MLOps maturity assessment checklist
Use this structured template to evaluate any machine learning system across its operational dimensions. Copy and adapt it for project reviews:
1# MLOps System Maturity Assessment
2
3**Project:** [Project Name]
4**Evaluator:** [Name / Team]
5**Date:** [YYYY-MM-DD]
6**Current Assessed Level:** [Level 0 / Level 1 / Level 2]
7
8### 1. Code & Environment Management
9- [ ] Code is version-controlled in Git with peer review on pull requests.
10- [ ] All runtime dependencies are pinned with exact versions in lockfiles.
11- [ ] Random seeds are explicitly set across all stochastic operations.
12- [ ] Code is organized into modular scripts, not monolithic notebooks.
13
14### 2. Data Governance & Validation
15- [ ] Training datasets are stored in versioned, immutable storage.
16- [ ] Formal data contracts define schemas, null tolerances, and value ranges.
17- [ ] Automated validation checks run before training and inference begin.
18- [ ] Feature transformations are shared between training and serving.
19
20### 3. Training & Experimentation
21- [ ] Hyperparameters, metrics, and code commits are logged automatically.
22- [ ] Model artifacts are stored in an organized repository with metadata.
23- [ ] Training workflows run as an orchestrated Directed Acyclic Graph (DAG).
24- [ ] Training pipelines can be re-run on demand without manual steps.
25
26### 4. Evaluation & Model Governance
27- [ ] Automated gates test candidate models against production champions.
28- [ ] Performance is evaluated across distinct data slices and cohorts.
29- [ ] A formal model registry tracks semantic versions and approval stages.
30- [ ] Model cards document architecture, training data, and known limits.
31
32### 5. Deployment & Serving
33- [ ] Model serving code is containerized and tested in pre-production.
34- [ ] Rollout strategies use canary releases or shadow deployments.
35- [ ] Real-time endpoints have documented latency and throughput budgets.
36- [ ] Rollback procedures are tested and documented.
37
38### 6. Monitoring & Continuous Retraining
39- [ ] Telemetry monitors server latency, error rates, and resource usage.
40- [ ] Input feature distributions are tested for statistical drift.
41- [ ] Alerts notify engineers when prediction accuracy or drift degrades.
42- [ ] Retraining runbooks or automated triggers handle model refresh.Sources
Checked on 4 November 2026:
- Google Cloud Architecture Center, MLOps: Continuous delivery and automation pipelines in machine learning.
- Microsoft Azure Architecture Center, Machine learning operations (MLOps) maturity model.
Mistakes beginners make
When engineering teams attempt to improve their MLOps maturity, they frequently encounter several common pitfalls:
1. Building end-to-end CI/CD before standardizing local pipelines
Teams often spend weeks writing complex GitHub Actions or GitLab CI pipelines to automate deployments before they have established a working, reproducible training script. When automated builds run broken scripts, the automation only creates noise.
Fix: Ensure your data validation and training pipeline runs cleanly and deterministically from a single terminal command before attempting to automate remote execution through CI/CD.
2. Treating model registries as plain cloud storage
Some teams store serialized model weights in an AWS S3 bucket or Google Cloud Storage folder and label it a model registry. Without metadata linking the artifact to its Git commit, training data hash, hyperparameters, and evaluation metrics, cloud storage is just an unindexed file dump.
Fix: Use a dedicated model registry tool or a structured catalog that enforces version tagging, approval stages, and explicit metadata lineage alongside the model binary.
3. Setting arbitrary drift alert thresholds
Teams often configure sensitive statistical tests across dozens of input features, triggering alerts on every minor fluctuation. The resulting alert fatigue leads engineers to ignore notifications entirely, missing real performance degradation.
Fix: Focus drift monitoring on the most influential features identified during model training. Baseline statistical divergence metrics on stable historical validation sets before setting production alert thresholds.
4. Skipping slice-based evaluation during promotion
Evaluating a model solely on global test metrics can hide catastrophic regressions in critical business segments. A churn model that improves overall accuracy by two percent might simultaneously drop recall by twenty percent among high-tier subscribers.
Fix: Incorporate slice-based evaluation into automated validation gates, verifying that candidate models maintain acceptable performance across all defined customer cohorts before promotion.
Recap and try it yourself
In this lesson, you explored the principles and maturity stages that govern MLOps:
- Dependable MLOps rests on six principles: reproducibility, automation, multi-modal versioning, continuous testing, continuous monitoring, and collaboration.
- MLOps maturity progresses through three levels: Level 0 (manual scripts and handoffs), Level 1 (automated training pipelines and continuous training), and Level 2 (automated CI/CD for rapid pipeline iteration).
- Successful teams automate incrementally: beginning with code hygiene and data validation, moving to pipeline orchestration, and finally implementing telemetry and automated CI/CD.
- StayWell begins at Level 0, relying on unversioned local notebooks and manual exports that create operational risk.
Try it yourself
To apply these concepts to your own work, complete these exercises:
- Conduct a maturity self-assessment: Use the maturity assessment checklist above to score a machine learning project at your company or from past coursework. In which of the six categories does the project score lowest? What is the single highest-leverage improvement you could make this week?
- Trace lineage for a deployed model: Imagine an executive asks you to verify whether a production prediction service was trained on user data that has since been deleted under a privacy request. What specific records would you need to check to prove which user IDs were included in the training set?
- Design a slice-based validation gate for StayWell: For StayWell's customer churn model, identify three distinct subscriber slices that must be evaluated independently before promoting a challenger model to production.
In the next lesson, we will cover the essential machine learning fundamentals needed for MLOps, focusing on data splits, evaluation metrics, and leakage prevention.