Diagnose drift and evaluate generated answers
Decide which production alerts can be interpreted before ground-truth labels arrive.
Diagnose drift and evaluate generated answers
Work through the decision
A new delivery model receives higher basket values than its training set. It also gives more weight to distance than it did last month. Actual delivery times arrive tomorrow. What can be concluded now?
Check your reasoning
Compare serving features with the training reference to measure skew, and recent serving windows with earlier serving windows for drift. A shift in attribution can indicate changed model behavior or input mix. Once outcomes mature, join them to predictions by key and compare error conditional on relevant features. An input alert alone cannot establish that the relationship between input and outcome changed.
Compare the choices
- Training-serving skew
- Compare production inputs or preprocessing with the training distribution. Feature definitions may differ even on the first day of service.
- Data drift
- Compare the input distribution across serving periods. Check seasonality and sample size before acting.
- Concept drift
- The conditional relationship between inputs and outcomes changes. Investigate it with mature labels after accounting for input mix and data defects.
- Attribution drift
- Compare distributions of feature contributions using consistent methods and versions. Investigate changed explanations alongside inputs and outcomes.
- Generative response evaluation
- Monitor representative prompts and sampled outputs against a rubric for relevance, groundedness, safety and user outcomes. Calibrate with human reviewers.
Test the decision
Define reference windows, sampling, thresholds and alert owners in model monitoring. Track the model version with inputs and predictions. For a generative endpoint, evaluate a representative prompt set for groundedness, relevance, safety and refusal quality and calibrate automated ratings against human review.
Practice the guide skills
- Configure a monitoring reference, sampling period, threshold and alert owner. Join model version and prediction ID to eventual outcomes. Watch 2:27:01
- Classify four signals as training-serving skew, data drift, concept drift or attribution drift. State which signals require mature labels. Watch 2:27:29
- Evaluate generated answers on fixed prompts and a production sample for groundedness, relevance, safety and appropriate abstention. Compare automated scores with human judgments. Watch 2:29:44
Official objectives for this lesson
Lab · Separate an input alert from prediction errors
Run this Python 3 fixture locally. A model predicts delays for urban and rural deliveries. The monitoring window contains both mature and pending labels. Predict which denominators can support an input alert and which can support an accuracy comparison.
baseline = ["urban"] * 8 + ["rural"] * 2
# location, predicted delay, observed delay (None until known)
live = [
("urban", False, False), ("urban", True, True),
("rural", False, True), ("rural", True, True),
("rural", True, None), ("rural", False, None),
]
def rural_share(locations):
return sum(place == "rural" for place in locations) / len(locations)
print(f"rural share: {rural_share(baseline):.0%} -> "
f"{rural_share([row[0] for row in live]):.0%}")
for region in ["urban", "rural"]:
labeled = [(pred, actual) for place, pred, actual in live
if place == region and actual is not None]
errors = sum(pred != actual for pred, actual in labeled)
print(region, "errors / mature labels:", errors, "/", len(labeled))
Check the result
rural share: 20% -> 67% urban errors / mature labels: 0 / 2 rural errors / mature labels: 1 / 2
The input distribution uses all six serving requests. Each slice error count uses only its two mature labels. Fill in the missing outcomes and recompute. A distribution shift alone cannot establish concept drift. Compare equivalent label windows and larger samples before a promotion or rollback decision.
Related lesson · Find the stage where work starts to accumulate
Diagnose drift and evaluate generated answers quiz
Answer 3 questions. Check each answer for an explanation.
Worked example · Diagnose drift and evaluate generated answers