TensorTau PathToAGI Neural Networks from First Principles Level 06

Level 06 · Neural Networks from First Principles · Chapter 079

ReLU and Geometry

What does ReLU actually do to space, beyond the formula max(0,x)?

1. The formula is simple

ReLU⁡(z)=max⁡(0,z).\operatorname{ReLU}(z)=\max(0,z).

For positive input the slope is 1. For negative input the output is 0.

output
  ↑      /
  |     /
  |____/______→ z
      0

But its importance is geometric.

2. A neuron creates a boundary

Before ReLU, a neuron computes

z=wTx+b.z=w^Tx+b.

The equation wTx+b=0w^Tx+b=0 is a line in 2-D, a plane in 3-D, and a hyperplane in higher dimensions. ReLU treats the two sides differently:

wᵀx+b < 0  → 0
wᵀx+b > 0  → wᵀx+b

So a ReLU neuron folds/clips space along a learned boundary.

3. Many ReLUs create regions

Two ReLU neurons can introduce two boundaries. A network then behaves like different linear functions in different regions.

That is why a ReLU network is called piecewise linear: locally linear, globally capable of complex bends.

4. Why gradients work well

For z>0z>0,

dReLU⁡dz=1.\frac{d\operatorname{ReLU}}{dz}=1.

For z<0z<0, the derivative is 0. At exactly zero the classical derivative is undefined; frameworks choose a convenient subgradient convention, commonly 0.

Positive activations therefore pass gradients without the strong saturation of sigmoid/tanh.

5. Dead ReLUs

If a neuron stays negative for every example, its ReLU output and local gradient remain zero. It may stop learning: a dead ReLU. Initialization, learning rate and variants such as Leaky ReLU can reduce this problem.

Shape Check

ReLU changes values, not shape:

[B,H] → ReLU → [B,H]

What to Remember

ReLU is not merely a threshold formula. It lets learned hyperplanes divide space into regions and gives deep networks a way to bend an otherwise linear transformation.

Next → XOR: can these bends solve the smallest famous problem that one straight boundary cannot?

Six ways to work the chapter, climbing from explaining it in your own words to investigating it like a researcher. Reading is not enough — this is where the chapter lands.

  1. Explain: ReLU as a geometric gate.
  2. Calculate: Apply ReLU to [-3,-0.2,0,1,4] and state derivatives away from zero.
  3. Predict: Does ReLU change tensor shape?
  4. Break: Initialize/bias a neuron so it is negative on all examples and observe zero gradients.
  5. Build: Implement ReLU forward and backward from scratch.
  6. Investigate: Compare ReLU, Leaky ReLU and tanh activation/gradient distributions during training.