How to Evaluate AI Answers: LLM Evals for Beginners
You change one line in the instructions of your company's help chatbot, ask it three questions, and the answers look better. A week later a customer finds that refund questions now get a wrong answer. Nobody checked those, because "it looks fine to me" was the only test. LLM evals fix that: a fixed set of questions, marked the same way every time, so you can tell whether a change really made things better.
Why "it looks fine" is not a test
A quick look misleads you for two reasons. First, a language model's answers vary. Ask the same question twice and the wording can change, and sometimes one version is right while the other is not. That happens because chat apps usually let the model pick among several likely next tokens with a little randomness, the process you met in What Is an LLM?
Second, a change that fixes one question can quietly break another, and you only notice if you check the others too. People are also swayed by tone. As Why AI Hallucinates showed, a fluent, confident answer is not evidence that it is true. An eval replaces impressions with a number you can compare.
What an eval is
An eval, short for evaluation, has three parts. A test set is a fixed list of questions. Next to each one you write what a good answer looks like: the exact answer, or the facts it must contain. A scoring method turns every answer into a number. Run the whole test set, add up the scores, and you have one result for that version of your system.
The same idea works for the agents from What Is an AI Agent? There, each test is a task, and you score whether the agent finished it correctly, safely and within its step limit.
Building a small test set
Start small: 15 to 30 questions is enough to catch the big problems. Take them from real life, such as questions users have actually asked, not ones invented to make the system look good. Mix three kinds:
- Easy questions the system must never get wrong.
- Hard questions that need several facts or careful reading.
- Tricky questions: a false premise, a question your documents do not answer, or a request it should refuse. Here the right answer is "I don't know" or a polite no.
Write the expected answers or must-have facts before you look at any model output. If you write them afterwards, you will be tempted to accept whatever the model said. Then keep the test set fixed. If you add questions later, remember that old and new totals are no longer directly comparable.
Three ways to score
Exact or keyword match is the simplest: does the answer contain "Canberra"? It is fast, free and repeatable, which suits short factual answers. It is also brittle. "Many think it is Canberra, but it is Sydney" contains the keyword and passes, yet it is wrong. A keyword check sees words, not meaning.
A human rubric is a short list of criteria with points, like the card below. A person reads each answer and scores it for being correct, complete, safe and grounded. Grounded means every claim is backed by the source passages the system was given, which matters for RAG. A rubric is the most trustworthy method, and also the slowest.
An AI judge is a second language model that receives the question, the answer, the expected facts and the rubric, and is asked for a score. It is fast and cheap enough for hundreds of questions. But judges have biases of their own: studies have found they tend to favour longer answers and answers written in their own style, and they can simply be wrong. Give the judge clear criteria, and have a person spot-check a sample of its marks, for example one in ten.
Comparing changes, and common mistakes
An eval earns its keep when you change something: a new prompt, a different model, or new documents for RAG. Run the full test set before and after, with the same settings, and compare question by question, not only the totals.
Remember that answers vary between runs. On 20 questions, a difference of one or two points can be pure chance. When the decision matters, run the set two or three times and compare the averages.
Three mistakes catch most beginners. Too few questions means one lucky answer swings the result. Only easy questions means every version looks perfect. Trusting an AI judge blindly means you never learn when its marks are wrong.
Check yourself
Why write the expected answers before reading the model's answers?
So you mark against a fixed standard instead of talking yourself into accepting whatever the model said.
A keyword check for "Canberra" passes "Many think it is Canberra, but it is Sydney". What does that show?
Keyword matching checks words, not meaning, so it can pass a wrong answer; a rubric or a judge is needed for cases like this.
On 20 questions scored 0 to 2, a new prompt raises the total from 30/40 to 32/40. Should you keep it straight away?
Not yet. Check which questions dropped and rerun the set, because a two-point gain on 20 questions can be chance.