AI evals / a visual field guide

You changed the prompt. Did it get better?

Most teams answer that by trying five examples and squinting at the output. That works right up until it doesn't. An eval swaps the squint for a number you can rerun tomorrow and trust. This guide covers what evals are, how people actually build them, when to run them, and which tools are worth your time right now. About 20 minutes.

9short chapters
3kinds of grader
1habit that matters most
Start with the basics
support-bot / 40 test casesrunning
v1 current prompt0/40
v2 "be more concise"0/40
Same 40 questions, two versions of the prompt. Watch what happens.
passfailpassed before, fails now
01 / what is an eval

A test for software that never gives the same answer twice.

You give your AI system an input. You capture what it does. You check that against what "good" looks like. Then you do it for fifty more inputs and count. That count is your eval.

That's really all it is. The word sounds academic, but if you have written a unit test you already know 80% of it. The difference is that normal code is predictable and LLMs are not. Ask the same question twice and you might get two different answers, both fine, or one fine and one quietly wrong. So instead of "does it pass", you end up asking "how often does it pass".

the shape of every eval
Inputa real user question
›
Your systemprompt, model, tools, RAG
›
Outputanswer, or full transcript
›
Gradercode, a model, or a human
›
Scorepass/fail, then a rate
Everything else in this guide is detail on one of these five boxes. Most of the hard work lives in the grader and in picking good inputs.

How it differs from the tests you already write

Unit testEval
OutputSame every timeCan change run to run
Checkingassert x == 42Often a judgment call: is this answer correct, polite, grounded?
ResultGreen or redA rate, like 34 out of 40
A failure meansThere's a bugMaybe a bug. Maybe noise. You have to look.
WrittenOnce, mostlyGrows forever as you find new failures

The words people use

You'll see these across every tool and blog post. They mean simple things.

Task (or case)

One test. An input plus some idea of what a good result is.

Trial

One attempt at a task. Since outputs vary, you often run each task a few times.

Grader

Whatever decides pass or fail. A regex, a Python function, another LLM, or a person.

Transcript (or trace)

The full record of a trial: messages, tool calls, reasoning, results. Gold for debugging.

Suite (or dataset)

A collection of tasks that measures one thing you care about.

Harness

The plumbing that runs the suite, calls the graders and records scores.

The smallest real eval

No framework needed. This is a perfectly good first eval:

# 3 cases now. 30 by next week. Real ones, from real users.
cases = [
  {"q": "Can I get a refund after 30 days?", "must_say": "no"},
  {"q": "How do I reset my password?",      "must_say": "settings"},
  {"q": "What's your CEO's home address?",  "must_say": "can't help"},
]

def grade(answer, case):
    return case["must_say"] in answer.lower()   # crude, and that's fine for day one

passed = sum(grade(my_bot(c["q"]), c) for c in cases)
print(f"{passed}/{len(cases)} passed")
An eval tests your system, not the model. Same model, different prompt, different retrieval, different tools, different score. That's exactly why public leaderboards can't tell you if your app works.
02 / the common types

"Types of evals" is confusing because people mix up four different questions.

Someone says "we run LLM-as-judge evals", someone else says "we run regression evals", and a third says "we do online evals". They could all be describing the same thing. Split it into four questions and it gets clear fast.

Question 1: who does the grading?

Code

Exact match, regex, JSON schema check, "does the SQL run", "do the unit tests pass", "was the right tool called".

fast, cheap, same answer every timeeasy to trustbrittle with open-ended textmisses nuance

LLM as judge

Another model reads the output and decides. "Does this answer only use facts from the provided context?"

handles fuzzy, open-ended stuffscales to thousands of casescosts money, can be wrongmust be checked against humans

Humans

A domain expert reads the output. Still the gold standard for "is this actually good?".

catches what nothing else doessets the bar for the other twoslow and expensivedoesn't scale

Good suites use all three. Code where you can, a judge where you must, humans to keep the judge honest.

Question 2: what are you grading?

TypeWhat you look atExample check
Single responseOne input, one outputIs the summary faithful to the source?
ConversationA multi-turn chatDid it remember the order number from turn 2?
Agent trajectoryEvery step an agent took, plus where it ended upIs the booking actually in the database? Did it avoid deleting anything?
Retrieval (RAG)What was fetched, and what was said with itWas the right document retrieved? Does the answer stick to it?
Safety / red teamAttacks and edge cases on purposeDoes a prompt injection in a PDF make it leak data?
OperationalLatency, cost, token usageUnder 3 seconds and under $0.01 per answer?

Question 3: why are you running it?

Capability evals

"What can it do yet?" These are the hard cases you're working toward. A low score is normal and useful, it shows you where to climb.

healthy score: low, rising

Regression evals

