Monitoring models in production
Watch five layers (service health, input data quality, drift, model quality via proxies until labels arrive, business KPIs) and page only on the few that predict user harm.
Analogy: A car dashboard: the engine light (errors) is not enough; you also need the fuel gauge (data), the speedometer (drift) and, eventually, whether you arrived (business result).
How it works
- A model can return HTTP 200 with garbage, so ordinary APM dashboards stay green while quality drops.
- Data quality (schema changes, null rates, out-of-range values) is the most common real cause of incidents.
- Labels arrive late (fraud chargebacks take weeks), so meanwhile watch score distribution, user corrections and review samples.
- For LLMs, track tokens, cost, refusal rate, guardrail triggers, and judge scores on ~1–5% of traffic.
- Trace every LLM call so a bad score links to the exact prompt, context and model version.
Check yourself
Answer to mark it learned; your answers aren't scored.
A fraud model's dashboards are green (p99 40 ms, zero errors) while fraud losses climb. The root cause: an upstream change sends merchant_country as null on 18% of requests. Which alert would have caught it within hours?
Go deeper
Full explanation
A model can return HTTP 200 with garbage. ML monitoring watches the layers ordinary APM can't see:
- Operational: latency p50/p99, errors, throughput, cost.
- Data quality: schema changes, null rates, out-of-range values; the most common real cause of incidents.
- Data drift & concept drift: input and prediction distributions vs. a training baseline (PSI, KS test, KL divergence).
- Model performance: accuracy and calibration per slice. Labels arrive late (fraud chargebacks take weeks), so meanwhile you watch proxies: score distribution, user corrections, manual review samples.
- Business KPIs: conversion, approvals, handle time; what the model exists for.
Alert on a few signals tied to harm; dashboard the rest.
LLM specifics: tokens and cost per request, refusal rate, guardrail triggers, empty or truncated outputs, thumbs and edits, and LLM-as-a-judge scores on a sampled slice of traffic. Trace every call (LLM observability & tracing) so a bad score links to the exact prompt, context and model version.
Code Population Stability Index as a label-free alarm
import numpy as np
def psi(baseline: np.ndarray, live: np.ndarray, bins: int = 10) -> float:
"""Population Stability Index of one feature or of the model score."""
# Bin edges from the training baseline (deciles) so both sides are comparable
edges = np.quantile(baseline, np.linspace(0, 1, bins + 1))
edges[0], edges[-1] = -np.inf, np.inf
b = np.histogram(baseline, edges)[0] / len(baseline)
l = np.histogram(live, edges)[0] / len(live)
b, l = np.clip(b, 1e-6, None), np.clip(l, 1e-6, None) # avoid log(0)
return float(np.sum((l - b) * np.log(l / b)))
# Daily job: score drift is a proxy while labels are weeks away
value = psi(train_scores, last_24h_scores)
if value > 0.25:
page_oncall("fraud-model score PSI", value) # significant shift
elif value > 0.10:
open_ticket("fraud-model score PSI", value) # moderate: investigateReal example
A fraud model's service dashboards stay green (p99 40 ms, zero errors) while fraud losses climb. Chargebacks take weeks, so measured accuracy can't show it yet. What fires first is data quality: an upstream change sends merchant_country as null for 18% of requests, and the score PSI jumps to 0.3. A null-rate alert on top features catches it in hours. For an LLM assistant, the equivalent early signal was refusal rate jumping from 2% to 9% the day the provider updated the model.
Trade-offs +3 · −3
+ You gain
- Catches silent failures that return 200 OK with wrong answers.
- Label-free proxies (data quality, score drift) warn you weeks before accuracy can.
- Ties model changes to business impact, which is what leadership asks about.
− You pay
- Drift alerts are noisy: many shifts are harmless (seasonality, a marketing campaign).
- True performance lags by the label delay, and some labels never arrive.
- Logging inputs and outputs adds storage cost and privacy risk; PII must be redacted.
Use it when
Every model that makes or influences production decisions: ops, data quality and one business KPI on day one; drift and sampled quality checks right after.
Avoid it when
It doesn't replace offline evals before release. And don't page on drift of every feature: page only on signals linked to user or business harm.
Numbers to know 3
- PSI rule of thumb: < 0.1 stable, 0.1–0.25 moderate shift, > 0.25 significant shift.
- Rule of thumb: run LLM-as-judge on ~1–5% of production traffic, more right after a release.
- Google SRE: page when a 30-day SLO burns 2% of its error budget in 1 hour (14.4× burn rate).
Common pitfalls 4
- Monitoring only infrastructure: the model can be confidently wrong at 40 ms p99.
- Alerting on drift of every feature: alert fatigue. Prioritize the top features by importance.
- Watching only aggregate accuracy while one segment (new users, a region) degrades.
- Not logging the model and prompt version with each prediction, so regressions can't be attributed.
Interview questions 2
Answer out loud first, then reveal.
Labels for your model arrive 60 days late. How do you know it works today?Show answer
I layer leading indicators. First, data quality on inputs (schema, nulls, ranges), because broken pipelines cause most incidents. Second, drift on the prediction distribution and top features against the training baseline. Third, fast partial labels: user overrides, a manual review sample, early chargebacks. Fourth, the business KPI. When the real labels land, I backfill performance per slice and check whether my proxies would have warned me, then tune thresholds from that.
What would you monitor specifically for an LLM feature?Show answer
On top of latency and errors: tokens and cost per request, since a prompt change can double the bill; refusal and empty-answer rates; guardrail trigger rates; and feedback like thumbs, regenerations and edits. For quality, I sample a few percent of traffic and score it with an LLM judge calibrated against human labels, broken down by intent. Every call is traced with prompt and model version, so when a provider updates a model I see the shift the same day.