Zenaique

Walk through an online sampled eval setup for safety in production

Flashcard·Medium·4.0 · 0·~30s·Asked atAi4bharatDeloitteGraphcore
Attempt it
TL;DR

Sample 1-5% of production traces, score them asynchronously with an LLM-as-judge against a safety policy, alert on rolling-baseline drift; stratify the sample to over-cover high-risk routes.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

Imagine a factory making millions of cookies a day. Tasting every cookie would slow the line and bankrupt you. Instead, a quality team randomly picks one cookie out of every fifty, tastes it carefully, and writes the result on a clipboard. Over a week, the clipboard shows the average taste score. If today's score drops sharply, an alarm rings and the factory checks the recipe. For especially important cookies, like the wedding cake flavoured ones, the team picks more often. The setup is cheap because most cookies fly through untouched, but you still notice when something goes wrong. Online sampled eval works the same way for AI safety: most traffic flows free, a sample is judged, and trends raise alarms.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Once an LLM product is live, the central safety question is no longer 'did we pass our pre-launch evals?' but 'are we still safe today, with this week's traffic, this week's model behaviour, and this week's adversaries?' Offline eval suites do not answer that question,they were written against a fixed test set that has long since lost contact with the live distribution. Online sampled eval is the bridge: a continuous, statistically grounded view of safety behaviour on the traffic you actually serve.

The design centres on three constraints. It cannot add user-visible latency, it cannot double the cost of every request, and it cannot rely on a human grading every output. The pattern that satisfies all three is sample and judge: copy a small fraction of traces to a side channel, score them asynchronously with an LLM-as-judge, write the score back to the trace, and aggregate over rolling windows for alerting.

Mental model: online sampled eval is a smoke detector, not a fire suppressant. It tells you something is burning. Runtime rails put the fire out.

Why sampled, why asynchronous

The cost math

If judging a trace costs roughly the same as serving it (one extra LLM call), full inline judging doubles your inference spend and shifts your p95 latency by however long the judge takes. For a high-volume product, doubling spend is non-starter. Sampling 1 to 5% adds 1 to 5% to spend and zero to user latency.

Statistical sufficiency

For monitoring purposes,am I drifting?,a sample is enough. If today's score on a 5% sample is 0.94 plus or minus 0.01 and yesterday's was 0.92 plus or minus 0.01, the drift is real and the sample size is plenty. The eval here is not 'judge every output'; it is 'estimate the population mean with usable confidence interval.'

Async means decoupled

The judge worker reads from a queue and runs at its own pace. If the judge is slow today, the queue backs up briefly and the rolling-window reporting lags by minutes,nobody on the user side notices. If the judge fails entirely, the production path is unaffected; alerting picks up on the absence of recent scores.

What the judge is not

The judge is not the rail. It does not block bad outputs. It measures them after the fact. Pairing online sampled eval with runtime input/output rails is the standard production stack: rails stop the obvious, sampled eval catches the drift and the weird tail.

Stratifying the sample by route and risk
Judge design, pinning, and human calibration
Aggregation, alerts, and signal routing
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.

Real products, models, and research that use this idea.

  • Langfuse and Arize Phoenix both ship sampled-eval workflows where a judge score is written back to the trace as a span attribute.
  • Braintrust's online-eval product is designed around the sample judge aggregate alert pattern for production safety drift.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow do you avoid the judge itself becoming a single point of failure?
A

Use two different judges (different vendors or different prompts) and require both to flag a trace as unsafe before alerting at high severity. Reserve the lower-severity 'one judge flagged' signal for investigation triage.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Judging 100% of traffic synchronously inline; doubles cost and adds tail latency to every user response. Sampling and async scoring are the points of the design.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Why sampled eval is the answer rather than judging 100% of traffic

  • How the async judge worker pool reads from a sample queue

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Pick the strongest reason…
MCQ·Medium