An LLM can write your tests, but who checks the tests? EvalGen has you grade 16 outputs, then keeps the checks that agree: 4 checks reach 73% coverage where an automatic baseline needed 9 for 49%.
Learn how to line up an automatic grader with your own taste, and why your taste moves while you grade.
Pick a judge below. It marks some of 20 model answers as failures. You graded the same 20. Watch how often it agrees with you. Then we build, piece by piece, the checks, the two counts, the score, the tool, the sampler and the surprise at the end.
You need a feel for what a language model answer is and a little Python for the code. We build the rest from zero.
Based on Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human Preferences (arXiv 2404.12272, UIST 2024) by Shreya Shankar, J.D. Zamfirescu-Pereira, Björn Hartmann, Aditya G. Parameswaran and Ian Arawjo. Every idea is re-taught here in our own words and devices. It is a reading for Stanford CS 329Z, Engineering AI Agents.
Illustrative: the 20 outputs, your grades and the three judges are invented to show the idea. The two counts and the alignment score are the paper’s definitions (Appendix A.3 of arXiv 2404.12272).
Chapter 0
See why a grader that nobody checks can fool you, and what this paper builds to fix that
Picture a small team that ships a chatbot for a clinic. The bot reads a call transcript and writes a short summary. Every week someone edits the prompt. Every week the team asks the same question: did the edit make the summaries better or worse?
Nobody can read a thousand summaries by hand. So the team builds a second program that reads them. It marks each summary pass or fail. The team now looks at one number, the pass rate, and trusts it.
This lesson is about the one thing that plan forgot. Who checked the program that does the checking?
A prompt template is a piece of text with a hole in it, such as “Summarize this call: {transcript}”. You fill the hole with real inputs and send the result to a language model. The model writes an output. The prompt, its model and its outputs together are the pipeline under test. The paper’s word for this work is prompt engineering: edit the prompt, run it on many inputs, look at what comes back.
Looking at what comes back is the hard part. A person can judge ten outputs. A pipeline makes thousands. So tools let you write an evaluator: a function that takes one output and returns pass or fail. Some evaluators are ordinary code, such as “is the summary under 150 words?”. Others call a second model, which then acts as a judge. You hand the judge a rubric such as “The response is not apologetic”, and it answers for each output.
The paper makes the point in one line. A model that grades is a model, so it has all the faults of the model it grades. Its grader prompt is still a prompt. The authors cite work showing that prompts react in surprising ways to small changes in wording or format. They also note that a model asked to pick the best answer from a set can be pushed around by the order of the set.
They describe a real case. Researchers posted a preprint that claimed GPT-4 could ace the MIT EECS exam. Within hours, other people showed the claim was wrong. One cause was that GPT-4 had been used to grade itself. That is a judge nobody validated.
The paper adds a second human weakness. People over-trust an AI that sounds sure. They also over-generalize: they see one bad output and decide the whole prompt is bad, or they check a few outputs and decide all are fine. Existing tools, the authors say, mostly leave users to trust the evaluator output or to check it by hand.
Try the problem yourself. A judge below fails some of twenty outputs. At first you see only its verdicts. Reveal your own grades five at a time and count how often the two of you disagree.
A cross means the judge fails that output. A teal fill means you graded it bad. Press the button to reveal your grades for the next five outputs. A red edge marks a disagreement.
Illustrative: the outputs, your grades and the “friendly tone” judge are invented. The lesson is the shape of the problem: a judge can look confident while it disagrees with you on more than half of the outputs.
With no grades revealed, the judge looks fine. Each cross is a firm verdict. Only your grades show that it misses most of the bad outputs and fails some good ones. A pass rate alone hides that.
The authors want to keep the speed of an automatic judge and add a person’s check at low cost. They build EvalGen, a screen added to the open source prompt tool ChainForge. It is a mixed-initiative design: the model proposes, the person edits and grades, and both steer. The pieces, in order, are:
An LLM suggests criteria, plain-language things a good output must do. For each criterion, an LLM writes several candidate checks. While those run, the person gives a thumbs up or thumbs down to a few outputs. The tool then keeps the checks that agree with those grades best, and shows a report card.
The paper tests this two ways. An offline run compares EvalGen with an automatic baseline called SPADE on two pipelines. A study with nine practitioners shows how people really use it. The study found a result the authors did not plan for. People’s criteria change while they grade. The authors name this criteria drift, and Chapter 9 gives it a full chapter.
The craft of scoring agents and models is covered in our agent evaluation lesson. A close cousin of this paper is JEV as a Judge, which builds a cheap judge that escalates when unsure. This lesson asks a different question: how do you know your judge agrees with you?
Suppose the clinic team reads a pass rate of 80% and ships. The symptom is a quiet one. Weeks later, users still complain about summaries that leak a name. The measurement was never taken: nobody counted how many of the leaking summaries the judge actually failed. The fix is the habit this lesson teaches. Grade a small sample yourself, and count the agreements and the disagreements.
Chapter 1
Turn a vague wish into a pass or fail check, written as code or as an LLM grader prompt
A teacher marks a stack of essays with a rubric. The rubric has lines such as “gives a source” and “stays under two pages”. Each line is a yes or no question about one essay. The mark is the pile of answers.
An evaluation of a language model works the same way. This chapter builds the vocabulary: the rubric line, the check that answers it, and the two ways to write that check.
Start with a wish. You want the clinic summaries to leave out private details. That wish is a criterion: one plain-language thing a good output must do. The paper’s criteria are binary, so each one is a yes or no question. Examples from its two test pipelines: “absence of personal information” and “word count near 150”.
A criterion in words is not yet a test. You need a function that reads an output and answers. The paper calls this function an assertion. In software, an assertion is a line in a unit test that stops the test if a fact is false. The paper borrows the word: an assertion is a boolean function that returns true or false for one output.
We will write it as a function f. It takes one input and output pair e (the filled prompt, plus what the model wrote) and returns 1 for pass or 0 for fail.
A set of assertions, one or more per criterion, is a metric in the paper’s wording. An output fails the metric if any assertion in the set fails it. Keep that “any”. It matters in Chapter 2.
A code-based assertion is ordinary Python. It is cheap, fast and exact. It cannot judge anything it cannot compute. Here is one for a word count.
def near_150_words(output: str) -> int:
n = len(output.split()) # count the words
return 1 if 100 <= n <= 200 else 0
An LLM-based assertion is a grader prompt. You send the output and a rubric to a second model, and the model answers true or false. It can judge fuzzy things, such as tone. It costs a model call each time, and it can be wrong in ways that are hard to see.
GRADER = """You check one rule.
Rule: the summary contains no personal information (name, age, gender, ID).
Summary: {output}
Answer with exactly one word: true if the rule holds, false if it does not."""
def no_pii(output: str) -> int:
reply = call_llm(GRADER.format(output=output)) # a second model
return 1 if reply.strip().lower() == "true" else 0
The data flow is the same for both. In: one string. Out: one bit. Inside, one function uses a few lines of logic and the other uses a model. The pipeline does not care which.
Take the criterion “no personal information”. A quick code version looks for two capitalized words in a row, which is how a full name looks. The device below runs that rule and an LLM grader on four short summaries. Pick a summary and pick a judge. Watch for the places where the verdict and your grade differ.
Choose a summary, then choose how to judge it. The box shows the function or prompt, its verdict, and your own grade of the summary.
Illustrative: the four summaries are invented. The code check is a real regular expression that runs on them. The LLM verdicts are written by hand to show a good grader; a real grader prompt can also be wrong, which is the paper’s whole point.
The code check fails Summary C because “Chief Complaint” looks like a name. That is a wrong rejection of a good output. It passes Summary D because “Ana” is one word. That is a miss. Both errors come from one idea of how a name looks. The grader reads meaning, so it gets all four right here.
You can see why the paper does not simply say “use LLMs”. The grader is a prompt, and prompts change with wording. And you cannot tell, by looking at the code or the prompt, which of the two will agree with you. You have to measure it. We start measuring in the next chapter.
Here is how a bad assertion shows up. The symptom: your dashboard says 97% of summaries pass the PII check, yet you spot a leaked name in the third output you open. The measurement: grade twenty outputs yourself, then count how many of your bad ones the check failed. If it failed two of eight, it is blind to most leaks. The fix: write more candidate checks, score each against your grades, and keep the best. Chapters 2 and 5 show how. Reword a grader prompt and rerun it, and the verdicts can change too, so a grader needs this test as much as code does.
In code, the input and output pairs are often a list of small records, each with an input string and an output string. An assertion reads the record and returns a bit. Nothing more is needed.
Chapter 2
Measure how well a set of checks agrees with your own grades, using two plain counts
An airport has a metal detector. It can go wrong in two ways. It can stay silent while a dangerous bag passes. Or it can beep at a harmless belt buckle. A good detector does neither often, and you need two counts to know. One count cannot tell you.
A set of assertions is a detector for bad outputs. This chapter defines the two counts the paper uses, and shows that each alone can be fooled.
The paper has no hidden answer key. The reference is you. You look at an output and press thumbs up or thumbs down. A thumbs down means the output is bad. We write yi = 1 when you graded output i bad, and yi = 0 when you graded it good. This is our notation. The paper’s idea is the same.
One more rule from the paper. A thumbs up is read as “this output passes every criterion”. So if an assertion fails an output that you liked, the tool counts that as a mistake by the assertion.
Compare the set’s verdicts with your grades. Every output lands in one of four boxes. The paper shows this as a confusion matrix when you hover over a criterion on its report card.
| Your grade | Set fails it | Set passes it |
|---|---|---|
| Bad (y = 1) | caught: the set did its job | missed: a bad output slipped through |
| Good (y = 0) | false failure: a good output was rejected | correctly passed |
Two rates come from the four boxes. Coverage asks: of the outputs you call bad, how many does the set fail? False failure rate, or FFR, asks: of the outputs you call good, how many does the set wrongly fail? High coverage and low FFR are what you want.
Note the two different denominators. Coverage lives inside the bad outputs. FFR lives inside the good ones. That is why a set can score well on one and badly on the other.
Use the twenty outputs from the hero. You graded 8 bad and 12 good. The word count check fails outputs 3, 8, 11 and 14. Outputs 3, 8 and 11 are among your bad ones. Output 14 is one you liked.
Step 1: caught bad outputs = 3, so coverage = 3 ÷ 8 = 0.375. Step 2: wrongly failed good outputs = 1, so FFR = 1 ÷ 12 = 0.083. The check is careful, but it sees little. It catches under half of the bad outputs.
Now add the PII grader, which fails outputs 1, 4, 13 and 16. All four are bad. Step 3: the set fails a bad output if either check fails it. The union of caught bad outputs is {1, 3, 4, 8, 11, 13, 16}, which is 7, so coverage = 7 ÷ 8 = 0.875. Step 4: the only false failure is still output 14, so FFR stays at 0.083. Two modest checks together cover a lot.
Use the device to see how the counts move as you switch checks on and off.
Each button adds one judge to the set. An output fails the set if any judge in it fails the output. Try the “friendly tone” judge on its own, then all three.
Illustrative: the same 20 outputs, grades and judges as the hero. Coverage and FFR are computed exactly as the paper defines them (Appendix A.3).
Two things stand out. Adding judges can only add failures, so coverage and FFR can only go up together. And “fail everything” reaches coverage 100%, which looks wonderful until you read the FFR. Both counts are needed, and the next chapter folds them into one number.
def coverage_and_ffr(assertions, outputs, y):
# y[i] = 1 if the person graded output i bad, else 0
def fails(e): # fails the SET if ANY assertion returns 0
return any(f(e) == 0 for f in assertions)
bad = [e for e, yi in zip(outputs, y) if yi == 1]
good = [e for e, yi in zip(outputs, y) if yi == 0]
coverage = sum(fails(e) for e in bad) / len(bad)
ffr = sum(fails(e) for e in good) / len(good)
return coverage, ffr
A set that fails 40% of all outputs sounds strict, so it sounds safe. The symptom: you trust it because it fails so much. The measurement: split its failures by your grades. Say it fails 8 outputs out of 20, but only 3 of those are bad ones, and you graded 8 bad in all. Coverage is 3 over 8, which is 37.5%. The other 5 failures hit good outputs, so FFR is 5 over 12, which is 41.7%. The fix: judge a set by both numbers, and set a limit on FFR before you start, as Chapter 5 shows.
Chapter 3
Combine the two counts into a single score, and see why a simple average would be fooled
Two smoke alarms hang in a hallway. The first never rings, so it never rings for burnt toast. The second always rings, so it always rings when there is a fire. Both are useless. You would like a score that says so.
The paper wants one number to rank candidate sets of checks. That number must be high only when coverage is high and the false failure rate is low. This chapter builds it and shows why the obvious choice fails.
Coverage is better when it is high. FFR is better when it is low. To compare them, flip FFR. Take good kept = 1 − FFR, the share of your good outputs that the set lets through. Now both numbers are better when high, and both sit between 0 and 1.
Score the two alarms. The silent one has coverage 0 and good kept 1. The noisy one has coverage 1 and good kept 0. Each has one perfect number and one terrible number.
The plain average of the two numbers gives (0 + 1) ÷ 2 = 0.5 to the silent alarm. It gives (1 + 0) ÷ 2 = 0.5 to the noisy alarm. A set that does nothing and a set that rejects everything both look half decent. That is wrong for ranking.
The fix is the harmonic mean. Start from the reciprocal, 1 ÷ x. A tiny x makes a huge reciprocal. Average the two reciprocals, then flip back. The result is pulled hard toward the smaller number. If either number is zero, the harmonic mean is zero.
This equals 2 ÷ (1 ÷ coverage + 1 ÷ good kept), the harmonic mean written the long way. The paper notes that it looks like the F1 score from classification. The difference is the target: here the “positive” event is a failure, and the unit scored is a whole set of checks.
Take the hero’s word count check. Coverage 0.375, good kept 0.917. Product: 0.375 × 0.917 = 0.344. Twice that: 0.688. Sum: 1.292. Alignment = 0.688 ÷ 1.292 = 0.53. The plain average would say 0.65.
Take the pair of word count and PII. Coverage 0.875, good kept 0.917. Twice the product: 1.604. Sum: 1.792. Alignment = 0.895. When both numbers are good, the two means agree.
The paper’s Table 1 uses the same formula. Product pipeline, EvalGen: coverage 0.73, FFR 0.39, so good kept 0.61. Twice the product is 0.891, the sum is 1.34, and alignment is 0.6646, which the table prints as 66.46. SPADE has coverage 0.49 at the same FFR: 0.598 ÷ 1.10 = 0.5435, printed as 54.35. Try these numbers in the device.
Drag the two sliders, or tap a preset. The green bar is alignment. The tick on it marks the plain average, which is easy to fool.
The Table 1 presets use the coverage and FFR the paper prints (arXiv 2404.12272, Table 1). Other slider positions are your own choices.
Look at “Always fails”. The plain average sits at 50%. Alignment is 0%. That is the point of the harmonic mean.
Suppose a tool ranked candidate checks by plain average. The symptom: it would keep a check that fails every output, because its coverage is perfect. The measurement: alignment of that check is zero. The fix is the harmonic mean, and also the paper’s false failure rate threshold, which Chapter 5 shows.
def alignment(coverage, ffr):
kept = 1 - ffr # share of good outputs let through
if coverage + kept == 0:
return 0.0
return 2 * coverage * kept / (coverage + kept)
alignment(0.73, 0.39) # 0.6646, the EvalGen row of Table 1 (product pipeline)
alignment(1.00, 1.00) # 0.0, fail everything
alignment(0.00, 0.00) # 0.0, fail nothing
The paper uses alignment at two levels. For each criterion, the report card shows the alignment of the chosen assertion, and a confusion matrix if you hover. For the whole set, it shows coverage and false failure rate across all chosen assertions. Per-criterion numbers tell you which check to fix. Set numbers tell you whether the metric as a whole agrees with you. A set can hold one weak check and still do well overall, because another check covers the gap. Read both, and look at the weakest criterion first.
Chapter 4
Follow one session from the first click to the report card, and see why grading happens while the machine works
You run a small restaurant and you are testing a new recipe. The kitchen needs ten minutes to prepare the sauce. You could stand and wait. Or you could taste yesterday’s dishes and say which were good. Ten minutes later the sauce is ready, and the kitchen already knows your taste.
That is the core design of EvalGen. A person cannot fully check a model judge, because the judge exists to save the person’s time. So EvalGen asks for a little work, in time that would be lost anyway.
The paper builds EvalGen inside ChainForge, an open source tool for prompt engineering. In ChainForge you wire boxes called nodes: an input node feeds a prompt node, which sends many prompts to a model. The authors add a Multi-Eval node, which holds several evaluators and runs them all on the outputs of the node before it.
A button on that node opens the wizard. It offers three ways to begin: Infer (a model suggests criteria from your prompt), Manual (you write them), or Grade First (you grade at least five outputs before any criteria appear). Then the session runs in five steps.
After the report card you return to the main ChainForge screen. The chosen assertions sit in the Multi-Eval node. You run them on all outputs and read a table where each row is an output and each column is an assertion.
Follow the data through the stages. The table lists what goes in and out at each one, as the paper describes it.
| Stage | In | Out | Who acts |
|---|---|---|---|
| Criteria suggestion | the prompt under test | binary criteria in plain language | GPT-4 proposes, you edit |
| Candidate synthesis | one criterion, code or LLM type | several candidate assertions, streamed one by one | GPT-4 |
| Execution | each new candidate, all pipeline outputs | a pass or fail bit per output, and a pass rate | executor, with broken candidates dropped |
| Grading | the next output chosen by the sampler | thumbs up or thumbs down | you |
| Selection | all grades, all candidates | one assertion per criterion, plus a report card | the tool, under your FFR limit |
Two design choices stand out. First, the pipeline is online, meaning it works as results stream in. When a new candidate arrives, the executor runs it at once on every output. It drops candidates that are obviously bad, such as Python that crashes. SPADE, the earlier system the authors build on, works offline and solves one big optimization problem at the end.
Second, the grade is one bit for the whole output. You do not mark each criterion. A thumbs up means the output passes all criteria. A thumbs down means it fails at least one. That is noisy, and it is fast. The authors chose speed here. Chapter 8 shows that some users asked for per-criterion grading.
Slide time forward in the device. See what the machine makes, and what you grade, at each moment.
The top lane is the machine writing and running candidate checks. The bottom lane is you grading outputs. Drag the time, or press play.
Illustrative: the timings, the 4 criteria and the 12 candidates are invented. The paper describes the order (candidates stream in while you grade) but gives no timing.
The point of the lanes is the overlap. If candidate writing took 60 seconds with nobody to grade, you would lose 60 seconds of your attention. Here you give about a dozen grades in the same minute, and the report card is ready when both lanes finish.
The authors say it directly. The only way to fully align an LLM judge would be to ask the person to label every output, and that defeats the purpose. So the design bets on a sample. Chapter 6 asks which outputs make a good sample.
def evalgen_session(prompt, outputs, ask_user):
criteria = llm_suggest_criteria(prompt) # you edit these
pool = {c: [] for c in criteria} # candidate assertions
grades = {} # output index -> 1 (bad) or 0 (good)
for c in criteria: # runs in the background in the real tool
for cand in llm_stream_candidates(c):
if runs_without_error(cand, outputs): # cull broken code at once
pool[c].append(cand)
while ask_user.wants_to_grade(): # "I'm Tired" ends this loop
i = sampler.next(outputs, pool, grades) # Chapter 6
grades[i] = ask_user.thumb(outputs[i])
return {c: most_aligned(pool[c], outputs, grades) for c in criteria}
Each start option suits a different state of mind. Infer suits the person who has a prompt and no list of rules. Manual suits the person who already knows what they want. Grade First suits the person who has a feeling and no words for it. Two study participants began by grading, and one said the other options probably were not the best start, because they could not have pulled every rule from the prompt alone. While grading they found rules the prompt never stated. A participant who did not grade first said the tool should make everyone look at at least 20 examples before writing criteria.
Chapter 5
Generate several checks per criterion, throw out the broken ones, and keep the best one that fails too few good outputs
You ask six friends to each write a rule that spots rambling summaries. One friend hands in a rule that crashes. One writes a rule so strict that it rejects most good summaries. One writes a rule so loose that it rejects nothing. Two are decent. You do not need all six. You need the best one that does not annoy you.
EvalGen does the same with a model as the friend. This chapter shows why it asks for many candidates, how it throws some away, and how it picks one winner per criterion.
A single request to a model gives one reading of a criterion. That reading may not match yours. The paper gives two reasons to ask for several. More candidates raise the chance that at least one agrees with you. And for code, a model sometimes writes a broken function, for example one that calls a library function that does not exist, so you need spares.
The tool makes one call to GPT-4 per criterion. The model writes several candidates inside marker tags and streams them out. Each time the tool sees a closing marker, it parses that candidate and hands it to the executor. The executor runs it on every pipeline output right away. If it crashes, the tool drops it. This is the cull.
Each surviving candidate gets a pass or fail bit for every output. As you grade, the tool compares those bits with your thumbs. Remember the rule from Chapter 2: a thumbs up means the output passes every criterion. If a candidate fails an output you liked, the tool ranks it lower.
It then computes the candidate’s coverage, false failure rate and alignment from Chapters 2 and 3. These are recomputed each time you grade, so the ranking improves as your sample grows.
At the end, for each criterion, the tool picks the candidate with the highest alignment. You can also set a false failure rate threshold, written τ. The tool then considers only candidates whose FFR is at or under τ. In the user study the report card used τ = 20% and picked the candidate with the highest coverage inside it.
Here is a pool of five candidates for the criterion “keep the summary near 150 words”. Candidate A crashed and is already gone. B passes 100 to 200 words and fails few outputs. E passes only 140 to 160 words and fails many. F fails everything. Move τ in the device and watch the winner change.
Each dot is a candidate check: coverage up, false failure rate across. Candidates right of the line are not allowed to win. The ring marks the winner. Drag the limit.
Illustrative: the five candidates and their coverage and FFR are invented. The selection rule is the paper’s: highest alignment among candidates within the FFR threshold (Sections 4.1 and 7.2.4).
With a tight limit the winner is careful but sees little. With a loose limit the winner catches more and also rejects more good outputs. At τ = 100% the candidate that fails everything may enter, but its alignment is zero, so it still loses. That is the harmonic mean doing its job.
Sometimes every candidate disagrees with you. The paper reports participants who saw this. They had a tacit idea of the criterion that the model did not share, and no number of grades fixed it. Some deleted the criterion with no complaint. One said, “I like that it tries, because maybe there will be a good implementation!” The report card helped: they could see low scores and discard a check, instead of trusting it blindly.
def select(candidates, outputs, y, tau=0.20):
best, best_al = None, -1.0
for f in candidates: # survivors of the cull
cov, ffr = coverage_and_ffr([f], outputs, y)
if ffr > tau: # too many good outputs rejected
continue
al = alignment(cov, ffr)
if al > best_al:
best, best_al = f, al
return best # None means: no candidate fits you
Picture the stream for one criterion, “no links”. The model writes candidate one inside its markers. The tool sees the closing marker, parses the function and runs it on all 100 outputs at once. It records the pass rate, say 62% (an invented number), as the candidate’s selectivity. Candidate two crashes on an output with no text, so the tool drops it. Candidate three arrives while you are grading output seven. By the time you stop, each survivor has a pass or fail bit for every output, and your grades say how well each bit agrees with you. Nothing waits for the slowest call.
Chapter 6
Pick a few outputs for a person to grade, using how often each check passes
A teacher has 100 exam papers and time to grade 16 of them, to test a new answer key. Which 16? If she grabs the top of the pile, they might all come from one class. If she grabs only the weird ones, she may never see a normal paper. The choice of sample shapes what she learns.
EvalGen faces the same choice. You will grade only a few outputs. This chapter shows how the tool picks them, and what the authors measured about the options.
The tool has no grades for most outputs. It still has the verdicts of every candidate assertion. It uses them to guess which outputs are probably bad. The guess rests on one number per assertion, its selectivity: the share of outputs it passes.
Think of two guards at a door. One guard stops almost everyone. When he stops you, that says little. The other guard waves nearly everyone through. When she stops you, that says a lot. An assertion with low selectivity is the first guard. An assertion with high selectivity is the second.
The paper turns this into a score for each output, to say how likely the output is poor. We write it so that a higher number means more suspicious.
Worked example. Three assertions have selectivity 0.9, 0.5 and 0.1. Output X is failed only by the first: s = 0.9. Output Y is failed by the second and the third: s = 0.5 + 0.1 = 0.6. Output Z is failed by none: s = 0. So X is the most suspicious, even though Y was failed twice.
This number moves. Each new candidate that runs, and each grade you give, updates the pass rates and the scores. The paper adds that the very first one or two outputs you grade are close to random, because the scores have not settled yet.
| Policy | Picks | Risk |
|---|---|---|
| Random | outputs uniformly at random | a lucky or unlucky sample, so results vary a lot |
| Highest | the outputs with the largest s(e) | you see mostly bad outputs and few good ones |
| Lowest | the outputs with the smallest s(e) | you see mostly good outputs and few bad ones |
| Alternating | one high, then one low, and so on | no guarantee, but a balance of bad and good is likely |
The authors used alternating in their user studies. They say they hoped it would give a balanced sample of good and bad grades, and they do not claim it is best. They also explain why they did not pick the middle scores, the way active learning does when it asks about the cases it is least sure of. Their score measures how likely an output is poor. It does not say whether a model is unsure.
Try the four policies on a toy pool. Each bar is one output, ordered by suspicion. The teal mark under a bar means you would grade that output bad.
Pick a policy. Bars in the warm colour are the 16 outputs you would be asked to grade. For random, press Draw again and watch the sample change.
Illustrative: the pool, the four toy assertions and the grades are generated from a fixed seed. They show how the policies behave. The paper’s own test (Appendix A.4, Figure 4) found that random sampling gave much more variable alignment than the other three over 10 trials of 16 outputs.
Highest fills the sample with bad outputs. Lowest fills it with good ones. Alternating balances them. Random is the odd one: press Draw again a few times and the mix of bad and good keeps changing. That swing is what the authors measured as large variance in alignment.
For the test in Appendix A.4, the authors drew 16 outputs per trial, with 10 trials per policy, on both pipelines from Chapter 7. The candidate assertions stayed the same. Random sampling gave a wide spread of alignment. The three policies that use the suspicion score gave consistently higher alignment than random. Alternating did not always win. The authors conclude that any non-random policy in EvalGen may do well enough.
def suspicion(e, assertions, selectivity):
return sum(selectivity[f] for f in assertions if f(e) == 0)
def next_to_grade(outputs, graded, assertions, selectivity, turn):
todo = sorted((i for i in range(len(outputs)) if i not in graded),
key=lambda i: suspicion(outputs[i], assertions, selectivity))
return todo[-1] if turn % 2 == 0 else todo[0] # alternating: most, then least suspicious
The symptom: your report card says 90% alignment, yet the check behaves badly in production. The measurement: look at what you graded. If you graded only the most suspicious outputs, your good pool holds few outputs, and one false failure there moves FFR a lot. Or you graded only easy ones, and you never saw the odd cases. The paper cites earlier work that stresses a representative graded sample. It also says the very first one or two grades are close to random, because the scores have not settled. The fix: sample from both ends, keep going past the first few grades, and treat a small sample as a first look.
Chapter 7
Read Table 1 and see what a few human decisions at the criteria step buy
Two cooks write a menu for a wedding. The first cook works alone and writes nine dishes, some nobody asked for. The second cook asks the couple three questions first and writes four dishes. Which menu fits the couple better, and which is easier to run? You could taste both.
The paper runs this kind of taste test. It compares EvalGen with a fully automatic system called SPADE on two real pipelines. This chapter reads the setup and Table 1 line by line.
SPADE is an earlier system that the authors build on. It reads the history of a prompt and writes criteria and candidate Python assertions by itself. Then it solves an integer linear program, an exact optimization method, to find the smallest set of assertions that meets a coverage target and an FFR limit. No person takes part. It works offline.
EvalGen differs in two ways. The user edits the criteria before candidates are made. And the selection step uses the user’s grades on a small sample, picking the most aligned assertion per criterion inside an FFR threshold.
The medical pipeline takes 84 transcripts of doctor and patient calls. The prompt asks the model to extract six items (such as the main complaint and the symptoms), to leave out personal information, and to stay near 150 words. The product pipeline takes 100 Amazon products with reviews. It asks for an SEO-friendly description in Markdown, with no links, no weaknesses of the product and under 300 words.
The authors ran GPT-3.5-Turbo once per input. Two of the authors graded every output to make the answer key. For the medical outputs, 68% were good, and 27 of 84 were bad. For the product outputs, 51% were good, and 49 of 100 were bad. Common faults were personal information in the medical outputs, and bad reviews or long text in the product outputs.
First the authors ran SPADE end to end with all graded outputs and an FFR limit of 10%. The medical pipeline met that limit. The product pipeline did not, and the limit had to rise to 40% before SPADE found a set. That alone shows the tension between coverage and false failures that Chapter 2 described.
Then they ran EvalGen at the same limits. The authors chose the criteria. For the medical pipeline: word count, presence of the six keys (both code) and absence of personal information (an LLM grader). For the product pipeline: no negative reviews (an LLM grader), no links, Markdown format and word count (all code). EvalGen got only 16 graded outputs per pipeline, not the full 80 to 100, since nobody grades that much in one sitting.
| Metric | Medical EvalGen | Medical SPADE | Product EvalGen | Product SPADE |
|---|---|---|---|---|
| Dataset size | 84 | 84 | 100 | 100 |
| Bad outputs | 27 | 27 | 49 | 49 |
| Assertions | 3 | 5 | 4 | 9 |
| Coverage | 0.33 | 0.33 | 0.73 | 0.49 |
| FFR | 0.10 | 0.10 | 0.39 | 0.39 |
| Alignment (%) | 48.29 | 48.29 | 66.46 | 54.35 |
Read it in three passes. On the medical pipeline, the two systems tie on every quality number. EvalGen needs 3 assertions and SPADE needs 5. On the product pipeline, EvalGen has higher coverage (0.73 against 0.49) at the same FFR (0.39), with 4 assertions against 9. That is less than half as many. Alignment follows: 66.46 against 54.35. Check one cell with Chapter 3: 2 × 0.49 × 0.61 ÷ 1.10 = 0.5435.
Use the device to flip between the pipelines and compare bar by bar.
Pick a pipeline. Teal bars are EvalGen, with a person in the loop at the criteria step. Warm bars are SPADE, fully automatic.
All values are the paper’s Table 1 (arXiv 2404.12272). The assertion bars use a scale of 9, the largest count. Both systems were run on two pipelines graded by the authors, so treat the result as a small, careful test and not as a broad ranking.
The paper also says why SPADE’s sets were larger. On the medical pipeline it added unneeded assertions, such as one for neutral tone, and it split the checks on the six keys into more criteria than needed. On the product pipeline it produced some unrealistic checks, such as a Python function that flags phrases like “never order” and “disappointed”. EvalGen’s set used an LLM grader for the same job, to check that the description stayed positive.
Three cautions. First, an alignment of 48.29 on the medical pipeline is not high. Coverage is 0.33, so two thirds of the bad outputs still pass every check. Second, the criteria for EvalGen came from the paper’s authors, who also did the grading, so the “human” here is not a stranger. Third, there are only two pipelines. The authors state the limits themselves, and Chapter 10 returns to them. The study in Chapter 8 tests the tool with people who are not authors.
Both systems were scored against the same key. Two of the paper’s authors graded every output, 84 medical and 100 product. That gives the counts you saw. Of 84 medical outputs, 27 were bad, which is 32% bad and 68% good. Of 100 product outputs, 49 were bad, which is 49% bad and 51% good. These counts set the pools that coverage and FFR divide by. For EvalGen, the key was used only through the 16 grades it received. SPADE was shown all of them. EvalGen matched or beat it on quality with far fewer labels, though the criteria came from the authors.
Chapter 8
Read the user study: how people used the tool, what they liked, and why their ratings split
Imagine sitting behind nine people, one after another, as each tries a new tool and says aloud what they think. You write down every sigh and every “oh, nice”. After nine sessions you have no statistics, but you have a very clear sense of where the tool helps and where people get stuck.
That is a think-aloud study, and it is the second half of the paper. This chapter reads how it ran and what the nine people did. Chapter 9 reads the surprise they produced.
The authors posted on Twitter, asking for anyone who wanted to solve the problem of “who validates the validators”. They took the first nine who had coded and built LLM pipelines for a company or product. The group included software engineers, ML scientists, startup executives and independent consultants.
Each session ran over Zoom. After five minutes of introductions, the participant opened a ChainForge pipeline for named entity recognition (NER) on 100 tweets, using GPT-3.5-Turbo. NER means finding the names of people, places and organizations in text. The prompt asked for up to three well-known entities per tweet, one sentence for each, as a Markdown bullet list, and no hashtags as entities. People could change the task or the prompt.
The authors showed the tool’s parts, then gave the participant remote control of the screen and up to 40 minutes to build an assertion set while thinking aloud. A short interview followed, with a 7-point rating of the statement “I felt like the assertions aligned with my grades”. Whole sessions lasted 45 minutes to 1 hour 15 minutes. The authors coded the transcripts with open and axial coding: first tag single remarks, then group the tags into themes.
All nine used the NER task. Three changed the prompt, and one of them switched the task to sentiment analysis. At the start of EvalGen, six pressed auto-generate. One wrote a criterion and then pressed auto-generate. Two chose to grade first. Those two graded between 5 and 10 outputs, with 2 to 4 thumbs-down.
After they saw the suggestions, people removed some and added one or two of their own. They rarely changed the code-or-LLM type, even in the few cases where the tool suggested a type that did not make sense, such as an LLM call to count words. They graded while candidates generated: some for up to ten minutes, some for only ten outputs. Three of nine opened the wizard a second time to iterate, and more than half said they would have iterated if they had more time.
Eight of nine were pleasantly surprised that the suggested criteria matched what they wanted. One said the suggestions helped with writer’s block. Another summed up the hope: “basically I want the AI to do 80% of it, and there can be escape hatches if the AI fails.” All but one found it a good use of time to grade while waiting. The table of results over all 100 outputs, with a row per output and a column per assertion, “earns trust”, as one person put it.
Four people wanted to give grades for each criterion, not one thumb for the whole output. Two wanted to swap the chosen assertion for another candidate. Some wanted to see the code of each candidate. Some wanted their grades fed back to the model that writes candidates. One wanted a different FFR limit per criterion, because some criteria must always pass and others may fail now and then.
The nine ratings of “the assertions aligned with my grades” were 6, 5, 3, 4, 5, 3, 1, 2 and 5. Add them: 34. Divide by nine: 3.78. Four people gave 5 or more, one gave 4, and four gave 3 or less. The paper calls the responses mixed. Look at the three views in the device.
Pick a view. The first shows each person’s alignment rating out of 7. The second shows how they began. The third marks who changed their criteria while grading.
All values are from the paper’s Table 2 and Section 7 (arXiv 2404.12272). Nine volunteers recruited on Twitter: the paper runs no significance test, and neither do we.
Why did ratings split? The authors point to one cause. The people with low confidence were still unsure of their own criteria while they graded. Five participants in all said things like “I guess” and “sure” in a questioning tone as they pressed thumbs. A tool cannot align to a target that is still moving. The next chapter is about that moving target.
Three limits shape how much to read into it. The nine people were all experienced with LLMs, so novices may behave differently. They had at most 40 minutes, so long projects are untested. And the study did not compare EvalGen with a control, such as a team working without the tool, so it cannot say how much time the tool saves. What it does show is a set of real behaviors, in the participants’ own words, and one robust surprise about criteria. The authors say these findings support the tool as a starting point, with caveats.
Chapter 9
Watch a rule change while you grade, and see why that breaks the idea of fixing criteria first
A new teacher marks her first stack of essays with the rule “cites a source”. By essay ten she notices students who cite a source that does not exist. Now the rule must mean “cites a real source”. She goes back to the first nine and changes two marks. Her rule did not exist in final form until she had read the essays.
The paper saw the same thing in its study, and gave it a name: criteria drift. It is the most important finding in the paper, and it changes how to think about all evaluation of language models.
To grade an output, you need criteria: some idea of what good means. To write criteria, you need to look at outputs and see what goes wrong. Each needs the other. The authors write that people “needed to externalize criteria in order to grade outputs, but they also needed to grade outputs, providing feedback on why bad outputs were bad, in order to externalize criteria.”
Even the two participants who graded first still refined their criteria on later grades, and some changed earlier grades. Drift is not a sign of a careless person. It is how people come to know what they want.
The first kind: new criteria appear. A participant sees a new type of bad output and wants a rule for it. Five of nine did this (P2, P5, P6, P8 and P9). In the prototype they could not add a criterion mid-way. They had to wait for all candidates to run, pass the report card and start again.
The second kind: old criteria are reread. Two participants wrote the criterion “the entities extracted were proper nouns”. At first, any output with an entity that was not a proper noun got a thumbs-down. Then they saw that outputs held varying numbers of proper nouns. They wanted to change the rule to “most entities are proper nouns”.
One participant gave a bad grade not because the output looked bad but to stay consistent with earlier grades. That is good labeling habit, the authors note, and bad for alignment. Another saw hashtags such as #justdoit in some outputs, and the word Nike, without the hash, in others. That made them rethink what the hashtag rule meant. “I think it’s hard to know until you see it,” they said.
Write the grade as a function of the criterion. Output e, graded under criterion c, gets the grade y.
Chapters 2 and 3 treated y as fixed. Drift says y depends on c, and c depends on what you have seen of the outputs. So the “ground truth” moves while you measure against it.
Try one case with six outputs. Each card holds an answer with three entities, and a dot is filled when that entity is a proper noun. Pick a grading rule, and pick an assertion. Watch what happens to alignment when only the rule changes.
A filled dot is a proper noun. Teal fill means you graded the output bad under your current rule. A cross means the assertion fails it. A red edge means they disagree.
Illustrative: the six outputs are invented to echo the proper noun example from Section 7.3.1 of the paper. The idea (a rule drifting from “all” to “most”) is the paper’s; the numbers are not.
Under the strict rule, the assertion “every entity” scores a perfect 100%. After you relax your rule, the very same assertion drops to 75%, because it now rejects two outputs you accept. The other assertion rises from 50% to 100%. Nothing about the outputs or the assertions changed. Only you changed.
A reader may guess that criteria settle after an hour of grading. The authors doubt it. The criteria shifted to fit how the model actually behaved. They are dependent on the outputs, not independent of them. The authors point to the courts as a parallel: standards for hard cases are never fully fixed. One participant said people “know a bad output when they see it”. The authors note that this echoes a famous 1964 Supreme Court remark, and they cite a legal scholar who argues that subjectivity is not the same as irrationality.
The cost for practice is large. Any change in a pipeline can start a new drift: a new model, an edited prompt, a changed step upstream. Methods that need settled criteria and large expert-labelled sets are shaky. The authors name AutoCalibrate as one. So the design lesson is to let criteria and implementations change together, and to ask for re-grades when criteria change.
def regrade(outputs, rule):
# the same outputs get new grades when the rule is reread
return [1 if rule(e) == "bad" else 0 for e in outputs]
strict = lambda e: "bad" if e.n_proper < e.n_total else "good"
relaxed = lambda e: "bad" if 3 * e.n_proper < 2 * e.n_total else "good"
# alignment(F, regrade(outputs, strict)) != alignment(F, regrade(outputs, relaxed))
The symptom: your alignment score for a check drops after you grade a few more outputs, though the check did not change. The measurement: list the grades you changed, and note why. If you changed them because your rule moved, that is drift, not error. The fix has three parts, all from the paper’s discussion. Let criteria and checks be edited together while you grade. Ask for re-grades when a criterion changes. And give the examples you graded to the LLM grader, as good and bad cases, so its prompt follows your current rule. The authors compare this to teachers, who update a rubric as they read more work and then regrade.
Chapter 10
Learn when each kind of judge fits, and where the authors say the method stops
To measure a plank you use a ruler. To decide whether a joke is funny you ask a person. A ruler is fast and exact but only knows length. A person knows funny but tires and varies. Picking the wrong one wastes the job.
The same choice sits inside every assertion: code or an LLM grader. This chapter reads what the study found about that choice, what the authors say about putting assertions to work, and where they say their own work stops.
Participants had a clear sense of when to use each. For formatting checks, counts and checks for or against exact phrases, they preferred code. Two of them said that most criteria in their own pipelines were fuzzy, so they wanted LLM graders. One chose an LLM grader whenever they could not think of a Python function for the job. One liked LLMs because they cope with an output of unexpected shape, while a code check tests an exact rule.
They also asked for different things from the two kinds. For code, many wanted to see the code and choose the function themselves. One put it plainly: when the job can be done in Python, they already have an implementation in mind that they can verify, and seeing the code is quicker. One said they read code of 10 lines or less, and for longer functions they would rather check the results. For an LLM grader, reading the prompt tells you much less, so people trusted it less. One participant said, “I cannot begin to think about how LLMs as validators [in production] can work, I’m very skeptical.”
The paper’s own pipelines follow the same split. For the medical pipeline, word count and the six required items were code, and absence of personal information was an LLM grader. For the product pipeline, no negative reviews was an LLM grader, and no links, Markdown format and word count were code. Sort six criteria yourself.
Each card is a criterion from the paper’s medical or product pipeline. Pick code or an LLM grader, then read why the paper chose as it did.
The six criteria and their types are the paper’s (Section 5.2.1, arXiv 2404.12272). The explanations are our reading of the paper’s discussion of code and LLM evaluators in Section 7.4.
Notice the rule of thumb the cards teach. If a short function can decide it exactly, write the function. If the criterion needs reading for meaning, use a grader, and then validate that grader with grades. That second step is the point of the whole paper.
Participants wanted to run their assertions in production. Some wanted them in the critical path, meaning each output is checked before a user sees it. Others wanted a passive daily report on a sample. The two uses need different things. In the critical path a false failure costs real time, because the pipeline may rerun the prompt and add delay. So the FFR limit matters most there. Code checks suit the critical path. LLM graders suit a sampled report.
def guard(prompt, call_model, code_assertions, max_tries=3):
for _ in range(max_tries):
out = call_model(prompt)
if all(f(out) == 1 for f in code_assertions): # cheap, exact checks only
return out
return out # give up after max_tries; log it, and let a sampled LLM grader review later
Teams raise new questions. When several people grade, graders will disagree, so a tool needs a way to handle inter-rater reliability. The authors suggest ideas from crowdsourcing, such as modelling each grader’s accuracy. They also imagine a “pull request” for a new assertion, reviewed by a teammate, much like code.
The paper lists its own limits. The offline test covers two pipelines, and other tasks may need other sampling and alignment methods. The study had nine experienced developers, with too little time to iterate many times, and it did not cover deployment. Assertions return only pass or fail, so they miss finer facts such as how long outputs are, compared with a typical run. Many real systems are chains of several model calls, or include retrieval, and aligning evaluation from end to end is harder. The authors also ask whether “alignment” is even a reachable goal when no fixed set of true labels exists.
Here is our reading, not the paper’s. Sixteen grades is a small sample. If 8 of them are good, one false failure moves the FFR by 12.5 points. A report card from that sample is a first look, not a certificate. Re-grade when your prompt, model or criteria change.
Take the guard function above. Suppose the code checks wrongly fail 10% of good outputs, and the guard allows 3 tries. A good output costs one call if the first try passes. With 10% false failure it costs a second call 10% of the time, and a third call 1% of the time. The expected calls per good output are 1 + 0.1 + 0.01 = 1.11. At 30% false failure it is 1 + 0.3 + 0.09 = 1.39. This is our arithmetic, and it assumes each retry fails independently. It shows why the FFR limit should be tighter in the critical path than in a sampled report.
Chapter 11
Keep the numbers, a checklist, the core code, and where to read next
An LLM can write tests and grade outputs, but nobody has checked that it agrees with you. EvalGen asks the model for criteria and many candidate checks. It asks you for a few thumbs. It keeps the check that best agrees with them, scored by coverage, false failure rate and their harmonic mean. The user study adds a warning: while you grade, your criteria move, so alignment is a target you keep re-aiming at.
| Number | What it is | Where |
|---|---|---|
| 73% against 49% | product pipeline coverage, EvalGen against SPADE, at the same FFR of 0.39 | Table 1 |
| 4 against 9 | assertions in the final set on the product pipeline | Table 1 |
| 66.46 against 54.35 | alignment (harmonic mean of coverage and 1 − FFR), product pipeline | Table 1 |
| 48.29 | alignment of both systems on the medical pipeline, coverage 0.33 | Table 1 |
| 16 | graded outputs given to EvalGen per pipeline in the offline test | Section 5.2.1 |
| 84 and 100 | outputs in the medical and product pipelines; 68% and 51% graded good | Section 5.1 |
| 10% then 40% | FFR limit for SPADE: the product pipeline needed 40% to find a set | Section 5.2.1 |
| 9 | practitioners in the think-aloud study, up to 40 minutes each, 100 tweets | Section 6 |
| 8 of 9 | were pleasantly surprised that suggested criteria matched their own | Section 7.2.1 |
| 3.78 of 7 | mean rating for “assertions aligned with my grades” (6, 5, 3, 4, 5, 3, 1, 2, 5) | Table 2 |
| 5 of 9 | participants who showed criteria drift (P2, P5, P6, P8, P9) | Section 7.3.1 |
| 20% | FFR threshold behind the report card in the study | Section 7.2.4 |
| Term | Plain meaning |
|---|---|
| Criterion | a yes or no question about one output, in plain words |
| Assertion | a function from one output to pass or fail, as code or a grader prompt |
| Coverage | share of your bad outputs that the set fails |
| False failure rate | share of your good outputs that the set fails by mistake |
| Alignment | harmonic mean of coverage and (1 − FFR) |
| Selectivity | pass rate of one assertion over the outputs |
| Mixed-initiative | the model proposes, the person steers, and both move the result |
| Criteria drift | your criteria change while you grade, so they depend on the outputs you have seen |
This list is our own summary of the lessons, in the order you would use them. Tick what you have done on a project of yours.
Tick each step you have done. The read-out tells you how far along you are.
Our summary of the paper’s lessons. It is not a list from the paper.
All of Chapters 1 to 6 fit in one short function. This is our sketch of the idea in Python, not the authors’ code.
def validate_the_validators(prompt, outputs, user, tau=0.20):
criteria = llm_suggest_criteria(prompt) # Ch 4: you edit this list
chosen = {}
for c in criteria:
pool = [f for f in llm_candidates(c) # Ch 5: many candidates
if runs_without_error(f, outputs)] # cull the broken ones
y = user.grades(sample(outputs, pool)) # Ch 6: a few thumbs, picked by suspicion
best = max((f for f in pool if ffr([f], y) <= tau), # Ch 5: stay under the FFR limit
key=lambda f: alignment(coverage([f], y), ffr([f], y)), # Ch 3
default=None)
chosen[c] = best # None: no candidate fits you
return chosen # then regrade whenever criteria or prompts change (Ch 9)
This paper sits between two lines of work. One is LLM-as-a-judge, where a model grades another model’s answers. The other is interactive machine learning, where people steer a model by labeling examples. EvalGen joins them: the judge is generated, and the person validates it with a few labels. The authors also cite promptfoo and EvalLM as tools that support LLM evaluators, and SPADE as the direct predecessor.
For the craft of scoring agents, see our agent evaluation lesson. For a judge that escalates when unsure, read JEV as a Judge. For error bars and sample sizes, see the statistics of evaluation. For a benchmark built with care for trust, see Terminal-Bench and benchmark auditing. For prompts themselves, see prompt engineering. The course around this paper starts at what agentic systems are, and an earlier lecture, data for agents, shows what agents learn from.
Who Validates the Validators? Aligning LLM-Assisted Evaluation of LLM Outputs with Human Preferences was written by Shreya Shankar, J.D. Zamfirescu-Pereira, Björn Hartmann and Aditya G. Parameswaran of UC Berkeley, and Ian Arawjo of Université de Montréal. It appeared at UIST 2024 and was posted as arXiv 2404.12272 in April 2024. Read the original at arxiv.org/abs/2404.12272. EvalGen is built inside the open source ChainForge. Every number in this lesson comes from that paper, except where a device says it is illustrative.