What to Measure, Offline and Online
Decide what to measure for an LLM feature: turn the ways it fails into specific pass or fail criteria, choose code checks, a judge or people for each, and see how a fixed offline set and online signals from production traces feed each other.
Contentsand lesson path
On this page
- Why it matters
- Start from failure modes, not metric names
- Who decides: code, a judge or a person
- Offline: a fixed set, before anything ships
- Online: what production tells you
- One loop, two halves
- Check your understanding
- Apply it
- Review prompt
Lessons of AI Evaluation
- What to Measure, Offline and Online Concept · 15 min
- Lab: Trace Real Traffic, Then Analyse Errors Lab · 30 min
- Building a Versioned Evaluation Set Worked example · 20 min
- Lab: An LLM Judge Checked Against Human Labels Lab · 25 min
- Evaluations as a CI Regression Gate Lab · 25 min
- Check: Read an Evaluation Report Knowledge check · 10 questions
What you will learn
- Build a versioned evaluation set from real or realistic inputs, including edge cases and adversarial examples.
- Trace production LLM calls with prompt and model versions, token usage, latency and user feedback, with personal data redacted, and score a sample of traces with online evaluations.
Prerequisites: RAG Retrieval Evaluation, Grounding & Citations
01. Why it matters
Lumen's help-centre assistant answers questions from retrieved passages and cites them. Last week someone shortened its system prompt, read five answers, liked them and shipped it. Two days later support tickets mentioned answers without sources. Nobody could say whether the new prompt was worse, because nobody had measured the old one.
Reading a handful of outputs is useful for finding problems, but it cannot tell you whether a change helped: five answers are too few, you pick the ones you remember, and the model gives different answers on different runs. An evaluation replaces that impression with a repeatable measurement of the things your users need.
This lesson decides what to measure and where: offline, on a fixed set before a change ships, and online, on real traffic after it ships. The rest of the skill builds each piece: tracing and error analysis (lesson 2), a versioned evaluation set (lesson 3), a judge you have checked against people (lesson 4) and a regression gate in CI (lesson 5).
02. Start from failure modes, not metric names
Generic scores are easy to compute and hard to act on. A "helpfulness" rating of 7.2 out of 10 does not say what to fix, and text-similarity scores such as BLEU or ROUGE penalise a correct answer that is worded differently from the reference. Start instead from the ways this product fails, found by reading real outputs, and turn each one into a specific criterion that an answer either meets or does not:
- "Cites only passages it was actually given" rather than "is trustworthy".
- "Says it could not find the answer when the help centre does not cover the question" rather than "is honest".
- "States the refund window from the cited passage" rather than "is accurate".
Prefer pass or fail to a 1 to 5 scale. Two people agree far more often on whether an answer meets one clear criterion than on whether it deserves a 3 or a 4, a judge model is more consistent for the same reason, and a pass rate is easy to explain and track. When one criterion hides several decisions, split it into several binary criteria instead of adding points to a scale.
Criterion Checked by Offline Online
Answer under 120 words, citations as [id] code every case every call
Cites only passages that were retrieved code every case every call
Says "could not find" when docs are silent code + cases every case sampled
Every statement supported by its citation rubric judge every case 10% sample
Refuses requests for other customers' data code + cases must pass -
Latency, tokens and cost per call trace fields - every call
Thumbs down, rephrased question, handoff user signals - every callThe right measures also depend on the task. A classifier is scored with accuracy, and with precision and recall per class when classes are rare. Extraction is scored field by field with exact matches. Retrieval uses recall@k and the rank-aware metrics from the retrieval evaluation skill. A RAG answer, as in the plan above, needs support for each statement, citation checks and correct abstention. Whatever the task, write down each criterion and the case it came from, so that a later reader knows why it exists.
03. Who decides: code, a judge or a person
Each criterion needs a grader, and there are three kinds:
- Code assertions decide properties that a program can check exactly: the reply parses, it stays under a length limit, every cited ID was retrieved, a forbidden string is absent. They are free, fast and give the same verdict every time, so they run on every test case and can run on every production call.
- An LLM judge decides properties that need reading comprehension, such as whether each statement is supported by its passage. It applies a written rubric, costs a model call per verdict, and has known biases, so you trust its numbers only after you have compared them with human labels (lesson 4).
- People provide the labels that the judge is checked against, and they are the only ones who notice failure types nobody has named yet. They are the most expensive grader, so they label samples and read failures instead of every output.
Use them in that order: code checks first, the judge only on answers that pass the code checks, and people on a sample of both. Where code can decide, a judge only adds cost and noise.
04. Offline: a fixed set, before anything ships
Offline evaluation runs the system on a fixed set of inputs whose expected behaviour you have written down, and grades every output. Because every prompt or model change runs the same inputs, a difference in the score comes from the change and not from different questions. A good set mixes realistic answerable questions with edge cases (typos, two questions in one, another language), questions the help centre cannot answer, questions outside the product and adversarial attempts such as prompt injection.
Two habits keep the numbers honest. Split the set into a development part that you look at while improving the system and a held-out part that you score only to confirm a finished version, because a prompt tuned while staring at the same cases fits those cases. And version the set, because scores are comparable only between runs on the same version. Lesson 3 builds such a set and lesson 5 runs it as a gate on every pull request.
The offline set has limits too. It only contains the failures someone thought of, it ages as the product and its users change, and the same set gives slightly different scores on every run because models sample their output. The first two limits are what online evaluation is for; the third is why lesson 5 repeats runs.
05. Online: what production tells you
Online evaluation measures real traffic, and it rests on a trace of every model call: prompt version and model, tokens, latency, retrieved passage IDs and, later, the user's feedback. Version tags make traces comparable: when a new prompt serves 20% of traffic as a canary, you compare latency, cost and failures per version.
User feedback comes in two forms. Explicit signals, such as a thumbs down, are sparse and skewed: most users never click, and unhappy users click more often than satisfied ones. Implicit signals, such as rephrasing the same question, asking for a human or abandoning the chat, cover more calls but are ambiguous. Treat both as pointers to traces worth reading, not as a quality score.
On top of the traces, online evaluations run the same code checks and the same validated judge on a random sample of calls, for example 10% of a day. There is no expected answer for live questions, so only criteria that need no reference apply: support for each statement, citation validity, format, refusals. The sample catches drift and failure types that the offline set lacks; those become new offline cases.
06. One loop, two halves
Offline and online evaluation are not alternatives; each feeds the other. Production traces show failures, error analysis names and counts them, recurring types become new cases in the next version of the offline set, the CI gate stops changes that bring them back, and the released version is watched again through its traces.
production traces --> sample + online checks --> read failures, name the types
^ |
| v
deploy as a canary <-- CI gate on the offline set <-- new cases, new set versionStart small: twenty real questions graded by hand teach you more than a dashboard of generic metrics. Add code checks, then a judge, and tracing as soon as anyone outside the team uses the feature.
07. Check your understanding
08. Apply it
Start the practice project of this skill with a measurement plan for your RAG tool, saved as EVALUATION.md in its repository:
- Run your tool on 20 questions you collected (real ones if you have them) and read every answer with its retrieved passages. Write one line per problem you see.
- Group the lines into five to eight failure modes and write one binary criterion for each. Mark each criterion as code, judge or person, and as offline, online or both, as in the plan above.
- List the fields you will record per call (prompt version, model, tokens, latency, retrieved IDs, feedback) and which parts of the user's text you will redact before storing.
- Sketch the 40-case set you will build in lesson 3: how many answerable, unanswerable and adversarial cases, and where each kind will come from.
09. Review prompt
Without looking back, answer in your own words:
- Why is a list of binary criteria more useful than a single 1 to 10 quality score?
- Which kinds of criterion belong to code, to a judge and to people, and in what order do they run?
- What does an offline set catch that production traffic cannot, and the other way round?
- Which fields does a trace need so that two prompt versions can be compared in production, and what must happen to personal data before a trace is stored?
References
Your progress
Reading state
Sign in to save that you finished reading this lesson.
Prove this skill
10 questions · about 8 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.