trendingzones
← Back to the Intermediate level

AI & ML — ADVANCED

Detecting Drift and Responding to Incidents in Production

The Intermediate level covered what to log. This level is about what that logging is actually for once a system is live: noticing when something has genuinely changed, figuring out what changed, and responding in a structured way instead of guessing.

The Quick Answer

“Drift” for an LLM system means one of two things: data drift — the real queries users send have shifted away from what the system was tested against — or model drift — the model itself starts behaving differently, often because a provider updated or replaced the model behind a fixed API name. Responding to a production incident follows the same three moves every time: detect it via monitoring, isolate whether the model/API, the prompt, or the input distribution actually changed, and apply a rollback or mitigation matched to that specific cause.

What “Drift” Actually Means for an LLM System

Both terms come from established MLOps practice, and both apply directly to LLM-powered systems, not just traditional trained-from-scratch models:

Model drift specific to third-party model APIs is a real, well-documented risk — not a hypothetical. A 2023 study by researchers at Stanford and UC Berkeley, “How Is ChatGPT’s Behavior Changing over Time?”, tested the same GPT-4 and GPT-3.5 versions on identical tasks in March and June 2023 and found substantial differences: GPT-4’s accuracy at identifying prime numbers dropped from 97.6% to 2.4%, and the share of its generated code that could run without modification dropped from 52% to 10%. OpenAI stated the changes weren’t intentional degradation, but the episode is a documented case of a model’s behavior shifting under a name applications were already depending on.

Source: Chen, Zaharia & Zou, “How Is ChatGPT’s Behavior Changing over Time?” arXiv:2307.09009

The other face of model drift is more structural: providers routinely deprecate and retire specific pinned model versions on their own schedule, sometimes auto-upgrading a deployment to a newer version and sometimes cutting it off entirely. Anthropic, for example, documents a formal lifecycle for every model ID — Active, Legacy, Deprecated, and Retired — with its own retirement date; OpenAI has published deprecation waves affecting dozens of model IDs at once. An application that hard-codes a model name without tracking this lifecycle can find its behavior changing not gradually, but at a specific cutover date set entirely by the provider.

Sources: Claude Platform Docs, “Model deprecations” · OpenAI API Docs, “Deprecations”

An Incident-Response Guideline for LLM Production Issues

A sudden spike in error rate, or a monitored quality signal dropping, needs a structured response — not an improvised one. Four steps, in order:

  1. 1. Detect via monitoring

    A spike in error rate, a jump in p95/p99 latency, or a drop in a tracked quality signal (thumbs-down rate, retry rate) shows up on the dashboard before — ideally — a wave of user complaints does. Detection has to be continuous and automatic, not dependent on someone noticing by hand.

  2. 2. Isolate: model/API, prompt, or input distribution?

    Check, in order: did anything change on the provider side (a model version deprecated, auto-upgraded, or silently updated)? Did anything change in the application (a recent prompt or code deploy)? Did the incoming queries themselves shift (a new topic, a new user segment, a spike in an unusual request type)? These three have different fixes, so conflating them wastes the response.

  3. 3. Roll back or mitigate, matched to the actual cause

    If the model/API changed: pin to the last known-good model version while the new one is evaluated (the same shadow-testing discipline covered in Comparing Ollama Models Advanced). If the prompt or code changed: revert the specific change and re-deploy. If the input distribution changed: this isn’t a “roll back” situation — it needs new handling (an updated prompt, a new tool, a fallback path) for the pattern that wasn’t there before.

  4. 4. Confirm the fix against the same monitored signal that caught it

    The metric that first showed the spike — error rate, a latency percentile, a quality signal — is also the metric that confirms the fix actually worked. A mitigation that isn’t verified against real, continuing production data is still just a guess.

The isolation step is the one worth slowing down for. A rising is_error rate on one specific tool (covered in Tool Calling Advanced) points at that tool or its downstream dependency, not the model. A drop in answer quality with error rates flat points at model drift or a prompt regression, not a tool failure. Treating every incident as if it has the same cause is what leads to rolling back the wrong thing.

A Monitoring Dashboard: What Actually Belongs on It

The metrics below are what make steps 1 and 4 of the incident-response guideline possible at all — without them, there’s nothing to detect a spike with, and nothing to confirm a fix against:

MetricWhy it belongs on the dashboard
Token cost over timeA real, per-call structural fact (see the Intermediate level) aggregated over time — the first place a runaway prompt, an unexpected traffic spike, or a newly-expensive model version shows up as a cost line moving the wrong way.
Error rate over timeThe share of calls returning is_error or failing outright, tracked as a trend rather than a single number — a sudden spike here is often the earliest signal that something upstream (a tool, an API, a model version) actually broke.
Latency: p50, p95, and p99Three separate lines, not one average — p50 shows typical experience, while p95 and p99 expose a slow tail that an average alone hides completely, which is exactly what the illustrator below demonstrates.

Why p95 and p99 Matter More Than the Average

A percentile answers a specific question: what value do a given share of requests fall under? p50(the median) is the point where half of requests are faster and half are slower — a reasonable stand-in for “typical” experience. p95 is the point 95% of requests are faster than, meaning 1 in 20 is slower. p99 is the point 99% of requests are faster than — 1 in 100 is slower than that. This is standard, widely-used observability practice, not specific to LLM systems.

The reason production teams track all three, instead of just the average, is that request latency is typically right-skewed: most requests cluster fast, and a long tail runs far slower — sometimes many times slower. An average blends the whole distribution into one number, so a small share of very slow requests barely moves it, even while those requests are a genuinely bad experience for the users who hit them. p95 and p99 are what actually expose that tail. This is the same latency-measurement discipline RAG Pipeline Architecture Intermediate applies to a single query’s stage-by-stage breakdown — here, applied across many requests over time instead of within one request.

Source: Aerospike, “What Is P99 Latency? Understanding the 99th Percentile of Performance”

Try both an illustrative healthy and unhealthy request-latency set below, and watch what happens to each percentile:

A p50 that barely moves while p95 and p99 spike sharply is itself a diagnostic clue: it usually means most requests are fine, but something specific — a slow downstream dependency, a cold cache, a subset of requests hitting a slower code path — is affecting a minority of traffic badly. That’s a different problem, with a different fix, than a system where all three percentiles rise together.

Fun Fact

The cost-per-quality-point calculation from Comparing Ollama Models Advanced and the incident-response guideline here are two ends of the same discipline: one decides whether a new model version is worth adopting before it ships, and the other catches it if a model changes underneath a fixed name without anyone deciding to adopt anything at all.

Test Yourself

What is the difference between data drift and model drift for an LLM system in production?

What did the Stanford/UC Berkeley study on ChatGPT’s behavior over time find?

In the incident-response guideline on this page, what comes right after detecting a spike via monitoring?

Why do production dashboards track p95 and p99 latency separately from the average?

In the latency percentile illustrator on this page, what happens to p50 versus p95/p99 between the "healthy" and "unhealthy" datasets?