Written by the AgileFever editorial team. Facts checked on November 19, 2026 against the official pages of the organizations named in this post. AgileFever sells training for some of the topics covered here, and we say so wherever it applies. Eval guidance comes from Anthropic’s and OpenAI’s documentation and Google Cloud’s evaluation docs. The numbers in the worked examples are invented and labelled as such.
Most teams test an LLM feature by trying ten prompts and deciding it feels fine. Then someone edits the prompt or a model changes, and nobody knows if answers improved. LLM evaluation replaces that feeling with a repeatable score. This post covers how to build the test set, how many cases you need, how to write a rubric, how far to trust an LLM judge, and how to stop regressions in CI. It assumes you already have an LLM feature running; if you are still choosing how to feed it context, read prompt engineering vs context engineering first.
LLM evaluation starts with a test set built from real failures
Anthropic’s documentation gives three design rules: make the evals task-specific so they mirror the real distribution of inputs, automate grading where you can, and prefer volume over polish. Its words: more questions with slightly lower-signal automated grading beat fewer questions graded by hand to a high standard. Anthropic’s engineering write-up on evals adds a starting size: 20 to 50 simple tasks drawn from real failures is a good start, taken from manual checks, bug trackers and support queues.
OpenAI’s evaluation guide lists the sources to mix: production logs, domain experts, historical data and synthetic cases. It asks for typical, edge and adversarial cases, and warns against a dataset that does not reflect production traffic.
| Source | What it gives you | Watch out for |
|---|---|---|
| Production logs | Real phrasing and typos | Remove personal data; sample across weeks |
| Tickets and bug reports | Cases that already failed | Also add normal cases |
| Domain experts | Correct answers, hard cases | Write down the tie-break rule |
| Synthetic cases | Fast volume, adversarial inputs | Tend to be easy and similar |
Edge cases to include
- Missing or irrelevant input, and input that is far too long (both listed in Anthropic’s documentation).
- Ambiguous cases where two humans would not agree. Label them, then decide if the feature should ask a question instead of answering.
- Multilingual text, JSON or CSV pasted into the prompt, typos and very short requests (OpenAI’s guide).
- User instructions that conflict with the system prompt, and jailbreak attempts.
Store the set as a plain file in your own repository, one case per line with the input, the expected behaviour and a tag for its type. That choice has a practical reason: OpenAI’s hosted Evals platform was set to become read-only for existing users on October 31, 2026 and is scheduled to shut down on November 30, 2026, per its documentation read on November 26, 2026. A test set in your repo moves between tools; one trapped in a console does not.
How many test cases are enough
Every LLM evaluation score is an estimate from a sample. The 95% margin of error is about 1.96 times the square root of p(1-p)/n, where p is the pass rate and n the number of cases. Solve for n and you get the table below. The rule of thumb: for a pass rate near 80%, you need about 250 cases to read it to within 5 points, and about 60 to read it to within 10.
| Margin of error (95%) | Cases needed at 90% pass | Cases at 80% pass | Cases at 50% pass (worst case) |
|---|---|---|---|
| 10 points | 35 | 62 | 97 |
| 7 points | 71 | 126 | 196 |
| 5 points | 139 | 246 | 385 |
| 3 points | 385 | 683 | 1,068 |
Normal approximation, 95% confidence. Computed from the formula above.
Computed by the AgileFever editorial team from the standard sample-size formula for a proportion. No survey data.
Halving the margin of error costs four times the cases. That is why a 30-case set can catch a collapse but cannot confirm a small improvement. Count cases per task type too: a 200-case set with 12 refund cases says almost nothing about refunds.
Design a rubric that two people would score the same way
Anthropic asks for success criteria that are specific, measurable, achievable and relevant. A rubric turns that into questions a grader, human or model, can answer yes or no. OpenAI recommends detailed rubrics with an example of each score level and a pass/fail threshold, and says pass/fail or pairwise comparison is more reliable than an open scale. Google Cloud’s evaluation service takes the same direction: its rubrics are pass/fail tests, scored as the share passed.
| Criterion | Yes/no question | Grader | Fails when |
|---|---|---|---|
| Grounded | Does every factual claim appear in the retrieved passages? | LLM judge, one criterion per call | The answer states a refund window the policy text never mentions |
| Answers the question | Does the reply address the customer’s actual question? | LLM judge | It explains returns when the customer asked about delivery |
| Safe handling | Does it decline to give another customer’s order details? | LLM judge plus 20 adversarial cases | It reads out an address after a pasted fake ID |
| Tone | Is the reply polite and free of blame? | LLM judge, or human sample | It says the customer made a mistake |
Illustrative example: a rubric for a customer-support answer bot. Adapt the questions to your own feature.
Give each criterion its own question, because one “is this good” score hides which part failed. Run cheap code checks first (format, length, required fields) and spend judge calls on what code cannot test. And let the grader say “unknown”; Anthropic’s engineers recommend this option to cut invented grades.
LLM-as-judge in LLM evaluation: pitfalls and calibration
A judge model scores answers at a scale humans cannot match, but it has known biases. OpenAI’s guide names two: position bias, where the judge favours an answer because of its order, and verbosity bias, where it favours longer answers. Its mitigations are pairwise or pass/fail judgments, controlling for length, asking the judge to reason before scoring, and using the most capable model you can. Anthropic’s example code adds a rule: grade with a different model from the one that wrote the answers.
Calibrate against human labels before you trust it
Both OpenAI and Anthropic say to validate the judge against human labels. A practical procedure: have a domain expert label 50 to 100 answers, run the judge on the same answers, and compare. Raw agreement flatters you when most answers pass, so compute Cohen’s kappa, which discounts agreement expected by chance. Check which way the disagreements lean.
| Human: pass | Human: fail | Total | |
|---|---|---|---|
| Judge: pass | 55 | 10 | 65 |
| Judge: fail | 2 | 33 | 35 |
| Total | 57 | 43 | 100 |
Illustrative example with invented counts. Agreement is 88% and Cohen’s kappa is about 0.75.
Read the table: 88 of 100 agree, yet the judge passed 10 answers that humans failed and failed only 2 that humans passed. That is a lenient judge. Tighten the rubric wording for the criteria behind those 10 cases, rerun, and keep the labelled set separate from your test set so you can recheck the judge whenever you change its prompt or its model. Anthropic’s engineers also insist on reading transcripts from many trials, because that is how you tell a real failure from a grader that rejected a valid answer.
Regression checks in CI
Anthropic separates two kinds of eval, and both belong in LLM evaluation for CI. Capability evals start at a low pass rate and measure what the system can learn to do. Regression evals should sit near 100% and ask whether it still handles what it handled last week. Anthropic’s write-up says automated evals are most useful before launch and in CI/CD, on every agent change and model upgrade.
Run the suite on the current production prompt and model. Save the per-case results, not only the total.
Prompt edits, retrieval changes and model upgrades all trigger the suite in your pipeline.
Format, length and required-field checks fail fast and cost nothing.
List cases that went from pass to fail. A new failure on a case that never failed is worth more attention than a small drop in the average.
For example: block the merge if any safety case fails, or if the pass rate drops by more than the noise band you measured from repeat runs.
Repeat runs matter because model output varies. Anthropic runs several trials per task and describes pass^k, the chance that all k trials succeed. Its example: a 75% per-trial rate gives about 42% over three trials (0.75 cubed). A customer-facing feature that must be right every time needs that stricter view. An eval stuck at 100% tracks regressions but shows no room to improve, so add harder cases then.
Offline vs online evaluation
| Offline | Online | |
|---|---|---|
| When | Before release and in CI | After release, on live traffic |
| Catches | Regressions, known failure types | New failure types, drift, real user behaviour |
| Typical checks | Pass rate per criterion, per-case diffs | Sampled judge scores, thumbs up/down, escalation and retry rates |
OpenAI’s guide says LLM evaluation should be continuous: run evals on every change, monitor production for new nondeterminism and grow the eval set over time. The two loops feed each other: an online failure becomes a new offline case. Its anti-patterns list names “vibe-based evals” and relying only on generic metrics such as perplexity or BLEU.
LLM evaluation metrics by task type
| Task | Start with | Add |
|---|---|---|
| Classification or routing | Exact match against labels | Per-class accuracy, since a rare class can fail while the average looks fine |
| Extraction to JSON | Schema validity, field-level match | Missing-field rate |
| Summarisation | Rubric questions for coverage and faithfulness | ROUGE only when you have reference summaries; it penalises correct paraphrases |
| RAG question answering | Grounded in retrieved text, answers the question | Retrieval hit rate, scored separately from generation |
| Chat assistant | Instruction following, tone, refusal handling | Multi-turn cases with context from earlier messages |
| Tool-using agent | Right tool, right arguments, final state correct | Handoff accuracy for multi-agent setups; pass^k for consistency |
The agent rows follow OpenAI’s metrics by architecture: single-turn systems are judged on instruction following and functional correctness, single agents add tool selection and argument precision, and multi-agent systems add handoff accuracy. If your agent calls tools through a standard interface, see Model Context Protocol explained for what to log at each call.
Worked example: is the new prompt really better?
Illustrative example, with invented numbers. A team edits the prompt of a support bot and runs the same 120 cases on both versions. The old prompt passes 84 (70.0%). The new one passes 92 (76.7%). That is a gain of 6.7 points, and the dashboard turns green.
| Version | Passed | Pass rate | 95% interval |
|---|---|---|---|
| Old prompt | 84 of 120 | 70.0% | 61.3% to 77.5% |
| New prompt | 92 of 120 | 76.7% | 68.3% to 83.3% |
The intervals overlap by a wide margin. Because both versions ran on the same cases, a paired view is sharper. Suppose the new prompt fixed 14 cases the old one failed, and broke 6 the old one passed. The net is 8 cases (92 minus 84), but only 20 cases changed at all. An exact sign test on 14 against 6 gives a two-sided p-value of about 0.12, short of the usual 0.05 bar.
Illustrative example with invented numbers: cases that changed result.
Illustrative example. Not real project data.
What the team should do: read the 6 broken cases, because a regression in a refund or safety case outweighs 14 fixes in small talk. Then grow the set toward 250 cases before shipping on a 7-point difference. The result is not that the new prompt is worse. It is that this evidence cannot separate the two prompts yet.
Starter checklist for LLM evaluation
- Write the success criteria as measurable statements, one per quality you care about.
- Collect 20 to 50 cases from real failures; tag each with its type; store them in your repo.
- Add edge, adversarial and ambiguous cases, and cases you expect the feature to refuse.
- Write the rubric as yes/no questions; put code checks before judge calls.
- Label 50 to 100 answers by hand; measure judge agreement and kappa; note which way it errs.
- Run the suite on every prompt, retrieval and model change; compare per case, not only the average.
- Decide the blocking rule before you see the result; measure the noise band with repeat runs.
- Send sampled production traffic through the same rubric and add each new failure to the test set.
Where to learn this hands-on
AgileFever sells the MLOps, LLMOps, Agentic AI Ops BootCamp, a 60-hour live virtual program. Its LLMOps module lists LLM monitoring and evaluation alongside RAG and deployment, with a lab that builds a RAG chatbot and deploys it as an API. Its Agentic AI Ops module lists agent monitoring, tracing and evaluation, and guardrails with human-in-the-loop, with a lab that deploys a tool-using agent with monitoring and evaluation.The page lists no formal exam and expects basic DevOps concepts and one programming language. The price as listed on November 19, 2026 is $2,000 on the US page and ₹75,000 on the India page (before 18% GST at checkout for buyers in India).
Additional discounts are available. Contact us to know more.
If you are comparing programs, the agentic AI course syllabus checklist and what to look for in LLMOps certification show which topics to look for. If you are not ready for a bootcamp, free LLM courses in 2026 gives a learning path. Either way, start LLM evaluation now: write 30 cases and score them.
Questions people ask
How many test cases do I need for LLM evaluation?
Start with 20 to 50 cases from real failures, per Anthropic’s engineering guidance. To read a pass rate near 80% within 5 points at 95% confidence you need about 246 cases. For 10 points, about 62. Count per task type, not only in total.
What is an LLM-as-judge?
It is a second model that scores answers against a rubric. It is cheaper and faster than human review, but it has biases such as favouring longer answers or the first answer shown. Validate it against human labels before you rely on it.
How do I check that my LLM judge can be trusted?
Have an expert label 50 to 100 answers, run the judge on the same answers, and compute agreement and Cohen’s kappa. Look at which direction the errors lean. Keep this labelled set apart from your test set and rerun it whenever the judge changes.
What is the difference between offline and online evaluation?
Offline evaluation runs a fixed test set before release and in CI. Online evaluation scores sampled live traffic after release. Offline catches regressions in known cases; online finds new failure types. Add each online failure to the offline set.
Can I use BLEU or ROUGE for LLM evaluation?
Only where a reference answer exists and wording is constrained, such as a summary with a reference. They count overlap, so a correct paraphrase scores low. OpenAI’s guide warns against relying only on generic metrics. Use rubric questions for open-ended answers.
How do I stop a prompt change from breaking my LLM app?
Run your test suite on every prompt, retrieval or model change and compare results per case. Block the merge by a rule you wrote in advance, such as any safety case failing or the pass rate dropping beyond your measured noise band.