← govind p lal
AI and ML Bootcamp · Lecture 26 · lecture notes

Evals - What They Are, How to Design Them, How to Use the Score

In short — How do you decide whether a new model or pipeline is really better, and not just better on a few examples? An eval is a repeatable procedure that answers this. These notes cover the three layers of evals, the parts of an eval, how to design and test one, and how to turn a score like 62% into a concrete fix.

Why a few examples are not evidence

Problem

New model, new prompts, new tools. You run 10 examples and they look better, but latency is higher. Ship it?

Solution

Not enough evidence. Sample is too small. Outputs are a distribution, so one run can look good by luck.

Averages can lie. System B can look 90% helpful overall, yet have more policy violations and twice the latency of A. Still not enough to decide.

What an eval is

Eval - a repeatable procedure with defined cases. You observe the outcomes, judge them against explicit criteria, aggregate the scores and make a decision (upgrade or not).

Task + casesRun + observeGraderAggregate scoresDecision rule
Parts of an eval.

What eval is not:

Three layers of evals

LayerWhat it testsUse
Model benchmarkThe model alone (e.g. retrieval, reasoning, cybersecurity scores at release)Choose which model to start with
Application evalModel + prompts + tools + policy + pipelineShow your new version is better; every team needs its own
Online evidenceReal traffic in productionFailures become new eval cases. Slowest, highest leverage
pick modelshipfailures become casesModel benchmarkApplication evalOnline evidence
Layers run in a loop.

Benchmarks decay. SWE-bench Verified was dropped as unreliable (more a memory test). OpenAI audited SWE-bench Pro and found about 30% of tasks broken. Evals decay because cases go stale, early judging errors exist, and models beat them.

Vocabulary and five questions

Before designing, answer five questions:

TypeTestsTells you
End-to-endWhole pipeline: request -> retrieval -> reasoning -> tools -> outcomeDoes it work overall
ComponentRetrieval, tools, reasoning, state separatelyWhere to improve or what might fail

Regression set - every failure you fixed gets added here. Any new version must pass all of it (100%). Other sets hold harder and edge cases to improve quality.

Designing an eval: baseline, target, decompose good

Design loop: decision -> users and task -> cases -> grader -> metrics -> gate -> validate the eval.

Example

'Evaluate this chatbot' is vague. Ask for the baseline (current production system), the scope (refund agent, refunds under $5,000), and limits (latency below a bound, no wrong actions). Now the job is concrete: is the new agent better than the current one on these?

Decompose good. 'Good' as one pass/fail gives no clue why it failed.

Building the case set

Open coding - read 50-100 traces yourself, write free notes, then cluster notes into groups (retrieval, tool, model). Do the first pass as a human.

A case is a reproducible, structured record, not a prompt string:

Buckets, so rare but important cases are not drowned out:

Example

95 simple questions, 5 refund actions. Five refund cases are too few. Bump to 30-40, but report the score re-weighted by the real 95/5 mix so you do not over- or under-estimate.

Sources: production logs, incidents, synthetic generation, benchmarks, red-teaming. Incidents mean a user already got hurt; logs are messy. Synthetic is most common.

Graders, gates and testing the eval

Problem

Refund agent says 'refund processed' but the tool timed out and nothing is in the DB. A grader reading only the response passes it.

Solution

Grade the closest observable to the real outcome: the DB row. Also check the evidence behind the claim (tool call, DB check) and fail if the agent made it up.

Judge pitfall - a naive judge given 'which is better, A or B?' invents its own criteria. Fix: judge on a stated rubric (e.g. correctness only) and let equal answers tie.

Do not weight all failures equally. A wrong refund matters far more than a typo, even if typos are more frequent. Fix the highest-impact failure first.

Gate - pre-declared yes/no rules to ship. Example: zero privacy violations, under 1% wrong cases, better than baseline, latency under 2.5 s. Set them at the start, with the baseline.

Test the eval itself before using it:

Turning a score into a fix

A score like 62% does not say what to fix. Look at traces and move one step back from where the failure shows up.

SymptomLook at
Tools fail (bad schema)Model producing the tool calls: output schema
Wrong reasoningContext given to the model
Wrong contextHarness and retrieval step

Check each stage in order:

Info present?Right plan?Right tool + args?Tool executed?State changed?Truthful reply?
Stages to check for a failing run.

Oracle probes - inject gold truth at one point:

Order of fixes, cheapest first: deterministic code fixes (retrieval, execution engine, grader) -> better or routed model -> fine-tuning. Fine-tune last: it needs labelled data, money and engineering hours. Do it only when the model has simply not seen enough examples.

!

Do not patch every failure into the prompt ('for this case do this'). That is overfitting the prompt. Cluster failures and write general guidance per cluster. After fixes, rerun everything including the regression set.

The eval flywheel

add to eval setFixGateWatch productionNew incidents
The eval flywheel.

Glossary

Eval
A repeatable procedure that runs defined cases, grades them against explicit criteria, aggregates scores and supports a ship decision.
P95
Latency under which 95% of requests finish.
Case
A structured, reproducible situation: input, initial state, expected and forbidden outcomes.
Trial
One run on a case.
Regression set
Past fixed failures that every new version must pass 100%.
Gate
Pre-declared yes/no thresholds a version must meet to ship.
Open coding
Reading traces by hand, writing free notes, then clustering them into failure types.
Canary
Rolling out to a small percentage of users first.