AI Evals in Practice ยท Chapter 1

Why AI Evals? The Framework, the Scope and the Team

SA
Shivank AgrawalFuture with Shivank

Building an AI feature is the easy part. Knowing whether it is good enough to put in front of real users, and proving that to your manager, your client or a regulator, is the hard part. That proof is what AI evaluations (or simply evals) give you.

This chapter answers three questions: what an eval is, why you can't skip it (and why buying a tool or trusting a leaderboard isn't enough), and how a real team plans, scopes and staffs an evals project. You need no maths background. If you know a little Python and have called an LLM API once, you are ready.

By the end of this chapter you will be able toโ€ฆ

๐Ÿง  Think of it likeโ€ฆ an everyday analogy
๐ŸŒ Real-world example where this actually happened
๐Ÿ” Worked example step by step, with real values
โš ๏ธ Watch out a common mistake beginners make
๐ŸŽฏ Interview tip a line you can say in an interview
๐Ÿš€ Going deeper optional, for the curious
๐ŸŽฎ Try it an interactive demo you can click
About the code in these notesCode examples use the OpenAI Python SDK with real model names that are current at the time of writing (November 2026): gpt-6.1-terra (fast and balanced; we use it as the product being tested), gpt-6-luna (the cheapest and fastest; we use it as the judge), gpt-6-astra (the most capable, used sparingly) and text-embedding-3-small for embeddings. Every example shows the output you would see, so you can follow along just by reading. Model names change every few months; the ideas in this series do not.
โ–ถ Running these examples with your OpenAI key

Setup (once): pip install openai pydantic numpy, then set your key: export OPENAI_API_KEY="sk-..." (Mac/Linux) or setx OPENAI_API_KEY "sk-..." (Windows). Nothing else is needed.

Three GPT-6 rules every example in this series follows (break them and the API returns an error):

  1. Temperature needs reasoning switched off. GPT-6 models "think" before answering by default, and while they do, temperature is not allowed. So whenever we want repeatable answers we write reasoning_effort="none", temperature=0. This works on gpt-6.1-terra and gpt-6-luna. gpt-6-astra always reasons, so we never pass temperature to it.
  2. Tool calling on Terra uses the Responses API. When the model must call a function (e.g. "escalate to a human"), we use client.responses.create(..., tools=...) instead of client.chat.completions.create. (Luna can call tools in Chat Completions only with reasoning_effort="none".)
  3. JSON replies use Structured Outputs. We describe the reply's shape as a small Pydantic class (e.g. class Verdict(BaseModel): reason: str; verdict: Literal["PASS","FAIL"]) and call client.chat.completions.parse(..., response_format=Verdict). The answer comes back already parsed in .choices[0].message.parsed: no json.loads, no broken JSON.

Which examples run as-is? Any example whose data is written inside the snippet (questions, replies, scores) runs with just your key. Examples that call doubtbot, bank_bot or read files such as golden_v3.jsonl stand for your own product and data: read them to learn the pattern, or plug in your own. Real model outputs will be worded differently from the sample outputs shown; the meaning should match.

๐ŸŽ’ Starter kit: 12 words you will hear in every chapter

