Sub topic 3
The four families of retraining triggers
This chapter assumes you know the train, validate, test, deploy workflow, can read basic Python, and have used CI/CD or a cron-style scheduler. It gives a map of the four trigger families. Later chapters cover each one in detail.
What a trigger is
A retraining trigger is a rule that evaluates a signal and decides whether to start the retraining pipeline. The trigger does not train anything. It only starts the pipeline. Validation, training, evaluation, and promotion happen in later stages.
Triggers exist because a deployed model is judged against data that keeps changing. The goal is to retrain often enough that quality stays acceptable, and no more often than that, since every run costs compute, review time, and deployment risk.
The four families
Every trigger you will meet falls into one of four families. They differ in what they observe and how quickly the signal arrives.
| Family | Signal it watches | Needs labels? | Typical lag | Main weakness |
|---|---|---|---|---|
| Schedule | Calendar time or model age | No | None | Retrains when nothing changed, or too late when something did |
| Performance | Accuracy, AUC, error, or a business metric on recent predictions | Yes | Days to months, depending on label delay | Slow and blind until labels arrive |
| Data drift | Distribution of inputs or predictions compared with training data | No | Hours to days | A distribution can shift without hurting the model |
| Data volume | Amount of new labeled data since the last run | Usually | Depends on ingestion | More data does not mean better data |
Schedule triggers
A schedule trigger fires on a clock, such as every Monday at 03:00 UTC, or when the model reaches a maximum age. It is simple, predictable, and easy to budget. It also acts as a safety net, because it still fires when your monitoring is broken.
Performance triggers
A performance trigger fires when a quality metric computed from real outcomes falls below a threshold. It measures what you care about directly. The difficulty is label delay. If a loan default is known only after 12 months, a performance trigger reports a problem long after the damage began.
Data drift triggers
A data drift trigger fires when production inputs (or model outputs) differ from the training distribution. It needs no labels, so it reacts quickly. Common statistics are PSI (Population Stability Index) and the two-sample Kolmogorov-Smirnov test. Drift is a proxy. Inputs can move without changing the input-to-label relationship, and concept drift can happen with stable inputs.
Data volume triggers
A data volume trigger fires when enough new training data has accumulated, for example 50,000 new labeled rows. It prevents retraining on a handful of examples. It works better as a condition combined with another trigger than as a trigger on its own.
How the families relate
The families watch different points in the system. Schedule and volume are properties of the pipeline and the data store. Drift watches inputs. Performance watches outcomes. Each one is a different place where degradation can show up first.
The diagram shows a design choice: the four triggers do not each start the pipeline on their own. They feed one policy, which decides whether to run. The policy is covered in a later chapter. For now, treat each family as a signal producer.
Evaluating every family in code
A useful habit is to compute all four signals independently and record which ones fired, even before you decide how to combine them. The log of which signals fired is valuable when you later tune thresholds.
from dataclasses import dataclass
from typing import Optional
@dataclass(frozen=True)
class Signals:
model_age_days: float
rolling_auc: Optional[float] # None while labels have not arrived
max_feature_psi: float
new_rows: int
def fired_triggers(s, max_age_days=30, min_auc=0.88,
psi_limit=0.2, row_limit=100_000):
"""Return the names of the trigger families whose condition is met."""
fired = []
if s.model_age_days >= max_age_days:
fired.append("schedule")
if s.rolling_auc is not None and s.rolling_auc < min_auc:
fired.append("performance")
if s.max_feature_psi >= psi_limit:
fired.append("drift")
if s.new_rows >= row_limit:
fired.append("volume")
return fired
print(fired_triggers(Signals(12, None, 0.27, 40_000)))
print(fired_triggers(Signals(35, 0.86, 0.05, 120_000)))The first call prints ['drift']. The model is young, no labels have arrived so the performance check is skipped, and volume is below its limit. The second prints ['schedule', 'performance', 'volume'].
Note the None check. A missing metric must mean "unknown", not "fine" and not "zero". Treating a missing AUC as 0.0 would fire the performance trigger on every run until labels arrive.
A schedule plus a manual trigger
Most teams start with a schedule and a manual button. In GitHub Actions both fit in one workflow.
name: retrain
on:
schedule:
- cron: "0 3 * * 1"
workflow_dispatch: {}
jobs:
retrain:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python -m pip install -r requirements.txt
- run: python train_pipeline.pyschedule fires every Monday at 03:00 UTC. workflow_dispatch lets a person start the same job on demand, which is useful after an incident or a known upstream change. A manual trigger is not a fifth family. It is a human acting as a trigger source, and it should go through the same pipeline and the same evaluation gate as automatic runs.
Choosing between families
Choose by asking how fast the world changes, how fast labels arrive, and how expensive a run is.
- Labels arrive within hours or days. Use a performance trigger as the primary signal. Add a schedule as a fallback.
- Labels arrive months late, or never. Rely on drift and schedule triggers. Use the performance metric for later review, not for triggering.
- The environment is stable and runs are cheap. A schedule alone is often enough. Do not build drift monitoring you will not act on.
- Data arrives in bursts, or labels come from manual annotation. Add a volume condition so you do not train on a few hundred rows.
- Retraining is expensive or needs human approval. Use stricter thresholds and combine signals, so a single noisy statistic cannot start a run.
Failure modes to expect
- Over-triggering. With large samples, a statistical test such as KS reports tiny, harmless shifts as significant. Use an effect-size threshold (such as PSI at 0.2), not only a p-value.
- Under-triggering. A threshold set too high, or a metric that hides a bad segment, lets degradation continue. Check metrics per segment as well as overall.
- Feedback loops. If the model's own predictions shape the data it later trains on, drift signals can reflect the model rather than the world.
- Silent monitor failure. If the monitoring job stops, no trigger fires and nothing looks wrong. This is the main reason to keep a schedule as a backstop.
Exercise
A fraud model receives confirmed fraud labels about 90 days after each transaction. Transaction patterns shift weekly. Which trigger families would you make primary, which would you keep as a backstop, and why?
Show answer
Make drift triggers primary, because they need no labels and react within days, which matches the weekly shifts. Keep a schedule trigger as the backstop (for example a maximum model age), because the monitoring itself can fail silently. A performance trigger is a poor primary signal because of the 90-day label delay. Compute performance metrics anyway for later review and for the evaluation gate. A volume condition can be added so drift-driven runs happen only with enough fresh data.
Exercise
In the fired_triggers function, why does the performance check test s.rolling_auc is not None instead of just s.rolling_auc < min_auc?
Show answer
A missing metric means labels have not arrived yet. Comparing None with a number raises a TypeError in Python 3, and substituting 0.0 would make the trigger fire on every evaluation. Explicitly skipping the check keeps "unknown" separate from "bad".