Blog

LLM-as-a-judge: check your judge against people before you trust it

How to check an LLM judge before it grades a release: agreement with human labels, Cohen's kappa, false passes, stability and a corrected score.

5 min read

  • Judges
  • Evaluation
  • Statistics
  • Human review

Exact match works when there is one right answer. For a summary, a reply or an explanation there is not, so teams ask another model to grade the output. That is LLM-as-a-judge, and it is often the only practical way to score open-ended answers.

But a judge is a model too. It can be lenient, harsh, inconsistent or biased towards its own family. Before its verdict decides a release, you need to know how often it agrees with people. This post shows the checks ModelStill gives you, following the LLM-as-a-judge guide.

The judge is a rubric and a verdict

An LLMJudgegets your instructions as the system message, with "End your reply with PASS or FAIL." added. The user message holds the reference answer and the output. The last PASS or FAIL in the reply is the verdict. A reply with neither raises an error, and the run stops instead of guessing.

judge.py
from modelstill.evals import run
from modelstill.judges import JudgePanel, LLMJudge, as_metric

judge = LLMJudge(model, family, instructions, complete)
panel = JudgePanel([judge], teacher_families={"qwen", "openai"})
result = run(cases, student, as_metric(panel))

complete is your function that calls the judge model, so you choose the provider and the temperature. as_metric turns the judge into a scorer that gives 1 for PASS and 0 for FAIL, and pass/fail scores get an exact Clopper-Pearson interval.

Check it against people

Have people label a sample of the same outputs as pass or fail. The golden dataset you already review is a good source. Then compare the two lists, item by item:

agreement.py
from modelstill.evals import judge_agreement

agreement = judge_agreement(judge_verdicts, human_labels)
print(agreement.accuracy, agreement.low, agreement.high, agreement.kappa)
print(agreement.false_pass, agreement.false_fail)
  • accuracy is the share of items where judge and person agree, with an exact Clopper-Pearson interval (low, high).
  • kappais Cohen's kappa: agreement beyond what the two pass rates would give by chance.
  • false_pass counts items the judge passed and the person failed. false_fail is the reverse.

Read kappa before accuracy. When most outputs pass, a judge that passes everything has high accuracy and a kappa near 0. It has learnt nothing about your task.

For a release gate, false passes matter most. Each one is a bad answer the judge let through. A judge with few false fails and many false passes will wave regressions into production.

Check that it is stable

A judge that changes its mind on the same input adds noise to every score it gives.

stability.py
from modelstill.judges import stability

found = stability(judge, items, repeats=3)
print(found.flip_rate, found.unstable, found.items)

Each item is judged repeats times, at least twice. An item is unstable when its verdicts differ, and flip_rate is the share of unstable items. Measure it at the temperature you will actually use.

Correct the score with a few human labels

A judge can be biased in one direction, for example passing slightly too much. corrected_scoreuses a small set of human labels to remove that bias from the judge's score over a much larger set of items. The method is prediction-powered inference.

corrected.py
from modelstill.judges import corrected_score

estimate = corrected_score(judge_scores, human_labels)
print(estimate.value, estimate.low, estimate.high)

It needs at least two labelled and two unlabelled items, and every labelled item must also be judged. The result carries a 95% interval.

One caveat. That interval comes from a normal approximation, unlike the exact and bootstrap intervals elsewhere in ModelStill. With very few labels it can be too narrow, so label more items than the minimum before you lean on it.

Compare two runs with a pairwise judge

Sometimes the question is not "is this answer right?" but "is the new answer better than the old one?". A PairwiseJudge picks A, B or a tie for two answers to the same input.

Judges tend to prefer whichever answer they see first or second. So ModelStill asks twice, once in each order, and keeps a verdict only when both orders agree. A verdict that follows the position becomes an inconsistent tie, so position bias cannot create wins.

Terminal
modelstill eval pairwise runs.jsonl <before> <after> --spec tasks/<task>/spec.yaml \
  --base-url http://localhost:4000 --api-key-env LITELLM_API_KEY

It prints wins for each run, ties, the later run's win rate over decisive cases with an exact interval, a sign test, and the inconsistency rate with its own exact interval. A high inconsistency rate means the judge cannot tell the answers apart, so trust the win rate less.

Keep the judge out of the teacher's family

A judge tends to prefer answers in the style of its own model family. If it shares a family with the teacher that labelled the training data, the student is graded by its teacher's taste. ModelStill refuses that in three places:

  • modelstill spec validate refuses a spec whose eval.judge family is a teacher family.
  • JudgePanel refuses a judge from a teacher family, and holds at most one judge per family.
  • Pairwise comparisons and parity_metric take the teacher families and refuse an overlap.

An LLMJudge on its own does not check. Call check_independent before you use a single judge, or put it in a one-judge panel as in the example above.

Then

Once the judge agrees with people, its scores can feed the same paired comparison and gate as any other metric. See what an LLM eval framework should decide.

See a release gate pass and fail in three commands.

Get started