Every machine learning system, from a spam filter to a large language model, learns through the same basic loop.
The Ingredients
- Data: examples of inputs, usually paired with the correct outputs (labels).
- A model: a function with adjustable numbers called parameters. Before training, those numbers are arbitrary and the predictions are poor.
- A loss function: a single number that measures how wrong the model's predictions are.
- An optimiser: a procedure that nudges the parameters to reduce the loss.
The Training Loop
- Feed a batch of examples to the model and get predictions.
- Compare predictions with the correct answers to compute the loss.
- Work out which direction each parameter should move to reduce the loss.
- Move the parameters a small step in that direction.
- Repeat many times.
Over thousands or millions of repetitions, the model's parameters settle into values that capture patterns in the data.
Generalisation Is the Real Goal
A model that only memorises its training examples is useless. What matters is how well it performs on new data it has never seen, which is why models are always evaluated on held-out examples.
Why More Data Usually Helps
More varied examples give the model a better picture of the real world and make it harder to latch on to coincidences. Quality matters as much as quantity: mislabelled or unrepresentative data teaches the wrong lessons.