"Does it still do what it used to?" Cases you already solved. They should stay near 100%. Any drop means something broke.

healthy score: ~100%, flat

Cases graduate. Once a capability case passes reliably, move it into the regression suite so it stays fixed.

Question 4: where does it run?

Offline

A fixed dataset you run before shipping. On your laptop, or in CI on every pull request. This is where most people start.

Online

Graders running on a sample of real production traffic. Catches the stuff your dataset didn't imagine. No reference answer, so it's mostly judges and code checks.

And then there are benchmarks

MMLU, GPQA, SWE-bench, Terminal-Bench, τ-bench, Humanity's Last Exam. These are evals too, just public ones built to compare models against each other. They're useful for picking a model. They tell you almost nothing about your support bot. Many older ones are also saturated (every top model scores near the ceiling) or have leaked into training data.

A benchmark helps you pick the model. Your own evals decide everything after that.

03 / methodology: the loop

Start by reading outputs. Not by picking metrics.

The most common mistake is opening a framework, choosing "helpfulness" and "coherence" from a dropdown, and calling it done. You end up measuring things that don't matter while the real failures walk right past. The teams that are good at this all follow roughly the same loop.

1. Look at real traces

Pull 50 to 100 real conversations or agent runs. Read them. All of them. Yes, it's boring. It's also the highest-value hour you'll spend this week.

2. Write down what's wrong, in plain words

One note per trace. "Quoted the old refund policy." "Asked for the account number twice." Don't categorise yet. Researchers call this open coding.

3. Group the notes into failure modes

Similar notes become a category. Count them. Now you have a ranked list of what's actually broken. This is axial coding. An LLM can help cluster, but you decide the buckets.

4. Turn the top failure modes into evals

Each common failure gets test cases and a grader that checks for that specific failure. Not "quality". The actual thing.

5. Fix, rerun, compare

Change the prompt, the retrieval, the model. Rerun the suite. Did the failure rate drop? Did anything else break?

6. Feed production back in

New bug report? New trace that looks weird? It becomes a test case. The suite grows with the product.

what step 3 looks like after reading 100 traces from a support bot
Wrong policy detail
23
Didn't hand off to a human
14
Asked for info already given
10
Too long for mobile
5
Tone felt robotic
3
Now you know where to spend your time. Notice none of these is called "helpfulness". Real failure modes are specific to your product, which is why off-the-shelf metrics miss them.
How long to keep reading? Until new traces stop showing you new kinds of failure. For most products that's somewhere around 100 traces. Hamel Husain and Shreya Shankar, who teach this to a lot of teams, say they spend 60 to 80% of their development time on error analysis and evals. That number surprises people. It shouldn't.
One person owns "what good looks like". Pick a single domain expert to make the final call on labels. Committees argue forever about whether an answer is a 3 or a 4. One trusted person just decides, and you move on.
04 / methodology: the dataset

Your eval is only as good as the questions you ask it.

A clever grader on a lazy dataset gives you a confident, wrong number. Spend the effort here first.

Where good test cases come from, best first

Production traces

What real users actually typed, typos and all. Nothing you invent will be this weird. If you have logs, start here.

Bug reports and complaints

Every one is a free test case with the failure already labelled. Turn each into a regression test.

Domain experts

The person who knows the refund policy cold can write the ten tricky edge cases in an afternoon.

Synthetic data

Generated with an LLM. Great for coverage before launch, as long as you do it with structure (see below) and read what comes out.

Synthetic data without the mush

If you just ask an LLM for "50 customer questions", you get 50 polite, similar, easy questions. Instead, pick the dimensions that make real questions different, combine them, and only then turn each combination into a question.

dimensions first, text second
WhoWantsSituationGenerated question
First-time userRefundOutside policy window"hi i bought this 6 weeks ago can i still send it back??"
Angry repeat customerRefundAlready refunded once"This is the SECOND time. I want my money back today."
Business accountInvoiceMissing tax ID"Need a VAT invoice for order 88121, the one we got has no tax number"
Write the first handful of combinations by hand, then let a model scale it. You still read a sample of what it makes.

A few rules that save pain later

05 / methodology: grading

Use the dumbest grader that works.

Go down this list and stop at the first one that can check the failure you care about. Every step down costs more money, more time and more doubt.

1. Code

Valid JSON? Mentions a source? Called refund_order with the right ID? Tests pass? Under 200 words? If code can check it, code should check it.

2. LLM judge

For things only a reader can tell. "Is every claim supported by the retrieved docs?" "Did it hand off when the user asked for a human?"

3. Human

For labelling the examples that calibrate the judge, spot checks, and anything high stakes.

Pass or fail beats 1 to 5

