LLM as a judge means a language model grades work against written criteria, instead of a person or an exact test. It works when the judge has the criteria in writing, sees the evidence, answers in a fixed format and cannot overrule the checks a machine can do.
We run one on every pull request our AI agent opens. It is not asked whether the work is good. It is told to try to refute it. This is how it is built, and the rules we added each time it got something wrong.
What is LLM as a judge?
The term comes from evaluating chat models. Instead of paying people to compare answers, you ask a strong model to do it. The paper that named it, Zheng et al., measured how well that works:
Our results reveal that strong LLM judges like GPT-4 can match both controlled and crowdsourced human preferences well, achieving over 80% agreement, the same level of agreement between humans.
Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena, NeurIPS 2023 (retrieved 2026-10-24)
The same abstract names the limits: "position, verbosity, and self-enhancement biases, as well as limited reasoning ability". A judge prefers the answer it saw first, the longer one, and the one that sounds like itself. Keep those three in mind. Every rule below fights one of them.
Today the idea is used far beyond chat benchmarks: grading retrieval answers, scoring agent runs, and reviewing code. Ours does the last.
When should you not use an LLM judge?
When a cheaper check gives the right answer. A judge is slow, costs tokens and can be wrong. Code that checks a fact is none of those.
What you want to know
The right check
Judge?
Do the tests pass, does it type check?
Run them
No
Did a new test fail before the fix?
Run it on the base code
No
Do the links work, do the cited quotes appear on the source page?
A script
No
Does a classifier pick the right category?
A set of examples labelled by people, scored by code
No
Does the change do what the issue asked?
Read the issue, the diff and the evidence
Yes
Does a test exercise behaviour, or just read the source as text?
Read the test
Yes
The classifier row is a real one. For a client's online marketplace we tuned an LLM that sorts listings into categories. We did not ask another model whether the categories looked right. We labelled real listings by hand and let code count the matches. When there is a correct answer, a judge only adds noise.
How does our LLM judge review a pull request?
The judge is the VERIFY step in our agent loop, and an advisory check on pull requests people open. Same parts in both:
01
Machine checks first
A plain bash gate runs the repository's tests, type checks and lint, and proves that new tests were red on the base code. A model never grades these.
02
What was asked
The judge gets the issue, its done-when criteria and the diff stat. For a pull request without an issue, what the pull request says it does.
03
A fresh, read-only session
A new session that did not do the work, with read-only tools such as Read, Grep and Glob. It cannot change the code it judges.
04
Told to refute
The prompt starts: you did not do this work, your job is to try to refute it. Only findings a human reviewer would send the work back for.
05
A typed verdict
pass, fix or blocked, plus findings with id, severity, where and evidence, validated against a JSON schema.
The call itself is a few lines. This is the step in our shared CI action, slightly shortened:
prompt="$(cat "$L/verify.md"; data "$W/asked.md"; data "$W/checks.txt")"
npx -y @anthropic-ai/claude-code -p "$prompt" --tools "Read,Grep,Glob" \
--json-schema "$(cat "$L/verify.schema.json")" --output-format json --max-turns 40 > "$W/raw.json"
verdict=$(jq -r .verdict "$W/verify.json")
[ "$mrc" != 0 ] && [ "$verdict" = pass ] && verdict=fix # a red machine check is never overruled
--json-schema makes Claude Code return output that matches the schema (CLI reference, as of 2026-10-24). data wraps the issue and the check log in markers, and the prompt says that everything between them is data written by others, not instructions. An issue body cannot talk the judge into a pass.
The last line is the most important one. If the tests are red, no verdict turns that into a pass. The same gate also fails a task branch that moves a submodule pointer, a rule we explain in Monorepo vs polyrepo.
What did the judge get wrong, and what did we change?
Every rule in the judge's prompt came from a real miss. Four of them:
Tests that prove nothing. The agent wrote tests that read source files as text and checked that an import was there. Green, and useless. The judge now has to open every new or changed test, and a test that does not exercise behaviour is a required finding.
Moving goalposts. On the second round the judge found new, smaller problems in code that had not changed, so the loop never ended. Now a later round gets the previous findings and checks only those.
Letter instead of intent. It flagged exact counts, wording and table layout that differed from the issue, while the intent was met. Now a finding is required only if a human reviewer would send the work back for it.
The same finding forever. Findings carry a stable id. If the same id comes back two rounds in a row, another round will not fix it, so the loop stops and asks a person.
The worst miss was not the judge's at all. Earlier this year our AI code review in CI passed on every pull request and did not post a single review. An upgrade of the underlying action had dropped two inputs, and the job exited green with no prompt. A judge that never ran looked exactly like a judge that approved. Today a missing or invalid answer is its own verdict, unavailable, and it fails the job.
Which judge biases still apply?
All three from the paper, in a smaller form:
Position bias matters most when a judge compares two answers. Ours grades one piece of work against criteria, so there is no first or second answer to prefer.
Verbosity bias pushes a judge toward long answers. The schema limits what counts: a verdict, findings with evidence, a summary of a few sentences.
Self-enhancement bias is the one we have not removed. Our judge is the same model family as the agent that wrote the code. A fresh session, the refute prompt and the machine checks reduce it. They do not make it go away.
Using a different model as the judge is the obvious next step. We do it by hand for texts, and we have not wired it into the loop yet.
Want a reviewer that sends bad pull requests back?
We set up the machine checks, the judge and the CI around them right in a team's repository as part of AI-native SDLC for development teams. Is your team short of hands rather than review? See a senior developer for your team. AI writes all of our code today, and a senior is accountable for the result. Since 2023 we have delivered 15+ production projects.
We get back to you within two business days, and together we pick what to fix first.
Using a language model to evaluate the output of another model, or of an agent, against written criteria, instead of a person or an exact-match test. The judge gets the task, the criteria and the evidence and returns a verdict, ideally as structured data.
How accurate is LLM as a judge?
In the MT-Bench and Chatbot Arena study, strong judges such as GPT-4 reached over 80 % agreement with human preferences, about the level at which humans agree with each other. The same paper names position, verbosity and self-enhancement biases. Accuracy depends on the task, so measure it on yours.
When should you not use an LLM judge?
When there is a right answer you can check with code: a test, a type check, a link check, or a label set made by people. A judge is for criteria that need reading and judgement, such as whether a change does what the issue asked.
Can the same model judge its own work?
It can, but it tends to favour its own style, which the literature calls self-enhancement bias. We reduce it with a fresh session that did not do the work, a prompt that asks it to refute, machine checks it cannot overrule, and a person who merges.
What should an LLM judge return?
A typed answer, not prose: a verdict from a fixed set, and findings with a stable id, a severity, where the problem is and the evidence. Code can then act on it, and a missing or invalid answer counts as a failure, never as a pass.
Ask AI about this article
The AI also draws on our other articles and experience from real projects.
Playwright MCP gives an AI agent a real browser. How we use it so the agent checks its own change in the running app and hands back PASS or FAIL with screenshots, what it catches that unit tests miss, and when plain Playwright scripts are the better tool.
How we run Claude Code review on every pull request with one reusable GitHub Action: what the AI reviewer is told to look for, how it stayed green and silent, what it misses, and why only a person approves.
A Claude Code hook can pass on every run and still do nothing: stderr sent to /dev/null, a relative path, a trailing || true. Four checks that catch it, and the Stop hook that blocks "done" while tests are red.