There is no single number that tells you whether an LLM application is good. A support chatbot, an invoice extractor and an AI agent fail in different ways, so they need different metrics. The useful question is not “which LLM evaluation metric is best?” but “what does a failure look like for this feature, and how would we count it?” This post is a reference to the LLM evaluation metrics we use, grouped by task: what each one measures, how it is calculated, and where it misleads. It ends with the frameworks and tools that compute them, and a starter set you can adopt this week. For how to build the test set and run evaluation in CI and production, see our guide to evaluating LLM applications in production.
Four kinds of metric
Every LLM evaluation metric falls into one of four groups, and they differ in cost and in how far you can trust them:
- Deterministic checks. Computed by code: valid JSON, required fields present, length limits, exact match against a known value. Free, instant and fully reliable, but they only cover what can be written as a rule.
- Reference-based metrics. Compare the output with a correct answer you wrote in advance: accuracy, F1, string or semantic similarity. They need labelled data, and text similarity in particular can penalize correct answers worded differently.
- Model-graded metrics. A language model scores the output against a rubric, often called LLM-as-judge. They can measure qualities like faithfulness or helpfulness that no rule captures, but they cost money, vary between runs and must be checked against human judgment.
- Human ratings and production signals. Expert review, user feedback, escalations and edits. The closest thing to ground truth, and the slowest and most expensive to collect.
Use the cheapest kind that measures the quality reliably. Most applications end up with many deterministic checks, a few reference-based metrics, a handful of model-graded ones and a small, regular human review.
Metrics by task
| Task | Main metrics | Usually graded by |
|---|---|---|
| Classification and routing | Accuracy, precision, recall, F1 per class, confusion matrix | Code, against labels |
| Extraction and structured output | Schema validity rate, field-level accuracy, document-level exact match | Code, against labels |
| Question answering and RAG | Retrieval recall@k, MRR, faithfulness, answer relevance, citation accuracy, correct refusal rate | Code for retrieval; judge for answers |
| Summarization | Key-point coverage, faithfulness, length | Judge, checked by people |
| Chat assistants | Resolution rate, correct escalation, policy and tone compliance, consistency across turns | Judge, people, production signals |
| Agents and tool use | Task success rate, tool-call accuracy, steps and cost per task, unsafe action rate | Code on traces, judge for outcomes |
| Code generation | pass@k on unit tests, compile rate | Code |
Classification and routing
When the model picks a category, such as the queue for a ticket or the intent of a message, use the standard classification metrics. Accuracy is the share of correct labels, but it hides problems when classes are uneven. If 90% of tickets are “billing”, a model that always says billing scores 90%. Precision (of the items labelled X, how many really are X) and recall (of the real X items, how many were found) per class tell you more, and F1 combines the two. A confusion matrix shows which classes get mixed up, which usually points straight at the fix.
Extraction and structured output
For pulling fields out of invoices, contracts or forms, measure at three levels:
- Schema validity rate: the share of outputs that parse and match the expected structure. This should be close to 100%, and structured-output features in most model APIs help get it there.
- Field-level accuracy: for each field, the share of documents where the value is correct after normalizing dates, amounts and whitespace. Report it per field, because a 97% average can hide a field that is wrong a third of the time.
- Document-level exact match: the share of documents with every field correct. This is the number that tells you how many documents a person still has to touch.
Question answering and RAG
RAG has two halves, and each needs its own metrics, because a wrong answer can come from either:
- Retrieval recall@k: for each test question, was a chunk containing the answer among the top k retrieved? This needs a labelled set of questions and the chunks that answer them.
- Mean reciprocal rank (MRR): how high the first correct chunk appears, averaged over questions. Useful when comparing chunking or reranking changes.
- Context precision: how much of what was retrieved is actually relevant. Low precision wastes tokens and gives the model more to get confused by.
- Faithfulness (or groundedness): the share of claims in the answer that are supported by the retrieved context. This is the main hallucination metric for RAG, and it is usually model-graded claim by claim.
- Answer relevance: does the answer address the question that was asked? A faithful answer can still miss the point.
- Citation accuracy: do the cited sources actually contain the cited claims?
- Correct refusal rate: on questions the sources cannot answer, how often does the system say so instead of guessing?
Our post on what breaks in RAG in production covers how to fix each of these when the numbers are poor.
Summarization
Summaries are hard to score with reference metrics because there are many good ones. Measure key-point coverage: list the points a good summary must include for each test document, then check how many appear. Pair it with faithfulness, meaning nothing in the summary contradicts or goes beyond the source, and a simple length check. ROUGE, which counts overlapping words with a reference summary, is cheap and fine for spotting large regressions, but it rewards copying and punishes good paraphrase.
Chat assistants
For a conversational assistant, single-answer metrics miss the point; what matters is whether the conversation reached a good end. Useful measures are the resolution rate (conversations where the user’s need was met), correct escalation (handing to a person when it should, and not when it should not), policy compliance (no promises or advice outside what it is allowed to give), tone against your style guide, and consistency across turns (it does not contradict itself or forget what the user said earlier). Test with multi-turn scripts, not only single questions.
Agents and tool use
Agents are judged on outcomes and on the path they took. The task success rate is the share of test tasks completed correctly, checked against the end state, for example the record that should exist. Tool-call accuracy covers whether it chose the right tool with valid arguments. Track steps per task and cost per completed task, because an agent that succeeds after twenty tool calls may be too slow and expensive to run. Count the unsafe action rate, meaning actions it took that it should have asked about, separately from ordinary failures, since one is far worse than the other. Our post on AI agent development cost shows how steps and tokens turn into a monthly bill.
Code generation
Code has the best metric of all: run it. pass@k is the probability that at least one of k generated solutions passes the unit tests. For an application that shows one answer, pass@1 is what counts. Add compile or lint success, and check that generated tests are not simply asserting whatever the code returns.
Text similarity metrics, and their limits
Exact match, BLEU, ROUGE, chrF, and embedding-based scores such as BERTScore or cosine similarity all compare generated text with a reference text. They are fast and cheap, and they suit tasks with a narrow range of right answers: translation, short factual answers, normalized values. For open-ended answers they mislead. A correct answer in different words scores low, and a fluent wrong answer that reuses the reference’s words scores high. Use them to catch big regressions, never as the main quality metric for chat or summaries.
Making LLM-as-judge metrics trustworthy
Model-graded metrics are how most teams measure faithfulness, relevance, tone and helpfulness. They are only as good as the judge, so treat the judge as something you test too:
- Grade one quality at a time. A separate judge prompt for faithfulness, relevance and tone is more reliable than one prompt asking for an overall score.
- Prefer yes/no or a short scale with written definitions. “Is every claim supported by the context: yes or no?” is more stable than a score out of 10.
- Ask for the reason before the verdict, and keep the reasons. They are how you find out when the judge is wrong.
- Measure agreement with people. Have experts label a sample, then compare. Report the agreement rate, or Cohen’s kappa if you want to discount agreement by chance, and recheck it when you change the judge model or prompt.
- Watch for known biases. Judges favor longer answers, the first option in a pairwise comparison, and sometimes text written by their own model family. Swap the order in pairwise tests and control for length.
- Fix the judge’s model version, so a provider update does not shift every score overnight.
Safety and policy metrics
- Harmful or off-policy output rate on a set of adversarial and sensitive prompts.
- Prompt-injection success rate: how often instructions hidden in user input or retrieved documents change the system’s behavior.
- Personal data leakage: outputs that reveal data the user should not see, checked with pattern matching and targeted test cases.
- False refusal rate: legitimate requests the system refuses. Tightening safety without tracking this one makes the product useless in a different way.
Operational metrics
Quality that is too slow or too expensive is not shippable, so evaluate these alongside it, on the same test runs:
- Latency: median and 95th percentile per request, and time to first token for streamed answers.
- Tokens and cost per request, and per completed task for multi-step flows.
- Error rate: timeouts, rate limits, malformed responses and retries.
Production signals
Once real users arrive, some of the best metrics come from behavior: thumbs-up and thumbs-down rates, how often users rephrase and ask again, escalations to a person, how much people edit an AI-written draft before sending it, and whether they come back. None of them is a clean quality measure on its own, but a sudden change in any of them is worth investigating, and the conversations behind them become your next test cases.
Turning metrics into decisions
A metric only helps if it changes what you ship. Four habits make the numbers usable:
- Set a threshold per metric before you look at results, and agree on who can override it.
- Compare against the current version, not an absolute ideal. The question for a change is whether it is better or worse than what is live.
- Report by slice. An overall score can rise while one customer type, language or document format gets worse.
- Know the noise. On 200 test cases, a measured 90% pass rate is only accurate to about plus or minus four points, so a two-point change between runs may be nothing. Run the set more than once when outputs vary, and grow it where decisions are close.
LLM evaluation frameworks and tools
You can compute most of these metrics in a few hundred lines of your own code, and for deterministic checks that is often the best option. For model-graded metrics, tracing and dashboards, these are widely used:
| Tool | What it is good for |
|---|---|
| Ragas | Open-source RAG metrics: faithfulness, answer relevance, context precision and recall |
| DeepEval | Open-source test framework with many ready-made metrics, written like unit tests |
| promptfoo | Open-source, config-driven prompt and model comparisons, CI checks and red-team tests |
| Inspect | Open-source framework from the UK AI Security Institute for writing detailed evaluations, including agent tasks |
| Langfuse, Arize Phoenix | Open-source tracing with evaluation scores attached to production traces |
| LangSmith, Braintrust | Hosted platforms for datasets, experiments, judges and production monitoring |
| lm-evaluation-harness | Running standard academic benchmarks against models, for comparing models rather than applications |
Choose by where your traces already live and how your team works, not by the length of the metric list. Whatever you pick, keep the test set in your own repository, so you can change tools without losing it.
Public benchmarks and leaderboards measure models on general tasks. They are a reasonable way to shortlist models, but they say little about how a model will do on your documents, your users and your prompts. Only your own test set can tell you that.
A starter metric set
If you have nothing in place yet, start with these and add more only when a real failure shows you need them:
- One deterministic check for every format rule: valid structure, required fields, length, banned content.
- The main task metric from the table above, such as field accuracy, task success or retrieval recall, on 100 to 300 real cases.
- One model-graded metric for the failure that worries you most, usually faithfulness, with its agreement against human labels measured on at least 50 cases.
- A small adversarial set, tracking both harmful outputs and false refusals.
- Median and 95th-percentile latency, and cost per request.
- One production signal, such as thumbs-down rate or escalation rate, reviewed weekly.
Conclusion
Good LLM evaluation metrics follow from the task: classification and extraction have exact answers and should be measured exactly, RAG needs retrieval and answer metrics kept apart, and chat and agents are judged on outcomes. Use code wherever a rule will do, check model judges against people, track cost and latency next to quality, and read every number by slice and against the version that is live. A short list of metrics people trust and act on beats a dashboard nobody reads.
Our quality engineering team builds evaluation suites like this for AI features, and we build them into every generative AI and AI agent project from the start. See how we tested the behavior of generative AI for a client.