liveBook · Manning

Stochastic gradient descent

As explained in How Large Language Models Work

Stochastic gradient descent is a gradient-descent technique that estimates parameter updates using a small random subset of training data.

Stochastic gradient descent (SGD) updates a neural network using a small random subset of training data instead of the entire dataset. Each subset estimates the next small move toward a lower loss. section 4.1.2

Using less data at each step greatly reduces memory requirements and speeds training. The estimate is usually sufficient because gradient descent changes parameters only a little at a time, though it is not the same as evaluating all data. section 4.1.2

A small step toward lower loss

Imagine a ball moving downhill on a loss-function graph. Inputs and known labels suggest how to adjust parameters; repeating these small updates millions or billions of times transforms the network into something useful.

How How Large Language Models Work covers it

How deep it goes
Explains the subset-based update and its memory rationale, but skips detailed mathematics and implementation procedures.
Examples
Uses labeled inputs, parameter adjustments, a downhill ball, and loss-function graphs to illustrate training.
What it assumes
Assumes a basic understanding of gradient descent, parameters, training data, and loss functions.
What you can do after
Evaluate/understand why training uses small data subsets and how those subsets approximate full-data gradient steps.
How it connects
Connects stochastic gradient descent with gradient descent, loss functions, neural-network parameters, training data, and Adam.

Also explained in

Compare how 12 books explain stochastic gradient descent →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of How Large Language Models Work. The section links point to the parts of the book it draws on.