LLM as a judge: how to write rules that hold up
Short answer: "LLM as a judge" means asking a second model to check an answer against a rule you write in plain English ("doesn't promise a refund before review") and return pass or fail. It's the only practical way to check tone, helpfulness or policy at scale. It works when each rule checks one thing, asks for pass/fail with a reason rather than a 1–10 score, and has been checked against your own judgment on 20–30 answers.
When to use a judge, and when not to
| Check | Use |
|---|---|
| Valid JSON, field present, label equals X, under 120 words, contains a link | An exact check. Free, instant, never wrong. |
| Answer matches a known fact (a total, a date) | Exact check if you can extract it; judge only if the wording varies a lot. |
| Tone, politeness, follows a policy, answers the actual question, no made-up details | A judge. |
Use exact checks wherever they fit and judges only for the rest. Every judge call costs money and adds a little noise.
Writing a rule that holds up
- One rule, one thing. "Polite, accurate and concise" is three rules. When it fails you won't know which part failed, and the judge will weigh them differently each time.
- Say what a failure looks like. "Fails if the reply promises a refund, a credit or a replacement before saying the order will be reviewed" beats "doesn't over-promise".
- Pass/fail, not a score. 1–10 scores drift: a 7 today is an 8 tomorrow. A binary verdict with a one-sentence reason is easier to check and to compare between models.
- Give the judge the context it needs: the user's input, the answer, and any facts it should check against (the order data, the policy text). A judge can't tell if "your order shipped on May 3" is true unless you give it the order.
- Ask for the reason before the verdict. Judges that explain first and decide second tend to be more consistent.
You are checking one answer from a customer-support assistant.
Rule: The reply must not promise a refund, credit or replacement
before stating that the order will be reviewed.
Customer message: {input}
Assistant reply: {answer}
First write one sentence explaining whether the reply follows the rule.
Then on a new line write PASS or FAIL.
Check the judge before you trust it
- Pick 20–30 answers, including some you know are bad.
- Mark them pass/fail yourself, without looking at the judge.
- Run the judge. Where you disagree, read its reason: usually the rule is ambiguous. Rewrite it and run again.
- Stop when you agree on nearly all of them. Then run the judge twice on the same answers: if verdicts flip, the rule is still too vague.
Known biases
- Self-preference: models tend to rate answers from their own family more kindly. When you compare models from several labs, use a judge from a lab that isn't in the comparison, or two judges from different labs.
- Length: longer answers often look better to a judge. If length matters, check it exactly, and tell the judge not to reward detail.
- Position: when you ask a judge to pick the better of two answers, the order can sway it. Checking each answer against a rule on its own avoids this.
A judge is a check, not a guarantee. For anything where a wrong answer is costly (money, legal, medical), use exact checks or a human review on top.
Where it fits
A judge is one step in evaluating an LLM for your product, and the rules you write are the reusable part: the same rules let you compare models whenever a new one ships.