Why Neural Networks Need Depth
From perceptrons, Novikoff's proof, XOR, and ReLU folding to depth's exponential expressivity, √d_k scaling, and residual connections.
A Brief Introduction to Deep Learning covered forward propagation and backpropagation. This post addresses two structural questions:
- Expressivity: Why can’t a single neuron solve XOR? Given the same budget of neurons, why does stacking them deeply represent far more complex functions than arranging them in a single wide layer?
- Trainability: As networks grow deeper or wider in dimension, why do vanishing/exploding gradients and Softmax saturation appear? How do scaling and residual connections alter gradient flow?
Perceptrons: A Single Hyperplane and Convergence Proof#
Introduced by Rosenblatt in 1958 [1], the perceptron computes a weighted sum followed by a step threshold. For input , weights , and bias :
When , defines a line (a hyperplane in higher dimensions) with normal pointing toward the side and distance from the origin. A single neuron can therefore only partition input space with one hyperplane.
Perceptron Update Rule#
Let the true label be . Whenever a sample is misclassified (), update with learning rate :
The new linear score becomes , so the signed score strictly increases and the boundary moves toward classifying correctly.
Novikoff’s Convergence Theorem (1962)#
If a dataset is linearly separable, can sample-by-sample updates cycle forever? Novikoff proved that the number of updates has a finite upper bound.
Proof: Fold the bias into the weights via and . Assume for all samples, and there exists a unit vector () with margin such that for all .
Take without loss of generality and start from . On the -th mistake (), :
- Lower bound on inner product:
- Upper bound on squared norm:
By Cauchy–Schwarz, , so:
A wider margin yields a smaller upper bound on convergence steps.
The arrow is , perpendicular to the boundary and pointing toward the circle class.
Circle: class 1Diamond: class 0; ringed points are misclassified
XOR and Multilayer Networks#
Switching the dataset above to XOR (quadrants I & III vs. II & IV) prevents errors from ever reaching zero. For the four corners vs. , a separating line would require:
Summing the top row gives ; summing the bottom row gives — a contradiction. Minsky and Papert analyzed this limitation in Perceptrons (1969). Two paths overcome linear inseparability:
Path 1: Nonlinear Feature Lifting#
Lifting each point to lets a single 3D hyperplane separate XOR (projecting back to a hyperbola in 2D). The drawback is manual feature engineering: a different distribution requires handcrafting new coordinates.
Path 2: Multilayer Composition and Differentiable Activations#
Two layers of threshold neurons express Boolean XOR () exactly:
The bottleneck then shifts to training: hidden units lack direct labels, and the step function has zero derivative everywhere . Replacing the step with differentiable activations such as Sigmoid enables chain-rule backpropagation [2]. Because causes deep gradient decay, hidden layers later switched to ReLU.
Piecewise-Linear Geometry of ReLU and Depth Advantage#
Without nonlinearities, collapses to one affine map. With , each neuron zeroes one half-space and stays linear on the other, creating a crease along . Inside each connected region carved by all creases, every neuron’s active/inactive pattern is constant, so the network is a piecewise-affine function.
Polynomial Limit of Width#
In 2D, ReLU units in a single hidden layer draw lines. Line intersects at most prior lines, splitting at most regions, so lines produce at most:
regions ( for ). For fixed input dimension, single-layer region count grows only polynomially in width.
Exponential Folding via Depth: Worked 1D Sawtooth#
On , two ReLU neurons construct a tent function:
Composing with itself gives :
- : ()
- : ()
- : ()
- : ()
Each composition doubles the number of linear segments. Composing times uses only ReLU neurons to generate segments of slope , whereas a single hidden layer needs at least ReLU units (for : vs. neurons).
Telgarsky (2016) [4] formalized this depth separation, and Montúfar et al. (2014) [3] established exponential lower bounds on linear regions with depth. This does not contradict the Universal Approximation Theorem [6]: a single hidden layer can approximate any continuous function on a compact domain, but the required width can grow exponentially.
Two-Spiral Training Experiment#
- Shape
- 2 → 8 → 1
- Params
- 33
- Steps
- 0
- Loss
- 0.730
- Train acc.
- 48%
73×73 grid sampled 28 activation patterns; a single hidden layer of 8 units can cut at most 37 planar regions. Grid sampling can miss tiny regions, and distinct patterns may still share the same output.
CircleDiamond
Under identical seed and optimization settings on 200 two-spiral points:
| Hidden Layers | Parameters | Accuracy at 6000 Steps | Sampled Linear Regions |
|---|---|---|---|
| 1 × 8 | 33 | 69% | 23 |
| 2 × 8 | 105 | 98% | 89 |
| 3 × 8 | 177 | 100% (2370 steps) | 172 |
Two caveats: (1) Hanin & Rolnick (2019) [5] showed that at typical random initialization, the expected number of regions along a 1D line grows only linearly with total neurons rather than hitting the exponential ceiling; (2) if a ReLU unit outputs negative pre-activations on all samples, its gradient stays (“dying ReLU”), which narrow layers hit more easily.
Gradient Issues in Deep and High-Dimensional Training#
Scaling Dot Products by #
If have independent entries with mean and variance , then and . At , the standard deviation is , pushing Softmax toward one-hot distributions where the Jacobian vanishes. Dividing by [7] restores unit variance and keeps gradients alive (distinct from numerical overflow prevention via subtracting ).
- Score std dev
- 0.78 expected single-score std dev: 1
- Max weight
- 0.294
- Entropy
- 2.62 bits uniform = 3
- 0.372
Gradient Products and Residual Connections#
Backpropagating across layers multiplies Jacobians:
With scalar gain , layers shrink to and blow up to .
Residual connections [8] set , turning each Jacobian into . Expanding the product preserves an identity path for gradients to flow directly to early layers. To prevent variance from growing with depth, GPT-2 [10] scales residual output projections by at initialization, and Pre-LN Transformers [9] stabilize early gradients further.
Open Questions#
Three core questions still lack a complete unified theory: (1) why overparameterized networks generalize under gradient descent instead of merely memorizing; (2) why first-order optimization rarely stalls in bad local minima on billion-dimensional non-convex landscapes; and (3) how to reliably identify and causally verify superposed features and circuits.