Topic 4 of 5 · 5 min read
Expected answers versus grading criteria
Goal: Choose for each case whether to store a reference answer or a criteria checklist and write it.
Store a reference answer when there is one right output you can compare against; store criteria, a list of things the response must and must not do, when many different outputs would be correct.
Check yourself · 1 of 3
For which task is a stored reference answer the best fit?
Why it matters
The storage choice decides how you can grade. A reference answer allows an exact or near-exact match, which is cheap and stable. But if you demand an exact match from an open-ended task such as summarising or drafting an email, correct answers fail and the score punishes good wording. Criteria let a human or a grading model judge any valid answer.
Pick by task type
| Task | Store | Why |
|---|---|---|
| Extract the invoice total | Reference answer (1,240.50) |
One right value, exact match works |
| Classify a ticket into a category | Reference label | Fixed label set |
| Generate a SQL query | Reference result of running it | Different queries, same rows |
| Summarise a meeting | Criteria | Many good summaries |
| Reply to an angry customer | Criteria | Tone and content matter, not wording |
| Refuse an out-of-scope request | Criteria | The behaviour matters, not the sentence |
Writing good criteria
- Make each item checkable. "Mentions the refund deadline of 30 days" can be answered yes or no. "Is helpful" cannot.
- Split must-include from must-not-include. Must include: the order number and the next step. Must not include: a promise of compensation, a made-up policy, the customer's address in the reply.
- Keep it short. Three to six items. A long checklist is hard to grade and hides which item matters.
- Mark the items that fail the whole case. An invented policy is worse than a missing greeting.
- Add a reference as an example, not a target. A model-graded eval can show the grader a good sample answer, labelled as one valid way.
Before and after
Weak: the case stores one full summary paragraph as the "expected output" and scores by string similarity. A summary with different words and the same facts scores 0.4 and fails.
Fixed:
{
"id": "summary-031",
"input": "<meeting transcript>",
"criteria": {
"mustInclude": ["The decision to move launch to 14 March", "Dana owns the vendor contract"],
"mustNotInclude": ["Any decision not stated in the transcript", "Speaker names invented by the model"]
}
}
What goes wrong
- Exact match on free text fails correct answers.
- Vague criteria such as "good tone" give different grades from run to run.
- Reference answers copied from a model carry that model's mistakes into the key.
Examples
Same task, two storage choices
Classify tickets into billing, shipping or account: store the label. Reply to a billing ticket: store criteria such as "states the correct refund window" and "does not promise a refund the policy does not allow". The label task uses exact match; the reply task needs a grader.
A vague criterion rewritten
"Answers politely" becomes two checkable items: "Opens by acknowledging the problem the customer described" and "Contains no blame wording such as 'you should have'".
Key points
- Use a reference answer when one output is right and can be compared cheaply, such as a label, a number or query results.
- Use criteria when many different responses would be correct, such as summaries, drafts and refusals.
- Each criterion must be checkable with a yes or no, split into must-include and must-not-include.
- Keep criteria lists short and mark the items that fail the whole case.
- A reference answer can still be shown to a model grader as one valid example, not as the only valid one.
Common mistakes
- Scoring free-text outputs by string similarity to a single reference.
- Writing criteria that cannot be answered yes or no.
- Piling on 15 criteria so no one knows which one matters.
- Using a model's output as the reference without an expert reviewing it.
Check yourself · 2 of 3
Which criterion is checkable enough to store?
Check yourself · 3 of 3
Why is scoring a summary by string similarity to one reference summary a problem?
Practice items, not counted towards your mastery.
Start here
- Develop test cases (Claude docs) (opens in a new tab)DocsFree
Anthropic's guidance on eval design: realistic task cases, edge cases, automated grading and volume over polish.
- promptfoo: Test case datasets (opens in a new tab)DocsFree
How to load test cases from CSV, JSON, spreadsheets and generated files into a runnable eval.
- Evaluation best practices (OpenAI) (opens in a new tab)DocsFree
Covers building datasets from production data, edge cases and continuous evaluation.
More for this topic
- Patterns for Building LLM-based Systems and Products (Eugene Yan) (opens in a new tab)ArticleFree
Field patterns for evals, including reference-based versus reference-free checks.