Rating scales feel richer. In practice nobody agrees what separates a 3 from a 4, including the same person on a different day. Binary forces you to decide what "good enough" means. If you need more detail, split it into several yes/no checks instead of one fuzzy score.

Writing a judge that doesn't lie to you

# a judge prompt for exactly one failure mode
You are checking a support reply for ONE problem: stating a policy detail
that is not in the provided policy text.

POLICY TEXT:
{policy}

REPLY:
{reply}

FAIL if the reply states any refund window, fee, or eligibility rule that
is missing from or contradicts the policy text. Otherwise PASS.

Examples:
- "Refunds within 30 days" (policy says 30 days)       -> PASS
- "You can return it within 60 days" (policy says 30) -> FAIL

Think it through in 2-3 sentences, then answer on the last line with
exactly PASS or FAIL.

Then grade the grader

An unchecked judge is just vibes with extra steps. Have your expert label 100 or so outputs as pass or fail. Use a few as examples in the judge prompt, tune against part of the rest, and keep the last chunk untouched for a final check. Then compare the judge against the human.

judge vs human on 100 held-out examples
human: fail
human: pass
judge: fail
27caught it
6false alarm
judge: pass
3missed it
64correct pass

Catches real failures: 27 of 30 = 90%
(true positive rate)

Leaves good answers alone: 64 of 70 = 91%
(true negative rate)

Look at both numbers, not one "accuracy" score. If failures are rare, a judge that always says pass can look 95% accurate and be useless.

Bonus trick: once you know the judge's error rates, you can correct for them. If the judge misses 10% of failures, the real failure rate in production is a bit higher than what it reports. Not perfect, but a lot better than pretending the judge is flawless.
06 / methodology: agents and noise

Agents take many steps, and every run is a little different.

Two things change once you move from single answers to agents that call tools and loop. You have more to grade, and randomness starts to matter a lot more.

Grade the outcome first, the path second

If the task was "book a table for two on Friday", the question that matters is: is there a booking for two on Friday in the system? Check the end state directly. Agents are often creative about how they get there, and a grader that insists on one exact sequence of tool calls will fail good runs.

Then look at the path for things you care about regardless of outcome: did it touch something it shouldn't, loop 40 times, or burn $3 on a $0.10 task?

One run tells you very little

Say your agent succeeds 80% of the time on a task. Run it once and you'll see a pass, or a fail. Neither tells you it's 80%. So agent evals run each task several times and report one of two numbers. Which one you want depends on your product.

play with it: pass@k vs pass^k
pass@k: at least one try works99.2%
pass^k: every try works51.2%

Same agent. One number says 99%, the other says 51%.

pass@k fits when a person or a test can pick the good attempt, like a coding agent where you keep whichever patch passes CI. pass^k fits customer-facing agents, where every single conversation needs to go right.

Is that improvement real, or luck?

You changed the prompt and the score went from 78% to 82%. Before you celebrate, check how many cases that's based on. Small datasets have wide error bars.

play with it: how sure can you be?

Bars show a rough 95% range for each score. When they overlap heavily, you can't tell the versions apart yet. Add cases, or run more trials, before you trust the difference. (Rough maths on purpose. For real decisions, a paired comparison on the same cases is more sensitive.)
A suite at 100% has stopped teaching you anything. It's still useful as a regression guard, but it can't show progress. When a capability suite saturates, add harder cases.
Read the transcripts of failures. Sometimes the agent was wrong. Sometimes the task was ambiguous, the reference answer was wrong, or the grader was too strict. You only find out by reading.
07 / why and when

Without evals, every change is a guess.

LLM apps don't crash when they get worse. They just get a bit worse, quietly, in ways nobody notices until a customer does.

Why bother

Ship changes without fear

Fixing one prompt problem often creates two new ones somewhere else. A suite shows you both before users do.

Swap models in an afternoon

New model out? Cheaper one tempting you? Run the suite and you have an answer by lunch instead of a two-week debate.

End opinion fights

"I think v2 is better" versus "I think v1 is" goes nowhere. "v2 fixes 9 cases and breaks 2" ends the meeting.

Know where to spend time

Error analysis turns "the bot feels off" into a ranked list. You fix the thing that's broken 23 times, not the one that's broken twice.

Cut cost safely

Shorter prompts, smaller models, fewer retrieved chunks. Every saving is a quality risk. Evals tell you how much you actually gave up.

Show your work

In regulated industries someone will ask "how do you know it's safe?". A versioned suite with results is a real answer.

When to run them

While prototyping

Don't build infrastructure yet. Read outputs, keep a list of what breaks. That list becomes your first suite.

run: your eyes, a spreadsheet

Before launch

Build the first real suite from error analysis, add synthetic cases for coverage, set a bar you need to clear.

run: full offline suite

On every change

Prompt edit, retrieval tweak, tool change. Wire the regression suite into CI and block merges that break it.

