Sub topic 3
Using and calibrating a model-based judge
This chapter assumes you know the grading methods from earlier sections, can read short Python, and have an evaluation set with a few dozen labeled cases. A model-based judge is a second language model that scores another model's output against a written rubric.
Calibrating the judge
Before you trust a judge, compare its labels with human labels on the same sample. Measure the agreement rate, then read the disagreements. Repeat calibration whenever the rubric or the judged model changes.
def judge_agreement(judge_labels, human_labels):
pairs = list(zip(judge_labels, human_labels))
if not pairs:
return 0.0
agree = sum(1 for judge, human in pairs if judge == human)
return agree / len(pairs)
judge = ["pass", "fail", "pass", "pass"]
human = ["pass", "fail", "fail", "pass"]
print(judge_agreement(judge, human)) # 0.75> Agreement alone can hide bias. If most cases are "pass", a judge that always says "pass" scores well. Check the label distribution and review a sample of disagreements by hand.
Setting acceptance criteria and thresholds
Write one threshold for each quality dimension. Base each threshold on the severity of failure, not on a round number chosen in advance.
| Dimension | Threshold | Severity if failed |
|---|---|---|
| Groundedness | At least 95% of cases pass | Critical for wrong refund amounts |
| Tone | At least 90% of cases pass | Minor |
Critical failures get zero tolerance. One critical failure blocks release, whatever the pass rate.
Using evaluations as release gates
A release gate is a check that a change must pass before it ships. Run the full evaluation on every candidate build. Compare the result with the last released build to catch regressions, not only absolute drops.
Offline evaluation versus online monitoring
Offline evaluation runs a fixed dataset before release. It is repeatable and cheap to rerun. Online monitoring samples live traffic after release. It reveals failures the dataset missed, but real users meet those failures first. Use offline results to block bad builds, and use online samples to add new cases to the dataset.
Keeping the evaluation current
Treat the dataset as code. Add each confirmed production failure as a new case, with its severity. Retire cases that no longer reflect the product, and recalibrate the judge after each change.
Exercise
A judge agrees with human reviewers on 92% of cases, but it marks 98% of answers as "pass". Should you trust it yet? Explain briefly.
Show answer
No. The high agreement may come from a dataset where most answers pass, so a judge that always says "pass" would also score well. Check the label distribution, review disagreements on failing cases, and recalibrate with more failing examples.