Sub topic 6
Performance triggers and the label delay problem
This chapter assumes you can train, validate, and deploy a model, read basic NumPy and pandas code, and know the difference between batch and online serving. It covers retraining triggered by measured model quality, and why that measurement is often late.
What a performance trigger is
A performance trigger starts retraining when a quality metric for the live model falls below a limit. The metric might be AUC, precision at a fixed recall, mean absolute error, or a business metric such as click-through rate.
This is the most direct signal you have. Drift statistics tell you the inputs changed. A performance trigger tells you the model is actually doing worse. Inputs can shift without hurting accuracy, and accuracy can fall with no visible input shift (concept drift). A performance trigger catches both cases.
The cost is that you need ground truth, meaning the true outcome for each prediction. Ground truth often arrives late, arrives for only some predictions, or never arrives.
The label delay problem
Label delay is the time between making a prediction and learning the true outcome. It differs a lot between use cases.
| Use case | Label source | Typical delay |
|---|---|---|
| Ad click prediction | User clicks | Seconds to minutes |
| Product recommendations | Purchases | Hours to days |
| Credit default | Missed payments | 3 to 12 months |
| Fraud detection | Chargebacks and investigations | 30 to 90 days |
| Churn prediction | Customer cancels | Weeks to months |
Delay makes the performance signal stale. If labels take 60 days, a metric computed today describes predictions from 60 days ago. A model could degrade for two months before the trigger fires.
Three other problems often come with delay:
- Partial labels. Only some predictions ever get a label. In lending, you see repayment only for applicants you approved. This is selection bias, and metrics computed on the labeled subset can look better or worse than reality.
- Label noise. Chargebacks and manual reviews are imperfect, so the metric itself has error.
- Feedback effects. The model's decisions change which outcomes you observe, which can distort later training data.
Matching predictions to labels
To compute a delayed metric you must join each prediction to its label later. Log every prediction with a stable ID, a timestamp, the model version, and the score. When labels arrive, join on the ID.
Compute the metric over a window of predictions made in a past period, and only include predictions old enough to have mature labels. For a 30-day label delay, evaluate predictions from 30 to 60 days ago, not from the last week.
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score
def windowed_auc(predictions, labels, now, label_delay_days=30, window_days=30):
"""AUC over predictions old enough to have labels, joined by prediction_id."""
end = now - pd.Timedelta(days=label_delay_days)
start = end - pd.Timedelta(days=window_days)
in_window = predictions[
(predictions["predicted_at"] >= start) & (predictions["predicted_at"] < end)
]
joined = in_window.merge(labels, on="prediction_id", how="inner")
coverage = len(joined) / max(len(in_window), 1)
if joined["label"].nunique() < 2:
return None, coverage
return float(roc_auc_score(joined["label"], joined["score"])), coverage
rng = np.random.default_rng(1)
now = pd.Timestamp("2026-11-30")
n = 4000
predictions = pd.DataFrame({
"prediction_id": np.arange(n),
"predicted_at": now - pd.to_timedelta(rng.uniform(0, 80, n), unit="D"),
"score": rng.uniform(0, 1, n),
})
truth = (predictions["score"] + rng.normal(0, 0.4, n) > 0.5).astype(int)
labels = pd.DataFrame({"prediction_id": np.arange(n), "label": truth})
labels = labels.sample(frac=0.8, random_state=1) # 20% of labels never arrive
auc, coverage = windowed_auc(predictions, labels, now)
print("AUC:", round(auc, 3), "label coverage:", round(coverage, 2))The function returns coverage as well as the metric. A metric computed on 15% of predictions should not drive a retraining decision the same way as one computed on 95%.
Making the trigger robust
A single metric reading is noisy. Retraining on every dip wastes compute and can cause oscillation. Apply these rules:
- Compare to a baseline. Use the metric the model achieved at validation or in its first healthy weeks, not an arbitrary number.
- Use a tolerance. Trigger when the metric drops more than a set amount, for example 0.02 AUC below baseline.
- Require persistence. Trigger only after several consecutive windows are below the limit.
- Check sample size. Skip evaluation if the labeled count or label coverage is too low.
- Add a confidence interval. Bootstrap the metric and trigger only if the upper bound of the interval is below the limit.
import numpy as np
from sklearn.metrics import roc_auc_score
def bootstrap_auc_interval(y_true, y_score, n_boot=500, seed=0):
"""95% bootstrap interval for AUC."""
y_true = np.asarray(y_true)
y_score = np.asarray(y_score)
rng = np.random.default_rng(seed)
values = []
for _ in range(n_boot):
idx = rng.integers(0, len(y_true), len(y_true))
if len(np.unique(y_true[idx])) < 2:
continue
values.append(roc_auc_score(y_true[idx], y_score[idx]))
return float(np.quantile(values, 0.025)), float(np.quantile(values, 0.975))
def performance_trigger(recent_aucs, baseline, tolerance=0.02, windows=2):
"""Fire when the last `windows` readings are all below baseline - tolerance."""
if len(recent_aucs) < windows:
return False, "not_enough_windows"
limit = baseline - tolerance
if all(a < limit for a in recent_aucs[-windows:]):
return True, "sustained_drop"
return False, "within_tolerance"
print(performance_trigger([0.90, 0.87, 0.86], baseline=0.90))
print(performance_trigger([0.90, 0.87, 0.89], baseline=0.90))The first call returns (True, 'sustained_drop') because the last two readings (0.87 and 0.86) are below 0.88. The second returns (False, 'within_tolerance') because 0.89 is above the limit.
Working around label delay
When labels are slow, you have several options. They are usually combined.
Use proxy labels
A proxy is an earlier signal correlated with the real outcome. For fraud, an early customer dispute or a manual review flag arrives before the final chargeback. For churn, a drop in logins arrives before cancellation. Proxies are faster but less accurate. Check how well a proxy agrees with the final label on historical data before you rely on it.
Monitor prediction distributions
You can compare the distribution of the model's scores now with scores at deployment, using PSI or the KS test from the drift chapter. A change in score distribution needs no labels. It is a leading indicator, not proof of lower accuracy.
Use the fast subset
Some labels arrive quickly even if most arrive slowly. Monitor the early-maturing cohort, such as customers who default within the first month, as an early warning. This cohort may not represent the whole population, so treat it as a hint.
Estimate performance without labels
Methods such as confidence-based estimation or importance weighting can estimate accuracy from inputs and scores alone. They rely on assumptions, such as no concept drift, and can fail silently when those assumptions break. Use them to raise an alert, not to make the final decision.
Retrain on a schedule as a backstop
If labels are very slow, a performance trigger alone is too late. Pair it with a schedule trigger and drift triggers so that the pipeline refreshes the model even when no metric is available.
Common errors
- Evaluating immature windows. Including predictions whose labels have not arrived biases the metric, often because quick outcomes differ from slow ones.
- Ignoring coverage. A metric on a small, unrepresentative labeled subset can mislead in either direction.
- Training-serving mismatch in the join. If the logged features differ from what the model saw, the metric does not describe the live model.
- Triggering on noise. Without tolerance, persistence, and sample-size checks, small fluctuations launch retraining jobs.
- Retraining that cannot fix the problem. If the cause is a broken upstream feature or a changed label definition, retraining on the new data can bake in the fault. Run data validation before training.
- Mixing model versions. After a rollout, windows can contain predictions from two versions. Group the metric by model version.
Choosing a performance trigger
- If labels arrive within hours, use performance triggers as the primary signal and compute the metric daily or hourly.
- If labels arrive in days to weeks, use performance triggers with a delayed window, and add drift triggers on inputs and scores for early warning.
- If labels arrive in months or are partial, use performance monitoring mainly for reporting and for validating other triggers. Rely on schedule and drift triggers to drive retraining.
Exercise
A fraud model has a 45-day label delay. Today is day 120. You compute AUC daily over a 30-day window. Which prediction dates should the window cover, and what two extra signals would you add so the model is not blind for 45 days?
Show answer
The window should cover predictions from day 45 to day 75 (end = 120 - 45 = 75, start = 75 - 30 = 45), because only those predictions have mature labels. Report label coverage with the metric. For early warning, add drift monitoring on input features and on the score distribution (PSI or KS), and add a proxy label such as early disputes or manual review outcomes. A schedule trigger as a backstop is also reasonable.
Exercise
The last three weekly AUC readings are 0.91, 0.88, 0.89 with a baseline of 0.91, a tolerance of 0.02, and a persistence requirement of 2 windows. Does performance_trigger fire? What if the tolerance is 0.01?
Show answer
With tolerance 0.02 the limit is 0.89. The last two readings are 0.88 and 0.89. 0.89 is not below 0.89, so the trigger does not fire. With tolerance 0.01 the limit is 0.90. Both 0.88 and 0.89 are below it, so the trigger fires with reason sustained_drop.