B2 · How Artificial Intelligence Works: Data and Learning

Learning from Mistakes

A model improves by learning from its mistakes: people find where it goes wrong, work out why, and give it more or better examples, often of exactly the cases it gets wrong. Then they train and test it again.

8 min Beginner Jump to the activity

What you need: Nothing. This page starts from the beginning, with no programming and no formulas.

Definition

The model keeps calling small dogs cats. How do we fix it?

A model improves by learning from its mistakes: people find where it goes wrong, work out why, and give it more or better examples, often of exactly the cases it gets wrong. Then they train and test it again.

In simple words

If you keep confusing two words, your teacher shows you more examples of both until you can tell them apart. In the activity, the model learned only from big dogs, so it calls every small animal a cat. Add a few small dogs to its examples, test again, and watch the accuracy rise.

Why it matters

Every real AI system is improved this way. Teams collect the cases a model gets wrong and add better examples. This is also how bias is reduced: when a model fails for one group of people, examples from that group are added.

Key terms

Error analysis
Studying a model's wrong answers to find out what kinds of mistakes it makes and why.
Retraining
Training the model again after improving the data.
Feedback
Information about whether an output was right, which is used to improve the system.
Iteration
One round of a repeated cycle: train, test, find mistakes, improve.
Edge case
A rare or unusual example that a model often gets wrong.

Explained in detail

A model does not fix itself

It is tempting to imagine that an AI system notices its own mistakes and quietly improves. Most do not. Once a model is trained, its parameters are fixed. If it calls a small dog a cat today, it will call the same dog a cat tomorrow and next year, until people step in. Improvement is something people do to a model: they find where it fails, work out why, change the data, and train it again.

Reading the mistakes

The most valuable habit in machine learning is to look carefully at the wrong answers. An overall score such as "82 per cent accurate" hides everything interesting. So engineers collect the examples the model got wrong and sort them into groups. Perhaps most of the errors are small dogs. Perhaps they are photos taken at night, or blurred ones, or cases where the label itself was wrong. This sorting is called error analysis, and it usually points straight at the fix.

What the errors showLikely causeFix
One kind of case is usually wrongToo few examples of that kindCollect and add more of exactly those
Errors are scattered with no patternLabels are noisy or features are weakCheck the labels; add better clues
Good in testing, poor in real useReal conditions differ from the dataGather data from real use
Two classes are confused with each otherThey look alike in the features usedAdd examples near the boundary, or a new feature

Better data usually beats more training

When a model disappoints, beginners often train it for longer on the same examples. This rarely helps, and it can make things worse by pushing the model towards memorising. A model that has never seen a wet road will not learn about wet roads from a thousand more passes over dry ones. What helps is the right new data: examples of exactly the cases it fails on. A hundred well-chosen examples of the weak spot can do more than ten thousand more of what the model already handles.

The cycle never quite ends

  1. Train the model on the current data.
  2. Test it on examples it has not seen.
  3. Study the mistakes and find their cause.
  4. Improve the data: add missing cases, correct wrong labels.
  5. Train again, and test again on fresh examples.

Products you use go round this cycle constantly. When you press "report spam" or "not spam", you are supplying a corrected label. When you choose a different word from the one your keyboard suggested, that is feedback too. Companies gather such signals from millions of users and retrain their models regularly. The model did not learn from its mistake in the moment; people built a process that turns mistakes into better training data.

How it works

  1. Test the model and list its mistakes.
  2. Look for a pattern in the mistakes: are they all small dogs?
  3. Work out why: no small dogs in the training examples.
  4. Add labelled examples of the missing cases.
  5. Train and test again, and compare the scores.

Try it yourself

Fix a model that confuses two classes

Test the model, add the small dogs to its examples, then test again. Compare the two scores.

Common mistakes

  • Adding random examples instead of the cases the model gets wrong.
  • Fixing one mistake and never testing again. A change can break something else.
  • Blaming the model. Usually the examples are the problem.

Check yourself

Question 1

1. The model gets every small dog wrong. What is the best fix?

Question 2

2. After adding examples, what must you do?

Question 3

3. How is bias in AI often reduced?

Summary

  • Find the model's mistakes and look for a pattern in them.
  • Add examples of the cases it gets wrong, then train and test again.
  • This is also how unfair gaps in AI are fixed.

Finished reading?