Evaluation datasets and rubrics
Define success before running a model
An evaluation dataset is a versioned collection of tasks, reference evidence and scoring rules. For a fictional library FAQ, a successful answer must state a supported value and cite the required source; when no answer is supported, abstention is correct. Chapter 18 introduced thresholds and imbalance; Chapter 41 separated retrieval failures from answer failures. Here the canonical answer is a short string or None, not a required wording for general generation. The first example checks an intentionally narrow fixture. It returns four mutually exclusive outcomes. Evidence IDs are trusted reference labels; citation inclusion does not prove semantic entailment or validate additional claims. No model is called.
def outcome(reference, answer, evidence, citations): # Canonical short-answer fixture: None means no supported answer. if answer is None: return "appropriate_abstention" if reference is None else "missed_answer" if reference is None or answer != reference or not evidence or not set(evidence) <= set(citations): return "unsupported" return "supported"
print(outcome("7 days", "7 days", ["p1"], ["p1"]))print(outcome("7 days", "7 days", ["p1"], []))print(outcome(None, None, [], []))print(outcome("7 days", None, ["p1"], []))Design a reproducible dataset
Give each case a stable ID, language, difficulty, failure class, question, evidence version, expected answer or abstention, and rubric version. Define critical errors in advance: fabricated policy values, unsupported citations, unsafe disclosures. Split by document family or underlying question, not simply by random paraphrase: otherwise translations and near duplicates can leak into holdout. Use development cases to tune prompts, a separate calibration set for judges, and a locked holdout for the final comparison. Freeze the corpus, references and scoring rules; record SHA-256 and version. A five-case fixture teaches the mechanism, not statistically representative performance. Include easy, hard, missing evidence and adversarial-but-harmless cases, and report English and Persian separately. Persian appears only as query data, not translated lessons.
Separate exact metrics from semantic and operational metrics
Exact match works for canonical fields after a documented normalization policy; fuzzy string similarity may tolerate spelling changes but can reward a wrong number. Semantic similarity can recognize paraphrases but does not prove factual support or safe behavior. Use human rubrics for factual support, completeness and appropriate abstention; label relevant documents for Recall@k and MRR independently of answer quality. The example groups already scored observations by language, difficulty and failure type; each value holds count, successes, total latency in milliseconds, and total cost in integer microdollars (one millionth of a dollar). The input is fabricated, including time and cost. Divide the second value by the first for slice success, and totals by count for mean latency and cost. In production also measure p95 latency, missing runs, retries, token usage and high-severity errors. Do not silently remove failures or merge languages.
def slices(rows): # (language, difficulty, failure_class, success, milliseconds, microdollars) result = {} for language, difficulty, failure, success, ms, cost in rows: if type(success) is not bool or type(ms) is not int or type(cost) is not int or min(ms,cost)<0: raise ValueError("invalid observation") key = (language, difficulty, failure) a = result.setdefault(key, [0,0,0,0]) a[0] += 1 a[1] += success a[2] += ms a[3] += cost return result
rows = [("en","easy","known",True,120,30), ("en","easy","known",False,180,40), ("fa","hard","unknown",True,210,50)]for key, values in sorted(slices(rows).items()): print(key, values)Use anchored human rubrics
For general generation, assign pass only when all material claims are supported, relevant requested facts are complete, and citations identify evidence; fail for a wrong or unsupported material claim. If evidence is absent, an explicit abstention passes; if evidence exists, unnecessary abstention fails. Mark ambiguous evidence for adjudication instead of silently guessing. Score safety separately: one critical disclosure can block release even with a high average score. Keep reviewer instructions, examples of each rating, evidence and disagreements. A model judge can assist but is not the source of ground truth. For nondeterministic output evaluate allowed outcomes and repeated runs; avoid requiring one exact prose answer. Compare systems on the same cases, with matching settings and run logs.
Practice on the frozen FAQ fixture
Use the project worksheet and versioned eval-fixture.json. Score five held-out questions, including an unknown answer, missing citation and multilingual query. Do not alter labels after seeing the mock outputs. Report counts, denominators, unsupported answers and missed answers separately. Explain why exact string matching is insufficient for free-form answers, then propose a human rubric and independent calibration cases. Reference: ref-ai-evaluation-datasets-and-rubrics. Next, quantify agreement and uncertainty.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Evaluation datasets and rubrics quiz
Assess evaluation design, rubric outcomes, judge agreement and uncertainty.
What is a correct outcome when the evidence cannot answer a question?
Why split by underlying question or document family?
Does a matching citation ID prove semantic support?
What does a slice aggregate need for a success rate?
When is exact prose matching unsuitable?