1 The evolution of CNNs โ why architectures matter
Imagine building with LEGO. A convolution is one type of brick. But a pile of bricks isn't a castle โ how you arrange them is what makes it strong, tall, and beautiful. Over the years, smart people kept finding better ways to stack the same kind of bricks. Each new design built a taller, smarter "castle" that could recognise pictures better than the last. Today we tour the five most famous castles people built.
From Session 9 you know a convolution slides a small filter over an image to detect patterns (edges, then textures, then shapes). A CNN (Convolutional Neural Network) is just many of these convolution layers stacked, usually with pooling layers (which shrink the image) and a few ordinary fully-connected layers at the end to make the final decision.
So here's the natural question this whole session answers: if a CNN is "just layers stacked," why do we have famous named networks? Why not pick layers at random?
An architecture is the recipe for a network: how many layers, in what order, how wide, with what tricks connecting them. The exact same building blocks, arranged differently, can mean the difference between a network that barely works and one that wins a global competition. Architecture is design, and design is everything.
The competition that drove everything: ImageNet
Most of this story is powered by one contest. ImageNet is a giant dataset of ~1.2 million photos labelled into 1,000 categories (dogs, cars, mushroomsโฆ). From 2010โ2017 teams competed each year in the ILSVRC challenge to classify these images with the lowest error. Each architecture below was, in its year, the network that smashed the previous record.
A timeline you can hold in your head
Each architecture exists to fix a specific problem the previous one hit. AlexNet asked "can we go bigger?" VGG asked "can we go deeper, simply?" Inception asked "can we go wider and cheaper?" ResNet asked "why does going deeper suddenly stop working?" Keep this "what did it fix?" question in mind for every section โ it's the thread tying the whole story together.
The "top-5 error" is the percent of images where the correct label isn't in the model's top 5 guesses. In 2011, the best non-CNN system scored about 26% error. In 2012 AlexNet (a CNN) dropped it to 16% โ a shocking jump. By 2015, ResNet reached ~3.6%, which is better than a typical human (~5%) on this task. Five architectures, four years, and machines went from clumsy to superhuman at recognising photos.
2 LeNet & AlexNet โ the pioneer and the breakthrough
LeNet was like a clever little kid who learned to read the numbers on cheques โ small, neat, good at one job. AlexNet was that same kid all grown up, fed a mountain of food (data), given a super-fast brain (GPUs), and entered into the Olympics โ where it shocked everyone by winning. Same basic idea, just much bigger and trained with new tricks.
LeNet-5 (1998) โ the pioneer
Long before the AI boom, Yann LeCun built LeNet-5 to read handwritten digits (zip codes, cheque amounts). It's tiny by today's standards โ about 60,000 parameters โ but it already had every idea a modern CNN uses: convolutions to find patterns, pooling to shrink, and fully-connected layers to decide.
Its layout, on a 32ร32 grayscale digit image, was:
Notice the timeless shape: as you go deeper, the image gets smaller (pooling) but richer (more filters / channels). LeNet used the smooth tanh activation and average pooling โ choices later networks would improve on.
LeNet worked, but the world wasn't ready: there wasn't enough labelled data, and computers were too slow to train bigger versions. The ideas were right; the fuel (big data) and the engine (fast hardware) hadn't arrived yet. They both arrived around 2012.
AlexNet (2012) โ the ImageNet breakthrough
AlexNet (by Krizhevsky, Sutskever & Hinton) is essentially "LeNet, but much bigger and trained on ImageNet's 1.2M photos." It has ~60 million parameters (1,000ร LeNet) and 8 weight layers: 5 convolutional + 3 fully-connected. When it won ILSVRC 2012 by a huge margin, it kicked off the entire modern deep-learning era. But its size alone wasn't the win โ three new ingredients made training such a big net actually possible.
| Ingredient | What it is | Why it mattered |
|---|---|---|
| ReLU | The activation max(0, x) โ keep positives, zero out negatives โ replacing the smooth tanh. | It trains much faster and avoids the "vanishing gradient" slowdown of tanh (a problem we revisit in ResNet). |
| Dropout | During training, randomly "switch off" a fraction of neurons each step. | Stops the huge network from overfitting (memorising the training set instead of learning general patterns). |
| GPUs | Training was split across two graphics cards instead of a CPU. | Made training a 60M-parameter net on 1.2M images feasible in days, not years. |
ReLU stands for Rectified Linear Unit. The rule is dead simple: if a number is positive, keep it; if it's negative, make it zero. That's it. Despite being almost trivial, it lets deep networks learn far faster than the older S-shaped activations, because its slope for positive values is always 1 โ the learning signal doesn't shrink as it passes through.
Here's a single AlexNet-style block in PyTorch. Read the comments โ this is exactly the "conv โ ReLU โ pool" pattern plus dropout before the final decision.
import torch.nn as nn # One convolutional block, AlexNet-style block = nn.Sequential( nn.Conv2d(3, 96, kernel_size=11, stride=4), # 3 input colours -> 96 filters nn.ReLU(inplace=True), # the speed-up trick: max(0, x) nn.MaxPool2d(kernel_size=3, stride=2), # shrink the feature map ) # The classifier head, with dropout to fight overfitting head = nn.Sequential( nn.Dropout(p=0.5), # randomly drop 50% of neurons while training nn.Linear(9216, 4096), nn.ReLU(inplace=True), nn.Linear(4096, 1000), # 1000 ImageNet classes )
Notice MaxPool2d โ AlexNet used max pooling (take the
biggest value in each window) rather than LeNet's average pooling, which keeps the strongest signals.
AlexNet worked, but it was crude โ it used big 11ร11 filters and packed ~58M of its 60M parameters into the final fully-connected layers (huge and wasteful). The next architectures (VGG, Inception) were essentially asking: "great, it scales โ now can we be smarter about it?"
3 VGG & Inception โ go deeper, or go wider
Two teams in 2014 had different ideas for building a better tower. The VGG team said: "Let's use only one kind of small, simple brick, and just stack lots of them very tall." The Inception team said: "Let's look at things at several sizes at once โ a small magnifier, a medium one, and a big one โ all in the same layer, then combine what each saw." One bet on depth; the other bet on width.
VGG (2014) โ beautiful simplicity through depth
VGG (from Oxford's Visual Geometry Group) made one elegant bet: use only 3ร3 convolutions, stacked deep. No fancy filter sizes โ every conv is the same small 3ร3, and you just stack 16 or 19 weight layers (VGG-16, VGG-19). Its uniform design made it the easiest architecture to understand and copy.
Why 3ร3? Because two stacked 3ร3 convolutions "see" as much as one 5ร5, and three stacked 3ร3s see as much as one 7ร7 โ but with fewer parameters and more ReLU non-linearities in between (more chances to learn complex patterns). Small filters stacked deep beat big filters used shallow.
For a layer with C input and C output channels,
ignoring biases:
- One 5ร5 conv โ
5 ร 5 ร C ร C = 25 Cยฒparameters. - Two 3ร3 convs โ
2 ร (3 ร 3 ร C ร C) = 18 Cยฒparameters.
Same receptive field (the input area each output "sees"), but 28% fewer parameters and an extra ReLU in the middle. That's the whole VGG philosophy in one calculation.
VGG-16 is simple and accurate but heavy: ~138 million parameters and slow to run. Most of that weight, like AlexNet, sits in the giant fully-connected layers at the end. It's a great teaching model and feature extractor, but expensive in practice.
Inception / GoogLeNet (2014) โ go wide and cheap
The same year, Google's GoogLeNet (built from Inception modules) took the opposite tack. Instead of choosing one filter size, why not run several sizes in parallel within the same layer and let the network keep whatever's useful? A single Inception module runs 1ร1, 3ร3, and 5ร5 convolutions plus a pooling path side-by-side, then concatenates (glues together) all their outputs.
This "look at multiple scales at once" design is the multi-scale idea. A small dog and a large dog in different photos can both be caught because some path's filter size matches.
The secret weapon: 1ร1 convolutions
The genius trick that makes Inception affordable is the 1ร1 convolution. A 1ร1 filter doesn't look at neighbours at all (it's a single pixel wide) โ so what's the point? It mixes across channels at each pixel, and crucially it can reduce the number of channels cheaply before an expensive 3ร3 or 5ร5 runs.
Suppose a feature map has 256 channels and you want to run a 5ร5 conv producing 64 channels.
- Direct 5ร5:
5 ร 5 ร 256 ร 64 โ 409,600multiply-adds per pixel. - 1ร1 โ 5ร5: first squeeze 256 โ 64 channels with a 1ร1
(
1 ร 1 ร 256 ร 64 = 16,384), then 5ร5 on 64 (5 ร 5 ร 64 ร 64 = 102,400) โ total โ 118,784.
Roughly 3.4ร cheaper for nearly the same expressive power. This "bottleneck" trick (squeeze channels with 1ร1, do the expensive work, expand again) shows up everywhere afterwards โ including in ResNet.
Because Inception is so parameter-efficient, GoogLeNet has only ~5 million parameters โ about 27ร fewer than VGG-16 โ yet was more accurate. It also dropped most of the giant fully-connected layers, replacing them with global average pooling (average each channel down to a single number), which saved millions of parameters.
4 ResNet & skip connections โ making "deeper" work again
Imagine a long line of people whispering a message down the row (the game "telephone"). The longer the line, the more garbled the message gets by the end. Now imagine giving each person a walkie-talkie that copies the original message straight ahead, so it never gets lost no matter how long the line is. That shortcut is a skip connection, and it's why ResNet can be hundreds of people (layers) long and still work.
The mystery: deeper got worse
By 2015, everyone believed "deeper = better." But researchers found something baffling: a 56-layer plain network performed worse than a 20-layer one โ and not just on test data, on the training data too. This is the degradation problem. It's not overfitting (that would show as good training, bad test). The deeper network simply couldn't be trained well at all.
Networks learn by sending an error signal โ the gradient โ backwards from the output through every layer (this is backpropagation). At each layer the signal gets multiplied by small numbers. Through dozens of layers, those multiplications compound and the signal shrinks toward zero โ the vanishing gradient. The early layers barely get any signal, so they barely learn. Recall this is the very thing ReLU partly helped with in AlexNet โ but with enough depth, it comes back.
The fix: residual blocks with identity shortcuts
ResNet (by He et al.) introduced the residual block. The idea: instead of
asking a few layers to learn the full desired output H(x), ask them to learn
only the change (the "residual") F(x) = H(x) โ x, then add
the original input back: output = F(x) + x. That + x
is an identity shortcut (or skip connection) โ the
input is copied forward and added to the block's output.
Two wins from one trick. (1) Easy "do nothing": if a layer isn't helpful, it can
just learn F(x) = 0, leaving output = x โ a perfect
passthrough. So adding layers can never make things worse; that kills the degradation
problem. (2) Gradient highway: the + x shortcut gives the
backward gradient a direct path to flow through, skipping the shrinking multiplications. The
signal reaches early layers intact โ no more vanishing gradient.
Watch the out += identity line โ that single addition is the entire
ResNet idea.
import torch.nn as nn class ResidualBlock(nn.Module): def __init__(self, channels): super().__init__() self.conv1 = nn.Conv2d(channels, channels, 3, padding=1) self.bn1 = nn.BatchNorm2d(channels) self.conv2 = nn.Conv2d(channels, channels, 3, padding=1) self.bn2 = nn.BatchNorm2d(channels) self.relu = nn.ReLU(inplace=True) def forward(self, x): identity = x # save the input for the shortcut out = self.relu(self.bn1(self.conv1(x))) out = self.bn2(self.conv2(out)) out += identity # โ the skip connection: F(x) + x return self.relu(out)
If the block needs to change the number of channels or the size, the shortcut uses a small 1ร1 conv to match shapes โ but the core idea is unchanged: add the input back in.
Batch Normalisation rescales each layer's outputs to a stable range
during training. ResNet pairs it with skip connections; together they let networks train smoothly at
depths that were impossible before. You'll see BatchNorm2d in almost every
modern CNN.
Skip connections let ResNet go extremely deep โ the famous versions are
ResNet-50, ResNet-101, and ResNet-152 โ and still train well. ResNet-152 won ImageNet 2015
with ~3.6% top-5 error, beating human-level performance. The simple + x
shortcut is now in almost every deep network ever since, including the Transformers powering modern
language models.
F(x) and adds the input back via an identity shortcut
(F(x)+x). This makes "do nothing" easy and gives gradients a highway,
enabling networks 100+ layers deep that beat humans on ImageNet.
5 Design principles & comparison
Picking a network is like picking a vehicle. A bicycle is light and cheap but slow; a truck is powerful but guzzles fuel; a modern car balances both. There's no single "best" โ it depends on whether you care most about speed, cost, or carrying the heaviest load. Same with CNNs: you trade off accuracy, size, and speed.
Now that you've met all five, let's pull out the recurring design principles โ the levers every architect pulls โ and then compare the networks side by side.
The four levers
| Lever | What it means | Push it up andโฆ |
|---|---|---|
| Depth | How many layers (how "tall" the net is). VGG and ResNet pushed this. | Can learn more abstract patterns โ but risks vanishing gradients (fixed by skip connections). |
| Width | How many filters/channels per layer (how "fat" each layer is). Inception pushed this in parallel. | More patterns per layer โ but more compute and memory. |
| Parameter count | Total learned numbers. Driven mostly by fully-connected layers and wide convs. | More capacity โ but more memory, slower, and more prone to overfit. |
| Efficiency tricks | 1ร1 bottlenecks, global average pooling, small 3ร3 filters. | Same or better accuracy for far fewer parameters. |
Across this whole story, the winning move was almost never "just make it bigger." It was smarter design: 3ร3 stacks (VGG), 1ร1 bottlenecks and global average pooling (Inception), and skip connections (ResNet). Efficiency and trainability beat raw size.
The full comparison
Approximate figures for the canonical ImageNet versions (top-5 error, lower is better):
| Network | Year | Layers | Parameters | Top-5 error | Key idea |
|---|---|---|---|---|---|
| LeNet-5 | 1998 | 7 | ~60 K | โ (MNIST) | First conv+pool+dense CNN |
| AlexNet | 2012 | 8 | ~60 M | ~16.4% | ReLU, dropout, GPUs, scale |
| VGG-16 | 2014 | 16 | ~138 M | ~7.3% | Deep stacks of 3ร3 convs |
| GoogLeNet (Inception v1) | 2014 | 22 | ~5 M | ~6.7% | Multi-scale modules, 1ร1 bottlenecks |
| ResNet-152 | 2015 | 152 | ~60 M | ~3.6% | Residual blocks / skip connections |
Three stories jump out:
- VGG-16 vs GoogLeNet: GoogLeNet is more accurate with 27ร fewer parameters โ proof that clever design beats brute size.
- ResNet-152 vs AlexNet: 19ร more layers but the same ~60M parameters, because ResNet avoids giant fully-connected layers. Depth without bloat.
- The error trend: 16% โ 7% โ 3.6% in three years. Each architecture roughly halved the previous one's mistakes.
For a phone app you might pick a small, fast net; for top accuracy with a big GPU, a deep ResNet; for a quick feature extractor, VGG. The right choice depends on your accuracy needs, your compute budget, and your latency limits. We'll put these networks to practical use in Session 11 on transfer learning.
โ Putting it all together
You just walked through the entire history of CNN architectures. Here's the one-paragraph story that connects all five:
LeNet-5 proved the recipe โ convolutions to find patterns, pooling to shrink,
dense layers to decide โ but the world lacked data and compute. AlexNet scaled that
recipe 1,000ร and won ImageNet 2012 thanks to ReLU, dropout, and
GPUs, launching deep learning. VGG showed that stacking simple
3ร3 convolutions deep was elegant and powerful (if heavy), while
Inception went wide with multi-scale modules and cheap
1ร1 bottlenecks to be far more efficient. Then plain networks hit the
degradation problem โ and ResNet fixed it with the
residual block's skip connection (F(x)+x),
letting nets go 100+ layers deep, beat humans, and inspire nearly every architecture since. The
through-line: each network fixed the last one's bottleneck, and smart design beat raw size
every time.
Quick self-check
What three new ingredients made AlexNet's scale-up actually trainable?
ReLU (faster training, less vanishing gradient), dropout (less overfitting), and GPUs (made training a 60M-parameter net on 1.2M images feasible).
Why does VGG prefer two stacked 3ร3 convolutions over one 5ร5?
They cover the same receptive field but use fewer parameters (18Cยฒ vs 25Cยฒ) and add an extra ReLU non-linearity in between, so the network can learn richer patterns more cheaply.
What is a 1ร1 convolution good for if it can't see neighbouring pixels?
It mixes information across channels at each pixel and can cheaply reduce the channel count โ a "bottleneck" โ before an expensive 3ร3 or 5ร5 conv runs, saving a lot of compute (used heavily in Inception and ResNet).
What is the degradation problem, and how is it different from overfitting?
A deeper plain network trains worse than a shallower one โ even on the training data. Overfitting would mean good training accuracy but poor test accuracy; degradation is poor on both, caused by vanishing gradients making deep layers hard to optimise.
In one line, what does a skip connection do and why does it help?
It adds the block's input back to its output (F(x)+x). This makes "do nothing" easy (so depth can't hurt) and gives gradients a direct highway backward, defeating the vanishing-gradient problem.
GoogLeNet had ~27ร fewer parameters than VGG-16 yet was more accurate. What's the lesson?
Smart, efficient design (multi-scale modules, 1ร1 bottlenecks, global average pooling instead of huge fully-connected layers) beats raw size โ accuracy isn't just about more parameters.
๐ References & Further Reading
Class material
- SST Deep Learning handout (Session 10) โ your course handout for this session, covering CNN architectures from LeNet to ResNet.
Papers, docs & deep dives
- SST Deep Learning (course site) โ the companion site for this course's notes and materials.
- AlexNet โ "ImageNet Classification with Deep CNNs" (Krizhevsky et al., 2012) โ the paper that started the modern deep-learning era; see ReLU, dropout, and GPU training in context.
- VGG โ "Very Deep Convolutional Networks" (Simonyan & Zisserman, 2014) โ the case for stacking small 3ร3 convolutions deep; clean and very readable.
- GoogLeNet / Inception โ "Going Deeper with Convolutions" (Szegedy et al., 2014) โ introduces the multi-scale Inception module and 1ร1 bottlenecks.
- ResNet โ "Deep Residual Learning for Image Recognition" (He et al., 2015) โ the degradation problem and the residual block / skip connection that fixed it.