Sub topic 6
Performance Triggers and the Label Delay Problem
Assume you know the basic train, validate, test, and deploy workflow. You should also be comfortable with Python and with batch or online model serving.
A performance trigger starts retraining when a model's observed quality falls below an agreed limit. For example, a fraud model might trigger when its precision drops below 0.80 for two consecutive weekly reports. This trigger measures business behavior more directly than input drift does.
Measure performance with delayed labels
A model produces a prediction before the real outcome is known. The outcome is called a label. A loan default may take months to appear, while a payment-fraud label may arrive within hours.
This delay creates a gap between prediction time and evaluation time:
sequenceDiagram
participant S as Serving system
participant M as Model
participant O as Outcome system
participant T as Trigger
S->>M: Request prediction
M-->>S: Prediction
S->>O: Store prediction and features
O-->>S: Label arrives later
S->>T: Report metric after labels mature
T-->>S: Retrain or continuecaption: Prediction-to-label timeline alt: A sequence showing predictions being stored, labels arriving later, and a performance trigger evaluating mature records.
Do not calculate a performance metric from records whose labels are not mature. A recent drop in measured recall may simply mean that recent cases have not had enough time to receive their labels.
A useful monitoring record stores:
- The prediction and model version.
- The prediction timestamp.
- The feature or request identifier.
- The eventual label and label timestamp.
- Whether the label is final or still pending.
Choose a trigger rule
A trigger should specify the metric, evaluation window, minimum sample count, and action. These details prevent a few unusual examples from starting an expensive training run.
| Policy part | Example |
|---|---|
| Metric | Seven-day precision |
| Minimum sample count | 10,000 labeled predictions |
| Trigger threshold | Precision below 0.80 |
| Confirmation rule | Two consecutive windows |
| Action | Start a candidate training run |
Compare the current model with a fixed baseline or with the champion model currently serving traffic. For important systems, include uncertainty estimates. A small metric difference may be sampling noise rather than real degradation.
def performance_trigger(
metric_value,
threshold,
labeled_rows,
minimum_rows,
failed_windows,
required_failures=2,
):
"""Return a decision and reason for a delayed-label metric."""
if labeled_rows < minimum_rows:
return False, "not_enough_mature_labels"
if metric_value < threshold:
failed_windows += 1
else:
failed_windows = 0
if failed_windows >= required_failures:
return True, "performance_below_threshold"
return False, "monitor"
print(performance_trigger(0.77, 0.80, 12_000, 10_000, 1))The counter must persist between monitoring runs. In production, also add a cooldown so one incident cannot launch repeated retraining jobs.
Handle missing or changing labels
A label pipeline can fail independently of the model. If labels stop arriving, the measured performance may be empty or biased. Monitor label coverage and label latency as separate signals. Pause automated promotion when coverage falls below its minimum.
Labels can also change definition. For example, a fraud label based on chargebacks may later include customer complaints. Version the label definition and compare metrics only across compatible definitions.
Exercise
A classifier has 0.78 precision on 2,000 mature labels, but its policy requires 0.80 precision on at least 10,000 labels. Should it trigger retraining?
Show answer
No. The metric is below the threshold, but the sample has too few mature labels. Report insufficient evidence and continue collecting labels.