Add one hidden layer and the linear ceiling disappears โ the architecture that ended the AI winter.
๐ Where this lives: The multilayer perceptron is the single most deployed model in the world that nobody names. It is the final classifier on top of every image network, the layer that turns a language model's internal state into a word prediction, the credit-scoring model in a bank, and the "dense" layer in every deep learning tutorial. When a modern transformer is described as billions of parameters, roughly two-thirds of those parameters sit in plain feedforward MLP blocks. Search "multilayer perceptron universal approximation feedforward network".
Why a hidden layer changes everything
THE PROBLEM INHERITED FROM THE PERCEPTRON TOPIC: a single layer
computes a single hyperplane, so it cannot represent XOR or any
other non-linearly-separable function. Minsky and Papert's 1969
proof of this stalled the field for a decade.
THE ARCHITECTURE THAT SOLVES IT:
INPUT LAYER HIDDEN LAYER OUTPUT LAYER
(no computation) (the new part)
xโ โโโโโโฌโโโโโโโโโถ hโ โโโโโฌโโโโโโโโถ yโ
โณ โณ
xโ โโโโโโดโโโโโโโโโถ hโ โโโโโดโโโโโโโโถ yโ
โฎ
xโ โโโโโโโโโโโโโโโถ h_m โโโโโโโโโโโโถ y_k
FULLY CONNECTED between adjacent layers, FEEDFORWARD (no
cycles, no connections within a layer, no skipping backwards).
THE COMPUTATION, layer by layer:
hidden: h_j = f( ฮฃแตข v_ji xแตข + b_j )
output: y_k = g( ฮฃโฑผ w_kj h_j + c_k )
THE ABSOLUTELY CRITICAL CONDITION โ AND THE MOST COMMON EXAM
TRAP:
f MUST BE NON-LINEAR.
If f is the identity, then
y = W(Vx) = (WV)x = W'x
and the composition of two linear maps IS A SINGLE LINEAR MAP.
A HUNDRED LINEAR LAYERS COLLAPSE TO ONE MATRIX. The network
would have more parameters and exactly the same expressive
power as a single perceptron.
THE NON-LINEARITY IS NOT A DETAIL OF IMPLEMENTATION โ IT IS
THE ENTIRE REASON DEPTH BUYS ANYTHING.
WHAT THE HIDDEN LAYER ACTUALLY DOES, geometrically:
EACH HIDDEN UNIT DRAWS ONE HYPERPLANE in the input space,
exactly as a perceptron does. The output layer then combines
those hyperplanes.
ยท 1 hidden unit โ 1 line โ 2 regions
ยท 2 hidden units โ 2 lines โ up to 4 regions
ยท 3 hidden units โ 3 lines โ up to 7 regions
ยท n hidden units โ up to 1 + n + n(nโ1)/2 regions in 2D
So the hidden layer converts the input into a new
representation โ one coordinate per hyperplane, recording which
side of it the input falls on โ AND IN THAT NEW SPACE THE
PROBLEM IS LINEARLY SEPARABLE. That is the mechanism in one
sentence: THE HIDDEN LAYER RE-REPRESENTS THE DATA UNTIL A
LINEAR OUTPUT UNIT CAN FINISH THE JOB.
XOR, solved and traced
THE CANONICAL DEMONSTRATION. XOR needs 2 inputs, 2 hidden units
and 1 output โ NINE PARAMETERS in total (6 weights + 3 biases).
THE IDEA: XOR = OR AND NOT(AND) = OR AND NAND.
Neither OR nor NAND is hard โ both are linearly separable. So
let hidden unit hโ compute OR, hidden unit hโ compute NAND,
and let the output compute AND of the two.
THE WEIGHTS (step units, threshold at 0):
hโ (OR): net = 20xโ + 20xโ โ 10
hโ (NAND): net = โ20xโ โ 20xโ + 30
y (AND): net = 20hโ + 20hโ โ 30
THE FULL TRACE, all four cases:
xโ xโ โ hโ net hโ โ hโ net hโ โ y net y โ XOR
โโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโ
0 0 โ โ10 0 โ +30 1 โ โ10 0 โ 0 โ
0 1 โ +10 1 โ +10 1 โ +10 1 โ 1 โ
1 0 โ +10 1 โ +10 1 โ +10 1 โ 1 โ
1 1 โ +30 1 โ โ10 0 โ โ10 0 โ 0 โ
ALL FOUR CORRECT. And note WHY it works: in the hidden space,
the four inputs map to (0,1), (1,1), (1,1) and (1,0). THE TWO
"TRUE" CASES COLLAPSED ONTO THE SAME POINT (1,1), and a single
line now separates (1,1) from the other two. THE HIDDEN LAYER
MADE THE PROBLEM SEPARABLE BY MERGING THE TWO CASES THAT
NEEDED THE SAME ANSWER.
THE SAME WEIGHTS WITH SIGMOID UNITS, since real MLPs are
differentiable:
(0,0) โ h = (0.0000, 1.0000) โ y = 0.0000
(0,1) โ h = (1.0000, 1.0000) โ y = 1.0000
(1,0) โ h = (1.0000, 1.0000) โ y = 1.0000
(1,1) โ h = (1.0000, 0.0000) โ y = 0.0000
The large weights (ยฑ20) drive the sigmoids deep into
saturation, so they behave almost exactly like steps โ which
shows that the step network is the limiting case of the
sigmoid one, and that nothing was lost by making the units
differentiable.
Universal approximation, depth, and sizing
THE UNIVERSAL APPROXIMATION THEOREM (Cybenko 1989; Hornik 1991):
A FEEDFORWARD NETWORK WITH A SINGLE HIDDEN LAYER CONTAINING A
FINITE NUMBER OF UNITS, USING A NON-CONSTANT, BOUNDED,
CONTINUOUS ACTIVATION FUNCTION, CAN APPROXIMATE ANY CONTINUOUS
FUNCTION ON A CLOSED BOUNDED SUBSET OF โโฟ TO ANY DESIRED
ACCURACY.
READ THE FINE PRINT, because the theorem is routinely
overstated:
ยท IT IS AN EXISTENCE RESULT. It says suitable weights EXIST.
IT DOES NOT SAY YOU CAN FIND THEM, and backpropagation
offers no guarantee of doing so.
ยท "FINITE" MAY BE ASTRONOMICAL. The required width can grow
exponentially with the input dimension or with the
wiggliness of the target function.
ยท IT SAYS NOTHING ABOUT GENERALISATION. Approximating the
training data perfectly is exactly what overfitting is.
ยท CONTINUOUS FUNCTIONS ON A COMPACT SET only.
SO WHY GO DEEPER THAN ONE HIDDEN LAYER? Because of a separate
result about EFFICIENCY rather than possibility:
SOME FUNCTIONS REQUIRE EXPONENTIALLY MANY UNITS IN A SHALLOW
NETWORK BUT ONLY POLYNOMIALLY MANY IN A DEEP ONE.
Depth lets features COMPOSE: layer 1 learns edges, layer 2
combines edges into corners and textures, layer 3 into object
parts, layer 4 into objects. A shallow network must enumerate
every combination separately; a deep one reuses each feature
everywhere it appears. THAT REUSE IS THE ENTIRE ARGUMENT FOR
DEEP LEARNING โ not "one layer cannot do it", but "one layer
would need absurdly many units to do it".
SIZING THE NETWORK โ the practical questions:
INPUT UNITS: fixed by the data. One per feature; a 28ร28 image
flattened gives 784.
OUTPUT UNITS: fixed by the task.
ยท regression โ 1 linear unit
ยท binary classification โ 1 sigmoid unit
ยท k-class classification โ k SOFTMAX units, so the outputs
form a probability distribution summing to 1
HIDDEN LAYERS: one is enough for most problems by the theorem;
two or three help when the function has structure worth
composing; more only with the modern machinery (batch
normalisation, residual connections) that keeps deep
gradients alive.
HIDDEN UNITS: THIS IS THE REAL DESIGN DECISION.
ยท too few โ UNDERFITTING; the network cannot represent the
function, and training error stays high
ยท too many โ OVERFITTING; the network memorises the training
set, so training error is low and validation error rises
ยท rules of thumb, all crude: between the input and output
sizes; โ of input size plus output size; โค 2ร input size
ยท THE HONEST ANSWER IS TO SEARCH โ train several sizes and
pick by VALIDATION error, never training error.
PARAMETER COUNTS, because they grow faster than intuition
suggests:
2โ2โ1 โ 6 weights + 3 biases = 9 parameters
784โ30โ10 โ 23,820 + 40 = 23,860 parameters
784โ128โ10 โ 101,632 + 138 = 101,770 parameters
A NETWORK WITH 101,770 PARAMETERS TRAINED ON 60,000 MNIST
IMAGES HAS MORE PARAMETERS THAN TRAINING EXAMPLES โ which is
why regularisation, early stopping and validation monitoring
are not optional extras but part of the method.
THE STANDARD DESIGN CHOICES beyond size:
ยท WEIGHTS MUST BE INITIALISED RANDOMLY AND SMALL. If all
weights start equal, every hidden unit computes the same
thing and receives the same gradient forever โ THE
SYMMETRY NEVER BREAKS and the layer behaves as a single
unit. This is a favourite exam question.
ยท INPUTS SHOULD BE NORMALISED, so that no feature dominates
the initial gradients purely by scale.
ยท HIDDEN ACTIVATION: ReLU by default in modern practice;
sigmoid and tanh in the classical treatment, and tanh in
preference to sigmoid because it is zero-centred.
The mechanism in one sentence: the hidden layer re-represents the data until a linear output unit can finish the job. In the XOR trace the two TRUE inputs map onto the same hidden point (1,1), and once they have merged, a single line separates them from the rest โ which is precisely what a perceptron could not do in the original space.
๐ Go further: The parameter arithmetic above has a consequence that shaped the whole field. A modest 784โ128โ10 network already has 101,770 parameters โ more than the 60,000 training images in MNIST. A model with more free parameters than data points can, in principle, memorise the training set exactly and learn nothing generalisable, which is why the classical statistics of the 1990s predicted deep networks would fail. That they generalise anyway, despite being massively over-parameterised, is still an open research question with a name โ "benign overfitting" or the double descent curve โ and it is one of the genuinely unresolved puzzles of modern machine learning. Search "double descent overparameterized neural network generalization".
๐ก Exam angle: draw the three-layer architecture and give the layer equations h = f(Vx + b), y = g(Wh + c). The most reliably examined point is that f must be non-linear โ show that otherwise y = W(Vx) = (WV)x and the network collapses to a single layer. Work the XOR solution in full: hโ = OR, hโ = NAND, y = AND, with the four-row trace, and explain that the two true cases merge onto one hidden point. State the universal approximation theorem with the caveat that it is an existence result, and argue for depth on grounds of efficiency and feature reuse, not possibility. Know the sizing guidance and, above all, why weights must be initialised randomly โ equal weights leave every hidden unit computing the same function forever.
Syllabus points
MLP architecture
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.