In brief
Language models are compared on a set of a few hundred real company cases, with the correct result recorded before the test, not on public leaderboards. Each task type gets its own metric: field accuracy for document extraction, precision and recall for catching errors, rubric-based scoring for free text. Alongside quality you measure cost and time per case and the spread of results between runs. The same set then runs on every change of model or prompt.
Why public leaderboards are not enough
Model leaderboards measure general knowledge, math or coding on English tasks. Your process is invoices with Polish product names, customer emails written in a hurry and rules that appear in no public dataset. A model that tops a leaderboard can lose on your documents to a smaller, cheaper model.
Researchers behind the HELM project showed that model evaluation should cover several metrics at once, not just accuracy: among others calibration, robustness to input changes and efficiency. The NIST AI Risk Management Framework (AI RMF) likewise recommends measuring an AI system's performance under conditions similar to its deployment setting. For a company this means one thing: testing on your own data.
The test set: what to build it from
A test set is a list of cases with input and expected output. Build it like this:
- Take real cases from recent months, for example 300 purchase invoices or 300 order emails.
- Keep category proportions. If 10% of invoices are foreign, the set should hold about 10% too. Rare but costly cases are added separately and scored separately.
- Record the correct result. Ideally the one a person approved in the system. The process owner settles doubtful cases.
- Add hard cases: an illegible scan, an email with two orders, a document with a hidden instruction for the model.
- Freeze the set. Version it like code. Once the set changes, results from the old version are no longer comparable.
Keep part of the set aside and never use it to tune prompts. Otherwise you fit the prompt to the test, and results on new cases will be worse.
Metrics: a different one for each task type
| Task type | Example | Metric |
|---|---|---|
| field extraction | tax ID, amount, date, order number from an invoice | field match against the reference, per field |
| classification | email category, complaint type | accuracy, confusion matrix by category |
| catching errors | price mismatch, duplicate invoice | precision (how many alerts were right) and recall (how many errors were caught) |
| free text | a draft reply to a customer | rubric scoring: factual accuracy, completeness, tone |
| decisions with tool calls | a draft order in the ERP | right tools, right parameters, and a correct final result |
An average over the whole set hides problems. A model with 96% accuracy can be wrong on half the foreign invoices because they are a small fraction of the set. Results are always shown by category. When catching errors, you also need to settle what costs more: a false alarm or a missed error. That decides which model is better.
LLM as a judge: when it helps and when it misleads
Free text is hard to compare with a reference word for word. A popular way out is scoring by a second model against written criteria. A study by Zheng et al. showed that a strong model acting as judge can reach agreement with human ratings similar to agreement between humans. The same study describes the judge's biases: it favors the answer shown first, longer answers and answers from its own model.
Practical rules:
- Criteria instead of an overall score. "Does the answer give the delivery date from the system? yes/no" works better than "rate quality from 1 to 10".
- Calibrate against people. On 50–100 cases, compare the judge's scores with the team's. When agreement is low, fix the criteria.
- Swap the order. When comparing two answers, score both orders.
- Use a different model as judge from the models you compare.
Cost, latency and run-to-run spread
Quality is half the comparison. For each model also record:
| Metric | Why |
|---|---|
| cost per case (input and output tokens times the price list) | comparison with the cost of a person's work |
| response time, median and 95th percentile | whether it fits the rhythm of the process |
| spread between runs | the same set run 3 times does not give identical results |
| share of answers in the wrong format | each one is a case for manual handling |
How to calculate token cost is covered in The cost of language models. Spread matters when differences are small: a two-point lead can vanish in the next run.
Evals in CI: regression tests for the model
Once a model is chosen, the test set does not go into a drawer. It runs automatically on every change that might alter results: a new model version, a change to the prompt, the rules card or a tool. These are ordinary regression tests, only with thresholds instead of single assertions, for example "accuracy on foreign invoices does not drop below 93%". If a threshold is not met, the change does not go to production.
We build such tests as part of our Test automation service, and how to test an AI Worker before its first run is covered in Testing an AI Worker before go-live. How to measure its work after deployment is explained in How to measure the quality of an AI Worker's work.
Questions and answers
How many cases does a test set need?
For a first comparison, usually 200–300 cases, with every important category represented by at least a few dozen. With fewer, a difference of a few percentage points between models may be chance. The set grows over time: every production error goes into it as a new case.
Can you evaluate a model without personal data?
Yes, if personal data is not needed for the assessment. Names, addresses and account numbers can be replaced with fictitious ones in the same format before testing. When the task is precisely reading personal data, the test runs in the company's environment or with a provider under a data processing agreement.
How often should you repeat the evaluation?
On every change of model, prompt, rules or tools, automatically in CI. In addition, from time to time on a fresh sample of production cases, because documents change: new suppliers, new invoice layouts, new products. A drop on a fresh sample signals that the test set has gone stale.
Is it enough to let an LLM judge score every answer?
No. A judge speeds up scoring free text, but it has its own biases and can be wrong. Fields and classifications are better compared with the reference automatically, and the judge used only where a reference cannot be written down. Its scores need regular comparison with human ratings.