Autograd by Hand

The How It Learns board draws the loop: loss, slope, step, repeat. This lesson writes the part that finds the slopes, in Python: the first of six lessons that end with a small GPT built from scratch.
Before you start. A weight is one adjustable number inside a network. The loss is one number for how wrong the network’s answer is. A weight’s slope says how much the loss moves when you nudge that weight; one slope per weight, all together, is the gradient. In One Knob, One Slope you found one slope by hand: nudge the weight, see how much the loss changed, divide by the nudge. In How It Learns (loss, gradient descent, backprop) a number’s slope is its blame, its share of the wrongness. From What a Neural Network Is: a neuron multiplies each input by a weight and adds them up, plus one extra number called the bias. Also from What a Neural Network Is: XOR is a door with two switches that opens when exactly one is on, which one neuron cannot learn and a hidden layer, a row of neurons in the middle, can.
