How AI Models Learn: What This Guide Covers
Part 1 of this series covered what a model actually is: a learned recipe, tuned by parameters, doing inference once training is done. Fair question to ask next: learned from what, exactly, and how do you stop it learning the wrong lesson?
This post is about the learning itself — training data, epochs, loss, overfitting, fine-tuning, and RLHF. Six terms that show up constantly in AI writing and are rarely defined. I will not assume you know any of them.
What Is Training Data in Machine Learning?
Training data is the set of examples a model studies during training. For a language model, that is an enormous amount of text — books, websites, code, conversations. For an image classifier, it is photos with labels attached (“this one is a cat”). Google’s Machine Learning Glossary defines the closely related term “training set” the same way: the subset of the dataset a model actually learns from, as opposed to the data held back to check it afterwards. If you would like some real datasets to experiment with, I collected a few in Tools and Data to Experiment with Machine Learning.
The quality of that pile matters more than people expect. Feed a model sloppy, biased, or narrow examples, and it learns sloppy, biased, narrow habits — the same way you would if the only cookbook you ever studied was badly translated. Rubbish in, rubbish out is not a joke here; it is the entire mechanism.
What Are Epochs and Loss in Model Training?
An epoch is one full pass through the training data — the model has looked at every example once. Classical machine learning models usually train for many epochs, because a single read-through is rarely enough to learn much (I certainly cannot learn a new language from reading a textbook exactly once). Modern large language models are the exception: their datasets run to trillions of tokens, so pre-training often makes only one or two passes. Repeating the same text too often invites memorisation, and fresh, high-quality text is a finite resource. Google’s Machine Learning Glossary defines an epoch the same way: a full training pass over the entire training set, such that every example has been processed once.
Loss is a numeric measurement of how wrong the model’s current predictions are; training exists to push that number down. Loss starts high, because the model is guessing blindly. Then, step by step, an optimisation algorithm nudges the parameters to make the same mistakes a little less often, and loss creeps down.
Diagram 1. Training loss keeps falling, but validation loss turns back up once the model starts memorising.
The falling training curve is genuinely most of what “training” means in practice: guess, measure how wrong, adjust, repeat, thousands or millions of times. The second curve, validation loss, matters in the next section.
What Is Overfitting in Machine Learning?
Overfitting is a model behaviour where the model has memorised its training examples instead of learning the general pattern behind them. Imagine a student who prepares for an exam by memorising last year’s paper word for word, rather than understanding the subject. They will ace that exact paper and fail anything slightly different — that is overfitting.
| Signal | Well-fit model | Overfit model |
|---|---|---|
| Training loss | Falls steadily | Falls steadily |
| Loss on unseen (validation) data | Falls alongside training loss | Falls, then starts climbing again |
| Real-world behaviour | Generalises to new input | Repeats memorised examples, fails on anything new |
An overfit model looks brilliant on the data it was trained on and falls apart on anything new — which is precisely why it is trained on one set of data and checked against a separate set it has never seen. Google’s Machine Learning Crash Course describes an overfit model as an invention that performs well in the lab but is worthless in the real world — an apt summary of the training-loss-down, validation-loss-up pattern in the table above. For the wider trade-off between a model that is too simple and one that is too eager, see my Bias-Variance Challenge, and for checking a model honestly on data it has not seen, Cross-Validation Techniques.
What Is Fine-Tuning in AI Models?
Fine-tuning is the process of further training an already-trained, general-purpose model on a smaller, more focused set of examples so it gets noticeably better at one particular thing. Training a large model from nothing is enormously expensive, so most of the time nobody does it twice — fine-tuning is the shortcut. Hugging Face’s documentation describes the same trade-off: fine-tuning a pretrained model reduces compute cost and lets you use a state-of-the-art model without training one from scratch.
| Training from scratch | Fine-tuning | |
|---|---|---|
| Starting point | Blank, randomly initialised model | Already-trained general-purpose model |
| Data needed | Enormous, web-scale | Small, focused set of examples |
| Typical cost and time | Very high — weeks to months of compute, depending on scale | Comparatively low — hours to days |
| Result | A new general-purpose model | A specialist version of the existing model |
Fine-tuning comes in two common flavours. Domain adaptation continues training on specialist material, such as medical or legal text. Supervised fine-tuning (SFT, also called instruction tuning) trains on example question-and-answer pairs so that a model which merely continues text learns to follow instructions. SFT normally comes before RLHF, which is the next section. If you want to see how little of the model you can get away with changing, LoRA fine-tuning trains small adapters instead of the whole network, and my older transfer learning and fine-tuning example in TensorFlow shows the same idea on image classification.
Think of a chef who trained across every cuisine there is, then spent a further month working exclusively in an Italian kitchen. Still the same chef, same broad skill set underneath, but now unmistakably sharper at pasta.
One caveat: fine-tuning is good at changing behaviour and style, but it is a clumsy way to add fresh facts. If what you need is up-to-date knowledge, retrieval-augmented generation (RAG) is usually the better tool.
What Is RLHF (Reinforcement Learning from Human Feedback)?
RLHF stands for Reinforcement Learning from Human Feedback, and it is a post-training step that turns a raw text-predictor into something you would actually want to talk to. A raw model simply continues text; ask it how to pick a lock and it may cheerfully carry on writing a burglary manual.
It works in two stages. First, human reviewers compare pairs of model answers and pick the better one — more helpful, safer, less rude. Those pairwise preferences train a separate reward model, which acts as an automated referee that scores any answer. Second, the assistant model practises against that referee, using reinforcement learning (traditionally an algorithm called PPO), and adjusts its answers to earn higher scores. Humans never edit the model directly; they train the judge, and the judge coaches the model. Newer methods such as DPO skip the explicit reward model, but the idea of learning from human preferences stays the same.
RLHF resembles a diner sending a dish back — not because the recipe was technically wrong, but because it was not what anyone wanted to eat. A reward model is the diner’s opinion written down, so the kitchen can consult it without a customer standing at every table. It is a large part of why a raw model can sound blunt or erratic while the assistant version built on top of it sounds considerably more polite and useful. It does not make a model truthful, though; for that side of the story, see Can AI hallucinate?
A Combined Analogy: Training Data, Epochs, Loss, Overfitting, Fine-Tuning, and RLHF
Training data is what the chef studies. Epochs are how many times they go through the material. Loss is how far each attempt is from correct. Overfitting is memorising a recipe instead of learning to cook. Fine-tuning is specialising, and instruction tuning is learning to take an order. RLHF is a long string of diners sending dishes back, boiled down into a referee that tells the chef what people actually want.
How AI Models Learn: Quick-Reference Checklist
- Training data — the examples a model learns from; quality shapes everything downstream.
- Epoch — one full pass through the training data; classical models take many, large language models often one or two.
- Loss — a number measuring how wrong the model currently is; training pushes it down.
- Overfitting — memorising training examples instead of learning the general pattern.
- Fine-tuning — further training a general model on a narrower set of examples to specialise it; instruction tuning (SFT) teaches it to follow questions and answers.
- RLHF — human preference comparisons train a reward model, which then steers the assistant toward more helpful behaviour.
Next in This Series: Key Machine Learning Concepts
Training data, epochs, loss, overfitting, fine-tuning, and RLHF do not need maths to understand — training is just guess, measure, adjust, on repeat, at a scale that is hard to picture. What matters is knowing overfitting from genuine learning, and fine-tuning from RLHF, because release notes use all four words assuming you already do.
Next in the series, I bring in the actual maths: Part 3 covers the algorithms underneath — regression, gradient descent, and the classic architectures — for anyone who wants to go one level deeper.
References
- Training language models to follow instructions with human feedback — OpenAI’s InstructGPT paper, the paper that popularised RLHF for language models
- Overfitting — Google’s Machine Learning Crash Course definition and loss-curve diagnosis
- Machine Learning Glossary: ML Fundamentals — Google’s definitions of training set, epoch, and loss
- Fine-tune a pretrained model — Hugging Face’s documentation on fine-tuning
Stay Ahead in AI, Machine Learning & Python
No hype. Weekly notes on AI tools, Python, and what I'm actually building — plus seven free gifts, including Fantastic AI: The 2026 Toolkit and Python Virtual Environments.
You're in
Check your inbox for Set a password to unlock articles if you want gated tutorials. Log in with the same email.