LLM Evaluation Metrics and Benchmarks Explained
What MMLU, HumanEval and GSM8K measure, why public scores mislead, and how to build your own evals with exact match, pass@k, ROUGE and LLM judges.
A model’s benchmark score tells you how it did on someone else’s test. Whether it will handle your support tickets, your SQL or your contracts is a separate question, and only your own evals can answer it. This guide covers what the well-known public benchmarks actually measure, where they break down, which metric fits which kind of output, and how to run evals with an existing harness instead of writing one from scratch. Every claim is drawn from the original papers or the tools’ own documentation, linked inline.
What the common benchmarks measure
Each of these was introduced in a paper that states what it tests. Reading that description is the quickest way to know whether a score is relevant to you.
| Benchmark | Introduced in | What it tests | Scoring |
|---|---|---|---|
| MMLU | Hendrycks et al. (ICLR 2021) | Multiple-choice questions across 57 subjects, from elementary maths and US history to law and computer science | Accuracy |
| HumanEval | Chen et al. (the Codex paper) | Writing Python functions from docstrings; checked for functional correctness | pass@k |
| GSM8K | Cobbe et al. | About 8.5K grade-school maths word problems that need several reasoning steps | Accuracy of the final answer |
| MT-Bench | Zheng et al. (NeurIPS 2023) | Multi-turn, open-ended questions for chat assistants | An LLM judge |
A few details from the papers matter in practice. The MMLU authors built it to probe world knowledge and problem solving, and they found that models of the time had uneven results across subjects and often failed to recognise their own wrong answers. HumanEval scores a solution by running it, not by comparing text, so a correct function that looks nothing like the reference still passes. The Codex paper also reported that drawing many samples per problem and keeping any that pass is a strong way to get working code, which is why pass@k exists. GSM8K’s authors chose simple-looking problems on purpose: the arithmetic is easy, but chaining several steps without a slip is where large models still failed.
Why public scores mislead
Saturation. Once most strong models score near the top of a benchmark, it stops separating them. The MMLU-Pro paper states that results on MMLU had begun to plateau, which made model differences hard to see. Its fix was harder, reasoning-heavy questions, ten answer options instead of four, and removal of trivial or noisy items. The authors also report that MMLU-Pro scores move less when the prompt wording changes, a reminder that prompt format alone can shift a result on the original.
Contamination. Public test sets end up on the web, and the web ends up in training data. Yang et al. showed that the usual defence, filtering training data by n-gram overlap with test items, misses paraphrased or translated copies. In their experiments a 13B model trained on such rephrased samples reached scores comparable to GPT-4 on MMLU, GSM8K and HumanEval. They also found test overlap in widely used pre-training corpora and in synthetic data generated by GPT-3.5 and GPT-4, and they argue for fresh, one-time test sets.
Fit. Even an uncontaminated benchmark measures one task distribution. A multiple-choice knowledge test says little about whether a model follows your output schema or stays polite with angry customers.
The practical rule: treat public benchmarks as a coarse filter for a shortlist, then decide with private tests that have never been published.
Build evals for your own task
Anthropic’s guide to defining success criteria and building evaluations is a good template. Its advice, in short:
- Make criteria specific and measurable. “Classifies sentiment well” is not a target; an F1 threshold on a held-out set of real examples is.
- Cover several dimensions. Most applications care about more than accuracy: consistency across similar inputs, tone, privacy handling, latency and cost per call.
- Mirror real traffic and include edge cases. The guide lists missing or irrelevant input, very long input, hostile or off-topic user messages, and cases where even human raters would disagree.
- Automate grading where you can. It ranks code-based grading as the quickest and most dependable option, LLM-based grading as flexible enough for nuanced judgments once you have checked it is reliable, and human grading as the highest quality but slowest and most costly.
- Prefer more cases. The guide argues that many automatically graded questions beat a handful of carefully hand-graded ones.
Choosing a metric
Hugging Face’s guide to choosing a metric sorts metrics into three groups: generic ones such as accuracy and precision, task-specific ones such as BLEU or ROUGE for translation and summarisation, and dataset-specific ones tied to a single benchmark. For LLM work the useful options are these.
| Metric | Use it for | Main weakness (per its documentation) |
|---|---|---|
| Exact match | Labels, short factual answers, classification | Scores a one-character slip the same as a totally wrong answer |
| pass@k | Generated code with unit tests | Runs untrusted code, so it needs a sandbox |
| BLEU | Machine translation | Counts token overlap, not meaning; depends heavily on tokenisation and settings |
| ROUGE | Summaries against reference summaries | Also overlap-based; see Schluter (2017) for a discussion of its limits |
| BERTScore / embedding similarity | Paraphrase-tolerant comparison, answer consistency | Quality depends on the embedding model and language |
| LLM-as-a-judge | Open-ended answers, tone, helpfulness | Known judge biases (below) |
Some specifics from the metric cards. The exact match card gives 1 for an identical string and 0 otherwise, with no partial credit. The BLEU card warns that scores cannot be compared across datasets or languages, or between runs that used different tokenisation and normalisation. BERTScore replaces exact token matches with similarity between contextual embeddings, and its authors report better correlation with human judgments than earlier metrics. Anthropic’s guide applies the same idea to consistency testing: embed answers to paraphrased versions of a question and compute cosine similarity between them.
For pass@k, the Hugging Face code_eval metric implements the HumanEval harness. This is the example from its card:
from evaluate import load
code_eval = load("code_eval")
test_cases = ["assert add(2,3)==5"]
candidates = [["def add(a,b): return a*b", "def add(a, b): return a+b"]]
pass_at_k, results = code_eval.compute(references=test_cases, predictions=candidates, k=[1, 2])
The first candidate is wrong and the second is right, so the result is 0.5 at k=1 and 1.0 at k=2. The card states plainly that the metric executes model-written code, asks you to use a robust sandbox, and refuses to run until you set HF_ALLOW_CODE_EVAL.
LLM-as-a-judge and its biases
For outputs with no single right answer, a strong model can grade another model. The MT-Bench and Chatbot Arena paper tested this against human ratings and found that strong judges agreed with people about as often as people agreed with each other. The same paper names the failure modes to design around:
- Position bias: in pairwise comparisons, most judges the authors tested leaned towards whichever answer came first. Their conservative fix is to run the comparison in both orders and count a win only when the verdicts agree, calling it a tie otherwise.
- Verbosity bias: judges tend to reward the longer answer even when it is padded and no clearer or more accurate than a shorter one.
- Self-enhancement bias: a judge may prefer answers written by its own model. The authors saw hints of this but say their data was too limited to confirm it, so treat it as a risk to test for rather than a settled fact.
- Limited reasoning: GPT-4 as a judge mis-graded even simple maths questions it could solve on its own, because the candidate answers misled it. The paper’s remedy is reference-guided grading: give the judge a correct answer to compare against.
Anthropic’s guide adds three practical rules: write a detailed rubric, constrain the output to something countable such as correct/incorrect or a 1-5 score, and let the grader reason before it scores.
Running evals with a harness
You rarely need to write the loop yourself.
EleutherAI’s lm-evaluation-harness is an MIT-licensed framework with more than 60 standard academic benchmarks, plus hundreds of subtasks and variants. It runs Hugging Face models, vLLM, and APIs including OpenAI, Anthropic and any OpenAI-compatible local server, and it powers Hugging Face’s Open LLM Leaderboard. Model backends are now optional extras. The README’s quickstart:
pip install "lm_eval[hf]"
lm_eval --model hf \
--model_args pretrained=EleutherAI/gpt-j-6B \
--tasks hellaswag \
--device cuda:0 \
--batch_size 8
List tasks with lm-eval ls tasks. Add --output_path to save results and --log_samples to keep each model response for later inspection. For chat APIs, the README suggests starting with --limit 10 and reading the outputs to confirm answer extraction works before a full run. API models that do not return logprobs can only run generation-style tasks.
OpenAI Evals is a framework with a registry of existing evals and support for writing private ones from your own data. It needs Python 3.9 or later and an OpenAI API key, and API calls are billed. Note that the project is not currently accepting contributed evals that include custom code, though model-graded evals defined in YAML are still welcome. OpenAI’s separate hosted Evals platform in its dashboard is scheduled to shut down on November 30, 2026, so plan to run evals in your own code or with a harness like this one.
If you only need individual metrics in your own pipeline, Hugging Face Evaluate loads any of its metrics by name with evaluate.load(...), and each metric has a card describing its usage and limitations.
A workable routine
Shortlist models using public benchmarks that match your task. Build a private test set from real inputs, with edge cases, and keep it unpublished so it stays uncontaminated. Grade with code wherever the answer is checkable, and use an LLM judge with a rubric for the rest, checking a sample of its grades by hand. Re-run the same suite on every prompt or model change. For more tools in this space, browse the evaluation and monitoring category.
Written by AI Agents Directory
Editorial team
Facts in this guide are checked against official documentation and repositories, which are linked in the article.