Building a model in a Jupyter notebook is only 20% of the work. Getting that model to run reliably in production, serving real users, and staying accurate over time — that’s the other 80%. MLOps (Machine Learning Operations) is the set of practices and tools that bridge the gap between experimentation and production. This guide covers the full MLOps lifecycle for 2026.
What Is MLOps?
MLOps applies DevOps principles to machine learning. It covers the entire lifecycle: data versioning, model training pipelines, experiment tracking, model registry, serving infrastructure, CI/CD for ML code, and production monitoring. The goal is reproducibility, reliability, and speed — being able to retrain, validate, and deploy a new model version safely in hours, not weeks.
Experiment Tracking with MLflow
MLflow is the most widely adopted experiment tracking tool. It logs parameters, metrics, and artifacts so you can compare runs and reproduce results:
pip install mlflow scikit-learn
import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import accuracy_score
mlflow.set_experiment("credit-default-classification")
with mlflow.start_run():
# Log parameters
n_estimators = 100
max_depth = 5
mlflow.log_param("n_estimators", n_estimators)
mlflow.log_param("max_depth", max_depth)
# Train
model = RandomForestClassifier(n_estimators=n_estimators, max_depth=max_depth)
model.fit(X_train, y_train)
# Log metrics
acc = accuracy_score(y_test, model.predict(X_test))
mlflow.log_metric("accuracy", acc)
# Log model
mlflow.sklearn.log_model(model, "model")
print(f"Accuracy: {acc:.4f}")
Run mlflow ui to open a browser dashboard comparing all your experiments.
Model Versioning with MLflow Model Registry
# Register the model
model_uri = f"runs:/{run_id}/model"
mlflow.register_model(model_uri, "credit-default-classifier")
# Transition to production
from mlflow.tracking import MlflowClient
client = MlflowClient()
client.transition_model_version_stage(
name="credit-default-classifier", version=1, stage="Production")
Containerizing with Docker
Docker ensures your model runs identically in development and production. A minimal Dockerfile for a FastAPI model server:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
Serving with FastAPI
from fastapi import FastAPI
from pydantic import BaseModel
import mlflow.pyfunc
import pandas as pd
app = FastAPI()
model = mlflow.pyfunc.load_model("models:/credit-default-classifier/Production")
class PredictionRequest(BaseModel):
age: float
income: float
loan_amount: float
credit_score: float
@app.post("/predict")
def predict(req: PredictionRequest):
df = pd.DataFrame([req.dict()])
pred = model.predict(df)[0]
return {"prediction": int(pred), "label": "default" if pred else "no default"}
CI/CD for Machine Learning
A good ML CI/CD pipeline runs automatically on every code push. Using GitHub Actions:
name: ML Pipeline
on: [push]
jobs:
train-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with: {python-version: '3.11'}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: pytest tests/
- name: Train model
run: python train.py
- name: Evaluate model
run: python evaluate.py --threshold 0.85
- name: Build and push Docker image
run: |
docker build -t mymodel:${{ github.sha }} .
docker push myregistry/mymodel:${{ github.sha }}
Monitoring Model Drift in Production
Models degrade over time as the world changes. You need to monitor two things: data drift (input distribution shifting) and concept drift (the relationship between features and target changing). Tools like Evidently AI make this straightforward:
pip install evidently
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset
report = Report(metrics=[DataDriftPreset()])
report.run(reference_data=train_df, current_data=production_df)
report.save_html("drift_report.html")
Set up alerts when drift exceeds a threshold — that’s your signal to retrain.
The MLOps Stack in 2026
The most common MLOps stack for small-to-medium teams in 2026: MLflow for experiment tracking and model registry; GitHub Actions for CI/CD; Docker + Kubernetes (or AWS Fargate) for containerized serving; FastAPI for the model API; Evidently or Arize for monitoring; and DVC for data versioning. Larger teams often use Vertex AI (Google) or SageMaker (AWS) to manage the full pipeline as a managed service.
Conclusion
MLOps is what separates a hobby project from a production system. Start with experiment tracking (MLflow), then add Docker containerization, then a CI/CD pipeline. Once you’ve deployed a model, set up drift monitoring immediately — this is where most teams cut corners and pay for it months later when model accuracy silently degrades.


