The big picture: two stages Watch
Every AI model lives two lives. First it learns, which is called training. Then people use it, which is called inference. Training happens once (or once in a while) and is very expensive. Inference happens every time you type a prompt or upload a photo.
- Collect data: photos, text, voice, numbers.
- Label it: add the right answer to each example.
- Train the model: guess, check, adjust, millions of times.
- Test it on examples it has never seen.
- Deploy it in an app, with the weights frozen.
- Inference: you give an input and get an answer.
Step 1: What is data labelling? Watch
A label is the right answer attached to an example. A photo with the label "cat", an email with the label "spam", a voice clip with the typed words. Data labelling (also called data annotation) is the work of adding these answers, mostly done by people.
Think of flashcards for a child: a picture on the front, the word on the back. The AI is the child, only it needs thousands of cards per word, not ten.
Kinds of labels Watch
| Type of label | What the person does | Used for |
|---|---|---|
| Class | picks a name: cat or dog, spam or not spam | photo apps, email filters |
| Bounding box | draws a box around each car, person or signal | self-driving cars, CCTV |
| Segmentation | colours every pixel of an object | medical scans, photo editing |
| Transcript | types out what is said in a voice clip | voice typing, Alexa, Google Assistant |
| Sentiment | marks a review positive, negative or neutral | customer feedback tools |
| Ranking | chooses the better of two chatbot answers | making chatbots helpful and safe |
How labelling is done, step by step Watch
- Write clear rules: for example, "label a photo cat only if the whole face is visible".
- Label: people use tools such as Label Studio (free and open source) to click, draw boxes or type answers.
- Check: a second person reviews a sample. When two people disagree, the rule is made clearer.
- Split: most examples, often 70 to 80 percent, are used to train; a small part is used to tune, and another part is kept hidden for the final test.
A famous example: ImageNet, the photo dataset behind the 2012 deep learning boom, has over 14 million images labelled by people around the world through online crowd work. Data labelling is also a real job today, and many labelling teams work from India.
Step 2: The training loop, inside Watch
A new model starts with random weights, so its first answers are pure guesses. Then the same four steps repeat:
- Example: give it one labelled example, say a photo labelled "cat". In practice a small group, called a batch, goes in together.
- Guess (forward pass): the pixels flow through the layers and the model says "cat, 30 percent sure".
- Loss: compare the guess with the label. The right answer was 100 percent cat, so the mistake, called the loss, is big.
- Adjust (backpropagation): work backwards through the layers to find how much each weight added to the mistake, and nudge every weight a little in the right direction. This is called gradient descent, and the size of the nudge is the learning rate.
After the nudge, the same photo might get "cat, 45 percent". One full pass over the whole dataset is called an epoch. Training runs many epochs, and the loss slowly gets smaller.
Step 3: Testing, then freezing Watch
While training, the model is checked on the tune (validation) set it does not learn from. If it scores well on training photos but badly on new ones, it has memorised instead of learning: this is called overfitting. At the end, the hidden test set gives the honest final score.
When the score is good enough, the weights are saved and frozen. That saved file of numbers is the trained model.
Step 4: What happens when you give an input (inference) Watch
Now you open the app and type or upload something. Here is what happens in a fraction of a second:
- Input: your prompt, photo or voice.
- Turn it into numbers: text is cut into tokens and each token becomes a list of numbers; a photo becomes pixel values.
- One forward pass: the numbers flow through all the layers, multiplied by the frozen weights.
- Scores: the last layer gives a score to every possible answer, like "cat 97 percent, dog 2 percent".
- Answer: the best one is shown to you. A chatbot picks one token, adds it to the text and repeats, word by word, until the answer is done.
Training vs inference in one table Watch
| Training | Inference | |
|---|---|---|
| What happens | the model learns from labelled data | the model answers your input |
| Weights | change after every batch | frozen, do not change |
| How often | once, or once in a few months | every time anyone uses it |
| Time | days to months | a fraction of a second to a few seconds |
| Computer power | thousands of GPUs for big models | one server, or even your phone for small models |
| Example | learning from millions of cat photos | face unlock checking your face |
Where deep learning fits Watch
Deep learning is machine learning with neural networks that have many layers. "Deep" just means many layers. Everything above, the forward pass, the loss and backpropagation, is exactly how deep learning models are trained.
Nobody tells the layers what to look for. From the labelled photos alone, early layers learn edges and colours, middle layers learn shapes, and deep layers learn eyes, ears and whiskers. Chatbots like ChatGPT and Gemini are deep learning models too, with dozens of layers and billions of weights.
Try it yourself, free Watch
Open Google Teachable Machine (teachablemachine.withgoogle.com). Hold up a pen to your webcam for a few seconds, then a cup: that is labelling. Press Train: that is training. Now show it the pen again and watch the percentages: that is inference. All three stages in under two minutes.
Lesson learned Watch
People label examples, the model trains by guessing, checking and nudging its weights millions of times, and then the weights are frozen. When you type, the frozen model turns your input into numbers, runs one forward pass and gives the most likely answer.
Frequently asked questions
What is data labelling in AI?
Data labelling, or annotation, means adding the right answer to each example, such as "cat" on a photo or a typed transcript on a voice clip, so a model can learn from it.
What is the difference between training and inference?
Training is when the model learns from data and its weights change. Inference is when the finished model answers a new input with its weights frozen.
Does ChatGPT learn from my chat while I talk to it?
No, its weights do not change during a chat. It sees earlier messages because they are sent again with each new one. Some apps may use saved chats to train future versions, depending on your settings.
What are the steps of training a model?
Start with random weights, then repeat: give a batch of labelled examples, let the model guess, measure the loss, and adjust the weights with backpropagation. Test on unseen data at the end.
Is deep learning different from this?
Deep learning is the kind of machine learning that uses many-layer neural networks. It is trained with exactly these steps: forward pass, loss and backpropagation.