Lab 08: ML Monitoring & Drift Detection

Objective

Build production ML monitoring systems: data drift detection (KS test, PSI, MMD), concept drift detection (ADWIN, Page-Hinkley), model performance monitoring with alerts, and automatic retraining triggers — applied to a live malware detection pipeline.

Time: 55 minutes | Level: Advanced | Docker Image: zchencow/innozverse-ai:latest


Background

Your model trained on 2023 data. It's 2025. The world changed.
  - New malware families you've never seen
  - Network topology changed  
  - Users behaviour patterns shifted
  - Label distribution drifted

Silent failures: model still predicts, accuracy drops, nobody notices.
ML monitoring catches this before it becomes a production incident.

Step 1: Setup and Baseline

docker run -it --rm zchencow/innozverse-ai:latest bash

📸 Verified Output:


Step 2: Data Drift — KS Test and PSI

📸 Verified Output:


Step 3: Concept Drift — ADWIN Algorithm

📸 Verified Output:

💡 ADWIN detected drift at batch 115 (start of gradual drift) — before performance degraded catastrophically. Early detection saves 33 batches of bad predictions.


Step 4: Model Performance Monitor

📸 Verified Output:


Step 5–8: Capstone — Automated Retraining Pipeline

📸 Verified Output:


Summary

Drift Type
Detection Method
Threshold

Feature distribution

KS test

D-stat > 0.1 (p < 0.05)

Feature distribution

PSI

0.1=warn, 0.2=retrain

Concept drift

ADWIN

δ = 0.002

Prediction confidence

Distribution shift

Mean/std monitoring

Model performance

AUC degradation

Below SLA threshold

Further Reading

Last updated