How machines learn
Guess, check, adjust, repeat. Every model on Earth learns with the same simple loop.
Imagine learning to throw a paper ball into a bin across the room. You throw, you miss to the left, you aim a little more right. Throw again. Closer. Adjust again. Machine learning is exactly that, done millions of times very fast.
1οΈβ£ The model makes a guess
A model is just a big mathematical function with lots of adjustable knobs called parameters (or weights).
At the start the knobs are set randomly, so its guesses are rubbish.
2οΈβ£ We measure the mistake
We compare the guess with the right answer. A loss function turns "how wrong" into a single number.
Big number = very wrong. Small number = nearly right.
3οΈβ£ We nudge the knobs
An algorithm works out which direction to turn each knob to make the loss smaller, and turns it a tiny bit.
This is called optimisation. The most famous method is gradient descent (you'll meet it in Intermediate).
4οΈβ£ Repeatβ¦ a lot
One pass through all the training data is an epoch. Models often train for many epochs.
A big language model's knobs get nudged trillions of times during training.
What does the loss function tell us?
ποΈ Training vs. using
Training is the slow, expensive learning phase, where the knobs change.
Inference is using the finished model. The knobs are frozen; it just answers. When you chat with an AI, you're doing inference.
When you ask a chatbot a question, the model isβ¦
β¨ Before you drift off
- A model is a function with adjustable parameters.
- Training loop: predict β measure loss β adjust β repeat.
- Training changes the parameters; inference just uses them.
π Go deeper (free & open)
- But what is a neural network? (video series) β Β· 3Blue1Brown (Grant Sanderson) Β· Beautiful visual intuition
- ML Crash Course: Linear regression & loss β Β· Google Β· CC BY 4.0