LearnThatStack Ace your next interview

AI Evals & Observability

LLM evals, tracing and tools as of September 2026 Checked Sep 2026

The model

  • An eval scores your system on a fixed set of cases, so you can tell whether a change helped.
  • Grade with code checks first, then reference answers, then an LLM judge, then people. Check the cheaper graders against human labels.
  • Offline evals gate a change before it ships. Online evals score live traffic, usually with no ground truth.
  • A wrong answer still returns 200, so log a trace per request, with a span for each LLM call, retrieval and tool call.
  • Every score is an estimate. Pin the model snapshot, compare case by case, and ignore gaps inside the noise.
Eval setversioned casesOffline evalsCI gateProductionlive trafficTracesspans, scoresSHIPrun cases per changeship if no regressionWATCHlog every requestalert, roll backLEARNlabeled failures
Offline evals gate each change before it ships. Online evals score the traces and raise alerts. Labeled failures go back into the eval set.

Evals & graders

what an eval is, and how to grade the output

Offline and online evals

Test a change before releaseOffline eval. Fixed dataset, known answers. It can block a deploy.
Measure the live systemOnline eval. Real traffic, usually no ground truth. It alerts.

TrapA fixed dataset never covers everything real users ask, so watch production too.

Pick a grader

Code checksCheck format and banned strings
Reference scoresScore against a known answer
LLM judgeGrade open-ended text like tone
Human reviewSet the ground truth
yesnoweak for open-ended text

TipCode checks cost nothing and never vary, so run hundreds per change. They can't tell if an answer helps.

TrapBLEU and ROUGE score word overlap. A correct answer in different words scores low.

When people must review

Decide what good meansLabel the first golden cases and write the rubric.
Trust a judge at scaleLabel a sample and check the judge agrees.
Find failures you haven't seen yetRead raw outputs to see what actually breaks.

TipSafety, legal and medical calls, and anything that moves money, always get a person.

TrapHuman review is a recurring cost. Automated scores are only as good as the labels behind them.

Public benchmarks

Say why a high MMLU score doesn't transferIt tests the model on exam questions, not your product or users.
Explain contamination and saturationTest items leak into training, and top models bunch at the ceiling.
Say how LMArena, now Arena, ranks modelsBlind votes between two replies, fit with a Bradley-Terry model.

TipShortlist two or three models with benchmarks. Decide with your own eval set.

TrapFormatting and length win Arena votes. Providers can test variants privately and publish the best.

Eval datasets

build, cover and version the cases you score

Build a golden dataset

{"id": "ret-014",stable id "input": "Return shoes after 40 days?", "expected": "No, it's 30 days.", "must_include": ["30"]}a code check
Define a golden datasetA small set of cases with known-good answers, approved by people.
Build one from productionSample traces by intent, segment and length. Add known failures.
Label the rowsTwo labelers per row. Their disagreement caps any judge you build.

TipDrop near-duplicates, and redact PII in the trace store before any export.

TrapRe-label as a new version when rules change. A stale label fails correct answers.

Cover and version the set

Define coverageEvery important slice has enough cases to trust its score.
Plan coverageMake a grid of the axes that matter. Set a floor, say 20 per cell.
Version an eval datasetNever edit in place. Hash each release, and give cases stable IDs.
Handle a version bumpRe-run the current best version for a new baseline.

TipKeep a production-like mix and an oversampled hard mix, and report them apart.

TrapA label fix makes older scores non-comparable. Log fixes apart from added cases.

Start with no traffic

Write the first casesWrite 20 to 50 by hand with a domain expert, from tickets and docs.
Name the risks of synthetic dataToo clean, too similar, and one model writing, answering and judging.

TipThen have a model expand the seeds into paraphrases and messy inputs. A person approves every label.

TrapSynthetic cases are a start, never ground truth. Swap in real traffic when it arrives.

Don't overfit the eval set

