NewProject Coding is here — build features and fix bugs in real codebases with an AI assistantSee what's new
Advanced
LLM-as-Judge: Building a Judge You Can Trust
35 min readChapter 4Core

1. LLM-as-judge: building a judge you can trust

An LLM judge is a language model you prompt to grade another model's answer against one written rule and return pass or fail. It reads the rule, a few labeled examples, and the answer, writes a short critique, then gives its verdict. Use one when the rule needs judgment code cannot apply and there are too many outputs for people to read every release. Skip it when code can check the rule, such as an exact refund amount, or when you have no human labels to check it against.

That last point is what the interview is really about. The question usually arrives as a follow-up: "You use an LLM to grade answers. How do you know the judge is right?" The judge is itself a classifier, and it makes mistakes. Your job is to measure those mistakes on human labels and carry them into every number you report. LLM Engineering 101 introduces judges as one evaluation option. Here we build one properly.

We'll stay with HelpDesk Assistant, the support assistant for a software company that answers from help-center articles and, in agent mode, can look up accounts and issue refunds. One criterion runs through the whole tutorial: the answer follows the refund policy, meaning it never promises a refund the policy does not allow.

This is a core eval topic. A mid-level candidate writes a binary judge with a critique and examples, then validates it with true positive and true negative rates on held-out labels. A senior candidate also picks the judge's threshold from labeled data, corrects the reported pass rate for the judge's own errors, and decides when a cheaper judge is good enough.

premium content mask
Upgrade to premium and unlock full chapter
Spot an issue or have a suggestion?
Comparing Versions and Catching Regressions  |

Discussion

Upgrade to premium to read and join the discussion.