1
Problem
2
Challenge
3
Solution
4
Implementation
5
Summary

Shift, drift, and noise

Three mechanisms

The Problem

Engineers and risk officers use one word—“drift”—for slow mix change, sudden regime breaks, and seasonal batch noise. Detectors and runbooks differ. Applying a gradual-drift playbook to an abrupt policy shock wastes days; treating holiday variance as concept drift burns credibility with the business.

LedgerRoute gives us three synthetic streams with the same feature schema: gradual online mix shift, abrupt label-rate change, and sinusoidal noise without structural change.

Gradual
Covariate mix (CUSUM can fire mid-stream)
Abrupt
Label-rate step (changepoint)
Seasonal
Noise-only oscillation

Where vocabulary fails

Alert fatigue and wrong runbooks

The Challenge

False alarms at scale

Monitoring dozens of features every hour multiplies false positives unless you control multiplicity. Seasonal class-balance fluctuation can look like drift until window length matches the business cycle (payroll weeks, quarter close, holiday spend).

In this seed a CUSUM on normalized daily channel mix fires mid-stream; the noise-only stream does not cross the same threshold. That separation is what you want from detector design—not identical alerts on every wiggle.

One pager route, three mechanisms
Alert fires
Classify mechanism
Pick runbook
Owner + SLA

Operational mistakes

Shared on-call route: Gradual drift and abrupt shock hit the same playbook.
Hourly PSI on 40 features: Guaranteed alert fatigue without Bonferroni or hierarchy.
Short windows on seasonal data: Noise looks like drift every December.
No replay: Cannot test whether last week’s alarm was justified.

Our approach

Name the mechanism first

The Solution

Name the mechanism, then pick the response

Gradual covariate drift: scheduled evaluation, segment metrics, planned retrain windows. Abrupt concept or policy shift: rollback, feature flags, human gate. Noise: longer windows, stratified sampling, or seasonal baselines before paging.

Gradual

CUSUM / PSI + segment accuracy → scheduled retrain.

Abrupt

Changepoint on outcomes → policy rollback or threshold freeze.

Noise

Extend window; compare to same calendar week last year.

Replay

Re-score historical week offline before changing production.

What changes in operations

Separate routes
Gradual vs abrupt vs noise
Fewer pages
Multiplicity control
Faster MTTR
Right runbook first time

Code for CUSUM and overlays

Three-stream comparison

Implementation

cusum_daily.py
def cusum(series, threshold=5.0, drift=0.0):
    s_pos = s_neg = 0.0
    alarms = []
    for i, x in enumerate(series):
        s_pos = max(0, s_pos + x - drift)
        s_neg = max(0, s_neg - x - drift)
        if s_pos > threshold or s_neg > threshold:
            alarms.append(i)
            s_pos = s_neg = 0.0
    return alarms

Key points

  • Overlay plot: Three normalized daily signals in one figure for teaching.
  • Detector choice: Match test to suspected mechanism before automating response.
  • Window length: Align to business cycle, not only to statistical convenience.

Notebook: 04_shift_vs_drift_noise.ipynb

Summary

Runbooks that match physics

What this run shows

Side-by-side curves make the vocabulary concrete. Teams that separate runbooks respond faster than teams that retrain on noise.

Gradual drift, abrupt shift, seasonal noise
Gradual mix drift, abrupt label-rate step, and seasonal noise compared on the same axes.

CUSUM on mix

Fires on gradual stream in this seed.

Noise stream

Does not cross the same threshold without a real shift.

Runbook split

Retrain schedules ≠ rollback ≠ wait-and-measure.

Questions answered

Same detectors for abrupt and gradual events? No. Gradual: CUSUM/PSI with segment outcome checks. Abrupt: changepoint on labels or queue volume, then policy/rollback path. Share tooling, not runbooks.
How many feature tests per hour at scale? Cap surfaced alerts: hierarchy (channel mix first, then top-k features), FDR control, and a daily digest for sub-threshold moves.
Replay without retraining? Yes—re-score stored features from a past week with the current model; if alarms disappear, the issue was transient noise or infra.
Window length vs false alarms? Set minimum window to one business cycle (e.g., 28 days for monthly seasonality); use shorter windows only on score/outcome layers with enough labels.

Production insights

On-call card

Click to reveal

Print three bullets: gradual → segment eval; abrupt → policy/rollback; noise → extend window.

Holiday baselines

Click to reveal

Compare to last year’s same ISO week before paging in Q4.

Alert budget

Click to reveal

Cap pages per service per day; overflow goes to digest.

Post-incident

Click to reveal

Tag alerts with mechanism after triage—train the team, not just the model.

Continue this saga

Next chapter: Modalities and governance.

← Previous StoryBack to saga overviewNext Story →