Sub topic 7
Write Reference Answers and Rubrics
This chapter assumes you can read JSONL, run basic Python, and have a task definition and case schema from the earlier chapters. Here you label cases so a grader can score outputs against something concrete.
Two ways to label a case
A reference answer is a known-good output for one input. A rubric is a short list of checkable criteria that any good output must meet. Pick based on how many correct outputs the task allows.
| Task type | Better label | Example |
|---|---|---|
| One correct answer | Reference | "Returns are accepted within 30 days." |
| Many valid phrasings | Rubric | "States the 30-day limit. Does not promise a refund." |
| Extraction or classification | Reference | A label or a JSON object |
| Open-ended writing | Rubric | Tone, completeness, no invented facts |
Reference answers are cheap to grade but punish valid rewordings. Rubrics tolerate variation but need a grader that can apply them.
Writing a good reference
Keep the reference to the facts that must be true. A short reference is easier to match and easier to review.
- Write the reference before you see the model's output. Otherwise you tend to accept whatever the model said.
- Use the source of truth, such as the policy document, not your memory.
- Record the source in the case so a reviewer can verify it later.
- Where several answers are acceptable, store a list of them instead of one string.
{"id": "refund-001", "input": "Can I return a laptop after 45 days?", "reference": "No. Returns are accepted within 30 days of delivery.", "tags": ["returns", "policy"], "source": "production_log", "difficulty": "easy"}Writing a rubric
Each criterion should be answerable with yes or no from the output alone. Vague criteria such as "is helpful" produce noisy grades. Concrete criteria do not.
- Name one behavior per criterion.
- Phrase it so a stranger would reach the same verdict.
- Include at least one "must not" criterion for known failures, such as inventing a policy.
- Mark which criteria are required and which are optional.
Here is a rubric stored with a case. The rubric field replaces reference for tasks with many valid outputs.
{"id": "refund-002", "input": "My laptop arrived broken 40 days ago. What can I do?", "rubric": [{"check": "States that the standard return window is 30 days", "required": true}, {"check": "Offers to escalate the damage claim to support", "required": true}, {"check": "Does not promise a refund", "required": true}, {"check": "Uses a polite tone", "required": false}], "tags": ["returns", "damage"], "source": "expert_written", "difficulty": "hard"}A score can then be the share of required criteria met, with any failed "must not" criterion forcing a fail.
def score_rubric(results, rubric):
"""results: list of booleans, one per rubric item, in order."""
required = [r for r, item in zip(results, rubric) if item["required"]]
return all(required)Common errors
- Reference too long. Exact match fails on harmless wording. Shorten it to the key fact or switch to a rubric.
- Reference copied from model output. This bakes in the model's mistakes and inflates scores.
- Unstated assumptions. If the answer depends on a date or customer tier, put that in the input.
- Stale references. When the policy changes, the label is wrong. Keep the source field so you can find affected cases.
The diagram shows how the label type follows from the task.
Exercise
A case asks, "Summarize this complaint in two sentences." Should you label it with a reference answer or a rubric, and name two criteria you would write.
Show answer
Use a rubric, because many different summaries are valid. Example criteria: the summary is exactly two sentences (required), and it mentions the customer's main complaint without adding facts not in the text (required).