# LLM-as-a-Judge

> The LLM-as-a-Judge is a technique of using a language model to evaluate the outputs of another model.

## What is LLM-as-a-judge evaluation?

The technique where a model scores or compares answers using defined criteria, for example correctness, completeness or tone. Allows evaluating open-ended outputs at scale, but the judge itself should be checked against human ratings.

- Topic: Quality & Operations
- Type: technique

## Example

Wrong:

```js
const prompt = `Rate this answer from 1 to 10:\n${answer}`;
const score = Number(await llm(prompt));
```

Right:

```js
const prompt = `Question: ${question}
Answer: ${answer}
Does the answer state the correct refund period (30 days)
and cite the policy page? Explain briefly, then reply
with JSON: {"reasoning": "...", "pass": true | false}`;
const { pass } = JSON.parse(await llm(prompt));
```

A pass or fail rubric with reasoning first gives more consistent, explainable judgments than a vague 1–10 score.

## Common mistakes

- Trusting judge scores without checking known biases, like preferring longer answers.

## Key points

- The judge prompt has a clear rubric with defined scores or a pass or fail result.
- The judge is asked to explain its reasoning before giving a score.
- Judge scores are checked against a sample of human labels.

## Interview questions

### What biases do LLM judges have?

Common ones are preferring longer answers, preferring the first option in a comparison and favoring outputs that sound like their own style.

### Can I use the same model as the judge and the generator?

You can, but it may favor its own outputs. Check judge results against human labels, and consider a different model as the judge.

### Is pass or fail better than a numeric score?

Usually yes. Binary checks with clear criteria are more consistent between runs than scores like 1 to 10.

## Related cards

- [Evals](https://wonderium.dev/ai/evals.md)
- [Benchmark](https://wonderium.dev/ai/benchmark.md)
- [AI Code Review](https://wonderium.dev/ai/ai-code-review.md)
- [Structured Output](https://wonderium.dev/ai/structured-output.md)

---

- Level: [Artificial Intelligence](https://wonderium.dev/ai.md)
- HTML version: https://wonderium.dev/ai/llm-as-a-judge
- Last updated: 2026-11-25
