Part VIII — Neural Network Fundamentals, Backpropagation & Optimizers · Chapter 4

The forward pass

Hook

One neuron takes a weighted sum and squashes it. What happens when the same two inputs feed three neurons at once, each with its own opinion?

Intuition
x10.0x20.0A: z = 0.000.00B: z = -1.000.00C: z = 0.500.50
outputs: A=0.00, B=0.00, C=0.50

Drag either input. Every neuron computes its own weighted sum from the exact same (x1,x2)(x_1, x_2) — they just disagree about which weights and bias to use. Watch the ring around each one: it lights up the moment that neuron's output is positive.

Formalize

A layer is just several neurons run in parallel on the same input:

zi=wix+bi,ai=ReLU(zi)z_i = w_i \cdot x + b_i, \qquad a_i = \text{ReLU}(z_i)
  • ziz_i — neuron ii's raw weighted sum, before activation.
  • wiw_i — neuron ii's own weight vector.
  • bib_i — neuron ii's own bias.
  • xx — the shared input vector fed to every neuron in the layer.
  • aia_i — neuron ii's activation, the layer's output for that neuron.
  1. Nothing new inside each neuron

    ziz_i is exactly the perceptron's weighted sum, computed once per neuron.

  2. A layer is several of these in parallel

    A layer of 3 neurons on 2 inputs is 3 independent weighted sums, each fed through the same activation.

  3. Stacking layers builds a network

    Feed one layer's outputs into the next layer's inputs, and stack enough of these, and that's a neural network.

Play
x1-2.0x22.0A: z = -4.000.00B: z = -1.000.00C: z = 6.506.50
outputs: A=0.00, B=0.00, C=6.50

Push x1x_1 negative and x2x_2 positive. Some neurons' sums go negative and their ReLU (short for Rectified Linear Unit) output flatlines at exactly 0 — dead for this input, no matter how negative their sum gets. Others stay positive and keep responding linearly. Same inputs, three completely different reactions.

Worked example

At (x1,x2)=(2,2)(x_1, x_2) = (2, 2):

  1. Neuron A: w = (1, -1), b = 0

    z=22=0z = 2 - 2 = 0, so ReLU(0)=0\text{ReLU}(0) = 0.

  2. Neuron B: w = (0.5, 0.5), b = -1

    z=1+11=1z = 1+1-1 = 1, so its output is 11.

  3. Neuron C: w = (-1, 2), b = 0.5

    z=2+4+0.5=2.5z = -2+4+0.5 = 2.5, output 2.52.5.

  4. Compare the three

    Same (x1,x2)(x_1,x_2), fed through three different weight vectors, three completely different answers — that's the entire forward pass.

Checkpoint

Set x1 and x2 so neuron B’s output reaches 1.

x10.0x20.0A: z = 0.000.00B: z = -1.000.00C: z = 0.500.50
neuron B output = 0.00
Move a slider to try it
Summary
zi=wix+bi,ai=ReLU(zi)z_i = w_i \cdot x + b_i, \qquad a_i = \text{ReLU}(z_i)

A "layer" is nothing more than this computation repeated once per neuron, in parallel, on the same input. The next chapter asks the question this one was quietly setting up: if a network is just layers chained together, how do you compute a gradient through the whole chain — not just one neuron's slope?