19.2 Training-Serving Skew, Data Drift, Concept Drift & Attribution Drift
Key Takeaways
- Training-serving skew is a difference between the training data distribution and production serving data, often caused by pipeline or preprocessing differences.
- Data drift is a change in production input distributions over time, while concept drift is a change in the relationship between inputs and the target.
- Concept drift often can't be seen in input distributions alone; it shows up in model performance against ground truth or in prediction and attribution changes.
- Feature attribution drift tracks changes in how much each feature contributes to predictions, and it can reveal problems when input distributions look stable.
- L-infinity distance measures the largest difference in any category's share, and Jensen-Shannon divergence measures the overall difference between two distributions.
The exam guide lists monitoring for common issues (for example, training-serving skew, data drift, concept drift, and feature attribution drift). Scenario questions describe symptoms, so you need to tell these apart.
Definitions
| Issue | What changes | Compared against | Typical cause |
|---|---|---|---|
| Training-serving skew | Serving feature distribution differs from training | Training data | Different preprocessing, different data sources, bugs, stale features |
| Data (feature) drift | Serving feature distribution changes over time | An earlier serving window | Changing users, seasons, markets, products |
| Prediction (output) drift | Distribution of predictions changes | Training predictions or an earlier window | Input drift, concept change, upstream issues |
| Concept drift | The relationship between inputs and label changes | Ground-truth performance over time | Fraud tactics evolve, customer preferences shift, policy changes |
| Feature attribution drift | How much each feature drives predictions changes | Baseline attributions (SHAP) | Broken or redefined features, interactions changing, concept shift |
Skew vs. drift in one sentence
Skew means "production doesn't look like training." Drift means "production today doesn't look like production before."
How Distributions Are Compared
Agent Platform monitoring and BigQuery ML validation use:
| Metric | Applies to | Intuition |
|---|---|---|
| L-infinity distance | Categorical features | The largest absolute difference in any single category's share |
| Jensen-Shannon (JS) divergence | Numerical (and optionally categorical) features | A symmetric, bounded measure of overall distribution difference |
Worked L-infinity example: in training, a payment_method feature was 60% card, 30% wallet, and 10% bank transfer. In serving it's 35% card, 55% wallet, and 10% bank. Differences are |0.60 − 0.35| = 0.25, |0.30 − 0.55| = 0.25, and 0. L-infinity is 0.25, below a default threshold of 0.3, so there's no alert. If wallet rises to 65% and card falls to 25%, L-infinity is 0.35 and an alert fires.
Threshold tuning: thresholds that are too low cause alert fatigue on harmless variation. Thresholds that are too high miss real shifts. Tune per feature by importance and natural volatility, and use larger time windows for low-traffic models.
Diagnosing by Symptom
| Symptom | Most likely issue | Next step |
|---|---|---|
| Right after launch, several features differ sharply from training | Training-serving skew | Compare preprocessing code and data sources. Check units, defaults, and null handling |
Gradual shift in age and device_type over months, accuracy still fine | Data drift without harm | Keep monitoring. Consider retraining on the next schedule |
| Inputs stable, but ground-truth precision falling | Concept drift | Retrain on recent labeled data. Consider new features |
| Inputs stable, predictions suddenly shift toward one class | Upstream bug, model version mix-up, or concept change | Check deployments, feature pipelines, and attribution drift |
| A minor feature suddenly dominates attributions | Feature attribution drift from a broken feature (for example, constant or scaled wrongly) | Inspect that feature's pipeline, and roll back if needed |
| Accuracy drops only for one region | Segment-specific drift or bias | Slice-level monitoring and fairness checks (Chapter 18) |
Why Concept Drift Needs Ground Truth
Concept drift changes P(label | features). Inputs can look identical while their meaning changes. For example, the same transaction pattern that used to be legitimate is now typical of a new fraud ring. Distribution monitors on inputs can miss it entirely. Detect it with:
- Continuous evaluation: join predictions with delayed labels and track precision, recall, and calibration over time (Chapter 7).
- Prediction drift and attribution drift as indirect signals.
- Business KPIs, such as chargeback rate or return rate.
Feature Attribution Drift
Attribution monitoring watches which features the model relies on:
- If the most important feature's attribution drops, that feature may have become constant, missing, or wrongly scaled.
- If a low-importance ID-like feature's attribution rises, the model may be picking up leakage or a pipeline bug.
- Attribution drift can appear when input distributions stay within thresholds, because interactions between features changed.
Model Monitoring v2 tracks attributions with SHAP values. With the Explainable AI deprecation (Chapter 18), plan SHAP-based batch jobs as a long-term way to compute attributions.
Drift Isn't Always Harmful
A drift alert means "look," not "retrain now":
- Harmless drift: a feature the model barely uses shifts, or the shift stays within ranges the model handles well.
- Harmful drift: important features shift into regions with little training data, or performance on recent labels declines.
- Expected drift: known seasonal patterns. Compare against the same period last year with a window and offset baseline.
Combine drift magnitude with feature importance and performance evidence before deciding to retrain.
Prevention vs. Detection
| Prevent | Detect |
|---|---|
| Shared preprocessing (TRANSFORM, tf.Transform, Feature Store) → less skew | Skew monitoring against training data |
| Point-in-time training data → fewer leakage surprises | Attribution drift monitoring |
| Regular retraining policy → less impact from drift | Drift monitoring plus continuous evaluation |
Worked Scenario
A ride-hailing ETA model's MAE jumps 30% overnight. Monitoring shows distance_km skew with L-infinity-style alerts on bucketed distance, while other features are stable. Attribution for distance_km fell sharply.
Diagnosis: training-serving skew. A backend release changed distance from kilometers to meters. Fix: roll back or correct the unit conversion, add a parity test, and add a range check on distance_km in preprocessing.
A fraud model's input feature distributions have stayed within drift thresholds for months, but precision measured against confirmed fraud labels has steadily declined. What is the most likely issue?
In training, a categorical feature was 70% A, 20% B, and 10% C. In the last day of serving, it's 45% A, 45% B, and 10% C. What is the L-infinity distance, and does it exceed a 0.3 threshold?
Right after a new model launch, monitoring shows several features in production differ sharply from the training data, although the business environment hasn't changed. What should the team investigate first?