05 / 16

Evaluation

If you can't measure it, you're shipping vibes.

0/14 studied
01Eval-driven development

Write the evals before or with the feature, like TDD: the eval suite is the spec, and every prompt, model or retrieval change ships only if the suite's numbers say it's better.

Core◇ Diagram</> Code
02Error analysis: look at your data

Read ~100 real traces, write a free-form note on each failure, group the notes into failure modes, count them, and fix the biggest bucket first. Automate evals only for modes you actually found.

Core◇ Diagram</> Code
03Golden datasets & test sets

A curated, versioned set of inputs with expected outputs or grading criteria, covering the slices that matter. It's the fixed ruler every change is measured against; without it, scores aren't comparable.

Core◇ Diagram</> Code
04Code-based graders & assertions

Grade LLM outputs with plain code wherever the answer is checkable: exact match, regex, schema validity, right tool and arguments, SQL results, unit tests. Cheap, instant and reproducible, so try them before any LLM judge.

Core◇ Diagram</> Code
05LLM-as-a-judge

Use a strong LLM with a narrow rubric to grade outputs at scale, but treat it as a classifier: calibrate it against human labels, report agreement, and counter position, verbosity and self-preference bias.

Core◇ Diagram</> Code
06Human evaluation & annotation

Domain experts are your source of truth: they label a few hundred examples under written guidelines, you verify they agree (Cohen's kappa), and those labels validate your automated judges instead of grading everything.

Core◇ Diagram</> Code
07Precision, recall, F1, ROC-AUC

Every guardrail, router or judge is a classifier: read its confusion matrix, set the threshold by what each error costs, and prefer precision, recall and PR-AUC over accuracy when positives are rare.

Core◇ Diagram</> Code
08Measuring hallucination & groundedness

Split the answer into atomic claims, check each against the provided context with an NLI model or LLM judge, and report the unsupported share per slice. Faithful-to-context is not the same as factually true.

Advanced◇ Diagram</> Code
09Evaluating agents

Run each task several times in a sandbox; grade the outcome (the end state) and the trajectory (required and forbidden tool calls, steps, cost), and report pass^k: users need reliability, not one lucky run.

Advanced◇ Diagram</> Code
10Non-determinism: pass@k & variance

Same input, different outputs: one eval run is a sample, not a measurement. Run several trials, report mean ± confidence interval, and choose pass@k (any success) or pass^k (every success) to match real use.

Core◇ Diagram</> Code
11Offline vs online evaluation

Offline evals score a version on fixed datasets before deploy; online evals measure live traffic through user behavior, feedback and sampled judging. You need both, and if they disagree, trust neither until you know why.

Core◇ Diagram</> Code
12A/B testing LLM features

Randomly split users between old and new model or prompt, compare one pre-chosen primary metric, and let guardrails (latency, cost, safety) veto. Size it with a power analysis; never stop at the first significant peek.

Advanced◇ Diagram</> Code
13Public benchmarks & contamination

Public benchmarks measure generic capability on fixed test sets, and many are saturated or contaminated by training data. Use them to shortlist two to four models, then decide on your own eval set.

Core◇ Diagram</> Code
14Evals in CI/CD & release gates

Run the eval suite automatically on every prompt, model, retrieval or tool change, and block the merge or release when scores fall below floors or regress versus the baseline beyond noise.

Core◇ Diagram</> Code