Simple definition#
Evaluation methodology is the toolbox of ways to score a model’s output. There are four families: language-modelling metrics (how well the model predicts text), exact evaluation (checks with an unambiguous answer), AI as a judge (another model scores the output) and comparative evaluation (rank models by which output people or judges prefer).
No single method is enough. Production evaluation combines them — see evaluating AI systems for how to build the pipeline.
Why evaluating foundation models is hard#
| Challenge | Why it matters |
|---|---|
| Open-ended outputs | A question can have many good answers; you cannot compare to one reference |
| Stronger models are harder to judge | Checking a PhD-level proof or a long research report takes an expert |
| Black boxes | You often do not know the training data, architecture or post-training |
| Benchmarks saturate | Public benchmarks are solved, or leaked into training data, within months |
| The scope widened | General-purpose models must be checked for capabilities nobody asked for — and for harms |
Language-modelling metrics#
These measure how well a model predicts text. They matter most to model builders, but are useful to application teams for data checks and confidence.
| Metric | Meaning | Lower is better? |
|---|---|---|
| Entropy | How much information a token carries on average — how unpredictable the data is | — (property of data) |
| Cross-entropy | How hard it is for the model to predict the next token in a dataset | Yes |
| Bits-per-character / bits-per-byte (BPB) | Cross-entropy normalised per character or byte, so models with different tokenizers can be compared | Yes |
| Perplexity | The exponential of cross-entropy — roughly “how many tokens the model is choosing between” | Yes |
How to read perplexity:
- More structured data → lower perplexity. Code and HTML are more predictable than poetry.
- Bigger vocabulary → higher perplexity, because there are more options per token.
- Longer context → lower perplexity, because the model has more to condition on.
- Post-training (SFT, RLHF) usually raises perplexity even as the model becomes more useful, so perplexity is a poor guide to assistant quality.
Practical uses: detecting data contamination (unusually low perplexity on a benchmark suggests the model saw it), filtering training data, flagging unusual inputs, and as a confidence signal.
Exact evaluation#
Exact methods produce a verdict without ambiguity.
Functional correctness#
Does the output do what it should? This is the gold standard wherever you can run it.
| Task | Check |
|---|---|
| Code generation | Run unit tests; pass@k — the probability that at least one of k samples passes |
| Text-to-SQL | Execute the query and compare result sets |
| Structured extraction | Validate against a schema and compare field values |
| Agents and games | Did the task complete? Did the score improve? |
| Optimisation tasks | Is the schedule feasible, is the cost lower? |
Similarity against reference data#
When you have reference answers, compare the output to them:
| Method | How it works | Strength | Weakness |
|---|---|---|---|
| Exact match | Output equals the reference (or contains it) | Simple, strict | Fails on valid paraphrases |
| Lexical similarity | Overlap of tokens or n-grams: BLEU, ROUGE, edit distance | Cheap, established in translation and summarisation | Rewards wording, not meaning; needs many references |
| Semantic similarity | Cosine similarity of embeddings; BERTScore | Captures paraphrases | Depends on the embedding model; a fluent wrong answer can still look similar |
Embeddings turn text into vectors where semantically similar text sits close together — the same building block used for retrieval. Their quality is measured on benchmarks such as MTEB, but test on your domain.
AI as a judge#
An AI judge is a model prompted (or fine-tuned) to evaluate outputs. It is fast, cheap compared with humans, works without reference data and can explain its verdict, so it has become the default for open-ended evaluation.
Three ways to use a judge#
| Mode | Prompt shape | Use |
|---|---|---|
| Score a single output | “Rate this answer’s helpfulness from 1 to 5” | Absolute quality monitoring |
| Compare to a reference | “Is this answer consistent with the reference?” | Correctness when references exist |
| Compare two outputs | “Which response better answers the question?” | Model comparisons, preference data |
A good judge prompt contains: the task, the criteria (with definitions), a scoring system (binary or a short scale, which judges handle better than 1–100), and examples of each score with explanations. Ask for the reasoning before the score.
Limits and biases#
| Problem | What it looks like | Mitigation |
|---|---|---|
| Inconsistency | The same input scored differently across runs | Low temperature, multiple samples, examples in the prompt |
| Criteria ambiguity | Different judge tools define “faithfulness” differently, so scores are not comparable | Fix your own definitions and rubric; version the judge prompt and model |
| Cost and latency | A judge call per output doubles the bill | Sample in production; use small specialised judges; judge offline |
| Self-bias | A model favours outputs from itself or its family | Use a different model family as the judge |
| Position bias | Prefers the first (or second) option in pairwise comparison | Evaluate both orders; average |
| Verbosity bias | Prefers longer answers | Instruct against it; control for length |
| Shared blind spots | The judge misses the same errors the model makes | Validate the judge against human labels |
Specialised judges#
| Type | What it does |
|---|---|
| Reward model | Scores a (prompt, response) pair — used in RLHF and for ranking |
| Reference-based judge | Scores a response against a reference answer |
| Preference model | Predicts which of two responses users prefer |
Small fine-tuned judges can be cheaper and more consistent than prompting a frontier model, for a fixed set of criteria.
Comparative evaluation#
Instead of scoring each output, ask which of two outputs is better. People find comparison easier and more consistent than absolute scoring. Aggregating many pairwise “matches” with a rating algorithm (Elo, Bradley–Terry, TrueSkill) produces a ranking — the approach behind public arenas such as LMArena (formerly Chatbot Arena).
flowchart LR
P["Prompt"] --> A["Model A answer"]
P --> B["Model B answer"]
A --> J{"Human or AI judge:<br/>which is better?"}
B --> J
J --> R["Record win / loss / tie"]
R --> E["Rating algorithm<br/>Elo / Bradley–Terry"]
E --> L["Ranking"]
Challenges#
- Scalability. The number of model pairs grows quadratically; ratings need many comparisons per pair to be stable.
- Lack of standardisation and quality control. Crowd-sourced prompts are often simple; voters may not check correctness and may prefer style over substance.
- Relative, not absolute. Knowing A beats B does not tell you whether either is good enough for your use case.
Use public arenas as a signal, and run comparative evaluation on your own prompts with your own criteria when choosing between candidate models or prompt versions.
Choosing a method#
| Situation | Prefer |
|---|---|
| Output can be executed or validated | Functional correctness |
| Closed answer, stable references | Exact match or semantic similarity |
| Open-ended answer, clear criteria | AI judge with a rubric, validated against humans |
| Choosing between two versions | Pairwise comparison (both orders) |
| High stakes or new domain | Expert human review, then calibrate a judge |
Common mistakes#
Review questions#
What is perplexity and when is it useful for an application team? The exponential of cross-entropy — how uncertain the model is when predicting text. It helps detect data contamination, filter data and flag unusual inputs, but is a poor guide to assistant quality after post-training.
What is pass@k? The probability that at least one of k generated samples passes the tests — a functional-correctness metric for code generation.
What are the main biases of AI judges? Self-bias (favouring its own outputs), position bias (favouring an answer’s position), verbosity bias (favouring longer answers), inconsistency, and blind spots shared with the model under test.
How would you make AI-judge results trustworthy? Define criteria with examples, use a short scale, ask for reasoning first, use a different model family, swap positions in pairwise tests, version the judge prompt and model, and measure agreement with human labels.
Why use comparative evaluation, and what are its limits? Pairwise preferences are easier and more consistent to collect than absolute scores and produce rankings. But it scales poorly, crowd preferences lack quality control, and it tells you which model is better, not whether it is good enough.
Summary#
- Four families: language-modelling metrics, exact evaluation, AI judges, comparative evaluation.
- Prefer functional correctness wherever outputs can be executed or validated.
- Lexical similarity rewards wording; semantic similarity rewards meaning; both need references.
- AI judges scale open-ended evaluation but are biased — validate them against humans.
- Comparative evaluation ranks models; it does not set an absolute bar.
References#
- Chip Huyen, AI Engineering, O’Reilly, 2025 — chapter 3.
- Chen et al., Evaluating Large Language Models Trained on Code (pass@k), 2021.
- Zheng et al., Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena, 2023.
- Zhang et al., BERTScore: Evaluating Text Generation with BERT, 2019.
- Chiang et al., Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference, 2024.