Error Analysis & Debugging Quality
Read failures, name and count them, find root causes and fix one thing at a time.
A score says how often the system fails, not why. Read at least 50 failures, describe them, name and count them, and ask why until you reach a fixable cause. Slice results by group, and change one thing at a time.
- Error analysis
- Reading failures closely to find patterns and causes.
- Root cause
- The underlying reason a failure happens.
- Slice
- A group of cases, such as one language or one customer type.
A score tells you how often the system fails. It does not tell you why. Error analysis is the practice of reading failures closely, grouping them and finding root causes. It is where most real improvement comes from. This lesson shows a method that works for any AI system.
Read before you measure more
Teams often respond to a low score by adding more metrics. A better response is to read 50 failures. Patterns appear quickly. The same cause lies behind many failures. Fixing one cause may lift the score more than a week of tuning.
A simple process
1. SAMPLE Pull 50 failed cases at random (not only the worst ones). 2. DESCRIBE For each, write one plain sentence: what went wrong? 3. NAME Give similar problems the same short label, like "old data" or "ignored limit". 4. COUNT Tally each label. Sort from most to least common. 5. ROOT CAUSE For the top two labels, ask why five times until you reach a fixable cause. 6. FIX Make one targeted change per cause. 7. VERIFY Re-run. Did that label shrink? Did a new one appear? 8. RECORD Add the cases to the test set and note the fix in the change log.
Common failure families
- Missing or wrong information: search did not find the fact, or the source was out of date.
- Ignored instructions: the prompt told the model a rule, and it did not follow it.
- Made-up facts: the answer states things no source supports.
- Wrong format: the output cannot be parsed or breaks a length rule.
- Wrong tool or wrong input: the agent called the right tool with a bad argument, or the wrong tool.
- Over- or under-refusal: it refuses safe requests, or answers risky ones.
- Context problems: the key fact was buried in a long input, or got cut off.
- Hostile input: a user or a document tried to override the rules.
Ask why, five times
A shallow fix hides the real cause. Keep asking why. The answer was wrong. Why? The model used an old price. Why? Search returned the old page. Why? Both pages exist in the index. Why? Nobody removed the retired page. The fix is to remove it and set review dates, not to tell the model to prefer new prices.
Slice the results
An overall score hides groups that do badly. Slice your results by type of question, customer group, language, length and difficulty. A system that is right nine times out of ten overall may be right only five times out of ten for one important group.
Fix the cheapest cause first
- Data and sources: update, remove or restructure documents.
- Prompt: clearer rules, better examples, an explicit unsure path.
- Code: add checks, limits or validation outside the model.
- Search: change chunking, filters or ranking.
- Model: switch or upgrade only if the above fail.
Write it down
Keep a short log: date, change, reason, score before and after, and anything that got worse. This log becomes the team's memory. It also protects you when someone asks why a decision was made.
- ✓Read at least 50 failures before adding more metrics. Patterns appear quickly.
- ✓Describe, name, count and find root causes. Keep asking why until the cause is fixable.
- ✓Slice results by group, because an average can hide a weak spot.
- ✓Fix one cause at a time, starting with data and prompt before the model, and keep a change log.
Run an error analysis
- Take 30 outputs from any AI feature, including failures.
- Write one sentence per failure, then give each a short label.
- Count the labels. For the top one, write five whys down to a fixable cause.
- Propose one change. Write how you will check it worked and what could get worse.
Q1Why sample failures at random?show answer
Looking only at the worst cases skews your picture. A random sample shows the real mix of causes.
Q2Why slice results by group?show answer
An overall average can hide a group that does badly. Slices show where the weak spots are.
Q3Why change one thing at a time?show answer
If you change many things, you cannot tell which one helped or hurt. One change at a time lets you learn.