Sub topic 9
Combining Signals into a Trigger Policy
Assume you know how to train, validate, and deploy a model. You also know basic Python, NumPy, batch or online serving, and version control. This chapter focuses on deciding when a signal is strong enough to start retraining.
A trigger policy converts monitoring signals into a controlled decision. It should answer four questions:
- Which signals can request retraining?
- What threshold makes a signal actionable?
- How much new data is required?
- How often may retraining run?
A single signal is rarely reliable enough. For example, a small distribution change may be random noise. A large change with only ten new records may not provide enough data for useful training.
Combining signals
Common policy rules include:
- A maximum model age forces periodic retraining.
- A drift threshold detects a meaningful input change.
- A minimum row count prevents training on a tiny sample.
- A cooldown prevents repeated runs from the same incident.
- Multiple signals may need to agree before a run starts.
The policy can use OR and AND logic deliberately:
| Signal | Example rule | Purpose |
|---|---|---|
| Maximum age | Model is at least 30 days old | Prevents stale models |
| Drift | Maximum PSI is at least 0.2 | Detects changed inputs |
| New data | At least 50,000 new rows | Provides training volume |
| Cooldown | Last run was more than 2 days ago | Limits repeated runs |
A useful default is:
- Retrain if the model reaches its maximum age.
- Otherwise, retrain when drift exceeds its threshold and enough new data exists.
- Reject both decisions during the cooldown period.
The order matters. Check the cooldown before expensive work or downstream scheduling. Record the selected reason with every decision so operators can explain why a run started or did not start.
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
@dataclass(frozen=True)
class TriggerConfig:
drift_threshold: float = 0.2
minimum_new_rows: int = 50_000
maximum_model_age: timedelta = timedelta(days=30)
cooldown: timedelta = timedelta(days=2)
def retraining_decision(
now: datetime,
last_trained: datetime,
maximum_drift: float,
new_rows: int,
config: TriggerConfig,
) -> tuple[bool, str]:
age = now - last_trained
if age < config.cooldown:
return False, "cooldown"
if age >= config.maximum_model_age:
return True, "maximum_model_age"
if (
maximum_drift >= config.drift_threshold
and new_rows >= config.minimum_new_rows
):
return True, "drift_with_enough_data"
return False, "no_trigger"
now = datetime(2026, 11, 30, tzinfo=timezone.utc)
last_trained = now - timedelta(days=10)
print(
retraining_decision(
now,
last_trained,
maximum_drift=0.31,
new_rows=80_000,
config=TriggerConfig(),
)
)This example returns True with the reason drift_with_enough_data. Use timezone-aware timestamps consistently. Otherwise, comparisons between timestamps can fail or produce incorrect age calculations.
Make the policy observable
Store the inputs and decision for each evaluation:
- evaluation timestamp
- model version and model age
- drift values by feature
- number of eligible new rows
- policy version
- decision and reason
This record helps distinguish a quiet system from a broken monitor. It also lets you tune thresholds without guessing.
Exercise
A model is 10 days old. Its PSI is 0.31, but only 20,000 new rows are available. The policy requires PSI of 0.2 and 50,000 rows. Should retraining start?
Show answer
No. The drift threshold is exceeded, but the minimum data requirement is not met. Record the decision as no_trigger.