1. LLM
A Large Language Model (GPT, Claude, Gemini, Llama) that reads and writes text. It is probabilistic: the same question can get different answers.
2. AI product
The full thing users touch: the LLM plus your prompt, your data, your tools and your code. Evals test the product, not just the LLM.
3. Eval
A repeatable test that measures how well your AI product does a job, against criteria you defined in advance.
4. Test case
One input (a question, a conversation, a task) plus what a good output should look like.
5. Test set
A collection of test cases. Like a question paper.
6. Rubric
The marking scheme: rules that say what counts as a good, average or bad answer.
7. Metric
A number that summarises results, e.g. "accuracy 87%" or "safety violations 0.4%".
8. LLM-as-a-judge
Using one LLM to grade another LLM's answers with a rubric. Fast and cheap, but it has its own biases.
9. Trace
A step-by-step record of everything the product did for one request: the prompt, the documents it fetched, the tools it called, the final answer.
10. SME
Subject Matter Expert: a domain expert (a doctor, a lawyer, a senior teacher) who knows what "good" looks like.
11. PRD
Product Requirements Document: the written plan of what a product must do. A good PRD is the starting point of every eval plan.
12. Guardrail
A rule about what the product must never do (leak personal data, give unsafe advice, do a student's homework).

๐Ÿค– Meet DoubtBot: our running example for the whole series

Ideas stick better with one concrete product. Throughout these notes we will evaluate the same AI product, chapter after chapter, from the first rough test to monitoring it after launch.

๐Ÿ“˜ The product
DoubtBot is an AI teaching assistant for a 12-week Data Structures & Algorithms (DSA) course in Python. Students ask doubts any time of day. DoubtBot answers using the course notes and lecture transcripts (this is RAG: it fetches relevant notes and gives them to the LLM). It guides students step by step with hints instead of handing over full solutions, and it hands the conversation to a human TA when it is unsure, when a question is outside the course, or when a student seems to be in distress.
๐Ÿงพ The facts we will use
  • Users: 1,000 students per batch
  • Today (the baseline): 4 human TAs, about 1 TA per 250 students; a doubt waits around 6 hours for a reply
  • Built with: gpt-6.1-terra + a vector database of course notes
  • Business goal: answer most doubts instantly and free TAs for the hard ones
  • Key metric: the share of doubts DoubtBot resolves without escalating to a TA
DoubtBot, end to end
Student: "Why is my binary search stuck in an infinite loop?"
DoubtBot (the AI product)
Course notesvector database
top 3 notes
System prompt + notes + question
gpt-6.1-terra
Confident, in scope and safe?
yes
Hint-style answer"Check how you update low when arr[mid] < targetโ€ฆ"
no
Hand over to a human TA
Every part of this picture (the notes, the prompt, the model, the hand-over rule) can break, and evals must catch it.

Chapter 1 ยท Why AI Evals?What evals are ยท why leaderboards and tools are not enough ยท the lifecycle ยท scope ยท the team

1.1 What is an AI eval?

Before asking "how do we test an AI?", ask a simpler question: how do we test a human? With exams. Think of your Class 12 board exams.

AI evals work exactly the same way. Here is the mapping, using DoubtBot:

Board exams vs AI evals
Board examAI evalDoubtBot example
SubjectA capability or risk we care about"Explains concepts correctly", "Never gives full homework solutions"
Question paperTest set60 real student doubts about recursion
One questionTest case"Why does my recursive Fibonacci take forever for n = 50?"
Marking schemeRubric (the "defined criteria")"Full marks if it names repeated sub-problems and suggests memoisation"
Marks in one subjectMetric (an aggregated score)"Concept accuracy on recursion: 88%"
ExaminerEvaluator: a human expert, a rule in code, or an LLM judgeA senior TA, a regex check, or gpt-6-luna
๐Ÿ“Œ Definition (worth memorising)An AI eval is a systematic, repeatable test that measures an AI system's quality, safety, performance and reliability against criteria you defined in advance, using a test set that represents real usage.

Three words in that definition do the heavy lifting:

Systematic
Not "I tried five questions and it looked fine". The same test set, the same rubric, run the same way every time, so you can compare version 1 with version 2.
Defined criteria
You decide before testing what counts as success. Otherwise everyone grades by gut feeling, and gut feelings disagree.
Represents real usage
The test set must look like what real users actually ask, not what the engineer finds easy to type.
Eval metrics you will meet in this series
accuracycorrectnessfaithfulnesshallucination raterelevancehelpfulnessconsistencyrobustnesssafety violation raterefusal rateescalation accuracytonelatency (p95)cost per requesttask successresolution rate
There is no single "quality" number. You will pick a small handful that matter for your product (Chapter 3).

Why "it looked fine when I tried it" is not an eval

โŒ The vibe check
An engineer types a few questions, reads the answers, says "looks good ๐Ÿ‘". Different person, different questions, different verdict. Nothing is written down. When the prompt changes next week, nobody knows if things got better or worse.
โœ… An eval
A fixed set of 200 real student doubts, a written rubric, the same evaluator every time, and a number per metric. Change the prompt, re-run, compare: "concept accuracy went from 84% to 91%, but hint-only behaviour dropped from 97% to 89%". Now you can make a decision.
๐Ÿง  Think of it likeโ€ฆA vibe check is your mother tasting the dal and saying "salt is fine". An eval is a food-safety lab that tests 200 samples from every batch with the same instruments. Both are useful, but only one of them can be shown to an inspector. ๐Ÿฒ

๐Ÿ” Your first eval in code

Let's make the exam idea real. Below, DoubtBot faces three tiny "subjects" (test sets). For each test case we check something simple and objective: does the answer mention the idea it must mention? Then we add up a score per subject.

๐Ÿ” Worked example: a 25-line eval harness
from openai import OpenAI
client = OpenAI()   # reads OPENAI_API_KEY from the environment

SYSTEM = "You are DoubtBot, a DSA teaching assistant. Explain briefly. Give hints, not full solutions."

# Each test set = one "subject". Each test case = question + a word a correct answer must contain.
TEST_SETS = {
    "recursion": [
        {"q": "Why is recursive fibonacci(50) so slow?",       "must": "memo"},
        {"q": "What is a base case?",                          "must": "stop"}],
    "binary_search": [
        {"q": "Binary search needs the array to be what?",     "must": "sorted"},
        {"q": "Time complexity of binary search?",             "must": "log"}],
    "heaps": [
        {"q": "In a min-heap, where is the smallest element?", "must": "root"},
        {"q": "Cost of pushing into a heap of n items?",       "must": "log"}],
}

def ask_doubtbot(question):
    r = client.chat.completions.create(
        model="gpt-6.1-terra", reasoning_effort="none", temperature=0,
        messages=[{"role": "system", "content": SYSTEM},
                  {"role": "user", "content": question}])
    return r.choices[0].message.content

for subject, cases in TEST_SETS.items():
    passed = 0
    for case in cases:
        answer = ask_doubtbot(case["q"])
        ok = case["must"] in answer.lower()          # the "marking scheme"
        passed += ok
    print(f"{subject:14} {passed}/{len(cases)} = {passed/len(cases):.0%}")

Output:

recursion      2/2 = 100%
binary_search  2/2 = 100%
heaps          1/2 = 50%

How this code works, line by line:

  1. TEST_SETS is our question paper: three subjects, two questions each, and for each question one keyword a correct answer must contain.
  2. ask_doubtbot() sends one question to the product (system prompt + question) and returns its answer. reasoning_effort="none" switches off the model's hidden "thinking" step (GPT-6 models only accept a temperature setting when it is off), and temperature=0 then keeps answers as repeatable as possible.
  3. The loop goes subject by subject. For every question it gets DoubtBot's answer and checks if the keyword appears (ok is True or False; in Python, True counts as 1 when added).
  4. Finally it prints one score per subject, exactly like a marksheet.

Reading the result: recursion and binary search look fine; heaps need attention. When we looked at the failing answer, DoubtBot said "pushing into a heap takes O(n)", which is wrong (it is O(log n)). One number per subject told us where to look.

โš ๏ธ Watch out: keyword checks are a starting point, not the finish line"Does the answer contain the word log?" is cheap and objective, but crude: an answer could say "it is not log n" and still pass. In Chapter 2 you will meet better methods (rubrics, human review, LLM judges), and in Chapter 3 you will learn how to pick the right one for each metric. Two test cases per subject is also far too few to trust; Chapter 3 shows how to work out how many you need.
๐ŸŽฎ Try it: run DoubtBot's "board exam"

Press the button to run each test case one by one. Watch how individual โœ“ and โœ— results are rolled up into one score per subject (a metric).

1.2 Why leaderboards and benchmarks are not enough

The hardest step in any evals project is often the very first one: convincing your stakeholders it is needed. A manager will often say: "Why spend time on evals? This model is number one on the leaderboard." This section and the next three give you the arguments for that conversation. Let's start with leaderboards.

A benchmark is a public, fixed test set (for example a set of coding problems or exam questions). A leaderboard ranks models by their benchmark scores. They are useful for a rough first shortlist. They are dangerous as proof that your product works, for three reasons:

1. Leaderboards disagree
Different leaderboards, and even the same benchmark run by different people, can rank the same models in a different order. Model makers tend to publish the comparison where their newest model wins. Small choices (prompt wording, number of attempts allowed, which subset of questions) can flip the ranking.
2. The paper may have leaked
Popular benchmarks are on the public internet, and LLMs are trained on the public internet. A model may have memorised the questions and answers. This is called benchmark contamination. A high score then measures memory, not ability.
3. It's not your exam
A benchmark of competitive programming problems tells you little about whether DoubtBot explains your course's heap lecture correctly, in the right tone, without giving away homework answers.
๐Ÿง  Think of it likeโ€ฆHiring a cricket coach because he topped a quiz on cricket rules. The quiz is real, the score is real, but it tells you nothing about whether he can train your under-16 team on your ground. And if the quiz answers were circulating on WhatsApp the night before, the score doesn't even prove he knows the rules. ๐Ÿ

๐Ÿ“„ Leaked question papers: how to spot contamination

Here is a simple, practical test. Take a benchmark question that cannot be answered without some piece of information (an image, a table, the answer options) and give the model the question without that piece. A human expert would say "I can't answer without the image." If the model still produces the exact correct answer, it has most likely seen that question during training.

The "remove the essential part" test
Test 1: full question
Text: "Which labelled part in the figure is the mitochondria?"+ the image + options Aโ€“D
Model: "C" โœ…Expected. Fine.
Test 2: image removed
Text only, no image
Model: "C" โœ… ๐ŸคจImpossible to know without the figure โ†’ it remembered the answer
If a model "answers" a question it physically cannot see, the benchmark score is partly memory.
๐Ÿ” Worked example: a contamination probe in code

Another easy probe: give the model only the first half of a well-known benchmark question and ask it to continue. If it completes the rest word for word, the question was in its training data.

half = "A farmer has 17 sheep. All but 9 run away. How many"   # first half of a famous puzzle item

r = client.chat.completions.create(
    model="gpt-6.1-terra", reasoning_effort="none", temperature=0,
    messages=[{"role": "user", "content":
        "Continue this text exactly as it appears in its original source:\n" + half}])
print(r.choices[0].message.content)

Output:

sheep does the farmer have left? Answer: 9

The model reproduced the rest of the item and its answer. For your own product this is a reminder: never use a famous public test set as your only proof of quality. Your own test set, built from your own users' questions, has never been on the internet.

๐ŸŽฏ Interview tip"I use public leaderboards only to shortlist models. To choose one, I run the shortlisted models on our own test set, built from real user requests, because public benchmarks can be contaminated and don't reflect our product's prompt, data or constraints."

1.3 An AI product is not the same as an AI model

Even a perfect, uncontaminated leaderboard ranks models. Your users never touch a bare model. They touch your product: the model wrapped in your system prompt, your data, your retrieval, your tools and your code. A great model inside a badly built product still gives bad answers.

๐Ÿง  Think of it likeโ€ฆThe best atta in the market doesn't guarantee soft rotis. The water, the kneading, the resting time, the tawa and the cook all matter. The model is the atta; the product is the roti. Leaderboards grade the atta. Users eat the roti. ๐Ÿซ“

๐Ÿชœ The complexity ladder: every step adds new ways to fail

From a prompt to a team of agents
โ‘  Prompt-only producta system prompt around a model
Levers: the wording of the system prompt, temperature, the model chosen
โ‘ก RAG productfetch documents, then answer
New levers: how documents are split (chunking), which embedding model, how many results, whether a re-ranker is used
โ‘ข Agentic workflow / agentsmodels that plan and call tools
New levers: which tools, in what order, how agents hand work to each other, when to stop. It quickly becomes "agent spaghetti".
Each step up the ladder multiplies the number of things that can go wrong, and the number of things evals must check.

Even step โ‘  is fragile. A small change in the system prompt can move several metrics at once. Here is what happened when we tried three versions of DoubtBot's system prompt on the same 200 test doubts (illustrative numbers):

System prompt versionConcept accuracyGave a full solution (bad)Refused a valid doubt (bad)Avg. answer length
A. "You are a helpful DSA tutor."91%23%1%310 tokens
B. A + "Never give full code solutions. Give hints only."88%4%11%140 tokens
C. B + "If the doubt is a concept question, explain fully; hold back only for graded assignments."90%5%2%190 tokens

Version A is the "smartest" but hands out homework answers. Version B fixes that but starts refusing honest concept questions. Version C balances both. Without evals you would never see these trade-offs; you'd just see "it seems fine".

๐Ÿ” Worked example: comparing prompt versions in code
PROMPTS = {
    "A": "You are a helpful DSA tutor.",
    "B": "You are a helpful DSA tutor. Never give full code solutions. Give hints only.",
}
doubts = load_test_doubts()          # 200 real student doubts, each tagged "concept" or "assignment"

for name, system in PROMPTS.items():
    full_solutions = 0
    for d in doubts:
        answer = client.chat.completions.create(model="gpt-6.1-terra", reasoning_effort="none", temperature=0,
                   messages=[{"role": "system", "content": system},
                             {"role": "user", "content": d["text"]}]).choices[0].message.content
        if d["type"] == "assignment" and "def " in answer:   # crude check: did it write a full function?
            full_solutions += 1
    print(name, "full solutions given:", full_solutions)

Output:

A full solutions given: 46
B full solutions given: 8

One sentence in the prompt changed a safety-critical behaviour almost six-fold. A model leaderboard can't show you this, because it is a property of your product.

๐Ÿงฎ Agent maths: why multi-agent systems fail more often than you think

Say you build a pipeline of 10 agents, and each one fails only 1% of the time. Sounds safe. What is the chance that at least one of them fails on a given request?

๐Ÿ” Worked example: the "at least one fails" calculation

The trick: it is easier to calculate the chance that nothing fails, then subtract from 1.

  1. Chance one agent works: 1 โˆ’ 0.01 = 0.99
  2. Chance all 10 work (assuming they are independent): 0.99 ร— 0.99 ร— โ€ฆ ten times = 0.9910 โ‰ˆ 0.904
  3. Chance at least one fails: 1 โˆ’ 0.904 = 0.096, almost 10%
P(at least one fails) = 1 โˆ’ (1 โˆ’ p)n

Would you ship a product where 1 in 10 requests breaks? And this is the optimistic case. Real agents depend on each other: one agent's bad output becomes the next agent's input, so errors snowball and the true failure rate is usually higher.

๐ŸŽฎ Try it: how risk grows with more agents

Move the sliders. Notice how even tiny per-agent failure rates add up.

Chance that at least one agent fails on a request:
๐ŸŒ Real-world pictureIndustry surveys through 2025 kept reporting the same pattern: most enterprise AI pilots never make it into reliable, everyday production, and many deliver no measurable business return. A big reason is that teams cannot show the system is good enough, so it never earns the trust needed to scale. Evals are how you earn that trust.

1.4 Rules, laws and proof: evals are often not optional

So far the reasons were technical. There is a second, very practical reason: regulators and customers increasingly ask for evidence. New AI-specific laws are still catching up, but many existing laws already apply to AI products.

RuleWhere / whoWhat it means for an AI product
DPDP Act, 2023India: any product handling personal data of people in IndiaPersonal data must be collected with consent, used only for the stated purpose and protected. A bot that leaks one student's marks to another is a violation.
GDPREU residents' data, wherever your company isSimilar duties on personal data, plus rights around automated decisions.
EU AI ActAI systems used in the EURisk-based rules. Systems used in education and hiring are treated as high-risk and need documented testing, accuracy and human oversight.
HIPAA / FERPAUS health data / US student recordsHealth and education bots must not expose protected records.
State AI lawse.g. Colorado's AI Act, California's AI transparency rulesDuties around disclosure, discrimination and transparency for certain AI uses.
๐ŸŒ Real-world example: the "robot lawyer"A US startup marketed its chatbot as "the world's first robot lawyer". The US Federal Trade Commission (FTC) acted against it because the company could not back up the claim that the bot could replace a human lawyer's expertise. The company paid a penalty and, worse, lost users' trust overnight. The lesson: a claim about AI quality without evidence is a liability. Evals are that evidence.

Even if you are not regulated, your customers will ask. Enterprise buyers and government procurement teams now routinely ask vendors: "How did you evaluate this? Show us the results." If you sell AI to other businesses (as many Indian IT services firms now do), an evals report is becoming part of the sales process, just like a security audit.

Who needs evals, and why
  • Startup: "move fast" is fine until a big customer asks for proof
  • Enterprise team: to win internal buy-in and budget
  • Buyer of an AI tool: to test vendors' marketing claims before signing
  • Your career: evals skills are in high demand for AI engineer, FDE and PM roles
โš ๏ธ "Ship and pray" only works when the stakes are low
A meme generator can afford to be wrong. A bot that advises students, patients, borrowers or employees cannot. The more regulated your industry, the less optional evals become.

1.5 "Can't we just buy an eval tool?"

Once your manager agrees evals are needed, the next question is usually: "There are many eval tools on the market. Why not just buy one? Why reinvent the wheel?" It is a fair question. Model providers and many startups now sell evaluation platforms, often with impressive customer stories ("we cut evaluation time by 40%"). Tools genuinely help. But buying a tool does not do the thinking for you. Here is why.

โš–๏ธ Problem 1: AI judges have biases

Most eval tools are built around LLM-as-a-judge: one model grades another. That judge is itself an LLM, with LLM habits:

๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘ง Self-preference ("nepotism")
Research has found that judges tend to prefer answers written by models from their own family (similar training, similar style). Ask an OpenAI judge to compare an OpenAI model with a Claude model, and the scores can lean towards OpenAI.
โ†”๏ธ Position bias
When comparing two answers side by side, many judges prefer whichever one is shown first (or second), regardless of quality.
๐Ÿ“ Length bias
Judges often give higher scores to longer answers, even when the short answer is better.
๐Ÿ” Worked example: catching position bias with a "swap test"

Ask the judge to compare answer X and answer Y twice: once as (X, Y) and once as (Y, X). A fair judge should pick the same answer both times.

JUDGE = """Which answer explains the student's doubt better?
Doubt: {q}
Answer 1: {a1}
Answer 2: {a2}
Reply with only "1" or "2"."""

def judge(q, a1, a2):
    r = client.chat.completions.create(model="gpt-6-luna", reasoning_effort="none", temperature=0,
        messages=[{"role": "user", "content": JUDGE.format(q=q, a1=a1, a2=a2)}])
    return r.choices[0].message.content.strip()

flips = 0
for q, x, y in comparison_pairs:            # 100 doubts, each with two candidate answers
    first  = judge(q, x, y)                 # "1" means it chose x
    second = judge(q, y, x)                 # "2" means it chose x
    chose_x_both_times = (first == "1") == (second == "2")
    flips += not chose_x_both_times
print(f"Judge changed its mind on {flips}/100 pairs just because the order changed")

Output:

Judge changed its mind on 17/100 pairs just because the order changed

17% of verdicts depended on order, not quality. A tool's dashboard would show you a confident number either way. Only a deliberate check like this reveals the problem. (Common fix: run both orders and count a win only when they agree.)

๐Ÿค– Problem 2: who judges the judge?

Some teams respond by training their own judge model. That just moves the question: how do you know the new judge is right? You still need humans. Human judgement is the anchor that defines what "good" means in the first place. If you remove humans from the loop entirely, the system slowly optimises for what the judge likes, which can drift away from what users need.

๐Ÿง  Think of it likeโ€ฆA school that lets one teacher check all the board-exam copies with no moderation. If that teacher secretly prefers neat handwriting, students learn to write neatly, not to answer correctly. Moderation by a second examiner (a human check on the judge) is what keeps marking honest. ๐Ÿ“

๐Ÿ“ฆ Problem 3: ready-made metrics don't know your product

Tools ship with generic metrics such as "hallucination score", "toxicity" and "helpfulness". They are convenient, but they don't decide whether your product succeeds. No generic metric knows that DoubtBot must give hints, not homework answers, or must escalate a distressed student to a human. Those are your product's rules, and you have to define and measure them yourself.

๐Ÿค Problem 4: the trust gap

A conversation that happens in many review meetings
๐Ÿ‘ฉโ€๐Ÿ’ป Engineer
"We ran 20 eval metrics. Everything is green. Hallucination 2%, helpfulness 4.6/5."
๐Ÿ‘” Business head
"Who decided 4.6 is good? Who graded it? An AI graded an AI and the AI says the AI is great? Why should I trust this?"
Numbers without a clear, human-agreed definition of "good" don't win trust.
๐Ÿ’ก The key insight of this sectionTools are good at automating evaluations. But automation is not the hard part. The hard part is deciding what to measure, what good looks like, and what cannot be automated and needs human or expert judgement. No tool can decide that for you. That thinking is what this series teaches. (Chapter 5 reviews eval tools honestly and shows when buying one makes sense.)

1.6 The evals lifecycle: before and after launch

Teams that do evals well follow a surprisingly similar workflow. It has two halves: pre-release (offline, before real users see it) and post-release (online, with real users).

The AI evals and analytics lifecycle
Pre-release ยท offline evals
โ‘  Qualitative evalsa quick, hands-on look at outputs; find how it fails (Chapter 2)
โ‘ก Quantitative evalsautomated metrics on test sets; run again and again (Chapter 3)
only if it meets the bar
โ‘ข Experiment / pilotreal users, small scale; does it drive business impact? (Chapter 4)
๐Ÿš€ Deploy
Post-release ยท online
โ‘ฃ Monitoringwatch eval, product and business metrics continuously (Chapter 4)
โ‘ค Analyticsfind insights and new opportunities; feed them back into the next version
Press the button to follow DoubtBot from its first rough test to its first month in production.
Before launch: evals drive development
Each change (new prompt, new model, new chunking) is checked against the test sets before it ships, the same way test-driven development works in normal software. This is called evaluation-driven development. Evals also inform the final release decision.
After launch: evals become diagnostics
The job isn't done at launch. You keep tracking eval metrics alongside product metrics (usage, escalations) and business metrics (TA hours saved, student satisfaction). Eval metrics now act as early-warning signals, so you catch problems before users complain.
โš ๏ธ Why experiments come last, and only after a bar is metA pilot with real users is the most expensive and slowest step (real students, real TAs, weeks of data). So teams gate it: only when qualitative and quantitative evals look good enough do they spend on a pilot. And the pilot matters, because a system can score well on every offline metric and still not be used the way you expected.
๐Ÿง  Think of it likeโ€ฆLaunching a new dish at a restaurant chain. โ‘  The chef tastes it and spots obvious problems. โ‘ก A food lab tests 100 samples for salt, oil and consistency. โ‘ข It's served in two branches for a month to see if customers order it again. ๐Ÿš€ It goes on the menu everywhere. โ‘ฃโ‘ค Head office watches sales, complaints and reviews every week, and uses that to improve the recipe. ๐Ÿ›

1.7 The one-page evals plan (go / no-go document)

A common failure pattern: teams rush to build and launch without ever writing down what the product should do and what success looks like. A short planning document fixes that. It acts as a checkpoint: before anyone says "ship it", these questions must have written answers. It has three parts that follow the lifecycle above.

The three parts of an evals plan
Part 1 ยท Scope & owners
  • Problem and business need
  • What's out of scope
  • Baseline: what we do today without AI, and its key number
  • Investment: budget, people, timeline
  • Pass/fail rule for launch
  • Team, experts and veto holders
Part 2 ยท Pre-release evals
  • Quick hands-on check: top user journeys, show-stoppers, stop rules
  • Metrics table: primary metric, guardrail metrics, supporting metrics, each with an owner, test set and threshold
  • Experiment plan: control, method, sample size, hypothesis
  • Launch readiness checklist and the final Go / Conditional Go / No-Go
Part 3 ยท After launch
  • Leading indicators (early warnings) with targets, check frequency, owner and action
  • Lagging indicators (real impact)
  • Who looks at what, how often, and what they do when a number goes red
๐Ÿ” Worked example: the first page of DoubtBot's plan
FieldDoubtBot
Decisionโ˜ Go โ˜ Conditional Go โ˜ No-Go ยท Owner: Product manager, Learning team ยท Decision date: before batch 14 starts
Executive summaryStudents wait ~6 hours for TA replies; many give up. DoubtBot answers course doubts instantly with hints and hands hard or sensitive cases to TAs. Expected: faster help for students, TAs focus on difficult doubts. Risk of doing nothing: lower course completion as batches grow.
Out of scopeGrading assignments; career counselling; doubts from other courses
BaselineHuman TAs only. Median first reply 6 h. TAs spend ~70% of time on repeat concept doubts.
Primary metric & pass ruleShip only if DoubtBot resolves โ‰ฅ 60% of doubts without escalation and all guardrails hold.
Guardrails (any failure = No-Go)Zero leaks of another student's data; full-solution rate on graded assignments โ‰ค 2%; 100% of distress messages escalated to a human
TeamPM ยท ML engineer ยท Data/eval analyst ยท SMEs: 2 senior TAs + course instructor
Veto holdersCourse instructor (teaching quality), Legal/Privacy (student data), Student-success head (well-being)
Example default fail rules for the quick check
  • Automatic fail if any privacy or safety violation can be reproduced.
  • Fail if an error or slowness breaks a key user journey and there is no fallback.
  • Fail if a large share of samples (for example one in five) shows the same type of defect: that's a pattern, not bad luck.
Why write it down?
It forces the hard conversations early ("Who decides 60% is enough?"), it gives veto holders a place to sign, and six months later it tells everyone why the product was launched. It is also exactly the document an enterprise client or auditor asks for.

1.8 Scoping an evals project

Every evals project starts like any other project: define the scope. Start from the product, not from the metrics. Five questions:

Five scoping questions
1. What problem are we solving?the business need behind the AI product
2. What is the baseline?what we compare against (often humans)
3. What does success look like?the key metric + the pass/fail rule
4. Who defines success?owners, experts, veto holders
5. What must never happen?the constraints (often forgotten!)

Start from the PRD

A useful team exercise: take the product requirements document (PRD) and map it to the eval plan. A good PRD should tell you the key user scenarios, the guardrails and the release criteria. In practice, PRDs often miss some of these. Finding those gaps together, before testing starts, is part of the evals work.

PRD โ†’ evals plan
PRD
tells you
Key scenarios / use casesGuardrailsRelease criteriaWho is on the evals team
Missing any of these? Write it down as an open question and settle it with the team before you start testing.
๐Ÿ” Worked example: DoubtBot's mini-PRD, decoded
"DoubtBot is a 24ร—7 AI teaching assistant for the DSA course. It answers students' doubts step by step using the course material, adapts to each student's level, and hands over to a human TA when it is unsure or when accuracy or safety limits are reached."
ProblemGoalsRoles
One TA for ~250 students, so replies are slow and uneven. Students need accurate, step-by-step help at the moment they are stuck (often at 11 pm before a deadline). Access: available 24ร—7
Quality: clear, step-by-step help that matches the course notes and the instructor's teaching style
Workload: take routine doubts off TAs' plates
PM (owner)
SMEs: instructor, senior TAs
Tech: data/eval, UX, engineering
Veto holders: instructor, privacy/legal, student-success head

Baseline: human TAs. Key metric: resolution rate without escalation (how often DoubtBot fully answers a doubt without needing a TA).

๐Ÿงฑ Scope = capabilities + constraints

Here is the mistake almost everyone makes: they define what the product should do and forget to define what it must not do.

๐ŸŒ Real-world patternA company launches a customer-support bot. It works perfectly for its job: users can cancel subscriptions, track orders, get refunds. Then curious users start asking it unrelated things: write a poem, give medical advice, answer questions that could put a vulnerable person at risk. The bot happily answers all of them, and screenshots go viral. Nothing was "broken"; nobody had written down the constraints, so nobody tested them. This has happened to well-known brands.
โœ… What DoubtBot SHOULD do (capabilities)
  • Explain DSA concepts accurately, at the student's level
  • Help debug code with hints, step by step
  • Adapt to the student's progress
  • Escalate to a TA when unsure
โ›” What DoubtBot must NOT do (constraints)
  • Knowledge boundary: answer questions from outside the course
  • Academic integrity: write graded assignments for students
  • Well-being: handle a distressed student alone; it must hand over to a human
  • Privacy: reveal any student's marks, email or phone number
๐ŸŽฎ Try it: capability or constraint?

For each student message, decide what DoubtBot should do. Click an option to check your answer.

โœ… Scoping recap
What problem?
Business need ยท Baseline ยท What must not happen
Who defines success?
Key players ยท SMEs ยท Veto holders
How is success measured?
Key metric ยท Pass/fail gate ยท Timeline

1.9 Who does what: evals is a team sport

Many companies assume evals are the PM's job: the PM designs the tests, runs them and uses the results. For a small, simple bot that can work. For anything serious, evals need several roles working together. The PM can coordinate, but no single role can own it all.

The evals core team
๐Ÿงญ Product managerdefines success ยท champions evals ยท gets resources and roadmap time ยท assembles the team
๐ŸŽจ UX / user researchturns user interviews into "what to measure" ยท finds critical user journeys ๐Ÿ“Š Data / evals teamturns goals into metrics ยท builds test sets ยท makes evals repeatable and automated ๐ŸŽ“ Subject matter expertssay what "good" looks like ยท shape metrics and rubrics ยท review results ๐Ÿ›  Engineeringsupports the evals ยท uses the results to fix and improve the system
Plus the veto holders, who are not on the team day to day but can stop the launch.
๐ŸŒ How a big-tech product team typically splits itImagine a team launching an AI feature that turns documents into short audio podcasts, for listeners in two countries. The PM sets the vision ("we're launching for listeners in country A and country B"). The UX researcher talks to real listeners and learns that one group prefers a short, crisp style while the other enjoys a more energetic one. The data scientist turns that into something measurable: a rubric such as "is this podcast too excited / not excited enough?" on a numeric scale, graded by human raters and an AI judge, with raters from both countries so the scores aren't biased towards one audience. PM = vision, UX = the humans, data = making it measurable.
๐Ÿง  Think of it likeโ€ฆMaking a film. The director (PM) decides what film we're making and keeps everyone moving towards it. Audience research (UX) tells you what viewers actually want. The editor and camera team (data) turn the vision into precise, repeatable shots. The technical adviser (SME), like a real police officer advising on a cop film, says "no cop would ever do that". The crew (engineering) builds the sets and fixes what breaks. And the censor board (veto holders) can stop the release. ๐ŸŽฌ

๐ŸŽ“ Bring subject matter experts in early

For a simple e-commerce or SaaS support bot, one person can sometimes run the evals: anyone can tell if "where is my order?" was answered correctly. But in many fields, a non-expert cannot tell a good answer from a subtly wrong one:

๐Ÿฉบ Healthcare
Is this dosage advice safe?
๐ŸŽ“ Education
Does this hint teach, or give away the answer?
โš–๏ธ Legal & finance
Is this clause interpretation or tax rule right?
๐Ÿ–ผ Multimodal
Is the X-ray or chart read correctly?
โš ๏ธ The expensive mistake: calling experts in at the endMany teams build first and invite experts only when problems appear. By then you may discover your metrics measured the wrong things, your rubric missed what matters, and your "passing" system fails in real use. All that work has to be redone. Involve SMEs from day one: they help define what to measure, what good looks like and which risks to avoid.
๐ŸŽฏ Interview tip"Evals are cross-functional. The PM owns the definition of success and the release decision, UX tells us what users actually care about, the data team turns that into reproducible metrics and test sets, SMEs define and validate what 'good' means for domain-heavy cases, and engineering uses the results to improve the system. I also list veto holders up front so the launch decision isn't blocked at the last minute."

1.10 Summary

Chapter 1 on one page
What
Eval = exam for AITest set ยท rubric ยท metricSystematic, defined criteria, real usage
Why
Leaderboards disagree & leakProduct โ‰  modelAgents compound failuresLaws & buyers ask for proofTools don't do the thinking
How
Qual โ†’ quant โ†’ pilot โ†’ deploy โ†’ monitor โ†’ analyseOne-page evals planScope = capabilities + constraintsCross-functional team + SMEs early
โœ… Key takeaways

๐Ÿ“ Quick quiz (click to reveal the answer)

Q1. Map these to AI-eval terms: question paper, one question, marking scheme, marks per subject.Question paper = test set. One question = test case. Marking scheme = rubric (the defined criteria). Marks per subject = a metric.
Q2. Give three reasons a leaderboard rank doesn't prove your product is good.(1) Leaderboards disagree with each other. (2) Benchmarks can be contaminated: the model may have memorised the questions. (3) They rank bare models on generic tasks, not your product with your prompt, data and constraints.
Q3. How would you check if a model has memorised a benchmark question?Remove something essential (the image, the options, the second half of the question) and see if the model still produces the exact answer, or ask it to continue the question text word for word.
Q4. A pipeline has 5 agents, each failing 2% of the time, independently. Chance at least one fails?1 โˆ’ 0.98โต โ‰ˆ 1 โˆ’ 0.904 = 0.096, about 9.6%. In real systems it's usually higher because agents depend on each other.
Q5. Name two biases of LLM judges and one way to detect one of them.Self-preference (favouring its own model family), position bias (favouring the first or second answer) and length bias (favouring longer answers). Detect position bias by running each comparison twice with the order swapped and counting how often the verdict flips.
Q6. Why do experiments/pilots come after quantitative evals?Pilots are the slowest and most expensive step (real users, weeks of data), so teams only run them once the product passes the qualitative and quantitative bar.
Q7. What does "scope = capabilities + constraints" mean? Give a DoubtBot constraint.You must define both what the product should do and what it must never do, and test both. DoubtBot constraints: don't answer outside the course, don't write graded assignments, always hand distressed students to a human, never reveal another student's data.
Q8. Who are veto holders, and why list them on day one?Stakeholders who can stop the launch (e.g. the instructor, legal/privacy, the student-success head). Listing them early means their concerns become eval criteria, instead of blocking the launch at the last minute.
Q9. Why is "the PM owns evals" usually not enough?Evals need user insight (UX), reproducible metrics and test sets (data), domain judgement (SMEs) and system fixes (engineering). The PM coordinates and owns the decision, but can't do all of it.
Q10. What is evaluation-driven development?Using evals before launch the way test-driven development uses unit tests: every change to the prompt, model, data or tools is checked against the test sets before it ships, and the results drive the next iteration and the release decision.

๐Ÿ“– Glossary

TermMeaning in one line
AI evalA systematic, repeatable test of an AI system against criteria defined in advance.
Test case / test setOne input with what a good output looks like / a collection of them.
RubricThe marking scheme that defines good, average and bad answers.
MetricA number that summarises eval results (e.g. accuracy 87%).
Benchmark / leaderboardA public test set / a ranking of models by benchmark scores.
ContaminationWhen benchmark questions were in a model's training data, so it can answer from memory.
Vibe checkInformal "try a few questions and see"; useful, but not an eval.
LLM-as-a-judgeAn LLM that grades another system's outputs using a rubric.
Self-preference / position / length biasA judge favouring its own model family / an answer's position / longer answers.
Offline vs online evalsTests before release on test sets / measurement in production with real users.
Evaluation-driven developmentUsing evals to guide every change before launch, like test-driven development.
BaselineThe current way of doing the job (often humans), which the AI is compared against.
Guardrail metricA metric that must stay within limits for launch, whatever the primary metric says.
SMESubject matter expert who defines and checks what "good" means in a domain.
Veto holderA stakeholder who can stop the launch.
PRDProduct requirements document.