A. Module overview
| Field | Value |
|---|---|
| Module ID | L2-M04 |
| Level | 2 - AI Quality Engineer (Evaluation) |
| Description | Use an LLM as a judge for the criteria that a metric function cannot score, and know when not to: a decision table across code, humans and a judge; three prompt variants (pointwise, pairwise, reference-based) with a closed parser and a structure lint; the published biases (position, verbosity, self-preference, leniency) and probes to measure them; calibrating the judge against human labels with a confusion matrix, Cohen's kappa, a threshold chosen on dev and reported on test; recording the judge configuration, cost, stability and a canary set that tracks drift. The lab continues the fictional HocVui Tutor product from L2-M01 to L2-M03 and runs offline with a seeded simulated judge (no model calls, no API key). What real models can do is quoted from sources that were read, with access dates. |
| Why this module matters | A figure such as "92% of answers are friendly", scored by a judge, is only as trustworthy as the judge. A judge can be fooled by a confident-sounding wrong answer, prefer the answer that comes first or the longer one, be lenient, and change behaviour when its version changes. This module teaches measuring the judge itself and recording enough configuration for others to re-check it. |
| Target professional competency | Level 2: "Implement and calibrate judges (LLM-as-a-Judge) against human labels, and know their biases and limits". |
| Estimated duration | 1 lesson × 90 minutes + 4 lessons × 120 minutes = 9.5 hours + module assignment ~4 hours + quiz 0.5 hours ≈ 14 hours for someone who has completed L2-M03. An estimate, not yet measured with real learners. |
| Prerequisites | L2-M03 (deterministic metrics, rubrics, per-slice reports); the judge is introduced in L1-M01-L05 and used in L2-M01-L03 (this module goes further, without repeating). High-school math. No API key needed. |
| Module output | A judge evaluator with a calibration check: a decision table, three prompt variants and a parser, a set of bias probes, a calibration report (kappa, threshold), a configuration record for each run |
| Cost | 0 VND |
What learners build. Step by step, in code-labs/l2-m04: (L01) a decision table that picks code, humans, a judge or a judge plus humans for each criterion, and a comparison of a code grader with a simulated judge; (L02) three prompt templates, a closed parser (output that cannot be read is an error, counted separately) and a structure lint; (L03) probes for position, length and model family on a log of verdicts, the both-orders rule and what it does not fix; (L04) a dev and test split, raw and chance-level agreement, kappa computed exactly with Fraction, a threshold chosen under a ceiling on the false-accept rate, a per-group report and a release gate; (L05) a lint and a hash of the judge configuration, a comparison of two runs, a cost estimate, a measure of repeat-scoring stability and a canary set that tracks drift. The lab is independent of the earlier labs and needs only pytest.
What the module does not do. It does not call a real model: the lab's numbers describe the simulation, not the properties of any model. The lab does not teach which wording makes a real judge score better; that takes running a real model on your own label set. Cohen's kappa is taught and computed for pass or fail labels; the §9 exercise of L04 extends it to multiple levels as an advanced exercise; L2-M05-L02 goes deeper (weighted kappa).
B. Learning objectives
| ID | Objective |
|---|---|
| MO1 | Decide when to use a judge, code, humans or a judge plus humans for a criterion, using a decision table with reasons. |
| MO2 | Design a judge prompt in three variants, write a closed parser and lint the prompt structure. |
| MO3 | Measure position, verbosity, self-preference and leniency bias with probes, apply mitigations and state what the mitigations do not fix. |
| MO4 | Calibrate a judge against human labels: compute kappa, choose a threshold on dev, report per group on test and make a decision. |
| MO5 | Record the judge configuration for every run, estimate cost and stability, and detect drift with a canary set. |
C. Lessons
| ID | Lesson | Duration | Prerequisite | Concepts | Practical output |
|---|---|---|---|---|---|
| L2-M04-L01 | How LLM-as-a-Judge works, and when not to use it | 90' | L2-M03-L05 | judge, raw output and parse, decision table, false accept and false reject, cost per call | A decision table |
| L2-M04-L02 | Designing prompts for a judge: pointwise, pairwise and reference-based | 120' | L01 | three variants, prompt anatomy, closed parser, lint, a frame against fake delimiters | Three judge variants |
| L2-M04-L03 | The known biases of judges: position, verbosity, self-preference and leniency | 120' | L02 | bias and noise, probe, both-orders rule, model family, threshold | A swap-order and length probe |
| L2-M04-L04 | Calibrating a judge against human labels: agreement, kappa and choosing a threshold | 120' | L03 | dev and test, kappa, false-accept and false-reject rates, choosing a threshold, release gate, a baseline that always passes | An agreement report and a threshold choice |
| L2-M04-L05 | Versions, cost and monitoring of a judge: recording the configuration for every run | 120' | L04 | configuration and hash, pinning a version, comparable runs, cost, stability, canary | A judge configuration recorded for every run |
D. Hands-on assignment (module assignment)
The module assignment (one judge for one criterion of an AI feature, with a decision table, a bias report, a calibration report and a configuration record) is in exercises.md. The five standalone exercises for the individual lessons are in code-labs/l2-m04/exercises/ and in §9 of each lesson.
E. Module assessment
The module quiz quiz.md, the module assignment rubric in exercises.md, and the practice-0N.md practice for each lesson. The solutions and the instructor guide are for instructors only and are not published.
F. References
The shared list references.md; each lesson also has its own references table in §12 with the access date and how much of each source was read.
Objectives ↔ assessment matrix
| Objective | Lesson | Standalone exercise (§9) | Module quiz |
|---|---|---|---|
| MO1 | L01 | exercises/test_l01_checklist.py |
(to be added with the quiz) |
| MO2 | L02 | exercises/test_l02_prompts.py |
(to be added with the quiz) |
| MO3 | L03 | exercises/test_l03_bias.py |
(to be added with the quiz) |
| MO4 | L04 | exercises/test_l04_calibration.py |
(to be added with the quiz) |
| MO5 | L05 | exercises/test_l05_ops.py |
(to be added with the quiz) |