- 1. What Is MLOps
- 2. Google MLOps Maturity Model
- 3. Data Management
- 4. Experiment Tracking
- 5. Model Registry and Version Management
- 6. CI/CD for ML
- 7. Model Serving Patterns
- 8. Monitoring: Drift Detection
- 9. Full Architecture Diagram
- 10. Conclusion: A Guide to Adopting MLOps
- References
1. What Is MLOps
1.1 Definition and Background
MLOps (Machine Learning Operations) is a set of practices for systematically managing the development, deployment, and operation of ML models. Just as DevOps was born to close the gap between software development and operations, MLOps aims to close the gap between ML model development and production operations.
Google Cloud's official MLOps guide defines MLOps as follows:
MLOps is an ML engineering culture and practice that aims at unifying ML system development (Dev) and ML system operation (Ops).
In a traditional software system you only have to manage code, but in an ML system you have to manage three axes at once: code, data, and models. That fundamental difference is what makes MLOps a separate discipline.
1.2 Key Differences from DevOps
DevOps and MLOps share the same principles of automation, CI/CD, and monitoring, but a number of differences arise from the characteristics unique to ML systems.
| Aspect | DevOps | MLOps |
|---|---|---|
| What is managed | Code | Code + data + models |
| Testing | Unit/integration tests | Data validation + model validation + code tests |
| Deployment | Service/application deployment | Model deployment + prediction service deployment |
| Monitoring | System performance, error rate | Model performance decay, Data Drift, Concept Drift |
| Rollback basis | When an error occurs | Based on model performance metrics |
| Version control | Code version control | Code + data + model + hyperparameter version control |
| Reproducibility | Build reproduction | Experiment reproduction (including data, environment, parameters) |
1.3 Technical Debt in ML Systems: Analyzing the Google Paper
The paper "Hidden Technical Debt in Machine Learning Systems" (Sculley et al., NeurIPS 2015), published by a Google research team in 2015, is the key paper that systematically laid out the technical debt problem in ML systems. Its core message is as follows:
In a real production ML system, the ML code is only a tiny fraction of the whole system. Most of the rest consists of surrounding infrastructure: data collection, validation, feature extraction, configuration management, monitoring, serving infrastructure, and so on.
The types of technical debt unique to ML systems that the paper identifies are as follows:
- Entanglement: changing one Feature in an ML model can change the influence of every other Feature. This is called the CACE (Changing Anything Changes Everything) principle.
- Hidden Feedback Loops: a circular structure in which the model's output influences future input data can exist without ever being detected.
- Undeclared Consumers: if you do not track who consumes the model's output, changing the model causes problems in places you did not expect.
- Data Dependencies: these are harder to track than code dependencies, and a dependency on an unstable external data source makes the whole system fragile.
- Configuration Debt: when countless hyperparameters, Feature flags, and preprocessing settings are not managed systematically, reproduction becomes impossible.
It is to manage this technical debt systematically that an MLOps pipeline is needed.
2. Google MLOps Maturity Model
The MLOps maturity model presented by the Google Cloud Architecture Center consists of 3 stages, from Level 0 to Level 2. Each level is distinguished by how automated the ML pipeline is and how far CI/CD is integrated.
2.1 Level 0: Manual Process
Level 0 is where most ML teams start, with every step performed manually.
Characteristics:
- Data scientists manually perform data analysis, preprocessing, model training, and validation in tools such as Jupyter Notebook
- The trained model is handed off manually to the engineering team
- Models are deployed very infrequently (a few times a year)
- There is no CI/CD --- no code testing and no automated deployment
- There is no model performance monitoring in production
- The training script and the prediction service are separate
The core problem: at Level 0, model performance decays over time once the model is in production, but there is no mechanism to detect it. The Google guide states that "models can decay in more ways than conventional software systems" and stresses that changes in the data profile are the main cause of model performance decay.
2.2 Level 1: ML Pipeline Automation
The goal of Level 1 is Continuous Training (CT) --- that is, automating the ML pipeline so the model can be trained continuously.
Core building blocks:
- Automated ML pipeline: the whole sequence of data extraction, validation, preprocessing, training, evaluation, and deployment runs as an orchestrated pipeline
- Data Validation: automated schema validation and statistical Drift detection are performed
- Model Validation: whether a newly trained model performs better than the existing one is evaluated automatically
- Feature Store: a centralized Feature store that guarantees Feature consistency between training and serving is used
- Metadata Management: pipeline execution history, data lineage, and model artifacts are tracked systematically
- Pipeline Triggers: retraining is triggered by a range of conditions, such as a schedule, the arrival of new data, detected performance decay, or Concept Drift
The key difference from Level 0: at Level 0 you deploy a trained "model", while at Level 1 you deploy a "pipeline". The same pipeline runs symmetrically in the development and production environments, and each stage of the pipeline is modularized and containerized.
2.3 Level 2: CI/CD Pipeline Automation
Level 2 is the stage where updates to the ML pipeline itself are automated as well. Where Level 1 automated continuous training (CT) of the model, Level 2 also covers continuous integration (CI) and continuous deployment (CD) of the pipeline code.
The 6 pipeline stages:
- Development and experimentation: new algorithms and modeling techniques are tried out in orchestrated steps
- Continuous Integration (CI): source code is built, tested, and packaged. This includes unit tests of Feature Engineering logic, verification that model training converges, and component integration tests
- Continuous Delivery (CD): pipeline artifacts are deployed to the target environment
- Automated triggers: the pipeline is executed automatically in the production environment
- Model CD: the trained model is deployed as a prediction service
- Monitoring: model performance and pipeline efficiency are tracked continuously
Deployment strategy:
- Automatic deployment to the test environment
- Semi-automatic deployment to the pre-production environment after review
- Manually approved deployment to production after pre-production validation
Test items included in CI:
- Unit tests of the Feature Engineering logic
- Convergence tests for model training
- Verification that no NaN or infinite values arise during model training
- Integration tests between pipeline components
- Model interface compatibility tests
3. Data Management
3.1 Feature Store: Feast
A Feature Store is the system that manages and serves Features centrally in an ML pipeline. Feast (Feature Store) is a leading open-source Feature Store whose core goal is to solve the Feature consistency problem between training and serving (Training-Serving Skew).
Feast's core architecture:
+-------------------+
| Feature Store |
| (Feast) |
+-------------------+
/ \
+------------------+ +------------------+
| Offline Store | | Online Store |
| (Historical) | | (Low-latency) |
+------------------+ +------------------+
| - BigQuery | | - Redis |
| - Redshift | | - DynamoDB |
| - Snowflake | | - Datastore |
| - File (Parquet) | | - SQLite |
+------------------+ +------------------+
| |
Model Training Model Serving
(Batch Feature Retrieval) (Online Feature Retrieval)
- Offline Store: stores large volumes of historical Feature data and is used to retrieve Features in batches during model training
- Online Store: serves the latest Feature values with low latency and is used for real-time inference serving
Why use Feast:
- Preventing Training-Serving Skew: it guarantees that the Feature transformation logic used at training time is identical to the logic used at serving time
- Feature reusability: a Feature defined once can be reused across several models
- Point-in-time Correctness: Feature values as of a past point in time can be retrieved accurately, preventing Data Leakage
- Feature Discovery: available Features can be searched and explored from the central store
Example Feast Feature definition:
from feast import Entity, FeatureView, Field, FileSource
from feast.types import Float32, Int64
from datetime import timedelta
# Define the data source
driver_stats_source = FileSource(
path="data/driver_stats.parquet",
timestamp_field="event_timestamp",
)
# Define the Entity
driver = Entity(
name="driver_id",
description="Driver identifier",
)
# Define the Feature View
driver_stats_fv = FeatureView(
name="driver_hourly_stats",
entities=[driver],
ttl=timedelta(hours=2),
schema=[
Field(name="conv_rate", dtype=Float32),
Field(name="acc_rate", dtype=Float32),
Field(name="avg_daily_trips", dtype=Int64),
],
source=driver_stats_source,
)
3.2 Data Versioning: DVC
DVC (Data Version Control) is an open-source tool that versions data and ML pipelines on top of Git. Just as Git manages code, DVC efficiently versions large datasets, model files, and intermediate outputs.
DVC's core principle:
Only the metadata about data files (the .dvc files and dvc.yaml) is committed to the Git repository, while the actual data is stored in Remote Storage (S3, GCS, Azure Blob, and so on).
# Initialize DVC
dvc init
# Start tracking a data file
dvc add data/training_dataset.csv
# Only the metadata files are committed to Git
git add data/training_dataset.csv.dvc data/.gitignore
git commit -m "Add training dataset v1"
# Configure Remote Storage
dvc remote add -d myremote s3://my-bucket/dvc-storage
dvc push
DVC Pipeline definition (dvc.yaml):
stages:
preprocess:
cmd: python src/preprocess.py
deps:
- src/preprocess.py
- data/raw/
outs:
- data/processed/
train:
cmd: python src/train.py
deps:
- src/train.py
- data/processed/
outs:
- models/model.pkl
metrics:
- metrics/scores.json:
cache: false
evaluate:
cmd: python src/evaluate.py
deps:
- src/evaluate.py
- models/model.pkl
- data/test/
metrics:
- metrics/eval_results.json:
cache: false
A DVC pipeline plays the role of a "Makefile" for an ML project. Because each stage's inputs, outputs, and dependencies are declared explicitly, the single command dvc repro reproduces the whole pipeline.
4. Experiment Tracking
4.1 MLflow Tracking
MLflow is an open-source platform for managing the entire lifecycle of ML experiments, developed by Databricks. MLflow Tracking is its core experiment management component, systematically recording and comparing parameters, metrics, artifacts, and code versions.
Core concepts of MLflow Tracking:
- Experiment: a logical grouping of related Runs
- Run: a single model training execution, recording parameters, metrics, artifacts, and tags
- Parameter: the hyperparameters used during model training (learning rate, batch size, and so on)
- Metric: the model's performance measures (accuracy, loss, F1-score, and so on)
- Artifact: outputs of the run such as model files, visualizations, and data files
MLflow Tracking usage example:
import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score, f1_score
from sklearn.model_selection import train_test_split
# Set the Tracking Server URI
mlflow.set_tracking_uri("http://mlflow-server:5000")
mlflow.set_experiment("fraud-detection-experiment")
# Run the experiment
with mlflow.start_run(run_name="rf_baseline_v1"):
# Log the hyperparameters
params = {
"n_estimators": 100,
"max_depth": 10,
"min_samples_split": 5,
"random_state": 42
}
mlflow.log_params(params)
# Train the model
model = RandomForestClassifier(**params)
model.fit(X_train, y_train)
# Predict and compute metrics
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
f1 = f1_score(y_test, y_pred, average='weighted')
# Log the metrics
mlflow.log_metrics({
"accuracy": accuracy,
"f1_score": f1
})
# Log the model artifact
mlflow.sklearn.log_model(model, "random_forest_model")
# Log additional artifacts (the confusion matrix image and so on)
mlflow.log_artifact("plots/confusion_matrix.png")
4.2 Weights & Biases (W&B)
Weights & Biases is an integrated MLOps platform for experiment tracking, hyperparameter optimization, and model management. It offers functionality similar to MLflow, but its strengths lie especially in real-time dashboards and team collaboration features.
W&B's key features:
- Experiment Tracking: tracks parameters, metrics, and system resource usage during training in real time and visualizes them in interactive charts
- Artifacts: versions datasets and model checkpoints so you can trace exactly which data a given model was trained on (Lineage)
- Sweeps: automates hyperparameter optimization. It supports a range of strategies including Bayesian Optimization, Grid Search, and Random Search
- Tables: visualizes prediction results as tables so you can analyze model behavior in fine detail
import wandb
# Initialize W&B
wandb.init(
project="fraud-detection",
config={
"learning_rate": 0.001,
"epochs": 50,
"batch_size": 32,
"architecture": "ResNet50"
}
)
# Log metrics inside the training loop
for epoch in range(wandb.config.epochs):
train_loss = train_one_epoch(model, train_loader)
val_loss, val_acc = evaluate(model, val_loader)
wandb.log({
"epoch": epoch,
"train_loss": train_loss,
"val_loss": val_loss,
"val_accuracy": val_acc
})
wandb.finish()
MLflow vs W&B comparison:
| Item | MLflow | W&B |
|---|---|---|
| License | Open source (Apache 2.0) | Freemium (free for individuals) |
| Hosting | Self-hosted / Managed | Cloud (SaaS) |
| Real-time dashboard | Basic | Advanced and interactive |
| Team collaboration | Limited | Strong collaboration features |
| Model Registry | Built in | Managed through Artifacts |
| Hyperparameter Tuning | Not supported (needs a separate tool) | Sweeps built in |
5. Model Registry and Version Management
5.1 MLflow Model Registry
The MLflow Model Registry is the component that centrally manages the entire lifecycle of an ML model. It systematically supports model version management, stage transitions, and approval workflows.
Core concepts of the Model Registry:
- Registered Model: a logical model unit (for example, "fraud-detection-model")
- Model Version: each version of a registered model. Version numbers are assigned automatically
- Model Aliases: gives a meaningful name to a specific version (for example,
@champion,@challenger) - Tags: attaches metadata to a model as tags, making search and filtering easier
Model Registry workflow:
Development (Experiment) --> Model registration --> Staging --> Production
| | |
Version 1 Test/validate Serve
Version 2 A/B test
Version 3
MLflow Model Registry usage example:
import mlflow
from mlflow import MlflowClient
client = MlflowClient()
# Train and log the model (done in Tracking)
with mlflow.start_run() as run:
mlflow.sklearn.log_model(model, "model")
model_uri = f"runs:/{run.info.run_id}/model"
# Register in the Model Registry
model_version = mlflow.register_model(
model_uri=model_uri,
name="fraud-detection-model"
)
# Set the Alias (designate it as champion)
client.set_registered_model_alias(
name="fraud-detection-model",
alias="champion",
version=model_version.version
)
# Load the champion model in production
champion_model = mlflow.pyfunc.load_model(
model_uri="models:/fraud-detection-model@champion"
)
predictions = champion_model.predict(input_data)
Why use a Model Registry:
- Audit Trail: you can trace the full history of which model was deployed to production, when, by whom, and from which experiment
- Easy rollback: when a model performance problem arises you can roll back to the previous version immediately
- Approval workflow: you can require a model to go through review and approval before it is deployed to production
- Reproducibility: by tracking which Run each model version is linked to, you can reproduce the training data, parameters, and code exactly
6. CI/CD for ML
6.1 Differences Between Traditional CI/CD and ML CI/CD
CI/CD in an ML project has to bring not only code but also data and models into the pipeline. This is called CI/CD/CT (Continuous Integration / Continuous Delivery / Continuous Training).
- CI (Continuous Integration): tests run automatically when code changes. In ML, data schema validation, Feature Engineering logic tests, and model training script tests are added.
- CD (Continuous Delivery): validated pipelines and models are deployed automatically to the target environment.
- CT (Continuous Training): the model is retrained automatically when new data arrives or model performance degrades.
6.2 CML (Continuous Machine Learning)
CML is an open-source tool from Iterative.ai (the makers of DVC) that integrates with GitHub Actions and GitLab CI to implement CI/CD for ML projects.
CML's key features:
- Posts ML experiment results to a Pull Request automatically as a report (metrics, visualizations)
- Allocates cloud instances on AWS, GCP, or Azure automatically when compute resources such as GPUs are needed
- Integrates with DVC to run experiments automatically according to the data version
GitHub Actions + CML workflow example:
# .github/workflows/ml-pipeline.yml
name: ML Pipeline CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
train-and-evaluate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: iterative/setup-cml@v2
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Pull data with DVC
run: |
dvc pull
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Train model
run: |
dvc repro
- name: Create CML report
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Compare metrics
echo "## Model Performance Report" >> report.md
echo "" >> report.md
dvc metrics diff --md >> report.md
echo "" >> report.md
# Add the visualization
echo "## Training Curves" >> report.md
cml asset publish plots/training_curve.png --md >> report.md
echo "" >> report.md
echo "## Confusion Matrix" >> report.md
cml asset publish plots/confusion_matrix.png --md >> report.md
# Post it as a comment on the PR
cml comment create report.md
This workflow trains the model automatically whenever a Pull Request is opened and posts the performance metrics and visualizations as a PR comment. A code reviewer can then review not just the code change but the change in model performance.
6.3 Testing Strategy in an ML Pipeline
On top of traditional software testing, an ML project needs the following kinds of ML-specific testing.
+----------------------------------------------------+
| ML Testing Pyramid |
| |
| /\ |
| / \ End-to-End Pipeline Test |
| /----\ |
| / Model \ Model Quality Tests |
| / Quality \ (Performance Threshold) |
| /------------\ |
| / Training \ Training Tests |
| / Convergence \ (NaN, Inf, Overfit) |
| /-------------------\ |
| / Data Validation \ Schema, Statistics |
| / & Feature Tests \ |
| /-------------------------\ |
| / Unit Tests (Code) \ Standard Unit |
| /______________________________\ Tests |
+----------------------------------------------------+
- Unit Tests: verify the correctness of preprocessing functions and Feature Engineering logic
- Data Validation Tests: verify that input data matches the schema, check statistical properties, and check the proportion of missing values
- Training Tests: verify that model training converges, that no NaN/Inf appears, and check for overfitting
- Model Quality Tests: verify that the model is at or above the defined performance threshold
- End-to-End Pipeline Tests: verify as a whole that the entire pipeline runs correctly
7. Model Serving Patterns
Once a model is trained and validated, it has to be served so it can deliver predictions to real users. The serving style and deployment strategy are decided by business requirements and system characteristics.
7.1 Batch Serving vs Real-time Serving
Batch Serving:
- Runs predictions over large volumes of data periodically (hourly, daily, weekly) and stores the results
- Used for things like precomputed recommendation lists in a recommender system, churn prediction scoring, and weekly demand forecasting
- Real-time behavior is not required; throughput is what matters
- Implemented in combination with Apache Spark, Apache Airflow, and similar tools
# Batch Serving example: Apache Spark + MLflow
from pyspark.sql import SparkSession
import mlflow
spark = SparkSession.builder.appName("batch-prediction").getOrCreate()
# Load the production model
model = mlflow.pyfunc.load_model("models:/fraud-detection@champion")
# Batch prediction over a large volume of data
input_df = spark.read.parquet("s3://data-lake/daily/transactions/")
predictions = model.predict(input_df.toPandas())
# Save the results
result_df = input_df.toPandas()
result_df["prediction"] = predictions
spark.createDataFrame(result_df).write.parquet("s3://data-lake/predictions/")
Real-time Serving:
- Returns a prediction immediately (within a few ms to a few hundred ms) for each individual request
- Used for fraud detection, real-time recommendation, search ranking, and similar cases
- Latency and availability are the key metrics
- The model is served through a REST API or gRPC endpoint
- Built with TensorFlow Serving, TorchServe, Triton Inference Server, BentoML, and similar tools
7.2 Deployment Strategies
A/B Testing:
Two or more model versions are deployed to production at the same time, traffic is split between them, and their effect on business metrics is compared statistically.
User request ──────> Load Balancer
|
+---------+---------+
| |
Model A (70%) Model B (30%)
(current model) (new model)
| |
return response return response
| |
+----> collect metrics <----+
|
statistical significance analysis
- Models are compared on direct business metrics (click-through rate, conversion rate, revenue, and so on)
- The experiment continues until statistical significance is reached
- Because it affects real users, it has to be designed carefully
Shadow Deployment:
The new model receives a copy of production traffic and produces predictions, but those predictions are not used in the actual response. Only the existing model serves the real response.
User request ──────> existing model (Production)
| |
| returns the real response
|
+----------> new model (Shadow)
|
stores the prediction (not used in the response)
|
performance comparison analysis
- You can validate the new model in the production environment without affecting users
- You learn its performance on real production data in advance
- The drawback is that infrastructure cost doubles
Canary Deployment:
The new model is rolled out first to a small set of users (for example, 5% of total traffic), and if nothing goes wrong the traffic share is raised gradually.
Phase 1: existing model 95% ──|── new model 5% (monitoring)
Phase 2: existing model 75% ──|── new model 25% (validation)
Phase 3: existing model 50% ──|── new model 50% (confirmation)
Phase 4: existing model 0% ──|── new model 100% (complete)
- The new model's technical stability (error rate, latency) is verified step by step
- Immediate rollback is possible if a problem appears (because the blast radius is limited)
- It can be combined with A/B Testing: confirm technical stability with a Canary first, then measure the business effect with A/B Testing
8. Monitoring: Drift Detection
Monitoring after a model reaches production is the most important area in MLOps, and often the most overlooked. Model performance will inevitably degrade over time, and the key is detecting that early and responding to it.
8.1 Types of Drift
Data Drift:
This is when the statistical distribution of the input data diverges from the distribution of the data used in training. The model itself has not changed, but the characteristics of the input data have, and the model's prediction accuracy degrades.
- Example: an abrupt shift in consumption patterns caused by the COVID-19 pandemic, or seasonal variation
- Mathematical definition: P_train(X) != P_production(X)
Concept Drift:
This is when the relationship between the input (X) and the output (Y) itself changes. The correct answer for the same input has changed.
- Example: fraud patterns evolving, user preferences shifting, classification criteria changing because of a regulatory change
- Mathematical definition: P_train(Y|X) != P_production(Y|X)
Model Drift:
This is when the model's prediction performance measures (accuracy, precision, recall, and so on) degrade over time. It often appears as a consequence of Data Drift or Concept Drift.
8.2 Drift Monitoring with Evidently AI
Evidently AI is an open-source Python library for monitoring ML model and data quality. It provides more than 20 prebuilt Drift detection methods and more than 100 built-in metrics.
Evidently's key features:
- Data Drift detection: detects Drift per Feature using a range of statistical tests, including the KS Test, PSI (Population Stability Index), Jensen-Shannon Divergence, and Wasserstein Distance
- Data Quality monitoring: detects data quality problems such as the proportion of missing values, outliers, and data type changes
- Model Performance tracking: tracks how model performance metrics such as accuracy and error rate change over time
- Interactive reports: generates visual reports of the detection results automatically
Evidently Data Drift detection example:
import pandas as pd
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset, DataQualityPreset
from evidently.metrics import DataDriftTable
# Load the training data (reference) and the production data (current)
reference_data = pd.read_csv("data/training_data.csv")
current_data = pd.read_csv("data/production_data_latest.csv")
# Generate the Data Drift report
drift_report = Report(metrics=[
DataDriftPreset(),
DataQualityPreset(),
])
drift_report.run(
reference_data=reference_data,
current_data=current_data
)
# Save the HTML report
drift_report.save_html("reports/data_drift_report.html")
# Access the results programmatically
report_dict = drift_report.as_dict()
dataset_drift = report_dict["metrics"][0]["result"]["dataset_drift"]
if dataset_drift:
print("Dataset Drift detected! Triggering model retraining.")
# Retraining pipeline trigger logic
Setting up an automated monitoring pipeline:
from evidently.test_suite import TestSuite
from evidently.tests import (
TestShareOfDriftedColumns,
TestColumnDrift,
TestShareOfMissingValues
)
# Define the test suite (for CI/CD integration)
data_stability_tests = TestSuite(tests=[
TestShareOfDriftedColumns(lt=0.3), # fewer than 30% of columns may have drifted
TestColumnDrift(column_name="transaction_amount"),
TestColumnDrift(column_name="user_age"),
TestShareOfMissingValues(lt=0.05), # missing value proportion under 5%
])
data_stability_tests.run(
reference_data=reference_data,
current_data=current_data
)
# Check the test results
test_results = data_stability_tests.as_dict()
all_passed = all(
test["status"] == "SUCCESS"
for test in test_results["tests"]
)
if not all_passed:
# Send an alert and trigger retraining
send_alert("Data stability test failed!")
8.3 Establishing a Monitoring Strategy
Effective ML monitoring calls for a multi-layered approach.
| Monitoring layer | Target | Tools | Cadence |
|---|---|---|---|
| Infrastructure | CPU/GPU utilization, memory, network | Prometheus, Grafana | Real time |
| Service | Response latency, error rate, throughput | Prometheus, Datadog | Real time |
| Data quality | Schema, missing values, outliers | Evidently, Great Expectations | Batch/real time |
| Data Drift | Feature distribution changes | Evidently, NannyML | Daily/weekly |
| Model performance | Accuracy, F1, AUC, and so on | Evidently, W&B | Daily/weekly |
| Business metrics | Conversion rate, revenue, click-through rate | In-house analytics tools | Daily/weekly |
9. Full Architecture Diagram
Below is a complete MLOps pipeline architecture corresponding to MLOps Level 2.
┌────────────────────────────────────────────────────────────────────┐
│ MLOps Pipeline Architecture │
├────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Data Sources │───>│ Data Pipeline │───>│ Feature Store (Feast)│ │
│ │ (DB, API, │ │ (Ingestion, │ │ ┌────────┐┌────────┐│ │
│ │ Streaming) │ │ Validation, │ │ │Offline ││Online ││ │
│ └─────────────┘ │ Transform) │ │ │Store ││Store ││ │
│ │ └──────────────┘ │ └────────┘└────────┘│ │
│ │ │ └──────────────────────┘ │
│ │ │ │ │ │
│ ▼ ▼ ▼ │ │
│ ┌──────────┐ ┌────────────────┐ ┌────────────┐ │ │
│ │ DVC │ │ Data Version │ │ Training │ │ │
│ │ (Data │ │ & Validation │ │ Pipeline │ │ │
│ │ Version) │ │ (Evidently) │ │ │ │ │
│ └──────────┘ └────────────────┘ └──────┬─────┘ │ │
│ │ │ │
│ ▼ │ │
│ ┌──────────────────────────────────────────────────┐ │ │
│ │ Experiment Tracking │ │ │
│ │ ┌─────────────┐ ┌──────────────────┐ │ │ │
│ │ │ MLflow │ │ Weights & │ │ │ │
│ │ │ Tracking │ │ Biases │ │ │ │
│ │ └──────┬──────┘ └──────────────────┘ │ │ │
│ └───────────┼──────────────────────────────────────┘ │ │
│ ▼ │ │
│ ┌──────────────────┐ ┌───────────────────────────┐ │ │
│ │ Model Registry │ │ CI/CD Pipeline │ │ │
│ │ (MLflow) │──>│ (GitHub Actions + CML) │ │ │
│ │ ┌────────────┐ │ │ ┌─────┐ ┌────┐ ┌─────┐ │ │ │
│ │ │ @champion │ │ │ │ CI │ │ CD │ │ CT │ │ │ │
│ │ │ @challenger│ │ │ └─────┘ └────┘ └─────┘ │ │ │
│ │ └────────────┘ │ └────────────┬──────────────┘ │ │
│ └──────────────────┘ │ │ │
│ ▼ │ │
│ ┌───────────────────────────────────────────────────────┐│ │
│ │ Model Serving Layer ││ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │▼ │
│ │ │ Batch │ │Real-time │ │ Deployment Strategy│ │ │
│ │ │ Serving │ │ Serving │ │ - A/B Testing │ │ │
│ │ │ (Spark) │ │ (REST/ │ │ - Canary │ │ │
│ │ │ │ │ gRPC) │ │ - Shadow │ │ │
│ │ └──────────┘ └──────────┘ └──────────────────┘ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ Monitoring Layer │ │
│ │ ┌────────────┐ ┌──────────────┐ ┌─────────────────┐ │ │
│ │ │ Data Drift │ │ Model Perf │ │ Infrastructure │ │ │
│ │ │(Evidently) │ │ Monitoring │ │ (Prometheus/ │ │ │
│ │ │ │ │ │ │ Grafana) │ │ │
│ │ └──────┬─────┘ └──────┬───────┘ └─────────────────┘ │ │
│ └─────────┼──────────────┼─────────────────────────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────────────────────────┐ │
│ │ Alert & Retrain Trigger │──── trigger the retraining pipeline │
│ └──────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────┘
Data flow between the architecture components:
-
Data collection and preprocessing: data is collected from a variety of sources (DB, API, streaming) and preprocessed through a data pipeline. DVC versions the data and Evidently validates data quality.
-
Feature Engineering: the preprocessed data is stored in the Feature Store (Feast). The Offline Store serves Features for training and the Online Store serves Features for serving.
-
Model training and experiment management: the model is trained in the Training Pipeline and the experiment is tracked with MLflow Tracking or W&B. Parameters, metrics, and artifacts are recorded systematically.
-
Model registration and deployment: the validated model is registered in the MLflow Model Registry and automatically tested, validated, and deployed through the CI/CD pipeline (GitHub Actions + CML).
-
Model Serving: predictions are served through Batch Serving (Spark) or Real-time Serving (REST/gRPC), applying deployment strategies such as A/B Testing, Canary, and Shadow.
-
Monitoring and retraining: Evidently monitors Data Drift and model performance while Prometheus/Grafana monitor the infrastructure. When an anomaly is detected, the retraining pipeline is triggered automatically.
The key thing in this architecture is the feedback loop (Feedback Loop). Problems detected by monitoring trigger retraining automatically, and the retrained model is validated, registered, and deployed again - that cycle is the essence of MLOps.
10. Conclusion: A Guide to Adopting MLOps
For a team adopting MLOps for the first time, an incremental approach is recommended.
Phase 1 - Laying the foundation (starting at Level 0):
- Introduce version control systems: code (Git), data (DVC)
- Introduce an experiment tracking tool: MLflow Tracking or W&B
- Build a basic model serving environment
Phase 2 - Automating the pipeline (reaching Level 1):
- Automate the training pipeline (Airflow, Kubeflow, and so on)
- Introduce a Feature Store (Feast)
- Introduce a Model Registry (MLflow Model Registry)
- Build basic monitoring (Evidently)
Phase 3 - Integrating CI/CD (reaching Level 2):
- Build the CI/CD pipeline (GitHub Actions + CML)
- Automated testing (data, model, pipeline)
- Advanced deployment strategies (A/B Testing, Canary)
- Comprehensive monitoring and automatic retraining
At each stage it matters to choose tools and processes that fit the organization's ML maturity, team size, and business requirements. Rather than trying to build a perfect MLOps system from the outset, concentrating on the biggest current bottleneck and expanding gradually is the realistic and effective strategy.
References
- Google Cloud, "MLOps: Continuous delivery and automation pipelines in machine learning" - https://docs.cloud.google.com/architecture/mlops-continuous-delivery-and-automation-pipelines-in-machine-learning
- Google Cloud, "Practitioners Guide to MLOps" - https://cloud.google.com/resources/mlops-whitepaper
- Sculley et al., "Hidden Technical Debt in Machine Learning Systems", NeurIPS 2015 - https://papers.neurips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems.pdf
- MLflow Official Documentation - https://mlflow.org/docs/latest/
- MLflow Tracking - https://mlflow.org/docs/latest/ml/tracking/
- MLflow Model Registry - https://mlflow.org/docs/latest/ml/model-registry/
- Feast Official Documentation - https://docs.feast.dev
- DVC Official Documentation - https://doc.dvc.org/
- DVC Data Pipelines - https://doc.dvc.org/start/data-pipelines/data-pipelines
- CML (Continuous Machine Learning) - https://cml.dev/
- Iterative CML GitHub - https://github.com/iterative/cml
- Evidently AI Official - https://www.evidentlyai.com
- Evidently AI GitHub - https://github.com/evidentlyai/evidently
- Evidently AI, "What is data drift in ML" - https://www.evidentlyai.com/ml-in-production/data-drift
- Evidently AI, "What is concept drift in ML" - https://www.evidentlyai.com/ml-in-production/concept-drift
- Weights & Biases Documentation - https://docs.wandb.ai
- Weights & Biases Experiment Tracking - https://wandb.ai/site/experiment-tracking/