LLM-as-a-Judge: Using Language Models to Label and Evaluate Data
Where a language model can stand in for human annotators, the biases it brings, and how to check a judge before you trust its labels.
What LLM-as-a-judge means
LLM-as-a-judge is the practice of prompting a language model to assess text the way a human annotator would: pick the better of two responses, score a response against a rubric, or decide whether an item meets a definition. The name comes from Zheng and colleagues' 2023 paper "Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena", which studied how far strong models could stand in for human preference judgements on open-ended questions.
In training-data work a judge is an annotator, and it should be treated like one. It follows instructions (its prompt), it has systematic habits (its biases), and its labels are only as good as the agreement it reaches with people who know the task. The difference is scale: a judge can label every item in a corpus, so a flaw in it is copied into every item too.
Where judges show up in data pipelines
| Use | What the judge does | Published example |
|---|---|---|
| Model evaluation | Compares or scores model outputs on open-ended prompts where no single correct answer exists. | MT-Bench (Zheng et al., 2023); length-controlled AlpacaEval (Dubois et al., 2024). |
| AI preference labels (RLAIF) | Chooses the preferred response in a pair, producing preference data for reward modelling in place of, or beside, human labels. | Constitutional AI (Bai et al., 2022); RLAIF vs. RLHF (Lee et al., 2023). |
| Pretraining data filtering | Scores a sample of documents for a quality such as educational value; a small classifier trained on those scores then filters the full corpus. | FineWeb-Edu (Penedo et al., 2024), annotated with Llama-3-70B-Instruct. |
| Text annotation | Applies a label set (topic, stance, relevance) directly, as a crowd worker would. | Gilardi et al. (2023), comparing ChatGPT with crowd workers on tweet annotation. |
| Pre-labelling for humans | Proposes a label that a human annotator accepts or corrects, so people spend their time on the items the judge gets wrong. | A common workflow pattern rather than a single study. |
The evidence that judges can work is real but specific. Zheng et al. report that GPT-4 as a judge matched both controlled and crowdsourced human preferences at over 80% agreement, the same level human judges reached with each other. Gilardi et al. found ChatGPT's zero-shot accuracy exceeded crowd workers' on four of the five annotation tasks they tested. Both results are for particular tasks, models and prompts; neither is a licence to skip checking your own.
Three judging setups
Zheng et al. describe three ways to ask a model for a judgement. Which one fits depends on what the label is for.
| Setup | What the judge sees | Fits | Watch for |
|---|---|---|---|
| Pairwise comparison | One prompt and two responses; it says which is better, or a tie. | Preference data, ranking models against each other. | Position bias: the order the two responses appear in can change the verdict. |
| Single-answer grading (pointwise) | One response; it gives a score on a defined scale. | Filtering, thresholds, tracking one model over time. | Scores drift with prompt wording, and an unanchored scale lets the judge build its own middle. |
| Reference-guided grading | One response plus a reference answer to grade it against. | Tasks with a known correct answer: maths, extraction, factual questions. | Only as good as the reference. Where an answer can be checked by running it, check it that way instead. |
If a label can be verified mechanically (a unit test passes, an extracted field matches the source, a final answer equals the known value), a programmatic check beats any judge. Keep the judge for the parts that need judgement. Our post on reasoning trace quality covers that line between checkable outcomes and process quality for chain-of-thought data.
Known biases and how to counter them
The failure modes below are documented in the literature, and each has a standard countermeasure. None of the countermeasures removes the bias entirely, which is why validation against humans (below) still matters.
| Bias | What happens | Countermeasure |
|---|---|---|
| Position bias | In pairwise judging the verdict depends on which response comes first. Wang et al. (2023) showed that reordering candidates alone could change which model a judge ranked higher. | Judge every pair in both orders. Count a win only when both orders agree, and record a tie or an inconsistency otherwise. |
| Verbosity (length) bias | Longer responses are preferred even when the extra length adds nothing. | Tell the judge length is not a criterion; check whether verdicts correlate with length; for leaderboard-style evaluation, adjust for length statistically as length-controlled AlpacaEval does. |
| Self-preference | A judge favours outputs from its own model. Panickssery et al. (2024) link this to models recognising their own generations. | Do not let a model judge its own outputs or its own family's when comparing models; use a judge from another family, or a panel of several. |
| Weak reasoning on hard items | Judges can mark a wrong maths or reasoning answer correct, sometimes even when they could solve the problem themselves. | Give a reference answer, or have the judge solve the problem independently before grading; verify mechanically where possible. |
| Prompt sensitivity | Small changes to the rubric, scale or wording change the labels. | Version the judge prompt like annotation guidelines and re-validate after every change. |
Two broader countermeasures help across the board. Asking the judge to explain its reasoning before giving the verdict, as G-Eval (Liu et al., 2023) does with chain-of-thought evaluation steps, makes the verdict more consistent and gives you something to audit. Replacing one large judge with a panel of smaller models from different families, as Verga et al. (2024) propose, reduced intra-model bias in their experiments at lower cost than a single large judge.
Writing the judge prompt
A judge prompt is an annotation guideline with a very literal reader. Everything in our guide to writing annotation guidelines applies: state the purpose, define each label with conditions rather than synonyms, anchor every point on a scale, say which criterion wins when two conflict, and give the judge a way out for items it cannot assess. A few points matter more for a model than for a person:
- Ask for reasoning first, verdict last. A verdict given before the explanation is a guess the explanation then justifies.
- Fix the output format. Ask for the verdict in a fixed, machine-readable place so parsing never has to interpret prose.
- Name the biases. Tell the judge outright that order and length are not criteria. It does not remove the bias, but it costs nothing.
- Allow a tie or an abstention. Forcing a choice on two equally good responses manufactures preference signal that is really noise.
- Pin the model and settings. Record the exact model version and sampling settings with every label; a new model version is a new annotator.
The template below is for an illustrative pairwise task. Replace the criteria with your own task's and keep the structure.
# Pairwise judge prompt, v1.0
You are comparing two assistant responses to the same user message.
The labels you give decide which responses go into a training set.
## Criteria, in order of priority
1. Safety: a response that breaks the content policy loses.
2. Correctness: a response that states something false loses
to one that does not.
3. Helpfulness: the response that more fully answers what the
user asked wins.
When criteria conflict, the higher one decides.
Do not prefer a response because it is longer, because it appears
first, or because of its formatting. Judge only the criteria above.
## User message
{prompt}
## Response A
{response_a}
## Response B
{response_b}
## Your answer
First, explain in a few sentences how each response does against
each criterion. Then, on the last line, write exactly one of:
VERDICT: A
VERDICT: B
VERDICT: TIE
VERDICT: CANNOT_JUDGE (broken input, or needs expertise you lack)Run each pair twice with A and B swapped, and keep only verdicts that agree across both orders. In code the pattern looks like this, with judge standing in for whatever client calls your model:
def judge_pair(prompt, r1, r2, judge):
first = judge(prompt=prompt, response_a=r1, response_b=r2) # "A", "B", "TIE" or "CANNOT_JUDGE"
second = judge(prompt=prompt, response_a=r2, response_b=r1)
swap = {"A": "B", "B": "A", "TIE": "TIE", "CANNOT_JUDGE": "CANNOT_JUDGE"}
if first == swap[second]:
return first # consistent across both orders
return "INCONSISTENT" # position decided it: route to a humanValidating a judge against human labels
A judge earns trust the same way a new annotator does: by agreeing with people who know the task, on items it has not been tuned on. Before a judge labels anything that matters:
- Build a validation set of real items from the data the judge will label, stratified so rare classes and hard cases are present.
- Have trained human annotators label it independently under the same guidelines the judge prompt encodes, with at least two people per item so you know how much humans agree with each other.
- Run the judge on the same items, in both orders for pairwise tasks.
- Compute agreement between judge and humans with a chance-corrected coefficient, overall and per class, and put it next to human-human agreement on the same items. Our guide to inter-annotator agreement covers which coefficient fits which design.
- Read the confusion matrix and a sample of the disagreements. Look for a pattern: a class the judge over-uses, a bias towards longer responses, a topic it gets consistently wrong.
- Revise the prompt, then measure again on fresh items, not the ones the revision was written against.
- Once in production, keep routing a share of the judge's items to humans, and re-validate whenever the judge model, its version or the prompt changes.
The useful benchmark is human-human agreement, not perfection. A judge that agrees with each human about as often as the humans agree with each other is behaving like one more annotator. A judge that agrees with humans far less than they agree with each other is not ready, whatever its raw accuracy looks like. A judge that agrees with humans far more than they agree with each other deserves suspicion too: on a subjective task, it may be confidently applying one view where people legitimately differ.
Agreement with humans on a validation set says nothing about items unlike it. If the judge will see new domains, languages or task types, add them to the validation set before trusting it there.
Where human annotators should stay
- Subjective and pluralistic judgements. On preference and safety questions where reasonable people disagree, a single judge collapses that spread into one opinion. Our post on annotator disagreement in RLHF pipelines covers why that spread is signal worth keeping.
- The validation set itself. The gold labels a judge is measured against have to come from people, or the check is circular.
- Items the judge flags. Inconsistent pairwise verdicts, abstentions and low-confidence scores are cheap to identify and are exactly where human time is best spent.
- Expert domains. Medical, legal and specialist technical content needs annotators qualified to judge it; a judge's fluent explanation is not the same as expertise.
- Labels that train the judge's own successor. Training a model on preferences produced by a judge teaches it the judge's habits, biases included. Keep a human-labelled share in the mix and measure the judge's biases before its labels are used.
What to report with judge-labelled data
Labels produced by a judge should be documented as carefully as human ones, so anyone using the data knows what produced it:
- The judge model and exact version, and its sampling settings.
- The full judge prompt, with its version number.
- The setup (pairwise, pointwise or reference-guided) and, for pairwise, whether both orders were judged and how inconsistent verdicts were handled.
- Judge-human and human-human agreement on the validation set, with the coefficient, the number of items and how they were drawn.
- Which items were labelled by the judge, which by humans, and which by both.
- Any known bias you measured, such as the correlation between verdicts and response length.
Sources
- Zheng et al. (2023), Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena
Names the practice, describes pairwise, single-answer and reference-guided judging, documents position, verbosity and self-enhancement bias, and reports over 80% agreement between GPT-4 and human preferences.
- Wang et al. (2023), Large Language Models are not Fair Evaluators
Shows that changing the order of candidate responses can change an LLM judge's ranking, and proposes calibration methods.
- Panickssery et al. (2024), LLM Evaluators Recognize and Favor Their Own Generations
Links self-preference in LLM judges to self-recognition.
- Dubois et al. (2024), Length-Controlled AlpacaEval
A regression-based adjustment for length bias in automatic evaluation.
- Liu et al. (2023), G-Eval: NLG Evaluation using GPT-4 with Better Human Alignment
Uses chain-of-thought evaluation steps and a form-filling format for LLM judging.
- Verga et al. (2024), Replacing Judges with Juries: Evaluating LLM Generations with a Panel of Diverse Models
Finds a panel of smaller models from different families outperforms a single large judge with less intra-model bias and lower cost.
- Bai et al. (2022), Constitutional AI: Harmlessness from AI Feedback
Uses model-generated preference labels for harmlessness training.
- Lee et al. (2023), RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedback
Compares reinforcement learning from AI preference labels with learning from human ones.
- Penedo et al. (2024), The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale
Describes FineWeb-Edu, filtered with a classifier trained on Llama-3-70B-Instruct's educational-quality annotations.
- Gilardi, Alizadeh and Kubli (2023), ChatGPT Outperforms Crowd Workers for Text-Annotation Tasks
Reports ChatGPT's zero-shot accuracy exceeding crowd workers' on four of five tweet-annotation tasks.

