Module: L2-M03 · Duration: ~90 min (estimate, including the independent exercise) · Previous: L02 · Next: L04
1. Introduction
Some criteria cannot be graded by code: is an explanation easy enough for a student in grade 4 to follow, is a hint encouraging without giving away the answer. For these you need a person (or, in L2-M04, a model) to grade, and to make two graders agree you need a rubric: a table of criteria, a scale and a description of each level. L2-M02-L03 taught labelling guidelines for a binary decision (ok or leak); this lesson extends that to grading with many levels and many criteria.
The lesson covers four things: choosing an analytic or a holistic rubric; choosing a scale; writing each level's description concretely enough that two people see the same thing; and turning a rubric into data with a linter and a scoring function. An early warning: the linter checks only structure, not whether the rubric is good. You will see the lab let a meaningless five-word description pass the lint. The output of this lesson is a rubric with descriptive anchors and examples for each level.
2. Learning objectives
- Distinguish analytic from holistic rubrics and choose the kind that suits a criterion. Practice: §8.2 part C, §9 (TODO 4).
- Write a scale with descriptive anchors and examples for each level, and check the structure with a linter. Practice: §8.2 parts A and exercise §9.
- Score a set of ratings with weights and a critical criterion, and compute the normalised score exactly. Practice: §8.2 part B and §8.3.
- Run a simulation of two graders with and without anchors, and read the agreement and the leniency gap. Practice: §8.2 part C.
- State what the linter does not check and how to detect a bad rubric through grader disagreement. Practice: §8.3 and
test_lint_passes_a_nonsense_anchor_that_has_five_words.
3. Prerequisites and tools
- L2-M02-L03: labelling guidelines, borderline cases, raw and chance agreement. This lesson reuses raw agreement; the kappa coefficient is taught in L2-M05-L02.
- L2-M01-L02: quality criteria and risk levels.
- The code lab
code-labs/l2-m03(self-contained).
4. Concepts
4.1 When you need a rubric
Use code (L01, L02) when the criterion can be checked by a function. Use a rubric when the criterion needs judgement: tone, clarity, completeness. Anthropic writes that "vague rubrics produce inconsistent judgments" and advises "create clear, structured rubrics to grade each dimension of a task" [R1]. Anthropic's guide to building evaluations also says a qualitative scale works if it is "consistently applied" and paired with quantitative measures, and that a Likert scale such as "Rate coherence from 1 (nonsensical) to 5 (perfectly logical)" is a commonly used form [R2]. Neither source tells you which scale is right; they say a rubric must be clear enough to be applied consistently, and that this can be measured (§5.3).
4.2 Analytic and holistic rubrics
A holistic rubric gives a single score for the whole answer ("3 out of 4: good, with one weak point"). It is fast, but when the score is low you do not know why, and graders often let one prominent feature dominate the score. An analytic rubric scores each criterion on its own scale and then combines them: slower, but it shows which criterion is weak, allows different weights, and allows a critical criterion to veto an answer regardless of the other scores. Anthropic also advises grading each dimension with a separate judge rather than one judge grading everything [R1], and building partial credit for multi-component tasks [R1]. The lab's rubric (data/rubric_tutor.json) is analytic with four criteria: correctness (weight 3, critical), pedagogy (2), clarity (2), tone (1). The weights and the pass threshold of 0.7 are the lab's choices.
4.3 Scale: number of levels and the middle level
The lab uses a 0-3 scale, four levels. An even number of levels has no middle level: the grader must lean one way, so cannot dodge by picking "average" for everything. A five-level scale allows that dodge. This is a design choice with a price: four levels force a decision but make borderline cases (L2-M02-L03) harder to grade. Fewer than three levels do not discriminate enough (the linter rejects them); with many levels the descriptions become hard to tell apart and graders find it hard to agree. A 0-3 score is an ordering, not a measurement: the distance between 0 and 1 is not necessarily equal to the distance between 2 and 3, so do not read an average score of 2.5 as "83% of the quality". Report the distribution too (the number of answers at each level) when presenting results.
4.4 Descriptive anchors and example anchors
Each level has a descriptive anchor: a sentence stating what is observable in an answer at that level, and an example: a real answer at that level. A good anchor is one where two people read it and choose the same level. Compare two anchors of the pedagogy criterion: "Tốt" ("Good", nothing observable) with "Gợi ý, không nêu đáp số, và nêu phương pháp để thử tiếp" (a hint, does not state the answer, and names a method to try next: countable: is there a hint? is there an answer? is there a method name?). An observable anchor turns a judgement into a few yes/no questions. An example anchor (such as "Em thử viết phép nhân với 6 và 4 xem sao." for level 3 of pedagogy, a hint that does not give the answer) does the same for someone who has not read the description closely. In §5.3 you will see that the same graders, the same items, with and without anchors give very different agreement, in the simulation, under stated assumptions.
5. Technical deep dive
5.1 A rubric as data: structure and lint
The lab's rubric is JSON: mode (analytic or holistic), pass_score, and for an analytic rubric a list of criteria, each with id, weight, critical and levels (each level has an anchor and an example). Storing the rubric as data allows linting, versioning (L2-M02-L05) and grading by code.
rubric.lint(r) returns a list of structural problems: a missing or duplicate id; a weight that is not an integer from 1 (bool is rejected); a scale of fewer than 3 levels or non-consecutive levels; an anchor shorter than 5 words; an anchor using a vague word from a small list (such as tốt, ok, good); two levels with the same anchor or the same example; a level missing an example; no critical criterion; a pass_score that is not a number in (0, 1]. The rubric rubric_tutor.json has 0 problems; rubric_draft.json, a deliberately broken draft, has 12 (demo part A prints the first 4).
5.2 Scoring: normalisation, weights, the critical criterion
rubric.score(r, ratings) takes the score for each criterion and returns a normalised score: Σ weight × (score − lowest level) / (highest level − lowest level), divided by the total weight. All numbers are Fraction. A critical criterion at the lowest level vetoes the answer even when the total score is high. Examples from the lab: the scores [3, 3, 2, 1] (in the order correctness, pedagogy, clarity, tone) give 5/6 ≈ 0.833, a pass. The scores [0, 3, 3, 3] give 5/8 = 0.625 and correctness is at level 0 so it is vetoed: lower pass_score to 0.6 (0.625 is greater than 0.6) and the answer still does not pass (§8.3). The scores [3, 3, 3, 0] (tone at the lowest level, not critical) give 7/8 and still pass: tone alone cannot veto an answer. The normalised score assumes evenly spaced levels; that is the lab's choice so as to have a pass/fail rule, so still report the distribution next to it (§4.3).
The policy for invalid scores matters as much as the formula. score raises ValueError when a criterion is missing, a criterion is extra, a score is out of range, or a score is a float or a bool. OpenAI describes a score-model grader as returning a numeric score within a given range, "truncated to the given range, and default to 0 for all non-numeric outputs" [R3] (a non-numeric output counts as 0). Defaulting to 0 is a policy chosen in advance; the lab chooses a different policy (rejection) because a silent 0 looks just like a genuinely bad answer. Whichever policy you pick must be recorded.
5.3 Simulating two graders: anchors and agreement
rubric.simulate_ratings has a simulated "grader" grade 40 fictional items that have a hidden true score. The built-in assumptions, stated in the docstring and the cause of the result: noise has a standard deviation of 0.45 levels with anchors and 0.9 without; without anchors grader A is lenient by +0.5 level and B is strict by −0.5; the holistic grader puts 70% of the weight on the first criterion (correctness) and 30% on the other three. Results (demo part C):
| Grading mode | Exact agreement | Within 1 level | Leniency gap |
|---|---|---|---|
Analytic, correctness, no anchors |
0.275 | 0.725 | 0.850 |
Analytic, correctness, with anchors |
0.700 | 0.975 | 0.125 |
Analytic, pedagogy, no anchors |
0.350 | 0.775 | 0.800 |
Analytic, pedagogy, with anchors |
0.600 | 1.000 | 0.000 |
| Holistic, no anchors | 0.225 | 0.625 | 0.575 |
| Holistic, with anchors | 0.600 | 1.000 | 0.050 |
The "leniency gap" is the difference between the two graders' average scores. With a holistic rubric and no anchors, A gives level 3 on 22 of 40 items while B gives it on only 13 (scale_use, demo part C), so a fixed pass threshold passes more for one grader than for the other. Read the table with the right amount of caution: these numbers are a consequence of the assumptions, not measured on real people. What it teaches is the way of measuring (compare two graders on the same items, read exact agreement, agreement within 1 level, and the leniency gap) and the direction of the effect that the assumptions reflect, not the size of the effect in practice.
6. The QA perspective
6.1 What the linter does not check
A passing lint only says the parts are present. The test test_lint_passes_a_nonsense_anchor_that_has_five_words replaces an anchor with "alpha beta gamma delta epsilon" and the lint is still empty. The linter does not know: whether an anchor is observable (beyond a small list of vague words), whether the levels really increase in order, whether an example is right for the anchor of its level, whether two criteria overlap (measuring the same thing twice, so one feature counts twice), whether the weights fit the risk, and whether the criteria match what users need. Only measuring two independent graders on real items detects these. A quick check: give the rubric to someone who has never seen it, along with three example answers whose levels are hidden, and see whether they rank them correctly.
6.2 Writing a rubric in a loop, and reporting ordinal scores
The process (in the spirit of the loop in L2-M02-L03): write the rubric with anchors and examples; have two independent graders grade about 20 items, including a few borderline cases; list the items on which the two differ by 2 levels or more (exercise §9 does this) and read each one; fix the anchors of the criterion that causes the disagreement, not the graders; regrade on new items if possible. Measuring kappa and analysing disagreements in detail belong to L2-M05.
When reporting: state the rubric and its version, the number of graders and how they were chosen, the agreement per criterion (not just one overall number), the number of items vetoed by the critical criterion, and the score distribution rather than only the average. Do not merge scores from an analytic and a holistic rubric into one number; they measure differently (§5.3).
7. Real-world scenarios
Scenario 1 (fictional): "An average score of 2.6". A team graded 100 HocVui Tutor hints with a holistic rubric and reported an average of 2.6 out of 3, "nearly perfect". The two graders had different leniency: one gave 3 to every correct answer, the other gave 3 only to answers that were both correct and hinted the right way. They switched to an analytic rubric with observable anchors, saw pedagogy clearly lower than correctness, and made correctness the critical criterion.
Scenario 2 (fictional): "A long rubric, a green lint". A rubric had ten criteria, each level with an anchor of at least five words. The lint was green. Two graders tried 20 items and differed by 2 levels or more on 8 items, mostly on the two criteria engagement and warmth whose anchors differed by only one adjective. They merged the two criteria and rewrote the anchors with things you can count (does it mention the student's name, is there one specific encouraging sentence).
8. Hands-on tutorial
8.1 Setup
cd academy-content/code-labs/l2-m03
python3 -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -r requirements.txt
python -m pytest # 63 passed
8.2 Run the demo
python -m lab.demo l03
Output (copied from a real run on Python 3.14.6 and 3.12.14, 2026-11-03; the two versions give identical output):
A. lint: tutor rubric 0 problem(s), draft rubric 12 problem(s)
- criterion ids must be present and unique
- criterion quality: weight must be an integer >= 1
- criterion quality: levels must be consecutive integers, got [0, 1, 3]
- criterion quality level 0: anchor needs at least 5 words saying what you can see
B. scoring
[3, 3, 2, 1] -> normalized 5/6 = 0.833 vetoed [] pass True
[0, 3, 3, 3] -> normalized 5/8 = 0.625 vetoed ['correctness'] pass False
C. two simulated raters, 40 items (agreement follows from the simulation's assumptions)
analytic anchored=False correctness exact 0.275 within one 0.725 leniency gap 0.850
analytic anchored=False pedagogy exact 0.350 within one 0.775 leniency gap 0.800
analytic anchored=True correctness exact 0.700 within one 0.975 leniency gap 0.125
analytic anchored=True pedagogy exact 0.600 within one 1.000 leniency gap 0.000
holistic anchored=False overall exact 0.225 within one 0.625 leniency gap 0.575
level use 0..3 when not anchored: rater A {0: 2, 1: 8, 2: 8, 3: 22} rater B {0: 7, 1: 12, 2: 8, 3: 13}
holistic anchored=True overall exact 0.600 within one 1.000 leniency gap 0.050
Reading the output:
- A. The lab's rubric is clean; the draft has 12 problems (three of them: a missing unique
id, a weight of 0, non-consecutive levels). - B. Two sets of scores: one passes (5/6), one is vetoed by
correctness(5/8). - C. With anchors, exact agreement rises and the leniency gap falls in all three grading modes, under the simulation's assumptions.
8.3 Try it yourself
Save it as try_l03.py in the lab's root folder (next to lab/), run python try_l03.py, then delete the file:
import copy
from lab import data, rubric
r = rubric.load(data.DATA / "rubric_tutor.json")
print(rubric.score(r, {"correctness": 3, "pedagogy": 3, "clarity": 3, "tone": 0}))
print(rubric.score(r, {"correctness": 0, "pedagogy": 3, "clarity": 3, "tone": 3}))
r3 = copy.deepcopy(r)
r3["pass_score"] = "0.6"
print(rubric.score(r3, {"correctness": 0, "pedagogy": 3, "clarity": 3, "tone": 3}))
r2 = copy.deepcopy(r)
r2["criteria"][2]["levels"][0]["anchor"] = "alpha beta gamma delta epsilon"
print(rubric.lint(r2))
try:
rubric.score(r, {"correctness": 3, "pedagogy": 3, "clarity": 3})
except ValueError as e:
print("ValueError:", e)
print(rubric.agreement({"a": 1, "b": 3, "c": 2}, {"a": 1, "b": 1, "c": 3}))
Output (identical on Python 3.14.6 and 3.12.14):
{'normalized': Fraction(7, 8), 'vetoed': [], 'pass': True}
{'normalized': Fraction(5, 8), 'vetoed': ['correctness'], 'pass': False}
{'normalized': Fraction(5, 8), 'vetoed': ['correctness'], 'pass': False}
[]
ValueError: ratings must cover exactly ['clarity', 'correctness', 'pedagogy', 'tone']; missing ['tone'], extra []
{'exact': Fraction(1, 3), 'within_one': Fraction(2, 3), 'mean_abs_diff': Fraction(1, 1), 'leniency_gap': Fraction(1, 3)}
Reading: tone at level 0 does not veto the answer; correctness at level 0 does, even when pass_score is 0.6 and the normalised score 5/8 exceeds it; the lint lets a meaningless anchor through; a missing criterion is an error, not a score of 0; two graders differing by two levels on item b agree exactly on only 1/3 of the items.
8.4 Run the lesson's tests
python -m pytest tests/test_l03_rubric.py -v
Result: 10 passed. Read test_critical_criterion_at_lowest_level_vetoes_a_high_total and test_pass_score_boundary_is_inclusive.
8.5 Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
ValueError: ratings must cover exactly [...] |
A criterion is missing or extra in the set of ratings | Give exactly the rubric's ids |
rating must be an integer |
The score is a float or a bool |
Use an integer |
Lint reports levels must be consecutive integers |
The scale has a missing level | Fix the keys of levels |
9. Independent exercise
Problem: Write a rubric with anchors for the feedback of a fictional feature "explain the answer to a multiple-choice question", score a set of ratings, and read two graders.
Requirements: complete exercises/test_l03_rubric.py and exercises/my_rubric.json:
- TODO 1: fill in
my_rubric.json: an analytic rubric with exactly two criteriacorrectnessandclarity, each with four levels 0-3 with anchors and examples, positive integer weights, at least one critical criterion, and a sensiblepass_score. The lint must be empty, and each criterion must have at least one anchor containing something countable (a digit or a quotation). - TODO 2: fill in
NORMALIZED(a list of fraction strings such as"5/6") andPASSES(a list ofTrue/False) for the three sets of ratings inratings.json, according to your rubric. - TODO 3: fill in
BIG_DISAGREEMENTS(the item numbers, counting from 1, on which gradersaandbdiffer by 2 levels or more, sorted) andMORE_LENIENT("a"or"b", the grader with the higher average score).
Test data: exercises/ratings.json (3 sets of ratings {correctness, clarity} and the scores of two graders on 10 fictional items).
- TODO 4: at the end of the file
exercises/test_l03_rubric.py, a comment line# WHY ANALYTIC:followed by more comment lines (at least 15 words in total) saying why this feature needs an analytic rubric rather than a holistic one.
Deliverable: the filled-in my_rubric.json, the four variables and the # WHY ANALYTIC: passage.
Acceptance criteria: python -m pytest exercises/test_l03_rubric.py passes (4 tests, of which test_why_analytic_comment_exists only counts words); no TODO is left in my_rubric.json. The test checks for something countable with a simple expression (a digit or quotation marks); it does not know whether your anchor is really observable, which is for you and a reviewer to judge.
Hint: use rubric.score to get NORMALIZED and PASSES instead of computing by hand, then compute one set by hand to understand the formula. Two adjacent anchors must differ in something visible; try giving the rubric to someone else and see which level they put an example answer in. Both criteria can be scored 0; at which criterion's level 0 must the answer be vetoed?
10. Knowledge check
0/18 done · Results are kept in this browser only.
P02 · True or false
P04 · Select all that apply
P05 · Put in order
P06 · Match
P07 · Spot the bug
The clarity criterion below is taken from rubric_tutor.json but with one spot changed. Running rubric.lint on a rubric containing it reports one problem. Find the bug.
{
"id": "clarity",
"weight": 2,
"critical": false,
"levels": {
"0": {
"anchor": "The reply uses terms above grade 5 or sentences over thirty words.",
"example": "Hãy áp dụng tính giao hoán của phép nhân để đối chiếu hai vế của đẳng thức."
},
"1": {
"anchor": "The reply is understandable but uses one term the student has not met.",
"example": "Em thử đặt phép tính theo hàng dọc, chú ý phần nhớ nhé."
},
"3": {
"anchor": "The reply uses grade 3-5 words and every sentence says one clear thing.",
"example": "Em thử viết phép nhân. Rồi em đếm xem mỗi hộp có mấy cái."
}
}
}P08 · Short answer
The anchor "Câu trả lời thân thiện" ("The reply is friendly") of the tone criterion cannot be used. Rewrite it as an observable anchor for the highest level, with one example.
P09 · Essay
In the simulation without anchors on the holistic rubric, grader A gives level 3 on 22 out of 40 items while B gives only 13, and the leniency gap is 0.575. Write 5-8 sentences: how that makes a fixed pass threshold unfair, what you would do, and why you must not conclude anything about real graders.
P10 · Recall
Lesson: L2-M02-L03P11 · Recall
Lesson: L2-M01-L02P12 · True or false
P13 · Multiple choice
P14 · Fill in the blank
P15 · Select all that apply
P16 · True or false
P17 · Multiple choice
11. Summary
- Concepts: an analytic rubric scores each criterion and combines them, a holistic rubric gives one score; each level has an observable anchor and an example; a critical criterion vetoes an answer regardless of the total score; a 0-3 score is an ordering.
- Skills: writing a rubric as data; linting the structure; exact normalised scoring; simulating and comparing two graders; listing the items that differ by 2 levels or more.
- Traps: a vague anchor but a green lint; reading 2.5 as 83% of the quality; a holistic score hiding a weak criterion; defaulting to 0 for a broken score; trusting a simulated number as a measured one.
- You can now: take a rubric, say whether it has observable anchors, run the lint, score a set of ratings and name the extra measurement needed to trust it.
12. References
| ID | Title | Publisher | URL | Accessed | Relevance |
|---|---|---|---|---|---|
| R1 | Demystifying evals for AI agents | Anthropic | https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents | 2026-11-03 | Clear structured rubrics; grade each dimension; partial credit |
| R2 | Define success criteria and build evaluations (Develop tests) | Anthropic | https://platform.claude.com/docs/en/test-and-evaluate/develop-tests | 2026-11-03 | Consistently applied qualitative scales; a Likert scale example (read 100,000 of 152,950 characters) |
| R3 | Graders (score model graders) | OpenAI | https://developers.openai.com/api/docs/guides/graders | 2026-11-03 | A model grader's score is truncated to the range and defaults to 0 for non-numeric output |
Key terms (English ↔ Vietnamese)
| English | Tiếng Việt |
|---|---|
| Rubric | Rubric (bảng tiêu chí và mô tả mức điểm) |
| Analytic / holistic rubric | Rubric phân tích / tổng thể |
| Scale | Thang điểm |
| Anchor | Mốc mô tả (điều quan sát được ở một mức) |
| Anchor example | Ví dụ neo |
| Critical criterion | Tiêu chí then chốt (loại câu trả lời bất kể điểm khác) |
| Normalised score | Điểm chuẩn hóa (về khoảng 0-1) |
| Leniency gap | Khoảng cách khoan dung (hiệu điểm trung bình của hai người chấm) |
| Ordinal scale | Thang thứ tự |