Sub topic 1
Why an LLM app needs its own evaluation dataset
Prerequisites
This chapter assumes you have:
- Basic Python and JSON/JSONL handling.
- Experience calling an LLM API or using an LLM-based app.
- A basic idea of prompts and model outputs.
- Elementary statistics: mean, proportion, sample size.
The problem with "it seems to work"
Most LLM apps start with a demo. You try ten prompts, the answers look good, and you ship. Then you change the prompt, swap the model, or add a retrieval step. You can't tell whether the app got better or worse, because your only evidence is a memory of a few good answers.
An evaluation dataset is a fixed set of test cases that you run the app against each time it changes. Each case has an input and enough information to judge the output. The score you get turns "it seems to work" into a number you can compare over time.
Why public benchmarks don't replace it
Public benchmarks measure general model ability. Your app has a specific job, with its own users, documents, tone rules, and failure costs. A model that ranks first on a benchmark can still give the wrong return policy for your store.
Your own dataset measures the thing you ship: the model, your prompt, your retrieval, and your post-processing, all together.
Failure modes an eval dataset catches
LLM output varies from run to run, and small changes have non-local effects. These are the problems a dataset finds:
- Regressions. A prompt edit fixes one case and silently breaks another.
- Slice failures. The app does well overall but fails on one kind of input, such as non-English questions or very long messages.
- Model drift. A provider updates a hosted model and behavior shifts without any change on your side.
- Overconfident wrong answers. The app states a policy that does not exist.
- Unsafe or off-topic replies to adversarial inputs.
An average over a handful of hand-picked prompts hides most of these.
Where the dataset fits in the workflow
The rest of this tutorial builds each part of that loop: defining success, sourcing and labeling cases, choosing graders, splitting and sizing the data, and maintaining it.
What a single case looks like
You will design the schema properly later. For now, one line of a JSONL dataset shows the idea:
{"id": "refund-001", "input": "Can I return a laptop after 45 days?", "reference": "No. Returns are accepted within 30 days of delivery.", "tags": ["returns", "policy"], "source": "production_log", "difficulty": "easy"}The id makes the case stable. The reference defines a good answer. The tags let you report scores by slice, and source records where the case came from.
Common mistakes to avoid
- Testing only with prompts you invented while building the app. You tend to write inputs the app already handles.
- Reporting one overall accuracy number with no slices.
- Changing the dataset and the app in the same experiment, so you can't tell which caused the score change.
- Having no written definition of success, so graders and teammates disagree on what a pass is.
The next chapter starts with the last point: deciding what counts as success for your task.
Exercise
You change your support bot's prompt. Overall accuracy on your 50 hand-picked demo prompts rises from 84% to 86%. Give two reasons this does not show the app improved, and say what an eval dataset adds.
Show answer
First, the demo prompts are the ones you wrote while building, so they reflect inputs the app already handles, and 50 cases leave a two-point change well inside noise. Second, an overall average can hide a regression on one slice, such as refund questions, while other slices improve. A dataset built from varied sources, with tags for slices and a fixed set of cases, lets you compare before and after on identical inputs and see per-slice scores.