Lesson · ⏱ 7 min read

πŸ“‘ Monitoring models: drift and silent failures

EnglishHinglish

🏠 Real-life example

A demand-forecasting model trained before Diwali suddenly sees completely different shopping patterns during the festival season. Nothing 'crashed', but its predictions are now wrong. Like a car slowly going out of alignment, models drift as the world changes, and you only notice if you keep checking.

πŸ’‘ In simple words

Software errors are loud. Model errors are often silent. Data drift means the inputs change: new user types, new products, a changed upstream field. Concept drift means the relationship changes: what used to signal fraud no longer does. Monitor input distributions, prediction distributions, data quality and, when labels arrive, real accuracy. For LLM apps, trace every request (prompt, retrieved docs, output, cost, latency) and track user feedback. Set alerts and a retraining or rollback plan before you need them.

🎬 See how it works

avg transaction β‚Ήweeks β†’alert threshold🚨drift detected β†’ retrain

Nothing crashed, but the inputs drifted during the festival season. Monitoring catches the line crossing the alert threshold before accuracy quietly falls apart.

πŸͺœ Step by step

  1. System health: latency, errors and throughput, with alerts.
  2. Data: compare live feature distributions with training data (for example with PSI); watch for missing values and schema changes.
  3. Predictions: watch the share of each predicted class and the confidence scores over time.
  4. Real performance: when true labels arrive (days or weeks later), compute accuracy, precision and recall by week.
  5. Act: each alert has an owner and an action, such as investigate the pipeline, retrain or roll back.

πŸ”‘ Key terms

Data drift
Input data looks different from the training data.
Concept drift
The real-world relationship the model learned has changed.
Tracing
Recording each request's steps, inputs and outputs for debugging.

πŸ‘€ See it in action

text
Weekly monitor β€” fraud model v12
  avg transaction amount   β‚Ή1,240 β†’ β‚Ή2,980   ⚠️ data drift (festival season)
  % flagged as fraud       1.1%  β†’ 4.6%     ⚠️ prediction shift
  confirmed-fraud recall   0.81  β†’ 0.62     🚨 alert β†’ retrain with recent data

Watch the inputs, the outputs and, when you can, the true outcomes.

⚠️ Common mistakes to avoid

  • Monitoring only uptime. The service can be up while predictions are silently wrong.
  • Too many noisy alerts, so people ignore them. Alert only on what needs action.

βœ… Quick check

Model accuracy slowly drops over months with no code changes. Most likely cause?

  1. Too many tests
  2. A syntax error
  3. Drift: the real-world data or relationships changed
Show answer

C. Drift: the real-world data or relationships changed: When the world changes, a frozen model gets stale. That's drift.

πŸ™‹ Questions learners ask

How often should I retrain?

When monitoring shows drift or falling performance, or on a regular schedule if your data changes predictably. Always evaluate before replacing a model.

What tools are used?

Prometheus and Grafana for system metrics, Evidently or similar for drift, and your warehouse for performance reports.

πŸ“Œ Remember

Models decay silently. Monitor inputs, outputs and outcomes, with alerts.

πŸ“– Words from this lesson (AI dictionary)

Learn this as part of a full course

Track your progress, take the quick checks and follow the lessons in the right order. This lesson is part of:

ML Engineer Β· MLOps / AI Platform Engineer

Continue in the course