Accuracy is a lagging indicator. By the time a holdout score drops, the bad decisions have happened. Watch what the model sees and decides today, before labels arrive. Every hour a bad model keeps serving is an hour of discounted quotes or rejected good customers. An alert is worth building only if someone can act inside that hour.
A model can pass its accuracy check and still hurt the business. A ranking model trained on last quarter’s catalogue may see valid inputs and reasonable scores while pushing low-margin items to the top. The holdout score does not move, but revenue softens.
Accuracy answers how the model did on a fixed slice of history. Your business asks how it is doing on today’s traffic, where the value of a correct decision varies. A false negative on a high-value account costs more than ten on low-value ones.
Drift monitoring buys earlier notice. It does not prove the model is wrong. It says the world has moved away from the one it was fitted to, and the cost of being wrong is climbing.
Before choosing a statistical test, write down the decision the model makes and what a bad version costs. Then instrument an outcome you can observe without ground truth.
For a pricing model, the share of quotes below a floor finance set. For fraud, the manual-review rate. These proxies are imperfect, but they sit closer to revenue than a loss curve.
Give the signal a budget: how much badness you can absorb before intervening. Google’s SRE workbook shows how to turn a budget into alerts with good precision in its chapter on alerting on SLOs. Borrow the multiwindow, multi-burn-rate pattern. A drift signal that fires on every wobble gets ignored within a fortnight.
Drift lives in the request stream, so measure it where requests are served. Add light instrumentation to the inference endpoint and to the job computing your business proxy.
Three things are enough. Count decisions with a model-version label. Record the distribution of output scores and a few input features that drive value. Do not log every column at first; it gets expensive and creates privacy work.
Prometheus histograms fit this. They count observations in buckets and keep a count and sum, so you can ask what fraction of scores fell below a boundary without storing each value. Native histograms are more efficient and higher resolution, though library support varies by language. Classic histograms work everywhere but force bucket boundaries up front. Choose boundaries around values that change a decision, not round numbers.
# Share of pricing scores in the lowest bucket, by model version
sum(rate(model_score_bucket{le="0.4",model="pricing"}[10m]))
/ sum(rate(model_score_count{model="pricing"}[10m]))
Keep the version label. Without it, an alert cannot tell you whether the world changed or someone deployed at 09:00.
You do not need an exotic distance metric. Compare today’s bucket shares with a baseline you trust and alert when the difference persists. Population stability index is common because it is cheap to compute from buckets and yields a number a non-specialist can discuss.
def psi(expected, actual):
result = 0.0
for e, a in zip(expected, actual):
e = max(e, 1e-9)
a = max(a, 1e-9)
result += (a - e) * math.log(a / e)
return result
Pass fractions that each sum to one, taken from the same buckets. The tradeoff is real: PSI flags change, not harm. A campaign can shift your input mix in a good way. Treat the alert as a prompt to check the business signal.
Set thresholds from your own history. Replay months of traffic to see how often one would have fired. Pick a number that is quiet on normal days and catches shifts your team acted on. A threshold copied from a blog post is a guess with a citation.
Prometheus alerting rules give you two useful knobs. for delays firing until a condition holds. keep_firing_for keeps an alert active briefly after it clears, which the docs describe as a guard against flapping and false resolutions. Use them, but they are not a strategy.
Better is the SRE workbook’s pattern: pair a long window with a short one, so the alert fires only while budget is still being consumed. Its starting point for a 99.9% target pages at 2% consumed in an hour with a five-minute confirmation, at 5% in six hours with a 30-minute window, and tickets at 10% in three days.
- alert: RevenueDecisionBurnHigh
expr: |
(
job:bad_decision_ratio:rate1h{model="pricing"} > (14.4 * 0.001)
and
job:bad_decision_ratio:rate5m{model="pricing"} > (14.4 * 0.001)
)
or
(
job:bad_decision_ratio:rate6h{model="pricing"} > (6 * 0.001)
and
job:bad_decision_ratio:rate30m{model="pricing"} > (6 * 0.001)
)
labels:
severity: page
The 0.001 is a 99.9% example, not your default. If you cannot define a budget, start with a ticket and a dashboard.
Send page-level signals to someone who can roll back or switch a model. Send slow-burn signals to a ticket queue. Include the model version and affected segment in the notification so the responder knows which lever to pull.
Keep customer data out of alerts. A count and a version are enough. Link to a runbook instead of pasting feature values into chat, where retention is looser.
You set out to cut cost, so price the monitoring too. Every label multiplies time series. Every raw feature log consumes storage and indexing. Long retention on high-resolution histograms costs money at the remote-write endpoint.
Sampling is the obvious lever. Keep full-resolution metrics for the business signal and score distribution, then sample diagnostic detail. The trap is low traffic. The SRE workbook warns that low-request services produce misleading burn rates, since one failed request looks like a spike. Aggregate thin segments for detection and keep detail for investigation.
The other cost is human. A noisy alert costs minutes of attention each time. When in doubt, widen the window before tightening the threshold. You detect later and sleep better.
Acting too fast costs too. Automatic rollback on one signal can undo a healthy model when the real fault is an upstream schema change. Require two conditions before a robot reverts: distribution moved and business proxy degraded.
Logging feature values creates a second copy of customer data. Redact or hash identifiers before they reach the pipeline, and keep raw values in a store with tighter access and shorter retention.
Webhook tokens and drift database passwords belong in a secret store. Kubernetes’ good practices for Secrets explain why credentials in images or plain manifests are a bad idea and why encryption at rest and narrow RBAC matter. Apply the same thinking to whoever can silence alerts: that person can erase the control you built.
For releases, Kubernetes supports canary deployments and rolling updates that change a subset of pods at a time. Route a small share of traffic to a new model, watch the business proxy on that share, and hold the rollout if the budget burns. You get a longer release in exchange for a bad model touching a small slice of customers.
Is data drift the same as concept drift? No. Data drift means inputs or scores moved. Concept drift means the relationship between inputs and the right answer moved. You see the first immediately; the second needs labels.
Do I need a dedicated platform? Not to start. Histograms, a recording rule, and a job computing a distance from buckets cover one model. A platform earns its place when you have many models and shared baselines.
How often should I rebuild the baseline? On a schedule you can defend, and after a product change. Refresh too eagerly and a sustained shift becomes normal while your alert goes quiet. Keep the old baseline during the transition.
What if labels arrive months later? Then accuracy cannot drive operations. Alert on the proxy and keep labels for model review and for checking whether the proxy was any good.
Should drift trigger automatic rollback? Only with a second condition, such as a degraded business signal, and a tested path back. A rollback that fails halfway is worse than a slow alert.
How small can traffic be? Smaller than you think, but noise rises sharply. Aggregate thin segments for detection and keep per-segment views for diagnosis. If one request burns a large share of budget, treat that segment as a special case.
Pick one model and one business proxy. Add a version label and a score histogram this week. Set a budget from your history, wire a slow ticket alert first, and promote it to a page once you trust it. Then connect it to a canary rollout so there is something useful to do when it fires.
If you want a second pair of eyes on the plumbing between drift signals and your deployment pipeline, we would be glad to talk. Reach us at https://kubeify.com/contact.
Kubeify's team decrease the time it takes to adopt open source technology while enabling consistent application environments across deployments... letting our developers focus on application code while improving speed and quality of our releases.
– Yaron Oren, Founder Maverick.ai (acquired by OutboundWorks)
Let us know what you are working on?
We would help you to build a
fault tolerant, secure and scalable system over kubernetes.