MLOps practice projects: end to end with MLflow, Airflow and Evidently

Five MLOps practice projects that build one loop: MLflow tracking and registry, drift detection with Evidently, safe releases and Airflow retraining.

5 min read5 stepsReal lab output

By Verth Labs · Published

MLOps is the work around a model: tracking experiments, registering versions, serving, watching for drift and retraining. It is hard to practice because the tools only make sense connected to each other. This guide gives you MLOps practice projects that build on each other into one end-to-end loop, and shows the first steps with real output from MLOps Labs, captured on 14 November 2026 with MLflow 3.16.1, scikit-learn 1.9.1 and Evidently 0.7.23.

The loop you are building

  1. Train a model on tabular data and track every run (parameters, metrics, the model itself) in MLflow.
  2. Register the best run as a model version and give it an alias such as champion.
  3. Serve that version as a REST API and release a new version safely (canary, blue-green or shadow).
  4. Monitor incoming data for drift with Evidently, and chart it in Grafana.
  5. Retrain automatically with an Airflow pipeline when drift appears, and register the new version.

You can do steps 1, 2 and 4 on a laptop with pip install. Steps 3 and 5 are where local practice usually stops, because they need a model server, a router, a scheduler and a database running together.

Step 1: Project 1: experiment tracking and the model registry

The lab ships a small churn dataset generator so everyone gets the same data. Train three logistic regressions with different regularisation strengths, log each one, and register them:

import mlflow
from lab_mlops_governance import ensure_mlflow
from lab_mlops_pipeline import make_churn, FEATURES, NUM_COLS, CAT_COLS, LABEL
from sklearn.compose import ColumnTransformer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_auc_score
from sklearn.model_selection import train_test_split
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import OneHotEncoder, StandardScaler

ensure_mlflow()   # starts your own MLflow server and points this notebook at it
df = make_churn(4000, seed=1)
X_tr, X_te, y_tr, y_te = train_test_split(df[FEATURES], df[LABEL], test_size=0.25, random_state=0)
mlflow.set_experiment("seo-practice-churn")
for C in (0.1, 1.0, 10.0):
    with mlflow.start_run(run_name=f"logreg-C{C}"):
        model = Pipeline([
            ("prep", ColumnTransformer([("num", StandardScaler(), NUM_COLS),
                                        ("cat", OneHotEncoder(handle_unknown="ignore"), CAT_COLS)])),
            ("clf", LogisticRegression(C=C, max_iter=500)),
        ]).fit(X_tr, y_tr)
        auc = roc_auc_score(y_te, model.predict_proba(X_te)[:, 1])
        mlflow.log_param("C", C)
        mlflow.log_metric("roc_auc", auc)
        mlflow.sklearn.log_model(model, name="model", input_example=X_tr.head(3),
                                 registered_model_name="seo-practice-churn")
        print(f"C={C:<5} roc_auc={auc:.4f}")

The data and the output:

Output
(4000, 7)
   tenure_months  monthly_spend  support_calls contract_type region segment  churned
0           25.8          51.06              0       monthly  south       A        0
1           25.6          90.73              0       monthly  south       A        0
2           37.6          67.08              0      two-year  south       A        0
Successfully registered model 'seo-practice-churn'.
Created version '1' of model 'seo-practice-churn'.
C=0.1   roc_auc=0.7495
Registered model 'seo-practice-churn' already exists. Creating a new version of this model...
Created version '2' of model 'seo-practice-churn'.
C=1.0   roc_auc=0.7490
Registered model 'seo-practice-churn' already exists. Creating a new version of this model...
Created version '3' of model 'seo-practice-churn'.
C=10.0  roc_auc=0.7490

Three runs, three registered versions. The regularisation strength barely matters on this data, which is itself a useful finding: tuning C won't fix a model whose features carry limited signal.

Now pick the best version by its logged metric, give it the alias champion, and load the model by alias, the way a serving system would:

from mlflow import MlflowClient

