Ten Linear layers still need nonlinearity
Affine composition, ReLU and an XOR you can calculate
Stacking affine layers still produces an affine map. ReLU changes that; a two-unit XOR makes the difference explicit.
Adding layers does not automatically add a new kind of function. If every layer only multiplies and adds, ten layers still compute one affine transformation.
Start with training and inference and Linear shapes.
Two layers collapse into one
Write vectors as columns:
Define a new matrix and bias and the result is again y = Wx + b. “Linear” is the layer's conventional name; with a bias the map is affine. A narrow intermediate layer can even restrict the rank. The parameterization may affect optimization, but depth alone has introduced no nonlinearity.
ReLU makes the active computation depend on the input
ReLU(z) = max(0, z), applied component by component. Now:
Which components survive depends on x, so the entire function generally cannot collapse into one fixed affine map. Ordinary ReLU has no learned parameters; surrounding layers learn what to feed it.
An XOR you can calculate
Two binary sensors should trigger an alert exactly when they disagree. No affine expression ax1 + bx2 + c reproduces all four outputs: (0,0) forces c=0, (1,0) and (0,1) force a=b=1, and then (1,1) incorrectly returns 2.
Two hidden components solve it:
| x1 | x2 | h1 | h2 | y | |---:|---:|---:|---:|---:| | 0 | 0 | 0 | 0 | 0 | | 0 | 1 | 0 | 1 | 1 | | 1 | 0 | 1 | 0 | 1 | | 1 | 1 | 0 | 0 | 0 |
These weights were chosen by hand. We proved representational capacity, not that training will find this solution.
What this does not guarantee
ReLU has zero slope on its negative side. A unit negative for all training inputs may receive no local gradient through that route. A temporary zero is not itself evidence of a dead unit.
More depth does not guarantee better generalization. And an output is not automatically a probability: our construction computes abs(x1-x2) for general real inputs, which can exceed one.
Check yourself
Is Linear → Linear → Linear → ReLU equivalent to putting ReLU between every layer? No. Everything before the final ReLU still collapses into one affine map.
For x1=0.2 and x2=0.8 the construction returns 0.6. That is an absolute difference, not a 60% probability. When reading an architecture, mark the affine maps, the nonlinearities and the output's meaning separately.