Stochastic Gradient Descent, Exactly
Worked numerical examples of full-batch, single-sample, and mini-batch gradient updates with live tensors and checked exercises.
Stochastic Gradient Descent, Exactly
Trace full-batch, single-sample, and mini-batch updates step by step across a four-row dataset.
- Tiny Linear Data
per-sample losses vs mean loss across four slightly conflicting rows
- Full-Batch Gradient
averaging per-sample gradients across all four rows before updating w
- One Sample Gradient
updating the weight from a single training row's gradient
- Two Stochastic Updates in Order
evaluating the second sample's gradient at the weight produced by the first sample
- One Epoch Is One Pass
four sequential parameter updates inside a single pass over the dataset
- Same Samples, Different Order
why stochastic gradient descent is not commutative across sample orderings
- Mini-Batch Gradient
bridging full-batch stability and single-sample update frequency with mini-batches
- Side-by-Side Updates
one full-batch step, two mini-batch steps, and four single-sample steps side by side
- Why the Steps Differ
per-sample gradient variance and why fixed-step SGD wiggles around the optimum
- What SGD Is and Is Not
separating cheaper per-step optimization from generalization and exact convergence