Gradient LabStart the lesson

Lessons › Chapter 14: ML in practice

Monitoring and drift

A model learns from data collected at one point in time: here, the typical shopping basket. As long as new data looks similar, it does well.

Watch it move. This lesson is interactive on Gradient Lab: every step is an animated scene you can replay.

Start the interactive lesson

Step by step

Story

The world changes

Spending patterns shift every holiday season. Will the models notice when the world changes?

Concept

The model learned one world

A model learns from data collected at one point in time: here, the typical shopping basket. As long as new data looks similar, it does well.

Problem

The world moves

Then habits change: a new competitor opens, prices rise, a holiday arrives. Today’s inputs (yellow) no longer look like the training data. That’s drift.

Build

Accuracy quietly slips

Nothing crashes, and the model still answers. But as true outcomes arrive, live accuracy drifts down week by week. Without monitoring, nobody notices.

Key idea

Alert, investigate, retrain

Monitoring compares live data and accuracy with what the model was trained on and raises an alert when they diverge. The team investigates and retrains on fresh data, and accuracy recovers.

Real life

In real life: when shopping changed overnight

When shopping habits changed suddenly in 2020, many demand-forecasting models trained on older data started making big mistakes, overnight. Teams with good monitoring spotted it quickly and retrained; others found out from empty shelves.

Quick check: What is data drift?

Drift means the world the model sees has changed since it was trained.

Pseudocode

every day:
    compare today's inputs with the training data
    track live accuracy as true answers arrive
    if they differ too much:
        alert the team → investigate → retrain on fresh data

Key terms

drift
When the real-world data a model sees slowly (or suddenly) changes from what it was trained on.

Build it: Serve your model as a web API (40 min, runs in your browser)

See the project