What you will be able to do
- Choose between code-based, LLM-based and human grading using the docs' selection rule
- Pick the right code-based metric for categorical, consistency and summarisation tasks
- Write an LLM grader prompt with a clear rubric, a fixed output format and reasoning that is then discarded
- Combine grader types into one framework, using humans for calibration
1.Three grader families and how to choose
Once you have a dataset, every test case needs a score. Anthropic's guidance groups graders into three families: code-based, model-based (LLM) and human. A mixed-methods framework uses each family for the cases it handles best. The selection rule in the docs is simple: use the fastest, most reliable and most scalable method that can actually judge the task.
That rule gives a clear order of preference. Code-based grading comes first wherever the task allows it. The cookbook calls it by far the best method when you can design for it. LLM-based grading is next, for judgments that rules cannot express. Human grading is the most flexible, but it is slow and expensive, and the docs advise avoiding it where possible.
| Grader | Example methods | Strengths | Weaknesses |
|---|---|---|---|
| Code-based | String match (exact, regex, fuzzy); binary tests; static analysis; tool-call verification | Fast, cheap, objective, reproducible, easy to debug | Brittle to valid variations; lacks nuance for subjective tasks |
| Model-based | Rubric-based scoring; natural language assertions; pairwise comparison; multi-judge consensus | Flexible, scalable, captures nuance, handles freeform output | Non-deterministic; more expensive than code; needs calibration with human graders |
| Human | SME review; crowdsourced judgment; spot-check sampling; inter-annotator agreement | Gold standard quality; used to calibrate model-based graders | Expensive, slow, often needs experts at scale |
For agents there is one more choice: what the grader looks at. A grader can examine the transcript, meaning the full record of tool calls and reasoning. Or it can examine the outcome, the final state of the environment. A flight-booking agent may say the flight is booked. An outcome grader checks whether the reservation actually exists in the database.
Checkpoint 1 of 6· Exam question
An evaluation team is assembling test cases for a clause-extraction feature used on uploaded contracts. The current dataset contains only well-formatted, standard commercial leases. Following evaluation design best practices, which addition would most improve the test set's ability to predict real-world failures?
Correct answer: A — A stratified set of malformed, scanned, and non-standard contracts added alongside the standard leases to mirror production documents
- A. Correct. Task-specific evaluation design calls for mirroring the real-world task distribution, including edge cases like malformed or non-standard inputs the model will actually encounter in production.
- B. Incorrect. Adding more examples of a single, already well-represented category does not address the missing coverage of edge cases and non-standard documents, which is the actual gap.
- C. Incorrect. Multilingual fluency is a different capability than clause extraction on the documents this feature will actually process; it does not address the identified gap in document format coverage.
- D. Incorrect. Re-verifying labels on the existing standard-lease examples improves label quality but does not expand the test set's coverage of the edge cases the model will face in production.
Checkpoint 2 of 6· Match them up
Match each grader family to its main weakness
Tap a term, then the definition that fits it.
Each family trades speed and reliability against nuance. That is why the docs rank code first, LLMs next and humans last for routine grading.
“Code-based grading: Fastest and most reliable, extremely scalable, but also lacks nuance for more complex judgments that require less rule-based rigidity.”Source: platform.claude.com
2.Code-based graders: exact match, similarity and overlap
Code-based grading covers more than string equality. The docs use three metrics, each suited to a different task.
Exact match suits tasks with clear categorical answers, such as sentiment labels. The output is normalised for whitespace and case, then compared with the golden answer.
Cosine similarity measures *consistency*. The same question is asked several ways, including with typos and padded with irrelevant detail. The outputs are embedded, and the grader checks that they are semantically close even when the wording differs. Its dataset is built from groups of paraphrases, not single questions.
ROUGE-L grades summaries against reference summaries. It uses the longest common subsequence, so a high score means the summary captures key information in a coherent order.
The exact-match grader in the docs is only two lines long:
Checkpoint 3 of 6· Fill the gap
Which method completes the whitespace normalisation in this exact-match grader?
def evaluate_exact_match(model_output, correct_answer):
return model_output. ? ().lower() == correct_answer.lower()The grader removes leading and trailing whitespace with strip() and lowercases both sides, so formatting differences do not fail an otherwise correct label.
Source: platform.claude.comSources1
3.LLM-based graders: rubrics, scales and binary judgments
Some qualities, such as empathy, professionalism or whether a reply leaks private health data, cannot be checked with a string comparison. For these the docs use an LLM as the grader, in two forms. A Likert grader rates tone on a 1-to-5 scale against a target such as "empathetic". A binary classification grader answers yes or no to whether a response contains personal health information (PHI). It can catch subtle or implicit PHI that rule-based checks miss.
The docs say to test an LLM grader's reliability before scaling it, and give these tips:
- Detailed, clear rubrics. State exactly what makes an answer correct or incorrect. - Empirical or specific output. Ask for only "correct"/"incorrect" or a 1–5 score. Purely qualitative evaluations are hard to assess quickly and at scale. - Encourage reasoning. Have the grader reason first, then discard the reasoning and keep only the score. - Use a different model to grade. The example code notes it is generally best practice to grade with a different model from the one that produced the output.
def build_grader_prompt(answer, rubric):
return f"""Grade this answer based on the rubric:
<rubric>{rubric}</rubric>
<answer>{answer}</answer>
Think through your reasoning in <thinking> tags, then output 'correct' or 'incorrect' in <result> tags."""Checkpoint 4 of 6· Exam question
A team is designing a test framework for a Claude-based tool that answers factual questions about internal HR policies using short, well-defined answers (e.g., "What is the maximum number of paid sick days?"). To keep pace with frequent policy updates, which grading approach best supports automation while remaining accurate?
Correct answer: A — Grade each response with exact-match or normalized string comparison against a maintained answer key
- A. Correct. Questions with single, well-defined correct answers are best suited to exact-match or normalized string comparison against a maintained ground-truth key, which is fully automatable and scales with policy updates.
- B. Incorrect. Manual weekly review does not scale as an automated grading approach and reintroduces the human annotation burden the team is trying to avoid.
- C. Incorrect. A professionalism rating measures tone, not factual correctness against a maintained answer key, so it would not catch outdated or wrong policy figures.
- D. Incorrect. Similarity to prior responses does not verify correctness against the current policy; two consistently wrong responses would score as similar and pass undetected.
Checkpoint 5 of 6· Check yourself
Your LLM grader's scores look unreliable on complex judgments. Which change does the guidance recommend?
Reasoning before scoring improves grader performance, especially on complex judgments. Free-form output, self-grading and dropping the rubric all go against the guidance.
“Encourage reasoning: Ask the LLM to reason first before producing an evaluation score, and then discard the reasoning.”Source: platform.claude.com
Sources1
4.Putting the methods together
A mixed-methods framework assigns each grader type its own job. Within one task, several graders can score different aspects of the output. Their scores combine in one of three ways: weighted, where the combined score must pass a threshold; binary, where every grader must pass; or a hybrid of the two. The docs also say qualitative measures add value when applied consistently alongside quantitative ones, not in place of them.
Humans still matter, mostly as calibration. Model-based graders need checking against human judgment. The guidance reserves structured human studies for two uses: calibrating LLM graders, and judging subjective outputs where human agreement is the reference standard. Descript is one example. The team moved from manual grading to LLM graders using criteria the product team defined, with periodic human calibration.
Anthropic compares this layering to the Swiss Cheese Model from safety engineering. No single evaluation layer catches everything, so problems that get through one layer are caught by another.
Checkpoint 6 of 6· Check yourself
A task is scored by three graders: a unit-test grader, an LLM rubric grader and a tool-call check. The task passes only if all three pass. Which scoring mode is this?
Requiring every grader to pass is binary scoring. Weighted scoring sums the graders' scores against a threshold, and hybrid mixes the two approaches.
“For each task, scoring can be weighted (combined grader scores must hit a threshold), binary (all graders must pass), or a hybrid.”Source: www.anthropic.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Human grading is the safest default for any eval because it gives the highest quality.Why is that wrong?
Human grading is flexible and high quality, but the docs advise avoiding it where possible. Use the fastest, most reliable and most scalable method that works, and keep humans mainly for calibration.
Covered in Three grader families and how to choose
2.Grading with the same model that generated the output is fine, and even improves consistency.Why is that wrong?
The docs' grader code notes it is generally best practice to grade with a different model from the one that produced the output.
Covered in LLM-based graders: rubrics, scales and binary judgments
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“When deciding which method to use to grade evals, choose the fastest, most reliable, most scalable method:”
↩︎ Three grader families and how to choose“Exact match evals measure whether the model's output matches a predefined correct answer, typically after normalizing whitespace and case.”
↩︎ Code-based graders: exact match, similarity and overlap“It's ideal for evaluating consistency because similar questions should yield semantically similar answers, even if the wording varies.”
↩︎ Code-based graders: exact match, similarity and overlap“High ROUGE-L scores indicate that the generated summary captures key information in a coherent order.”
↩︎ Code-based graders: exact match, similarity and overlap“LLM-based grading: Fast and flexible, scalable and suitable for complex judgment. Test to ensure reliability first then scale.”
↩︎ LLM-based graders: rubrics, scales and binary judgments“This method can account for context and identify subtle or implicit forms of PHI that rule-based systems might miss.”
↩︎ LLM-based graders: rubrics, scales and binary judgments“Purely qualitative evaluations are hard to assess quickly and at scale.”
↩︎ LLM-based graders: rubrics, scales and binary judgments“Numbers provide clarity and scalability, but qualitative measures can be valuable if consistently applied along with quantitative measures.”
↩︎ Putting the methods together“Human grading: Most flexible and high quality, but slow and expensive. Avoid if possible.”
↩︎ Exam trap 1“Generally best practice to use a different model to evaluate than the model used to generate the evaluated output”
↩︎ Exam trap 2“Code-based grading: Fastest and most reliable, extremely scalable, but also lacks nuance for more complex judgments that require less rule-based rigidity.”
↩︎ Checkpoint“Encourage reasoning: Ask the LLM to reason first before producing an evaluation score, and then discard the reasoning.”
↩︎ Checkpoint - 2.
“Agent evaluations typically combine three types of graders: code-based, model-based, and human.”
↩︎ Three grader families and how to choose“The outcome is the final state in the environment at the end of the trial.”
↩︎ Three grader families and how to choose“Reserve systematic human studies for calibrating LLM graders or evaluating subjective outputs where human consensus serves as the reference standard.”
↩︎ Putting the methods together“They evolved from manual grading to LLM graders with criteria defined by the product team and periodic human calibration”
↩︎ Putting the methods together“Like the Swiss Cheese Model from safety engineering, no single evaluation layer catches every issue.”
↩︎ Putting the methods together“For each task, scoring can be weighted (combined grader scores must hit a threshold), binary (all graders must pass), or a hybrid.”
↩︎ Checkpoint - 3.https://platform.claude.com/cookbook/misc-building-evalsSecondary source
“This is by far the best grading method if you can design an eval that allows for it”
↩︎ Three grader families and how to choose