Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 06 · AI · GPT, built from scratch · with code: Python · about 19 min to read

Watch: What deep learning actually is: backprop, and why language was hard
▶ VideoPlay it as a journeyTutor comes with a plan

Autograd by Hand

How It Learns
How It Learns · Open board

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.

Lesson 58 of 83 in AI

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1970, Helsinki: a thesis about rounding errors, and a walk backwards
  • The receipt: a computation graph, where every number remembers its parents
  • The local derivative: each receipt knows one small slope
  • Blame through w2: reaching a weight that never touches the answer
  • Topological order: nobody passes on blame before collecting all of it
  • The gradient check: nudge and divide, to catch a wrong rule
  • One neuron, then XOR: autograd trains a hidden layer
  • The clerk writes a card for every number
  • A number used twice
  • Checking the clerk
  • Ten clerks, ten first guesses
  • All of it in code

Terms it explains: How It Learns, computation graph, local derivative, topological order, gradient check, autograd, automatic differentiation, backpropagation, batch / mini-batch, convergence, epoch, generalization, gradient, gradient descent, learning rate, loss / cost function, optimizer (SGD/Adam), overfitting, parameters/weights, regularization, step, validation set / early stopping.

Lab

Every step of training walks the dials downhill. How far should each step go?

Drag How far each step goes from 0.001 up to 0.5 and watch Steps to a loss under 0.01 fall, then vanish.

Open The learning rate

Related paper

Review AI