Error Analysis: Learning From the Examples a Model Gets Wrong
A step-by-step way to read model mistakes, group them, estimate what fixing each group is worth and choose your next experiment.
Key takeaways
- Study errors from validation data, and keep the test set out of the process.
- Sample at random, tag each error with one or more plausible causes and tally the tags.
- The share of errors in a category caps how much fixing that category can gain.
- Compare each category's error rate with its overall frequency before calling it a weakness.
- Expect to find label mistakes, pipeline bugs and unclear definitions alongside model failures.
Error analysis means reading a sample of the cases your model gets wrong, sorting them into causes and counting. It tells you which problems are common enough to be worth fixing, and which clever idea would barely move the score.
A single metric says how often the model fails. Only the examples say why. A few hours of reading often redirects weeks of work.
The basic procedure
- Run the current model on validation data and save each input, true label, prediction and score.
- Draw a random sample of errors, often around a hundred for a first pass.
- Read each one, write a short note and assign tags such as "blurry image" or "negation in text."
- Count the tags, merging and splitting them as patterns appear.
- For the biggest groups, propose a fix and estimate its ceiling and cost.
- Run one change, then repeat.
Reading by hand cannot be skipped. A summary chart will never tell you that half the "failures" are screenshots of text that the loader silently turned black.
Choosing tags that lead to action
Good tags point toward something you could change. "Hard example" does not. "Date written in day-month order" does. Start with free-text notes and let categories emerge after a few dozen cases, instead of forcing everything into a list written in advance.
It helps to separate three questions in your sheet. What is true of the input, such as noise, length or language? What went wrong in the system, such as truncation or a missed lookup? And was the label right? Keeping them apart avoids a muddle in which "long document" and "text cut off" compete for the same count when the first is a symptom of the second.
Have a second person tag a shared subset. If you disagree often, the categories are vague. Agree on definitions with two or three example cases for each, then retag. This also protects against one reader's favorite theory shaping every judgment.
How many errors should you read? Enough that the large categories stop changing. If the last thirty examples produced no new tag and the ranking at the top held, you can act. If new causes keep appearing, keep reading.
A worked tally
In an invented example, a classifier is wrong on 500 of 5,000 validation images, an error rate of 10 percent. You read 100 random errors.
| Tag | Errors out of 100 | Ceiling if fully fixed |
|---|---|---|
| Taken at night | 40 | About 4.0 points |
| Wrong or doubtful label | 25 | About 2.5 points |
| Object mostly hidden | 15 | About 1.5 points |
| Two similar classes confused | 12 | About 1.2 points |
| No visible reason | 8 | About 0.8 points |
The ceiling is the category's share times the total error rate: 0.40 × 10 points = 4 points. Real fixes recover only part of it. If tags overlap, ceilings cannot simply be added.
Sampling adds uncertainty. For 40 out of 100, the standard error of the share is √(0.4 × 0.6 / 100) ≈ 0.049, so an approximate 95 percent range is about 30 to 50 percent. That is precise enough to rank large categories, but not to separate 15 from 12.
Turning counts into priorities
The ceiling is only one factor. For each category, estimate the share of the ceiling a fix could realistically recover, the effort required and the importance of those errors to users.
In the tally above, night photos have the largest ceiling, but collecting and labeling new night images might take weeks. Label errors have a smaller ceiling and might be repaired in two days, and they also distort every future measurement. Many teams would fix the labels first.
Severity can outweigh frequency. A rare confusion that sends a safety-related report to the wrong queue may matter more than a common one between two nearly interchangeable categories. If errors carry different costs, weight your tally by cost and rank by that.
Write each proposed fix as a testable prediction: "Adding brightness augmentation will cut the night error rate noticeably without raising the day rate." After the experiment, compare the specific category as well as the total. A fix can reduce its target and quietly add errors elsewhere, and only a comparison of predictions case by case, listing newly right and newly wrong examples, will show that clearly.
Compare with the base rate
Suppose night photos make up 40 percent of errors. Whether night is a problem depends on how many photos are taken at night.
Say night accounts for 1,000 of the 5,000 images. With 500 errors in total and 200 of them at night:
night error rate = 200 / 1000 = 20%
day error rate = 300 / 4000 = 7.5% Night is 20 percent of the data and 40 percent of the errors, so the model really is weaker there. Had night images been 40 percent of the data, the same tally would show nothing special.
To measure this you need the tag on correct examples too, at least on a sample. It is easy to notice a feature among failures that is just as common among successes. Slice-based evaluation makes this systematic.
Where to look besides a random sample
A random sample gives honest proportions. Targeted views find specific problems faster.
- Confident errors: high score, wrong answer. These often reveal label mistakes or a misleading shortcut.
- Near the threshold: cases the model finds ambiguous, which may be ambiguous for people too.
- Largest residuals in regression: look for unit errors, data entry mistakes and missing variables.
- Confusion matrix cells: which pairs of classes swap most.
- Slices: device, region, language, input length, time of day.
- Recently changed behavior: cases the previous model got right and the new one gets wrong.
Do not extrapolate proportions from targeted views to all errors. For a first look at class swaps, a confusion matrix is the natural start.
Typical causes and remedies
| Finding | Possible response |
|---|---|
| Mislabeled examples | Correct labels, tighten guidelines |
| Humans cannot tell either | Add a new input, or allow the model to abstain |
| Rare condition underrepresented | Collect or augment that condition |
| Information lost in preprocessing | Fix truncation, resizing or parsing |
| Missing context | Add a feature that supplies it |
| Spurious cue relied upon | Rebalance data or remove the cue, then retest |
| Class definitions overlap | Redefine the classes with the users |
Label problems deserve care. Fix them using a rule applied blindly to the model's output where possible, and review some correct predictions too. If you only revisit labels where the model disagrees, you will tilt the evaluation in its favor. Finding mislabeled data covers methods.
Error analysis for regression and ranking
With numbers, there is no right or wrong, so sort by the size of the error and read the worst cases. Then plot residuals, the true value minus the prediction, against the prediction and against important features. A curve suggests a missing nonlinearity, a widening fan suggests that noise grows with the value, and a cluster suggests a subgroup behaving differently.
With ranking, read whole result lists for queries that scored poorly. Typical findings include relevant items never retrieved, which no reordering can fix, and good items retrieved but placed low. Separating those two cases tells you which stage of the system to work on.
Guard against fooling yourself
Once you have read validation errors and fixed them, your model is partly shaped to those examples. Keep a portion of validation data that you never read to check that improvements carry over. If the read portion improves and the unread one does not, your fixes are too specific.
Avoid hand-written patches for individual cases. A rule that rescues three examples adds maintenance and rarely generalizes. And beware of stories: a plausible explanation for one error is a hypothesis. Confirm it by editing the input, such as brightening a night image, or by measuring the error rate across many cases with that property.
Handle the data responsibly. Error samples often contain personal information. Restrict access, redact what reviewers do not need and follow your organization's rules.
Make it a team habit
Invite someone who knows the domain to read errors with you. They notice that a "misclassified" record is actually filed that way for a reason, or that one confusion is harmless while another is dangerous.
Keep a short table of tags, counts and actions for each model version. Over time it shows whether categories shrink after you target them and which new ones appear. It also gives stakeholders a concrete picture of what the system still cannot do, which a single accuracy figure never will.
Finally, set a stopping rule. When the remaining errors are mostly unreadable inputs and honest ambiguity, further modeling has little to offer. The next gains, if any, come from better inputs or a different product design, such as routing uncertain cases to a person.