Bitpath

Boss lesson · Unit 02

Backprop by hand

Multiply local slopes backward through one neuron

13 exercisesabout 3 min

What you practise

  • The chain rule multiplies local slopes
  • A tiny computation graph run forward then backward
  • The gradient of a one-neuron loss, checked against a numerical estimate

Try a question from this lesson

Pick one

Gear A turns gear B 3 times for each of its own turns. Gear B turns gear C 2 times per turn. Turn A once: how often does C turn?

The ideas

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

The chain rule

When y depends on u and u depends on x, a nudge to x travels through u to reach y. The slopes multiply:

dy/dx = dy/du × du/dx

Each factor is a local slope: it only looks at one link of the chain. A neural network is a long chain of simple links, so its gradient is a long product of simple slopes.

x --> u = 3x --> y = u²

du/dx = 3       dy/du = 2u

dy/dx = 2u × 3 = 6u

Concept

Forward, then backward

The neuron is a chain: w feeds the prediction p, and p feeds the loss L.

Forward pass: compute each value and keep it. Backward pass: start at the loss and multiply local slopes on the way back to each parameter.

This is backpropagation. Frameworks like PyTorch do it for you, with exactly these steps.

w --> p = w·x + b --> L = (p - y)²

dL/dp = 2(p - y)
dp/dw = x          dp/db = 1

dL/dw = 2(p - y) · x
dL/db = 2(p - y) · 1

10 more exercises in the app

  • 4× type the answer
  • 3× multiple choice
  • 1× fill the blanks
  • 1× true or false
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy