← All news

News / Learn / Evaluation & safety

What is LLM-as-a-judge?

You'll be able to use one language model to grade another model's answers, and know where that grading can go wrong.

LLM-as-a-judge means you use a language model to score or compare the output of another model. You give the judge a rubric, the input, and the answer, and it returns a verdict such as pass or fail, or a score from 1 to 5. It is a fast way to check answers that are hard to test with simple code.

Most AI features produce free-form text, so exact-match tests fail. Checking every output by hand does not scale. A judge model lets you run thousands of checks on each change to a prompt, model, or retrieval step. That speed is what makes regular evaluation practical for a small team.

A judge needs three things: the task, the criteria, and the answer under review. You write the criteria as specific yes-or-no questions or as a short rubric with clear level descriptions. Ask for a structured output, such as a label plus a one-sentence reason, so you can parse the result in code.

Before you trust a judge, compare its verdicts with labels from people on a sample of cases. Measure how often the two agree. If agreement is low, tighten the rubric, add examples of good and bad answers to the judge prompt, or split one vague criterion into several concrete ones.

Judges have known biases. They can prefer longer answers, favor the style of their own model family, or be swayed by the order in which answers are shown in a pairwise comparison. Reduce these effects by randomizing order, keeping the rubric focused, and not letting the judge see which model produced the answer.

Run the judge with a fixed model version and a low temperature so results are repeatable. Store the judge prompt and version next to your eval results. When you change the judge, rerun it on your labeled sample before you compare scores over time.

A minimal judge call that asks for a fixed JSON verdict. The client call is a placeholder for whichever provider SDK you use.

import json

JUDGE_PROMPT = """You are checking an answer against a source passage.
Rule: pass only if every claim in the answer is supported by the passage.
Return JSON: {"verdict": "pass" or "fail", "reason": "one sentence"}

Passage:
{passage}

Answer:
{answer}"""

def judge(passage: str, answer: str, call_model) -> dict:
    prompt = JUDGE_PROMPT.format(passage=passage, answer=answer)
    raw = call_model(prompt, temperature=0)  # placeholder client call
    result = json.loads(raw)
    if result["verdict"] not in ("pass", "fail"):
        raise ValueError("unexpected verdict")
    return result

A short sketch to show the idea. Check the official docs of the tool you use.

  • Trusting the judge without checking it Label a sample of cases yourself and measure agreement with the judge before you rely on its scores.
  • Using a vague rubric like 'is this good?' Write specific criteria, one per check, with clear examples of pass and fail.
  • Ignoring position and length bias Shuffle the order of compared answers and test whether longer answers get higher scores for no good reason.
  • Letting the judge see the model that produced the answer Hide the source model and strip identifying style cues so the judge scores content only.

Learn how to build a labeled eval set, since you need human labels to calibrate any judge. Then study pairwise comparison and how to compute agreement statistics, such as Cohen's kappa, to quantify how well the judge matches people.

Can a judge model replace human review?

Not fully. A judge scales checking, but humans still set the standard and check the judge. Use people to label a sample and to review disagreements.

Should the judge be a stronger model than the one being tested?

Often a more capable judge helps, but it is not required. What matters most is that the judge agrees with human labels on your own examples.

How many test cases do I need?

Start with a few dozen labeled cases that cover your common and risky inputs. Add more as you find failures. Size matters less than coverage of real use.

Why does my judge score change between runs?

Sampling randomness and model updates can shift results. Use temperature 0, pin the model version, and keep the prompt fixed when comparing runs.

Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.