Education › Evals & Harness › Stage 1: Evaluation foundations

Why evals, and eval-driven development

What an eval is, the kinds you need, and how evals turn prompt tweaking into engineering.

Intermediate ~30 min read Module 1 of 20

An eval is a repeatable test of how well an AI system does a task. Without evals, every prompt change, model upgrade or new tool is judged by trying a few examples and getting a feeling, which is how teams ship regressions they never notice. This lesson explains what evals are, the different kinds you need over a product's life, how eval-driven development works, and the habits that separate teams who improve their AI systems steadily from teams who go round in circles.

After this module you can
  • Define an eval and its parts: inputs, the system under test, and a scoring method
  • Distinguish capability, regression, safety and production evals
  • Explain eval-driven development and apply it to a prompt change
  • Recognise vibe-checking and the failures it causes
  • Plan a minimal eval for an AI feature on its first day

What an eval is

Every eval has three parts. A dataset of inputs, ideally with the expected output or grading guidance for each. A system under test: a single prompt, a RAG pipeline, or a whole agent with tools. And a scorer that turns each output into a number or a pass/fail, by exact comparison, by code, by a judge model, or by a human. Running the system over the dataset and aggregating the scores gives you a number you can compare across versions.

Language models are non-deterministic and sensitive to tiny changes in wording, so the only way to know whether a change helped is to measure it on enough cases. An eval is to an AI feature what a test suite is to ordinary code, with one difference: scores are usually percentages, not all-green, and the goal is to move them in the right direction without breaking anything else.

The smallest useful eval, framework-free
python
cases = [
    {"input": "Refund policy for damaged items?", "must_mention": "30 days"},
    {"input": "Do you ship to Canada?", "must_mention": "Canada"},
    {"input": "What is your CEO's home address?", "must_mention": "can't share"},
]


def run_eval(system) -> float:
    passed = 0
    for c in cases:
        output = system(c["input"])
        ok = c["must_mention"].lower() in output.lower()
        passed += ok
        print("PASS" if ok else "FAIL", c["input"])
    return passed / len(cases)


print(f"score: {run_eval(my_support_bot):.0%}")

The kinds of evals you will need

KindQuestion it answersWhen it runs
CapabilityHow good is the system at the task?While developing; when comparing models or designs
RegressionDid this change break anything that used to work?On every change, in CI
Safety and policyDoes it refuse, redact and stay in scope when it should?On every change and before release
Production / onlineHow is it doing on real traffic right now?Continuously, on sampled live requests
BenchmarksHow does a model compare on a public, standard task?When choosing models; never as your only eval

Public benchmarks are useful for shortlisting models but tell you little about your product: your users, documents and edge cases are not in them, and popular benchmarks may have leaked into training data. The evals that matter most are the ones built from your own task.

Eval-driven development

  1. Write the eval first. Collect 20-50 real examples of the task and decide how each should be scored.
  2. Get a baseline with the simplest reasonable system.
  3. Look at the failures, not just the score. Group them into causes.
  4. Change one thing aimed at the biggest group of failures: the prompt, retrieval, a tool, the model.
  5. Re-run and compare. Keep the change only if the target failures improved without regressions elsewhere.
  6. Grow the dataset with every new failure you find in testing or production, so it never happens again silently.
runoutputsre-runnew casesDatasetinputs + targetsSystemunder testScorercode, judge, humanResultsper case, per sliceRead failurescluster by causeChange one thingprompt, tool, modelProductionnew failures
Eval-driven development is a loop: run the system over a fixed dataset, score it, read the failures, change one thing and re-run, while production failures keep growing the dataset.
Tip

Reading 30 failed outputs teaches you more than any aggregate number. Every eval run should end with someone scrolling through the failures and naming their causes.

Vibe-checking and what it costs

Vibe-checking means trying a handful of prompts by hand and deciding the system feels better. It is fine for the first hour of a prototype and dangerous after that. Typical consequences: a prompt fix for one complaint quietly breaks three other cases; a cheaper model looks fine on the examples you remembered and fails on the long tail; two engineers argue for days because each tested different examples; and nobody can say whether last month's release was better than the one before.

  • Non-determinism means one good answer proves little; you need many samples.
  • Humans remember striking examples and forget boring successes and failures.
  • Changes interact: a system prompt edit can change tool use, refusals and tone at once.
  • Without a fixed dataset, scores are not comparable across time or people.

A day-one eval plan

You can start useful evals on the first day of any AI feature. Gather 30 realistic inputs from users, logs or domain experts, including a few hard and adversarial ones. Write down, for each, what a good answer must do. Start with cheap code checks (contains, matches a format, calls the right tool), add a judge for qualities code cannot check, and keep the script and data in version control next to the prompt. The rest of this track makes each of those steps rigorous.

Hands-on practice

Your first eval, today

  1. Pick an LLM feature you use or can build in a few lines (a support answerer, a summariser, a classifier).
  2. Write 30 test inputs, including five tricky or adversarial ones, and for each a check a script can run (must contain, must be valid JSON, must refuse).
  3. Implement run_eval as above and record the baseline score.
  4. Read every failure and group them into three to five causes.
  5. Change one thing aimed at the biggest cause, re-run, and record the before and after per case.
  6. Commit the dataset, the script and the results table to a repository.
Cheat sheet

Why evals, and eval-driven development — at a glance

Main things to focus on

  • Eval = dataset + system under test + scorer, run repeatably.
  • Capability, regression, safety, production evals answer different questions.
  • Public benchmarks shortlist models; your own evals decide.
  • Eval-driven: dataset first, baseline, read failures, change one thing, compare.
  • Every production failure becomes a new eval case.
  • Vibe-checks do not survive non-determinism or interacting changes.

Eval parts

dataset: input + target/guidanceWhat to test
system under testPrompt, pipeline or agent
scorer: exact | code | judge | humanHow to grade
aggregate: mean, pass rate, CIOne comparable number
version dataset + script with the promptReproducible results
30 real cases on day oneEnough to start

Eval kinds

capabilityHow good is it?
regressionDid it break anything?
safety / policyDoes it stay in bounds?
onlineHow is it doing on live traffic?
benchmarkStandard comparison, not your product

Loop

baseline -> read failures -> clusterFind the biggest cause
change one thing -> re-runAttribute the effect
keep if target up, nothing else downDecision rule
new failure -> new caseDataset grows forever

Common pitfalls

  • Judging changes by a few hand-picked prompts.
  • Relying only on public benchmarks for a product decision.
  • Looking at the aggregate score and never at individual failures.
  • Changing prompt, model and retrieval at once.
  • Keeping eval data outside version control, so results cannot be reproduced.
Quiz

Check your understanding

5 questions · 4 to pass · answers are explained as you go. Your best score is saved on this device only.

Progress and quiz scores are saved in this browser only. Back up or restore on the hub.

Was this lesson useful? Tell me what to improve →