Vaibhav Waghmare.

Projects / AI/ML / 2024

MLWatch - Model Monitoring

ML Drift Detection System

1K+ tested Events/Sec
5 monitored Models
<100ms Query Latency
KL, PSI, WD Algorithms
4 time ranges Windows
Real-time WS Dashboard

Developed MLOps monitoring platform using Spring Boot 3 WebFlux and Kafka Streams for real-time prediction event processing. Implements statistical drift detection algorithms (KL divergence, Population Stability Index, Wasserstein distance) monitoring model behavior. System ingests prediction events from Kafka topics, computes rolling window metrics, detects anomalies via statistical process control, sends alerts when drift thresholds exceeded. Built React dashboard with WebSocket real-time updates showing model health, feature distributions, performance trends over time.

The challenge

ML models degrade silently in production as data distributions shift. Traditional monitoring tracks infrastructure only, not model-specific metrics like prediction confidence, feature drift, or output distribution changes. Need real-time detection before model degradation impacts results. Statistical drift algorithms (KL divergence, PSI) require streaming architecture.

Implementation

Built reactive monitoring platform using Spring Boot 3 WebFlux + Kafka Streams for real-time event processing. Implemented drift detection algorithms (KL divergence, Population Stability Index, Wasserstein distance). WebSocket dashboard shows real-time model health. InfluxDB time-series storage enables fast historical queries. Alert rules trigger on threshold violations.

Architecture

  • Spring Boot 3 WebFlux reactive streams processing
  • Kafka Streams topology for event aggregation
  • InfluxDB time-series storage with retention policies
  • WebSocket Server-Sent Events for real-time dashboard
  • Statistical drift detection: KL divergence, PSI, Wasserstein
  • Rolling window aggregations: 1min, 5min, 1hour, 1day
  • Alert rule engine with configurable thresholds
  • Python microservice for statistical computations
  • Redis caching for frequently accessed metrics
  • Docker Compose multi-container deployment

Features

  • Kafka 3.6+ Streams for real-time prediction event processing
  • Statistical drift detection: KL divergence, PSI, Wasserstein distance
  • Data quality checks: missing values, outliers, schema validation
  • Performance metrics tracking: accuracy, precision, recall, F1, AUC
  • Automated alerting via configurable threshold rules
  • Feature distribution monitoring over rolling time windows
  • React 18 + WebSocket real-time dashboard with live updates
  • InfluxDB time-series queries with <100ms latency
  • Statistical process control charts for anomaly detection
  • Model comparison view showing drift across multiple models
  • Historical trend analysis with customizable time ranges
  • Prometheus metrics export for Grafana integration

Results

  • Drift detection algorithms implemented: KL divergence, PSI, Wasserstein distance
  • Real-time WebSocket dashboard with React 18 showing model health trends
  • Kafka Streams processing pipeline handling 1K+ events/sec in testing
  • InfluxDB time-series storage with <100ms query latency for metric retrieval
  • Rolling window metrics computed: 1min, 5min, 1hour, 1day aggregations
  • Statistical process control charts detecting anomalies automatically
  • Tested monitoring 5 ML models with simulated prediction data
  • Alert engine with configurable thresholds for drift, accuracy, latency

Technologies

  • Spring Boot 3.3
  • Spring WebFlux
  • Apache Kafka 3.6+
  • Kafka Streams
  • InfluxDB 2.7
  • PostgreSQL 16
  • React 18
  • TypeScript 5.x
  • Recharts
  • WebSocket
  • Python 3.11+
  • scipy (statistics)
  • Redis 7.2
  • Docker 24.0
  • Prometheus + Grafana