How AI Learns
Weights, loss, and gradient descent — the training loop in plain English.
- ✓What 'weights' are inside a model
- ✓How a loss function measures error
- ✓How gradient descent improves the model step by step
Explanation
Underneath, a model is a large math function with millions of adjustable numbers called weights. Learning means finding good values for those weights.
During training, the model makes a prediction, and a loss function measures how wrong it was. A bigger loss means a worse prediction.
Gradient descent then nudges every weight a tiny amount in the direction that reduces the loss. Repeat this over millions of examples and the model gradually gets better. The size of each nudge is the learning rate — too big and training is unstable, too small and it crawls.
Code Example
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
Training a large model can mean repeating this loop billions of times across thousands of GPUs — which is why frontier models are so expensive to train.
- • Setting the learning rate too high, which makes the loss bounce around instead of going down.
Explain the training loop (predict → measure loss → adjust) to a friend using a non-technical analogy.
1. What does a loss function measure?
2. Gradient descent works by...