Sub topic 1
Why models fail after deployment
A model can score well offline and still fail in production. Offline data may not represent future users, the input pipeline may break, or the relationship between inputs and outcomes may change. Monitoring checks whether the deployed system still receives valid data and produces useful results.
Prerequisites
Assume you know basic Python and NumPy, supervised learning, distributions, p-values, and how a model runs as an API or batch job.
Why models fail after deployment
Production differs from the training environment. Users change their behavior. New products, policies, or seasons change the data. A feature may become missing, use a new unit, or arrive with an unexpected category. The model may also be correct while the business outcome changes.
A useful monitor records the model version, input features, prediction, score, timestamp, request status, latency, and later outcome when it becomes available.
What to monitor: operational, data, prediction and performance layers
| Layer | What to track | Example failure |
|---|---|---|
| Operational | Latency, errors, throughput | API times out |
| Data | Schema, missing values, ranges | Age arrives as text |
| Prediction | Class rates and score distributions | Almost every request gets one class |
| Performance | Accuracy, precision, recall, or error | Recall falls after labels arrive |
Operational health: latency, errors and throughput
Track request latency, error rate, timeout rate, and throughput over time. Break these metrics down by model version, endpoint, region, and client when possible. A rising latency rate may indicate overloaded infrastructure. A sudden error increase may indicate a dependency or serialization problem rather than model drift.
Catching broken inputs: schema, missing values and ranges
A schema defines expected column names, types, and allowed categories. Validate it before inference. Also track missing-value rates, numeric ranges, duplicate records, and row counts. Reject or quarantine invalid records when silently accepting them could create unsafe predictions.
Covariate shift, label shift and concept drift
Covariate shift means the input distribution changes, such as a new customer mix, while the input-to-outcome relationship stays similar.
Label shift means the outcome distribution changes. For example, the proportion of fraudulent transactions rises, even if the feature behavior within each class is stable.
Concept drift means the relationship between inputs and outcomes changes. A fraud pattern can become obsolete, so the same features no longer imply the same label.
Exercise
Which drift type describes a feature distribution changing while the relationship between features and labels remains stable?
Show answer
Covariate shift.