+1 (570) 533-9287

Online Evals and Drift Monitoring: Knowing When a Shipped LLM App Gets Worse

An offline eval suite answers one question: is this change safe to ship? It runs against a fixed dataset, so it cannot see what changes underneath you. Users shift what they ask. A provider updates a model alias. A source system starts emitting a new document format. None of these touch your repo, and none fail your CI.

Online evaluation covers that gap. This post describes a minimal setup we use: sample live traces, score them with cheap checks, and alert on movement rather than absolute values.

What actually drifts

Four sources account for most of the silent regressions we see:

  • Input drift. The query mix changes. A feature launched for contract questions starts receiving billing questions.
  • Model drift. A floating alias such as -latest points at a new snapshot. Pin snapshots, and still monitor, because deprecations force moves.
  • Corpus drift. New or re-parsed documents change retrieval results. Recall on your fixed eval set stays flat because the set does not contain the new documents.
  • Dependency drift. A tool API changes a field. The agent copes badly and does not raise an error.

Step 1: Decide what a trace must carry

You cannot score what you did not record. Each trace needs the user input, retrieved chunk IDs and scores, the final prompt version, the model snapshot, the output, token counts, latency, and any tool calls with their results. In LangSmith this is metadata and tags on the run. Without LangSmith, a structured log line with a trace ID works. Redact PII before storage, not after.

Step 2: Sample, don't score everything

Scoring every trace with an LLM judge can cost as much as serving it. Use two tiers:

  1. Cheap deterministic checks on 100% of traffic. Output parses against the schema. Citations point to chunk IDs that were actually retrieved. Empty retrieval. Refusal phrases. Output length outside the expected band. These cost nothing in tokens.
  2. Judge-based scores on a sample. Start at 2 to 5 percent, stratified by route or intent so rare routes are not drowned out. Raise the rate for 24 hours after any deploy.

If you use an LLM judge, calibrate it first against human labels. An uncalibrated judge on live traffic produces a trend line you cannot interpret.

Step 3: Pick signals that map to a failure

A dashboard of ten averaged scores hides problems. Choose a few signals, each tied to a failure mode you have seen:

SignalFailure it catchesType
Empty or low-score retrieval rateCorpus or query driftDeterministic, all traffic
Citation-validity rateHallucinated sourcesDeterministic, all traffic
Schema-repair rateModel or prompt regression in structured outputDeterministic, all traffic
Groundedness scoreAnswers unsupported by contextJudge, sampled
Thumbs-down or edit rateAnything users noticeUser feedback
Tokens per request, p95Context bloat, retry loopsDeterministic, all traffic

User feedback is sparse and biased toward angry users. Use it as a trigger to pull traces into review, not as a metric on its own.

Step 4: Alert on movement

Absolute thresholds fail because baselines differ per route. Compare a trailing window against a baseline window instead. A workable starting rule: alert when a rate moves more than three standard errors from its 14-day baseline for two consecutive windows. The two-window condition removes most one-off noise. With a 3 percent sample and 500 requests a day, you have about 15 judged traces daily, so use daily or multi-day windows for judge scores. Hourly windows only make sense for the deterministic checks.

Route alerts by type. A schema-repair spike goes to the on-call engineer. A slow groundedness decline goes to a weekly review. Paging on every dip teaches the team to ignore pages.

Step 5: Close the loop into the offline suite

Online evals are most useful as a source of test cases. Each week, pull the lowest-scoring sampled traces and any thumbs-down traces. Label them. Add the confirmed failures to the offline dataset with the trace ID as provenance. The offline suite then covers what production has already shown you, and the next change is tested against it. This is the same loop described in our post on bootstrapping an eval suite from production traces, run continuously.

A minimal sampling hook

import hashlib

def should_judge(trace_id: str, route: str, rates: dict[str, float]) -> bool:
    # Deterministic: the same trace always gets the same decision.
    h = int(hashlib.sha256(trace_id.encode()).hexdigest(), 16) % 10_000
    return h < rates.get(route, 0.03) * 10_000

Hashing the trace ID keeps sampling reproducible, so you can re-run the scorer later and get the same set. Run the judge asynchronously, off the request path, so scoring never adds user-facing latency.

Trade-offs

  • Online scoring adds token spend and a storage and privacy surface. If your data cannot leave a boundary, the judge has to run inside it, and that may rule out the sampled tier.
  • Low-traffic apps cannot reach statistical power on judge scores. For them, review 20 traces by hand each week. That is a legitimate monitoring strategy.
  • Deterministic checks catch structure, not truth. They find broken answers, not confidently wrong ones.

What to do this week

  1. Confirm traces carry retrieval IDs, prompt version, and model snapshot.
  2. Add three deterministic checks and chart them.
  3. Turn on a 3 percent stratified judge sample for one route.
  4. Set a baseline-relative alert on the deterministic checks only.
  5. Schedule a weekly 30-minute review that feeds failures into the offline suite.

That is a day or two of work, and it turns "we think it still works" into a number you can compare week to week.