Error analysis
Before building metrics, read your failures. A pile of real examples tells you what to measure.
Words on this page (5)
- trace
- : The full record of one run: inputs, model calls, tool calls, outputs, timing and cost.
- tool use
- : The model asks your program to run a function and reads the result.
- tool
- : A function the model can ask your program to run, described by a name, description and argument schema.
- prompt
- : The input text you give a model, including instructions, examples and data.
- policy
- : A rule for choosing actions. In a language model, the model itself is the policy.
The method
Collect a sample of real , the full record of each run including inputs, and outputs. Read them one by one and write a short note on what went wrong in each. After around fifty, group the notes into categories such as "wrong ", "ignored the instruction", "stale source". Count each category. The largest ones are what you fix first, and each category becomes an automated check.
Why it works
Generic metrics such as "helpfulness score" miss your product's specific failures. Reading traces finds them. It also builds the intuition to write good graders and good . Do it again after each round of fixes, because new failure modes appear once the old ones are gone.
A worked example: fifty traces
Open fifty failed conversations. Next to each, write one line: "ignored the date filter", "quoted an old ", "called the wrong tool", "answered a question it should refuse". Group the lines. Counts: old policy 17, wrong tool 11, ignored filter 9, other 13. Fix "old policy" first (probably stale documents), then rerun and read another fifty.
Make each category a test
For every category, add two or three real examples to the test set. The same mistake can then never return unnoticed.
How to write a good note
One trace often has several problems. Note the first thing that went wrong, because later errors often follow from it. If the search returned an old policy, the answer was wrong and the tone was confident. Label it "old policy", not three separate failures.
Write what happened, not a judgment. "Quoted the 2022 return window" is useful. "Bad answer" is not, and it cannot be fixed or counted.
When to stop reading
Stop when new traces stop producing new categories. Invented numbers: the first 30 traces give six categories, the next 20 add one. That is a good sign you have seen most of the common failures.
What goes wrong: categories nobody agrees on
Symptom: the biggest group is "other" or "bad answer". Confirm by having a colleague label the same 20 traces without seeing your labels. If you differ on many of them, the category names are too vague. Split them until two people pick the same label.
Another trap is reading only conversations with a thumbs-down. Unhappy users are a biased sample, so also read some random ones.
When reading traces is not enough
If failures are rare, say 1 in 500, a random sample of 50 may show none. Pull traces that a cheap code check or a user report already flagged. If the product has no users yet, there are no traces. Write realistic inputs yourself first.
Common mistake
Starting with abstract scores like "helpfulness 7 out of 10" before reading a single trace.
A restaurant owner reads fifty customer comments and groups them: 18 say slow service, 9 say cold food, 4 mention noise. They fix service first. Reading real failures and counting them beats guessing what to improve. AI teams who skip this spend weeks tuning things that were never the problem.
Check yourself
What is a trace?
Not quite. You read traces to see how a run went wrong.
What do you do with failure categories?
Not quite. Counting directs effort and the categories become tests.
After reading 50 traces you see 17 "old policy", 11 "wrong tool" and 9 "ignored filter". What do you fix first?
Not quite. Fix the biggest category first. Here that is the old policy.
You got 0 of 3 right.
Go deeper
- ArticleYour AI product needs evalsArticle
Hamel Husain · Includes the look-at-your-data loop.
- Article
Hamel Husain · Error analysis, with examples of what to count.
- Repo
Arize · Open-source tracing and evaluation UI for inspecting runs.
Spotted a mistake or something unclear? Report it on GitHub.