Split the eval setA dev set to tune on, and a locked holdout you open at release.
Keep the set honestAdd fresh production samples each cycle.
Spot overfittingThe dev score rises while the holdout stays flat.

TipIf the metric moves but online signals don't, the win isn't real. That's Goodhart's law.

TrapKeep few-shot examples and tuning cases out of the eval set entirely.

LLM as judge

grade free text with a model, then check the grader

How LLM-as-judge works

Is every claim in the context?one criterionContext: {chunks} Answer: {answer}List unsupported claims first.reason first{"verdict": "pass" | "fail"}label last
Define LLM-as-judgeOne model grades another's output against written criteria.
Say why it's so widely usedMost output is free text. A judge is cheap and fast enough for CI.
Write a judge promptPass or fail labels, one criterion per call, and no model names.

TipMost judge disagreement comes from a fuzzy criterion, not a weak model.

TrapThe score is an estimate. Check it against human labels before you trust it.

Pairwise or pointwise

Decide whether prompt B beats prompt APairwise. Choosing between two is easier, and steady bias cancels out.
Gate CI, catch a weekly drop, or score live trafficPointwise. Each output gets an absolute score on its own.

TipUse pairwise to pick the change, and pointwise to track it.

TrapPairwise gives a win rate, not a level, and ranking many candidates takes many pairs.

Judge biases

Fix position biasJudge each pair twice, order swapped. Count only agreed wins.
Test for verbosity biasPad a good answer with filler, and see if its score rises.
Avoid self-preference biasUse a judge from another vendor, and strip author tells.

TrapRandom order only hides position bias. Track how often a swap flips the winner.

Test the judge

Measure whether a judge is any goodCompare it with human labels on a held-out set.
Pick the agreement metricCohen's kappa, which removes chance, plus recall on failures.
Keep a judge calibrated over timePin its version. Re-check it against fresh human labels on a schedule.

TipAim for human-to-human agreement, not 100%. Frozen anchor items show when the judge drifts.

TrapRaw accuracy misleads. A judge that always says pass scores 95% if 5% fail.

Traces & monitoring

see what the model saw, and what it cost

Traces and spans

trace chat_request 2.4s span retrieve_docs 310ms span llm_call 1.9s span guardrail_check 60ms
Define a trace and a spanA trace is one request. A span is one timed step in it.
Say what an LLM span recordsModel and prompt version, prompt, response, tokens, cost, timing.
Say why status codes aren't enoughA confident wrong answer still returns 200 at normal latency.
Join eval scores to what they judgedOne trace per task. Eval results carry the trace and span id.

TipSpans nest into a tree with one root. Scores and feedback attach by trace or span id.

TrapExport spans through a queue. A blocking exporter turns observability into an outage.

What to monitor

Monitor the basic signalsTraffic, p95 latency, time to first token, and errors by cause.
Track the signals only LLM calls haveTokens per call, retries and fallbacks, and truncated answers.
Report cost so it drives decisionsCost per successful task, joined to latency and pass rate.

TipPage on tail latency and error rate. Read token spend as a weekly trend.

TrapA cheaper model that fails more isn't cheaper. Divide spend by tasks completed.

OpenTelemetry and platforms

Instrument LLM calls without lock-inOpenTelemetry's GenAI conventions. Any backend reads the spans.
Keep traces on your own serversSelf-host Langfuse or Arize Phoenix.
Pick a platform for LangGraph, or for fast experimentsLangSmith for LangGraph apps. Braintrust for eval-first CI diffs.

TipPrompt and response capture is off by default. Turn it on, and still redact.

TrapThe conventions are still experimental. gen_ai.system became gen_ai.provider.name, so pin versions.

Sensitive data in traces

Decide what to log freelyMetadata. Versions, tokens, latency, cost, tools and scores.
Handle prompt and response textMask it in your process at the SDK hook, before export.
Set retentionMetrics for years, redacted traces for months, raw text for days.

TrapDetectors miss PII in free text, so short retention is the real backstop.