client = MlflowClient()
versions = client.search_model_versions("name='seo-practice-churn'")
best = max(versions, key=lambda v: client.get_run(v.run_id).data.metrics["roc_auc"])
client.set_registered_model_alias("seo-practice-churn", "champion", best.version)
loaded = mlflow.pyfunc.load_model("models:/seo-practice-churn@champion")
print(loaded.predict(X_te.head(5)))
Output
version 1 roc_auc 0.7495
version 2 roc_auc 0.749
version 3 roc_auc 0.749
champion = version 1
[1 0 1 0 1]

Aliases replace the old Staging/Production stages in MLflow: code asks for @champion and you move the alias when a better version arrives, without changing the code.

Extend it: add an XGBoost or LightGBM run, tune it with Optuna and log each trial, then compare all runs in the MLflow UI.

Step 2: Project 2: data drift detection

A model trained on last month's customers slowly goes wrong as customers change. Drift detection compares new data with the training data, column by column. The lab's helper wraps an Evidently report; here it compares a reference sample with a shifted one (drift=0.6) and an unshifted one (drift=0.0):

import lab_mlops_pipeline as lp

print("drift=0.6 ->", lp.drift(lp.make_churn(2000, seed=0), lp.make_churn(500, seed=1, drift=0.6)))
print("drift=0.0 ->", lp.drift(lp.make_churn(2000, seed=0), lp.make_churn(500, seed=1, drift=0.0)))
Output
drift=0.6 -> {'drift_share': 0.8, 'n_drifted': 4, 'n_columns': 5, 'dataset_drift': True}
drift=0.0 -> {'drift_share': 0.2, 'n_drifted': 1, 'n_columns': 5, 'dataset_drift': False}

With drift, four of five feature columns are flagged and the dataset as a whole counts as drifted. Without drift, one column is still flagged: statistical tests on a 500-row sample give false alarms, which is why teams alert on the share of drifted columns, not on any single one. The helper also writes each result to a table in your own Postgres, which Grafana charts.

Build the same thing with Evidently directly to see the full report:

from evidently import DataDefinition, Dataset, Report
from evidently.presets import DataDriftPreset

dd = DataDefinition(numerical_columns=NUM_COLS, categorical_columns=CAT_COLS)
reference = Dataset.from_pandas(make_churn(2000, seed=0)[FEATURES], data_definition=dd)
current = Dataset.from_pandas(make_churn(500, seed=1, drift=0.6)[FEATURES], data_definition=dd)
Report([DataDriftPreset()], include_tests=True).run(current_data=current, reference_data=reference)

Evidently changed its API in version 0.7. Many tutorials still use from evidently.report import Report and evidently.metric_preset; with 0.7 use from evidently import Report and evidently.presets, as above.

Step 3: Project 3: serve and release safely

Serve the champion model as a REST API with the MLflow model server from a terminal: mlflow models serve -m "models:/seo-practice-churn@champion" -p 5001 --env-manager local, call it with a JSON payload, then register a second model and practice the three release patterns behind the lab's router: a canary (send 10% of requests to the new version), blue-green (switch all traffic at once and back) and shadow (copy traffic to the new version without returning its answers). Watch request traces in Jaeger to see where time goes.

Step 4: Project 4: retrain on drift with Airflow

Write an Airflow DAG that runs daily: compute drift on the latest data, and if the dataset has drifted, retrain, log the new run to MLflow, register the version and move the champion alias only if its metric beats the current one. MLOps Labs includes a reference DAG for this pattern (lab_retrain_on_drift) that you can read before writing your own.

Step 5: Project 5: the full loop as a portfolio piece

Put projects 1 to 4 together on one dataset and write it up: the data checks (Great Expectations), the feature store (Feast) if you use one, the experiments and why you chose the champion, the release strategy, the drift dashboard and the retraining rule. That write-up, with screenshots, is what makes an MLOps project discussable in an interview.

Where to practice

You can run projects 1 and 2 locally with a few pip install commands. For projects 3 to 5 you need MLflow, a model server, a router, Postgres, Grafana and Airflow running and connected; that is what MLOps Labs gives you ready in the browser. If you are earlier in the journey, Data Science Labs covers model training and MLflow tracking without the operations tools.

Related: RAG practice project: build a RAG app on your own PDFs.