Chapter 24. Evaluating AI Workers: Golden Sets, Judges and Failure Modes
- Approved by
- Panaversity ·
Start here if you skipped Chapter 23
If you read Chapter 23, skip this. If you came from an earlier chapter, these are the words this chapter builds on. Each is explained again, briefly, where it is used.
| Word | What it means | Where this chapter uses it |
|---|---|---|
| The AP worker | Brightline's AI Worker for accounts payable (AP), the team that checks and pays a company's bills. It answers questions about invoices and policies, and cites a policy line for each answer | Everywhere |
| The portal | Brightline's own web site, where a person signs in and asks the worker a question. Its code also starts the worker's runs | 24.3 |
| Session | One run of the hosted worker, with its events recorded by the platform | 24.7, 24.8 |
| The morning triage | A scheduled run that starts at 7:10 every weekday, with a budget of $0.50. It gives every open invoice one decision and a policy line, with nobody at a desk | The point, 24.3 |
| Check by code | Plain code that compares the worker's report with something the model did not write, such as the tool results the platform recorded (23.16). It is the gate: the check that decides whether work may go on | 24.3 |
| Grader | A separate checker with its own context window. It judges, and it can be wrong (23.17) | 24.4 |
| Stop reason | Why one model response stopped: finished, wants a tool, declined, and a few more (21.3) | 24.7, 24.8 |
| Status | The number an API response carries. 200 means the API accepted the request. 400 means it rejected the request (21.9) | 24.7, 24.8 |
| Trace | The record of one run, step by step: each request, each tool call and each result (21.10) | 24.7, 24.8 |
| Schema | A written description of what valid data looks like: which fields, which types, which values (14.5) | 24.1, 24.3 |
| Answer check | Four questions written with the AP expert in Chapter 19, one of them Brightline's, each with the decision she expects, the line it must cite and the claim it must not make. She read each answer by hand (19.16) | 24.2 |
| Staging workspace | A separate part of the account for tests, with its own keys and its own spending limit (23.4, and its spending limit in 23.13) | 24.4, Lab 24 |
The point
Monday, April 12, 2027. At 7:10 the AP worker ran the morning triage, as it does every weekday. It gave every open invoice a decision and a policy line, inside its budget of $0.50. Before the session started, the portal's code had read each new invoice and written down its fields. Nobody was at a desk.
At 8:40 Ana Morales arrives. Ana is Brightline's AP analyst, and the worker's rules are hers. She has twenty minutes for the worker today. The triage is already done. On Friday the builder also opened a pull request that changes the worker's prompt, and a test run put 40 cases to the changed worker. That is 40 more answers. Tomorrow at 7:10 there will be more, and the day after that.
The book's operating rule says: humans define intent, AI Workers execute, humans verify outcomes. In Chapter 19 the check was reading. An AP expert read four answers, one of them Brightline's, and marked each one pass or fail (19.16). That worked for four answers at a desk. It does not work for a worker that runs before she arrives.
So this chapter asks one question. Ana cannot read every answer the worker gives. Who speaks for her on the answers she will not read?
Why it matters
Anthropic's exam prep course tells this story.1 A team built a feature that read order documents and pulled out their fields. The team checked a dozen results by hand, and every result passed every validation rule. Then a document said "ordered on March 3, received April 12". The feature took April 12 as the order date. The value was a real date in the right field, so every rule passed it. The rules checked the shape of the value. Nobody had written down the right value for a document with two dates, so nothing could say this one was wrong.
Brightline's worker can fail in the same hidden way. An answer can cite the right policy line, name the right approver, and still put two steps in the wrong order. A total can be a valid number of cents and still be the wrong number. No error appears, and every response ends in a normal way. The only thing that can tell a right answer from a wrong one is the judgment of the person who knows the work.
How this chapter works
Ana's judgment reaches the worker's answers in three carriers. A carrier is something that holds her judgment and takes it where she is not.
- She writes it down once. For each of 40 cases, Ana gives the answer she expects. These 40 cases are the golden set, and her expected answers are her labels (24.1, 24.2).
- Code checks what code can, on every pull request. Each extracted field is compared with her value. Each answer must cite her line and contain her words. A check by code stays the gate (24.3).
- A judge reads what only reading can check, such as the order of two steps. The judge is a separate model with a rubric, a written list of what a good answer has, made from Ana's reasons. It marks each answer correct, incorrect or unknown (24.4). Its marks count only as far as it agreed with Ana on 10 held-out answers, which are answers it never saw while its rubric was written (24.5).
Figure 24.1. Ana writes the golden set once. Code and a judge carry her judgment to the worker's answers. Every "incorrect", every "unknown" and every live failure comes back to her.
What Ana still reads. She reads every answer the judge marks incorrect or unknown, and every failure found in live work. On this Monday that is one answer, and the chapter follows it from Friday's pull request to her mark. When she agrees an answer failed, the builder reads its trace and names the failure (24.7 to 24.9).
What this does not reach. The worker that writes the 7:10 answers is one that passed the suite. The suite is the 40 cases run together as one test. Each morning's report is still checked by code against its tool results. The invoices that the portal's code extracts each morning get only a check of shape, until Chapter 25 adds a check of value. But a live answer unlike any of the 40 cases reaches Ana only when she or a check finds it wrong. Reading a sample of live answers is Chapter 35's subject.
Concepts 24.1 to 24.9 teach the method. Where one needs a product fact, it says so in a line marked In Claude. Concept 24.10 compares Claude, OpenAI and open-source tools, and the lab names the tools it uses.
What you will build
Who's who. You are the builder. You build and run the AP worker for Brightline, with coding agents. Ana Morales is Brightline's AP analyst. She labels all 40 cases, and she defines what a good answer is. This chapter needs her at every step, so plan the work with your own expert the same way.
Where you are. At the end of Chapter 23 the worker runs as a hosted agent inside Brightline's portal. It answers questions, and it triages open invoices at 7:10 every weekday. Nothing yet says whether a change to the prompt made the answers better or worse.
What you build. As before, coding agents write every file and run every command. You specify, check and approve.
- An extraction step. Extraction means reading a document and writing its fields as data. For each new invoice, the portal's code calls the model once, before the 7:10 session starts, and asks for the invoice's fields as JSON. Code checks the result with Chapter 14's schema. A result that fails goes to
needs_review, with no retry. - The golden set: 40 cases in
data/golden/cases.yaml, which are 25 AP questions and 15 invoice extractions, with Ana's labels indata/golden/labels.csv. - The suite.
npm run evalruns the 40 cases, and.github/workflows/eval.ymlruns them on every pull request, with a pass threshold, the lowest result that still passes. - A judge, with a rubric written from Ana's reasons, measured against her marks, her pass or fail on recorded answers, on answers it never saw.
- A report that shows, for every result, who marked it: code, the judge or Ana.
- Six recorded traces, one for each kind of failure, which you name and sort. One goes back into the golden set as a new case, with Ana's label. The set then has 41 cases, and the threshold moves from 39 of 40 to 40 of 41.
The lab takes three sittings and ends tagged ch24. The chapter's story shows the finished suite at work, and in the lab you build it. It ends with one extraction case still failing, on purpose. Chapter 25 starts from that case.
In this chapter
| Concept | The question it answers |
|---|---|
| 24.1 From a quality goal to a measure | How does something Ana says become a check that anyone can run? |
| 24.2 Golden sets, written with the expert | Where is her judgment written down, and which cases belong in it? |
| 24.3 Behavioral checks and regression tests in CI | What can code check on every pull request, and why does code stay the gate? |
| 24.4 LLM-as-judge: a rubric and a separate model | Who reads what only reading can check? |
| 24.5 Calibrating the judge against human labels | Why should a model's mark count at all? |
| 24.6 Metrics you can defend | What does a number say, and what can 40 cases not show? |
| 24.7 Naming the failure | Which of six failures is this one? |
| 24.8 Integration layer or model output | Did the fault begin in the code around the model, or in what the model wrote? |
| 24.9 Recovering by cause, not symptom | Which fix removes the cause, and how does the failure stay fixed? |
| 24.10 How today's tools realize it | Which carrier is each of today's tools? |
| Lab 24 | Ana's labels first. Then the extraction step, the suite and the judge, a broken prompt the suite catches, and six traces to name |
Sources
- Owner
- Panaversity