Your eval run finishes and the pass rate is 71%. The usual next move is to read two or three failing cases, guess at a cause, add a sentence to the prompt, and rerun. Sometimes the number goes up. Often it goes up on the cases you just read and drops somewhere you did not look, because the two or three failures you happened to open were not representative of the other 29%.
A failure taxonomy replaces that guess with a count. You read a batch of failures, write down in plain words what went wrong in each, group those notes into a short list of failure modes, and tally them. The tally tells you which fix is worth making first, and it tells you when a "failure" is not a model problem at all. This article walks through the procedure, a small script that supports it, and the places it goes wrong.
Read first, name the categories second
The common mistake is to start with categories ("hallucination", "formatting", "reasoning") borrowed from a blog post. Generic labels are too coarse to act on. "Hallucination" does not tell you whether to change the retrieval step, the prompt, or the grader. Categories should come out of your own failures.
The procedure, borrowed from the open coding used in qualitative research:
- Sample. Pull 30 to 50 failing cases from one eval run. If the suite has distinct slices (different intents, languages, input lengths), sample across them rather than taking the first 50 rows, which are often all from one slice.
- Write a one-line note per case, before any grouping. The note describes what happened, not a verdict. "Answer cites the 2023 policy; the 2024 policy is in the context" is a note. "Bad answer" is not.
- Read the whole trace, not only the final output. For a RAG or agent feature, open the retrieved chunks and the tool calls. Many failures that look like generation errors are retrieval or tool errors upstream.
- Group the notes. Merge notes that would have the same fix. Split a group when two notes in it would need different fixes. Aim for 5 to 10 groups; if you have 25, you are labeling symptoms, and if you have 2, you are labeling too coarsely to act.
- Name each group with a sentence that implies an action, such as "Context had the answer, model ignored it" or "Grader rejects a correct answer phrased differently."
Do this alone first. If a second person codes the same cases independently and your groups differ a lot, your categories are ambiguous, and that is worth fixing before you build anything on them.
Record the labels where code can count them
Notes in a doc are fine for step 2, but once you have categories, store one label per failing case next to the case ID so the tally can be regenerated for every future run. A flat file is enough:
case_id,label,note
c-0412,ignored_context,policy_2024 chunk was retrieved at rank 2 but answer used 2023 figures
c-0377,grader_strict,answer correct; grader wanted the exact phrase "within 30 days"
c-0105,retrieval_miss,no chunk about refunds for gift cards was retrieved
c-0291,format_break,JSON wrapped in a code fence; parser failedThen a short script to count them, weighted the way that matters. Raw counts mislead when your suite over-represents one slice, so also report each label as a share of the whole suite, not only of the failures:
import csv, collections
failures = list(csv.DictReader(open("failure_labels.csv")))
suite_size = 400 # total cases in the eval run
sampled_failures = len(failures)
total_failures = 116 # failing cases in the run (you sampled some of them)
counts = collections.Counter(row["label"] for row in failures)
scale = total_failures / sampled_failures # extrapolate sample to all failures
print(f"{'label':20} {'in sample':>9} {'est. cases':>10} {'% of suite':>10}")
for label, n in counts.most_common():
est = n * scale
print(f"{label:20} {n:>9} {est:>10.0f} {100*est/suite_size:>9.1f}%")With 40 sampled failures out of 116, a label that appears 14 times extrapolates to about 41 cases, roughly 10% of the suite. That is an estimate: 14 of 40 is 35% of the sample, but with a sample this small the true share of all failures could plausibly be anywhere from about 20% to about 50%. Treat the ordering of large categories as reliable and the ordering of near-ties as unknown. If two categories are close and the decision between them matters, label another 30 cases.
Let the label choose the fix
The value of the taxonomy is that each label points at a different part of the system. Mapping the example labels above:
- `retrieval_miss`: the answer was never in the context. No prompt edit can help. Look at chunking, query rewriting, or index coverage, and measure recall at k separately from answer quality.
- `ignored_context`: the right text was in the prompt and the model did not use it. Now prompt work is appropriate: placement of the documents, an instruction to quote the supporting passage first, or removing a conflicting older chunk.
- `grader_strict`: the system was right and the check was wrong. Fix the grader or the reference answers. This is the label that most often surprises teams, and fixing it raises the pass rate without changing a single production behavior, which is exactly why it must be separated from real improvements.
- `format_break`: a parsing or output-contract problem. Usually solved with schema constraints, a repair step, or a more tolerant parser, not with more instructions.
Notice what the taxonomy prevents. Without it, grader_strict and retrieval_miss failures both look like "the model got it wrong", and a prompt edit aimed at them moves nothing while risking regressions elsewhere. With it, you might find that 30% of your failing cases are grader problems, and the highest-value afternoon of work is rewriting twelve reference answers.
Pick one label, make one targeted change, rerun the full suite, and relabel only the cases that still fail. The tally for the targeted label should shrink, and every other label should stay roughly flat. If an unrelated label grows, your change had a side effect and you caught it by name.
Where this breaks down
- Labels drift. After a month, "ignored_context" quietly absorbs cases that belong in a new category. Keep a one-line definition and one canonical example per label in the same file as the CSV, and revisit the list when "other" exceeds about 15% of cases.
- One case, several causes. A case can have both a retrieval problem and a grader problem. Assign the earliest cause in the pipeline as the primary label; fixing it may resolve the rest, and if it does not, the case will resurface under the next label.
- Sampling hides rare, severe failures. A tally ranks by frequency. A failure mode that appears twice but leaks another customer's data outranks every count. Keep a separate severity tag, and read every case with a high-severity label regardless of how few there are.
- It is retrospective. The taxonomy describes failures your test set already contains. If the suite lacks a kind of input, no label for it will ever appear; pair this practice with production-query clustering to find what the suite is missing.
- It costs reading time. Labeling 40 cases takes an hour or two. That is cheap against a week of prompt edits aimed at the wrong layer, but it is not free, so do it when a pass rate plateaus or a regression's cause is unclear, not after every run.
Checklist
- [ ] Sample 30 to 50 failures across slices, not the first rows.
- [ ] Write a descriptive one-line note per case before choosing categories.
- [ ] Read retrieved context and tool calls, not just the final answer.
- [ ] Group by "would share a fix"; keep 5 to 10 labels, each with a definition and an example.
- [ ] Store one label per case ID in a file that code can tally across runs.
- [ ] Report each label as an estimated share of the whole suite, and treat near-ties as ties.
- [ ] Separate grader and reference-answer errors from system errors before declaring any improvement.
- [ ] Make one targeted change per iteration and check that only the intended label shrinks.
- [ ] Track severity separately from frequency, and read every high-severity case.
Comments (0)
No comments yet — be the first.
Sign in to leave a comment.