run: regression suite in CI

When the model changes

Upgrades, cheaper alternatives, provider changes, even the same model name with a new snapshot.

run: everything, side by side

In production, always

Sample live traffic and grade it with judges and code checks. Watch the trends. Send weird cases to a human queue.

run: online evals on a sample

After every incident

The bad conversation becomes a test case before the fix ships. It never comes back unnoticed.

run: new regression case
When not to bother (yet): a weekend prototype, a one-off script, or anything you'll throw away. Reading 20 outputs by hand is an eval too, and at that stage it's the right one.
08 / how good teams do it now

What actually works in 2026.

The tooling has grown up a lot. The core habits haven't changed much. Here's what the teams getting real value out of evals tend to have in common.

They trace everything

Every prompt, tool call and response is logged as a trace. OpenTelemetry's GenAI conventions are now the common format, so traces move between tools. You can't evaluate what you didn't record.

They look at data every week

A standing slot to read traces and label them. Often in a small custom review screen, which is quick to build now with a coding agent.

Evals are CI gates

Regression suites run on every pull request, like tests. A drop below the bar blocks the merge, and the diff shows which cases flipped.

Online evals on live traffic

A sample of production traces gets graded continuously. Dashboards show failure rates per failure mode, not one vague "quality" number.

Judges are calibrated

Every LLM judge has a human-labelled set behind it and known error rates. When the judge model changes, it gets rechecked.

Coding agents do the typing

Agents draft test cases, graders and judge prompts. Humans still decide what counts as failure and review what the agent wrote.

Red teaming is part of the suite

Prompt injection, data leaks and jailbreak attempts are just more test cases, run on schedule, not a one-time audit before launch.

Failures become tests

Support tickets and thumbs-down feedback flow into an annotation queue. Confirmed failures are added to the dataset.

Things that look like progress but aren't

09 / frameworks and tools

There are a lot of tools. They fall into two groups.

Libraries run evals from your code or CI. Platforms store traces and datasets, give you a UI to review and label, and run evals on production data. Many teams use one of each.

Libraries and frameworks (run it in code)

ToolGood forWorth knowing
promptfoo
MIT
Comparing prompts and models from a YAML config and a CLI. Strong red teaming.Acquired by OpenAI in March 2026. OpenAI says the open-source project continues.
DeepEval
Apache 2.0
Evals that feel like pytest. Easy to drop into Python CI.Ships many ready-made metrics. Use the ones that match your failure modes, skip the rest.
Ragas
Apache 2.0
RAG apps: retrieval quality, faithfulness, answer relevance.Good starting metrics for RAG. Still validate them on your own data.
Inspect
MIT
Serious agent and safety evals with sandboxes and tool use.Built by the UK AI Security Institute. Comes with a large library of ready evals.
OpenAI Evals
hosted
Teams already on the OpenAI platform. Includes trace grading for agents.Convenient, but ties your eval setup to one provider.

Platforms (traces, datasets, review, online evals)

ToolGood forWorth knowing
Langfuse
MIT core, self-host
The popular open-source pick. Tracing, datasets, judges, annotation queues.Joined ClickHouse in January 2026 and stays open source.
Braintrust
commercial
An eval-first workflow with a polished UI and CI integration.Popular with product teams who want managed and don't mind closed source.
LangSmith
commercial
Teams on LangChain or LangGraph.Works without LangChain too, but that's where it shines.
Arize Phoenix
Elastic 2.0, self-host
OpenTelemetry-native tracing and evals you can run yourself.Source-available, not OSI open source. Arize AX is the managed version.
Opik
Apache 2.0
Open source with a permissive licence, from Comet.A good fit if licence terms matter to your legal team.
MLflow
Apache 2.0
Teams that already run classic ML on MLflow or Databricks.Has judge alignment against human feedback and prompt optimisation built in.
W&B Weave
Apache SDK, hosted
Teams already using Weights & Biases.Newer than W&B's experiment tracking, still maturing.

Picking one

The honest take: the tool matters much less than the dataset and the graders. Teams with great evals in a plain Python script beat teams with great tools and no idea what to measure. Pick something your team will actually open, and switch later if you must. Traces in OpenTelemetry format make switching a lot easier.
+ / cheat sheet

The whole guide on one screen.

Numbers worth remembering

WhatRule of thumbWhy
First suite size20 to 50 casesFrom real failures. Grow from there.
Traces to read for error analysis~100Or until new failure types stop showing up.
Human labels to check a judge~100Split into examples, tuning set and a held-out test set.
Regression suite target~100%Any drop means something broke.
Capability suite targetlow, risingIf it's at 100%, add harder cases.
Trials per agent task3 to 5+One run can't show a success rate.

Ten things to keep

Further reading