How the units are wired β and what each wiring can and cannot compute.
π Where this lives: architecture is the prior knowledge you build in rather than learn. A convolutional network assumes nearby pixels are related; a recurrent network assumes order matters; a transformer assumes any element may depend on any other. Choosing an architecture is choosing what the network gets for free instead of having to discover from data β which is why the same amount of data trains a convolutional network on images and defeats a fully connected one. Search "neural network architecture inductive bias choice".
The fundamental division
THE PRIMARY CLASSIFICATION is by whether the connection graph has
cycles.
FEEDFORWARD NETWORKS
Connections go in ONE DIRECTION, input toward output. The
graph is a DIRECTED ACYCLIC GRAPH.
Β· the output depends ONLY on the current input
Β· NO MEMORY of previous inputs
Β· computation is one pass, and always terminates
Β· suited to STATIC pattern classification
RECURRENT NETWORKS
Connections form CYCLES β a unit's output can feed back to
itself or to an earlier layer.
Β· the network has INTERNAL STATE, so the output depends on
the HISTORY of inputs
Β· suited to SEQUENCES and to temporal patterns
Β· computation must be iterated, and may or may not settle
THE DISTINCTION IS CONSEQUENTIAL, not cosmetic: a feedforward
network computes a FUNCTION of its input, while a recurrent
network computes a function of its input AND its state. Only
the second can recognise "the third A after the last B".
THE FEEDFORWARD ARCHITECTURES, in order of capability:
1. SINGLE-LAYER FEEDFORWARD (the single-layer perceptron)
An input layer connected directly to an output layer. Only
ONE layer of weights, so it is called single-layer even
though it is drawn with two rows of units β THE INPUT LAYER
IS NOT COUNTED because it computes nothing.
input ββWβββΆ output
Β· computes a LINEAR SEPARATION, per the geometric argument
of the mathematical-model topic
Β· CANNOT compute XOR
Β· trainable by the perceptron rule or the delta rule
2. MULTILAYER FEEDFORWARD (the multilayer perceptron, MLP)
One or more HIDDEN layers between input and output.
input ββWβ½ΒΉβΎβββΆ hidden ββWβ½Β²βΎβββΆ output
Β· can represent NON-LINEARLY-SEPARABLE functions, including
XOR
Β· with enough hidden units, approximates any continuous
function β the universal approximation theorem
Β· trained by BACKPROPAGATION
Β· FULLY CONNECTED (dense) if every unit connects to every
unit in the next layer
3. COMPETITIVE / SELF-ORGANISING NETWORKS
Output units COMPETE, and typically one wins.
Β· a WINNER-TAKE-ALL layer, where the unit with the largest
response is set to 1 and the rest to 0
Β· SELF-ORGANISING MAP (SOM, Kohonen network): output units
arranged in a grid, trained UNSUPERVISED so that nearby
units respond to similar inputs β producing a
topology-preserving map of the input space, which is a
dimensionality-reduction and clustering method
Β· used for clustering and visualisation, not classification
4. RADIAL BASIS FUNCTION (RBF) NETWORKS
One hidden layer whose units respond to the DISTANCE between
the input and a stored centre, usually with a Gaussian.
Β· each hidden unit is LOCAL β it responds only near its
centre, unlike a sigmoid unit whose response divides the
whole space
Β· trains fast, because the output layer is linear given the
centres
Β· needs more units to cover a high-dimensional space
Recurrent and specialised architectures
THE RECURRENT ARCHITECTURES:
1. SIMPLE RECURRENT NETWORK (Elman network)
A hidden layer's output at step t is fed back as an extra
input at step t+1, through a CONTEXT layer.
Β· gives short-term memory
Β· trained by BACKPROPAGATION THROUGH TIME β unroll the
network over the sequence and apply ordinary
backpropagation
Β· suffers badly from vanishing gradients over long
sequences, because the unrolled network is deep in
exactly the way the activation-functions topic described
2. LSTM and GRU (gated recurrent architectures)
Add GATES that learn what to remember, what to forget and
what to output, with a cell state that flows through mostly
unchanged.
Β· the point is the same as a residual connection: give the
gradient a path that does not pass through a squashing
nonlinearity at every step
Β· these made sequence learning practical, and dominated
NLP before transformers
3. HOPFIELD NETWORK
FULLY connected, SYMMETRIC weights (wα΅’β±Ό = wβ±Όα΅’), no
self-connections, binary units updated asynchronously.
Β· an ASSOCIATIVE MEMORY: it settles into a stored pattern
from a partial or noisy version of it
Β· guaranteed to CONVERGE because it minimises an energy
function β the subject of the final topic in this section
4. BOLTZMANN MACHINE
A Hopfield network with STOCHASTIC units β a unit's state is
probabilistic rather than determined.
Β· escapes local minima the way simulated annealing does
Β· the RESTRICTED Boltzmann machine (RBM), with no
within-layer connections, was used to pre-train deep
networks before better initialisation and ReLU made that
unnecessary
5. BIDIRECTIONAL ASSOCIATIVE MEMORY (BAM)
Two layers with connections both ways, storing
pattern PAIRS so that either recalls the other.
THE MODERN SPECIALISED ARCHITECTURES β worth knowing by what
assumption each builds in:
CONVOLUTIONAL NEURAL NETWORK (CNN)
Shared local filters, as derived in the machine vision
topic. THE BUILT-IN ASSUMPTIONS: locality, and translation
equivariance. For images this is prior knowledge worth
roughly the 84,000-fold parameter saving computed there.
TRANSFORMER
Every element attends to every other, with learned attention
weights. THE BUILT-IN ASSUMPTION: any element may depend on
any other, with no fixed notion of distance β which is why
it handles long-range dependence better than a recurrent
network and why it costs O(nΒ²) in sequence length.
AUTOENCODER
Trained to reproduce its input through a NARROW bottleneck
layer, so the bottleneck must learn a compressed
representation. Unsupervised, and used for dimensionality
reduction, denoising and anomaly detection.
GENERATIVE ADVERSARIAL NETWORK (GAN)
Two networks trained against each other: a GENERATOR making
samples and a DISCRIMINATOR judging whether they are real.
The competition is the training signal.
Choosing and sizing an architecture
THE SELECTION TABLE β determined by the structure of the data,
not by fashion:
THE DATA THE ARCHITECTURE
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
fixed-length feature vector, MLP (fully connected)
no structure among features
grid structure β images, CNN
spectrograms
a sequence where order matters RNN / LSTM, or a
transformer
long-range dependence in a TRANSFORMER
sequence
no labels, want structure SOM, autoencoder
recall a pattern from a partial HOPFIELD / associative
cue memory
generate new samples GAN, or another generative
model
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
THE PRINCIPLE BEHIND THE TABLE: MATCH THE ARCHITECTURE'S BUILT-IN
ASSUMPTION TO A TRUE PROPERTY OF THE DATA. A CNN on tabular data
assumes an adjacency between columns that does not exist and
wastes its advantage; an MLP on images must learn translation
invariance from examples, which needs far more data than building
it in.
SIZING β how many layers and units:
TOO FEW β UNDERFITTING; the network cannot represent the
function (high bias)
TOO MANY β OVERFITTING and wasted computation (high
variance)
Both terms are from the machine learning topic, and the
biasβvariance trade-off is what architecture size controls.
THE PRACTICAL APPROACH, in the absence of theory:
Β· start from a size known to work on a similar problem
Β· grow until the TRAINING error is acceptable, then apply
REGULARISATION to control the test error
Β· use a VALIDATION SET to choose, never the test set
Β· one hidden layer suffices in principle by the universal
approximation theorem, but DEEPER NETWORKS OFTEN NEED
EXPONENTIALLY FEWER UNITS for the same function β depth is
more parameter-efficient than width, which is the
practical reason for deep rather than wide networks
A WORKED SIZING, using the parameter formula m(n+1) from the
mathematical-model topic. Classify 28Γ28 images into 10 classes:
784 β 128 β 10: 128(785) + 10(129) = 101,770 parameters
784 β 512 β 10: 512(785) + 10(513) = 407,050
784 β 128 β 64 β 10:
128(785) + 64(129) + 10(65)
= 100,480 + 8,256 + 650 = 109,386
NOTE THAT ADDING A SECOND HIDDEN LAYER OF 64 UNITS COSTS ONLY
ABOUT 7,600 MORE PARAMETERS, while widening the first layer to
512 costs 300,000 more. DEPTH IS CHEAP AND WIDTH IS EXPENSIVE,
because the first layer's weight matrix is dominated by the
784 inputs. That asymmetry is a real design consideration.
THE ARCHITECTURAL DECISIONS SUMMARISED:
the number of LAYERS (depth)
the number of UNITS per layer (width)
the CONNECTION PATTERN β fully connected, convolutional,
recurrent, skip connections
the ACTIVATION functions
whether weights are SHARED, as in a CNN
EVERY ONE OF THESE IS PRIOR KNOWLEDGE, and the reason
architecture matters is that prior knowledge substitutes for
data.
The parameter comparison makes an architectural rule concrete: adding a second hidden layer of 64 units costs about 7,600 parameters, while widening the first layer to 512 costs 300,000 more. Depth is cheap and width is expensive, because the first weight matrix is dominated by the input dimension.
π Go further: the natural question after this topic is whether architecture selection can itself be automated, and it can β neural architecture search treats the architecture as the thing being optimised, using reinforcement learning, evolutionary methods (the genetic algorithms of ACtE0905) or differentiable relaxations. It has produced architectures that beat hand-designed ones on benchmarks, at an enormous compute cost that drew justified criticism. The instructive finding is that the discovered designs often rediscover human intuitions β skip connections, bottlenecks β which suggests the design space has genuine structure rather than being arbitrary. Search "neural architecture search NAS efficiency criticism".
π‘ Exam angle: distinguish feedforward from recurrent networks and state the consequence β a feedforward network computes a function of its input alone, while a recurrent one has state and can process sequences. Describe the feedforward types: single-layer (one weight layer, linearly separable only), multilayer (hidden layers, trained by backpropagation), competitive/self-organising (SOM, winner-take-all), and RBF networks. Name the recurrent ones β simple recurrent, LSTM/GRU, Hopfield (symmetric weights, associative memory), Boltzmann machine, BAM. Explain that the input layer is not counted, and be ready to select an architecture for described data and to count parameters for a stated network.
Syllabus points
Feedforward, recurrent, single/multi-layer
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.