What is LLM-as-a-Judge and Why We Ask One AI to Grade Another
From the publisher’s feed, collected in the ZeroLabs newsroom.
Human review does not scale. Here is what LLM-as-a-judge means, how to use it, where it goes wrong, and how to check the judge is any good.Picture the same small shop in Islamabad. A new person at the counter writes a reply to a customer:“Your order 4512 is held at the Lahore warehouse. It should arrive on Tuesday.”Before that message goes out, a senior colleague reads it against a short checklist. Was it polite? Did it invent a date? Did it stay on the topic of the order?The customer never sees that checklist. They just get a reply that someone already checked.When the writer is one language model and the checker is another, that’s LLM-as-a-judge.So what is LLM-as-a-judge?LLM-as-a-judge means you use a language model to grade the output of another language model. Sometimes it even grades its own earlier answers.You give the judge the original question, the answer you want checked, and a rubric. The rubric is the checklist. It might say, “Mark this as a fail if the reply invents a delivery date.” The judge returns a score, a pass or fail, or a short verdict, often with a reason.This is different from a system prompt. A system prompt steers the model while it writes. A judge looks at the writing after it is done.Why we need a judge at allSome answers are easy to check with code. If you asked for a tracking number and the right number is 4512, you can test for an exact match. If you asked for valid JSON, a parser can tell you if it broke.Most useful answers are not like that. “Write a polite update about a delayed order” has many good versions. There is no single correct sentence. An exact string match will punish a perfectly good reply that used different words.The other option is a person. A person can read 20 replies carefully. They cannot read 2,000 before lunch, every time you change a prompt.Anthropic’s guidance on evals starts from a simple idea: define what success looks like, then design tests that measure it [2]. OpenAI makes a similar point. Automated scoring is how you evaluate early and often, but those scores still need to be checked against human judgment [3].Three common ways to judgePeople usually set this up in one of three ways [1]:Single-answer grading. You give the judge one reply and a rubric. It scores the reply on its own, like 1 to 5, or pass/fail.Pairwise comparison. You give the judge two replies to the same question and ask which one is better, or if they are tied.Reference-guided grading. You also give the judge a “gold” answer, written by a person, and ask how close the model’s reply is.Pairwise comparison is often easier for a model than inventing an absolute score. OpenAI notes that language models are better at discriminating between options than at open-ended judging [3]. If you only have one reply to check, a clear rubric with a pass/fail mark is usually cleaner than a vague “rate this from 1 to 10.”A tiny example in PythonHere’s a judge for the same shop we’ve used in earlier articles. A support model has already written a reply. Now a second model grades it.from openai import OpenAIclient = OpenAI()rubric = """You are grading a support reply for a small online shop.The customer asked about order 4512, which is held at the Lahore warehouse.Do not invent facts. There is no delivery date yet.Score the reply PASS only if all three points are met. Otherwise score it FAIL.1. Stays on the order, and is polite.2. Mentions that the order is held in Lahore.3. Does not invent a delivery date or tracking update.Reply in this exact format:Score: PASS or FAILReason: one or two sentences"""reply = "Your order 4512 is held at the Lahore warehouse. It should arrive on Tuesday."response = client.chat.completions.create( model="gpt-4o-mini", temperature=0, messages=[ {"role": "system", "content": rubric}, { "role": "user", "content": f"Grade this reply:\n\n{reply}", }, ],)print(response.choices[0].message.content)That reply should fail the third point. It invented a Tuesday arrival that nobody confirmed. A good judge will catch it, and tell you why.You would not run this once and call it a day. You would run it over a set of real examples, some good and some bad, and see whether the judge agrees with you.How well does it actually work?In 2023, researchers at LMSYS, the team behind Chatbot Arena, tested this idea in a paper that gave the method its popular name. They used strong models, including GPT-4, as judges on open-ended chat answers, and compared those verdicts with human ones.The headline result is why this caught on. A strong LLM judge agreed with humans more than 80% of the time, about the same as two humans agreed with each other [1]. On their MT-Bench set, GPT-4 and human experts agreed 85% of the time when ties were left out, which was slightly higher than the agreement among the humans themselves.That does not mean a judge is perfect. It means a good judge can stand in for a lot of slow, expensive human review, if you treat it as an approximation and keep checking it.Where the judge goes wrongA judge is still a language model. It has the same habits, and a few extra ones that show up when the job is grading.Position bias. When you show two answers, the judge often prefers whichever one you put first. In the LMSYS tests, even GPT-4 was not fully consistent when the same two answers were swapped [1]. A common fix is to judge both orders. If the winner changes, call it a tie.Verbosity bias. Judges often prefer a longer reply, even when the extra words add nothing. A short, correct update can lose to a padded one.Self-enhancement bias. A model can be a little kinder to answers that sound like its own style. If you are comparing two models, try not to let one of them be the only judge of the contest.It can also slip on tasks that need exact reasoning, like math, unless you give it a reference answer to check against [1]. And like any model, it can hallucinate a reason that sounds confident but is wrong. Anthropic’s later guidance on agent evals is practical here: calibrate the judge against human experts, give it a way to say “unknown,” and grade one clear criterion at a time rather than asking for one giant score [4].Practical tipsWrite a real rubric. “Be helpful” is not a criterion. “Fails if it invents a delivery date” is.Use a capable judge. A weaker model can write the reply, but grading usually needs a stronger one.Ask for a reason, then a score. A short explanation makes the mark easier to trust, and often improves it.Keep the temperature low, often 0, so the same example does not get a new grade every run.Test the judge on examples you have already graded yourself. If it disagrees with you a lot, fix the rubric before you scale it.Prefer code when you can. Exact IDs, JSON validity, and “did it call the right tool” are jobs for a script, not a model. Anthropic recommends deterministic graders where possible, and a model grader when you need the extra flexibility [4].For pairwise tests, swap the order and only keep a win if it holds both ways.Spot-check with a person on a regular sample. The judge should stay close to those marks over time.The short versionLLM-as-a-judge is when you ask a language model to grade another model’s answer, using a rubric you wrote.It exists because many good answers have no single correct wording, and people cannot read every reply. A strong judge can agree with humans about as often as humans agree with each other. It is still biased toward the first answer, toward longer answers, and sometimes toward its own style.Use it to scale review, not to replace your own judgment. Write a tight rubric, check the judge against examples you already marked, and let code handle the checks that do not need a model.So the next time someone says “the eval score went up,” a good follow-up question is: “Who was the judge, and have you checked it against a person?”References[1] Lianmin Zheng et al., “Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena,” NeurIPS 2023. https://arxiv.org/abs/2306.05685[2] Anthropic, “Define success criteria and build evaluations.” https://platform.claude.com/docs/en/test-and-evaluate/develop-tests[3] OpenAI, “Evaluation best practices.” https://developers.openai.com/api/docs/guides/evaluation-best-practices[4] Anthropic, “Demystifying evals for AI agents.” https://www.anthropic.com/research/demystifying-evals-for-ai-agentsI write one simple AI explainer every week. Follow if you want the next one.What is LLM-as-a-Judge and Why We Ask One AI to Grade Another was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.