How does a pile of parameters become something that can write, reason and code? Through training — and the core idea is simpler than it sounds. This is the most mathematical of our fundamentals, but we will keep the maths to what genuinely helps.
The pretraining loop
The whole objective: predict the next token
Pretraining sets the model one repetitive task: given some text, predict the next token. It reads a colossal corpus and, at every position, outputs a probability for each possible next token. That is all. Everything the model “knows” is a side-effect of getting very good at this one game.
Measuring wrongness: cross-entropy loss
To improve, the model needs a score for how wrong it was. That score is the loss, and LLMs use cross-entropy:
If the model gave the correct token a high probability, −log p is near zero (good). If it gave it a tiny probability, the loss is large (bad). Averaged over billions of predictions, this single number tells training exactly how it is doing.
Improving: gradient descent
Now the model must adjust its parameters to lower the loss. It computes the gradient — for each parameter, which direction and how much to change it to reduce error — and takes a small step in that direction:
The learning rate controls step size: too big and training is unstable, too small and it crawls. Repeat this step across the whole dataset many times and the loss steadily falls.
Backpropagation: gradients, efficiently
Backpropagation is the algorithm that computes all those gradients in one clever backward pass through the network, applying the chain rule from calculus. It is what makes training deep models practical rather than impossibly slow.
Why almost nobody pretrains from scratch
This loop, run on thousands of GPUs for weeks, costs millions — so only a handful of labs pretrain frontier models. Everyone else starts from a released base model and adapts it cheaply, which is exactly what fine-tuning, distillation and RLHF are for.
The scale behind “pretraining”
The numbers are staggering. A frontier model is trained on trillions of tokens, its compute measured in floating-point operations (FLOPs) that run for weeks on thousands of GPUs, at a cost commonly reported in the tens of millions of dollars. This is why only a handful of labs pretrain from scratch — and why the sensible path for almost every business is to adapt an existing base model rather than build one.
Reading a loss curve
Training is monitored by watching loss fall over time. Teams track it on held-out validation data too: if training loss keeps dropping while validation loss rises, the model is overfitting — memorising rather than generalising. A healthy run shows both curves falling together and levelling off, which is the signal that more compute would yield diminishing returns.