Lesson 1.2

The Forward Pass

Running the graph left to right: push numbers in, compute each node, get an output. The twist is that while it computes, it also remembers, which is what makes going backward possible.

concepts 8 min read

Left to right.

The forward pass is the obvious half: start at the leaves, evaluate each operation in order, and carry the results forward until you reach the output. It's just doing the arithmetic the graph describes. Watch it ripple through e = (a × b) + c:

Drag the inputs, values flow forward to e

e = (a × b) + c

a×b -6 e 4 a 2 b 2 c 2

the same operations run in the same order every time, that order is the graph

A walk through, by hand.

With a = 2, b = -3, c = 10:

d = a × b = 2 × (-3) = -6
e = d + c = -6 + 10 = 4

That's the whole forward pass: two operations, one output. Nothing surprising. The interesting part is what happens alongside the computing.

Computing and remembering at once.

As each operation runs, it does two things, not one. It computes its output value, and it records two facts about itself: which values were its inputs, and what operation it was. That record is what lets the backward pass later ask each node, "given the gradient arriving at your output, how much should flow to each of your inputs?"

A useful mental image: the forward pass lays down a trail as it goes, the graph from lesson 1.1, now filled with actual numbers and connections. Backprop simply follows that trail home in reverse. No trail, no backprop. This is why a framework can't just compute the answer and throw the steps away.

Key takeaways

1

The forward pass evaluates the graph from leaves to root, producing the output.

2

While computing, each operation records its inputs and its kind, the trail backprop will follow.

3

Forward computes the answer; the recorded trail is what makes the backward pass possible.