Test before you ship

catch regressions before users do

Regression tests in CI

Regression test a prompt changeRerun saved cases. Nothing that passed may now fail.
Compare the two runsCase by case. A flat average can hide a broken case.
Store promptsAs files in the repo, so a pull request that edits one runs the evals.
Gate the mergeOn the change against the base branch, with a noise band.

TipCheap checks on every push, the judge suite nightly. Cache outputs by prompt hash.

TrapA prompt is one global instruction. Fixing one complaint can change unrelated outputs.

Trust scores from noisy outputs

Cut the variance you controlPin the snapshot, set temperature 0, pass a seed, freeze the data.
Handle the variance that's leftRun each case k times. Report a mean and a confidence interval.
Compare two variantsPaired, on the same cases. Ship only if the gap beats the noise.

TipCases whose repeats disagree are your flaky set. Fix the prompt or rubric there.

TrapTemperature 0 isn't deterministic. Batching still changes outputs, and OpenAI's seed is best-effort.

Eval-driven development

Define eval-driven developmentWrite the eval first, then build until the score clears a bar.
Name the gates on the way to launchAgreed cases, a trusted judge, no regression, then online metrics.
Decide how much to spend on evalsBy what a bad output costs. Fund whichever layer is the bottleneck.

TrapA gate nobody can fail only reports. Every gate must be able to block a release.

Roll out & A/B test

try a change on real traffic without hurting users

Shadow, then canary

Test on real traffic before any user sees itShadow deployment. It gets real requests, but nobody sees its output.
Test with a small slice of real usersCanary release. Watch error rate, latency and refusals.
Keep a chat on one versionRoute canary traffic by session, not by request.

TipShadow has no user signal. Score it with a judge, or diff it against current output.

TrapIn shadow, stub tool calls, writes and emails, or side effects fire twice.

A/B test an AI feature

Randomize the testBy user or session, so answers stay consistent.
Keep the control arm fixedPin a dated model snapshot. Aliases can change.
Pick the winnerOn the product outcome, like task completion, not eval scores.

TipAdd cost per task and refusal rate to the guardrail metrics. Noisy output needs more traffic.

TrapVariant outputs leak into logs, retrieval stores and training data, and taint the control.

A/B test pitfalls

Analyze a test you randomized by userCluster the variance by user, or chatty users shrink the error bars.
Compare cost, tokens or latencyUse quantiles, a bootstrap or trimming. Means jump on long tails.
Watch results while the test runsFix the sample size first, or use a sequential test.

TipGive each arm its own cache namespace, or one arm warms the other.

TrapThe best of ten variants overstates its lift. Re-measure it on fresh traffic.

Online evals & feedback

judge live traffic, and learn from users

Judge and sample live traffic

Run an LLM judge on production trafficAsync, off the trace stream. All suspicious traces plus 5% random.
Split a small human review budgetA fifth at random, for the true error rate. The rest on likely failures.
Quote a quality rate from targeted samplesStore each trace's sampling probability p, and weight by 1/p.

TipRotate the targeting rules often, or they keep finding the same bug.

TrapPin the judge's model snapshot, or a score drop may just be the judge drifting.

Thumbs and implicit signals

Store a thumbs clickOn the response's trace id, with a reason tag.
Say why thumbs are a weak signalFew click, angry users click most, and few spot a confident error.
Name implicit signalsCopies, edits after accepting, retries, rephrasing, abandonment.

TipTreat thumbs as a queue for error analysis, not a score. Watch the trend.

TrapCheck each signal against human labels. Optimizing acceptance rate breeds short, agreeable answers.

Error analysis

Start error analysisRead real traces and note the first failure in each. That's open coding.
Turn notes into failure modesCluster the notes into named modes and count them. That's axial coding.
Decide what to fix and when to stopFix in count order. Stop when traces show no new modes.
Explain the data flywheelFailures from traces become labeled cases in a gating eval set.

TipWrite evals only for modes that repeat. Logging plus a dashboard is not a flywheel.

TrapUsers who churn send no traffic, so their failures never reach the eval set.

Drift & debugging

find out why quality fell

Kinds of drift

Detect input driftCluster input embeddings. Watch the population stability index.
Detect a silent model changeRun a canary set every few hours. Watch length, refusals, parse errors.
Detect retrieval driftWatch index age, empty hits and top-k similarity scores.
Detect concept driftRelabel a fresh sample and compare with the golden labels.
Respond to a model changeKeep the old snapshot routable. Re-run the golden set first.

TrapMost drift is silent. Latency and errors stay green while quality falls.

Debug a bad answer or a quality drop

Find the bad answerLook up its trace by the id the feedback button stored.
Read the traceFind the first failure. Check retrieval, the final prompt, then tools.
Replay the logged inputsSame snapshot, several runs. Always fails means inputs, not variance.
Debug a drop your offline evals missedFreeze the rollout. Check logging, sampling and the judge first.
Find where the data differsLook for production clusters thin or missing in the eval set.

TipAdd the failing case to the eval set, and score it over several runs.

TrapA live rerun samples a new output, and the index or model alias may have moved.

Guardrails & red-teaming

block bad output, and attack your own app

Guardrails and their metrics

Tell a guardrail from an evalAn eval scores a sample. A guardrail acts on every request.
Track a guardrailPer rule, the trigger rate, false positives and negatives, latency.
Keep regressions visible behind a guardrailScore raw output too, or a drop looks like a rising block rate.

TipRe-run a fixed red-team set after every rule change.

TrapTrigger rate alone is a vanity number. Label passed traffic too, or you never see false negatives.

Red-team the app

Red-team an LLM appHuman testers plus an attacker model that mutates known attacks.
Say how safety evals differ from quality evalsAttacker-chosen inputs, a growing set, and one success fails.
Report the resultAttack success rate, counting any success in k runs.

TipRank findings by blast radius, the tools, credentials and data an injection reaches.

TrapPayloads often arrive indirectly, in a retrieved document, web page or tool result.

RAG, agents & chat

evaluate systems with more than one step

Faithfulness and relevance

Define faithfulness and relevanceIs the answer backed by the context? Does it answer the question?
Measure faithfulnessSupported claims divided by all claims, checked against the context.
Measure answer relevanceGenerate questions from the answer, and compare them to the real one.

TipThey're independent. A grounded answer can still miss the question.

TrapFaithful isn't correct. If retrieval brings the wrong passage, a faithful answer is still wrong.

Evaluate retrieval alone

Check the right chunk came backrecall@k, on queries labeled with the chunks they need.
Check it ranked near the topMRR or NDCG. Position changes what the model uses.
Decide which half to fixChunk missing, fix retrieval. Chunk there, fix prompt or model.

TipRetrieval checks call no model, so run them on every index change.

TrapRetrieval is a hard ceiling. If the chunk misses the top k, no prompt can fix it.

Evaluate an agent

Score an agentTask success rate. Was the goal met at the end?
Measure reliabilitypass^k, all k runs succeed. pass@k needs just one.
Log cheap signals of user painCost per task, tool errors, human takeovers, step-cap hits.
Score the path the agent tookRequired steps in order, extras allowed. Or a judge reads the spans.

TipGrade the outcome first. Add path checks for loops or unsafe writes.

TrapErrors compound. 98% per step over 20 steps is 67% end to end.

Found this useful? Pass it on.
Pro · $10/mo

This sheet stays free. With Pro, you can:

  • Every answer on this sheet. Read the full answer to all 57 questions it links, not just the 7 free ones.
  • My sheet. The cards you star and the ones you miss in Quiz me, from every sheet, on one page to quiz and print.
  • PDFs. Download this sheet and My sheet, laid out for A4, with every question a link to its answer.
  • The rest of Pro. Every answer in the question library, and 1,000 AI credits a month.