Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Generative AI & Large Language Models — Alpha School

Lesson 14: Evaluating LLM Applications and Hallucination

How do you know whether a language model application is actually good? With a classifier, you could count right and wrong answers. With a model that writes free text, there is no single right answer to count against — a good summary can be written in a hundred ways, and a fluent answer can be completely wrong. Evaluating language models is therefore a craft of its own, and this lesson covers the three ways it is done: automatic checks, human judgement, and testing against known answers.

Automatic checks are fast but shallow. You can count whether the answer contains the key facts, whether it is the right length, whether it follows the format you asked for, and whether it cites sources that actually exist. You can also use a second model as a judge, asking it to score answers — which is fast and cheap, but risks the judge sharing the same blind spots as the model it judges. Automatic checks are good for catching regressions: run them every time you change something, and you will know immediately if the change broke the format or dropped the facts.

Hallucination: the failure that matters most

The failure you must watch most closely is hallucination: the model producing text that sounds plausible but is factually wrong, irrelevant or entirely invented — fake facts, invented studies, non-existent web addresses, wrong details about real people. IBM's description of the problem puts it plainly: large language models present invented material as factual, because they are trained to produce outputs that look statistically credible, not outputs that are true. Hallucination happens because the model predicts likely words rather than checking facts, and it is worst exactly where the model knows least — unfamiliar topics, precise details such as dates and numbers, and questions that assume something false.

Human judgement is slower but deeper. The honest way to evaluate is to take a sample of real questions, have people read the answers, and score them against a simple rubric: is it correct, is it complete, is it grounded in the sources given, and is it safe? A small, careful human evaluation of fifty answers tells you more than a thousand automatic scores. It also catches the failures that matter most to users — an answer that is technically correct but unhelpful, or one that is fluent and confident and wrong in a way that would mislead a real person.

Benchmarks: what they measure and what they hide

When a new model is announced, the announcement usually comes with benchmark scores — numbers from standard tests that measure how well the model answers questions, writes code, or reasons about problems. Benchmarks are useful for rough comparison, but they hide as much as they reveal. A benchmark tests the kinds of questions its authors chose, which may not match your questions at all. Models can also be trained, deliberately or accidentally, on the benchmark's own questions, which makes their scores look better than their real ability — a problem called contamination. And a single average score hides the pattern of failures: a model can score well overall while being terrible at the one kind of question your application depends on. The professional habit is to treat public benchmarks as a starting point and your own test set, built from your real questions, as the truth. If a model tops the public leaderboard but fails your test set, trust your test set.

The discipline to take from this lesson is to evaluate before you trust, and to keep evaluating after you deploy. Build your test set, run it on every change, read a sample of real answers every week, and keep a list of the failures you find — especially the hallucinations. A team that knows its model's failure modes is far safer than a team that only knows its average score.

Key Terms

Evaluation
Judging how good a language model application is, using automatic checks, human judgement, or tests against known answers.
Hallucination
A model producing plausible-sounding text that is factually wrong, irrelevant or entirely invented.
Rubric
A simple scoring guide for human evaluation, such as whether an answer is correct, complete, grounded and safe.
Model as judge
Using a second language model to score a first model's answers; fast, but it may share the same blind spots.
Regression
A change that makes an application worse; automatic checks are run on every change to catch them early.
Grounding
Basing an answer on real, checkable sources, so it can be verified rather than taken on trust.

Discussion Questions

  1. Why is evaluating a language model harder than evaluating a spam filter, where right and wrong can simply be counted?
  2. A model answers fluently and confidently, but invents a study that does not exist. Which evaluation method would catch that, and which would miss it?
  3. Why is a small human evaluation of fifty answers often more useful than a thousand automatic scores?

Practice Questions

  1. Why can't you evaluate a language model just by counting right and wrong answers?
  2. What is a hallucination?
  3. Why does hallucination happen?
  4. What is a rubric in human evaluation?
  5. What is a 'model as judge', and what is its risk?
Show answers
  1. Because free text has no single right answer — a good summary can be written in a hundred ways. A fluent answer can also be completely wrong, so correctness needs judgement, not just counting.
  2. Plausible-sounding text that is factually wrong, irrelevant or entirely invented. Examples include fake facts, invented studies and non-existent web addresses presented as real.
  3. Because the model predicts likely words rather than checking facts. It is worst where the model knows least: unfamiliar topics, precise dates and numbers, and false premises.
  4. A simple scoring guide, such as whether an answer is correct, complete, grounded and safe. People score a sample of real answers against it, which catches failures automatic checks miss.
  5. Using a second model to score the first model's answers; it is fast but may share the same blind spots. The judge can approve the same mistakes the first model makes.
Keep reading to complete this lesson