A gradient is a vector of partial derivatives indicating how a model objective changes with respect to its parameters. Gradient descent uses it to identify a direction that reduces loss, repeatedly adjusting weights and biases during training or fine-tuning. section 3.1.2
A training step uses the gradient within this sequence:
- Run inputs through the model to produce outputs. section 3.1.2
- Compare outputs with targets through a loss function that returns a single error value. section 3.1.2
- Backpropagate the loss, then let the optimizer update parameters in the direction that reduces error. section 3.1.2
Sentiment fine-tuning
When the correct sentiment is positive but the model assigns it only 30% probability, cross-entropy loss signals that the model should become more confident; gradients guide parameter updates toward that improvement. section 3.1.2
Figure 3.5 Gradient descent principle illustrated with a single weight variable. For LLMs, the same principle applies to billions of parameters.

Visualizes gradient descent with one weight variable while relating the same principle to models with billions of parameters. section 3.1.2


























