๐Ÿ“š Study Notes / Home / Neural Nets / Session 10
Session 10 ยท CNN Architectures

The famous CNNs, from a tiny digit reader to 152 layers deep

Last session you learned what a convolution is. Today we follow the story of how people stacked convolutions into the legendary networks โ€” LeNet, AlexNet, VGG, Inception and ResNet โ€” that taught computers to see. We assume you've studied none of this before. Every topic starts with a tiny "explain like I'm 5" story, then we build up the real detail with diagrams, tables, and code. By the end you'll know not just what these networks are, but why each one was invented to fix the one before it.

โฑ 19 min read๐Ÿ“– 5 topics

1 The evolution of CNNs โ€” why architectures matter


Explain like I'm 5

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?

The big idea

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

๐Ÿ”ข
1998 ยท LeNet-5
Reads handwritten digits
โ†’
๐Ÿš€
2012 ยท AlexNet
The ImageNet breakthrough
โ†’
๐Ÿงฑ
2014 ยท VGG
Deep & simple
โ†’
๐ŸŒฟ
2014 ยท Inception
Wide, multi-scale
โ†’
๐Ÿ”—
2015 ยท ResNet
Skip connections, 152 layers
A pattern to watch for

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.

Concrete example: how fast it moved

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.

Recap A CNN stacks convolution + pooling + fully-connected layers. An architecture is the specific recipe for that stack, and good recipes matter enormously. Driven by the ImageNet contest, CNNs evolved LeNet โ†’ AlexNet โ†’ VGG โ†’ Inception โ†’ ResNet, each fixing the previous one's main weakness.

2 LeNet & AlexNet โ€” the pioneer and the breakthrough


Explain like I'm 5

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:

๐Ÿ–ผ๏ธ
Input
32ร—32 digit
โ†’
๐Ÿ”
Conv
find edges
โ†’
๐Ÿ“‰
Pool
shrink
โ†’
๐Ÿ”
Conv
find shapes
โ†’
๐Ÿ“‰
Pool
shrink
โ†’
๐Ÿงฎ
Dense
decide 0โ€“9

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.

Why LeNet then went quiet for 14 years

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.

IngredientWhat it isWhy it mattered
ReLUThe 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).
DropoutDuring 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).
GPUsTraining 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.
What is ReLU, really?

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.

Worked example: ReLU and dropout in code

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.

Gotcha: AlexNet was a brute

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?"

Recap LeNet-5 (1998) was the tiny pioneer that already had conv + pool + dense and read digits. AlexNet (2012) scaled that idea up 1,000ร— to win ImageNet, powered by three new tricks: ReLU (fast training), dropout (less overfitting), and GPUs (feasible compute). It launched modern deep learning.

3 VGG & Inception โ€” go deeper, or go wider


Explain like I'm 5

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.

The clever insight behind VGG

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.

Worked example: 3ร—3 stacking saves parameters

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's cost

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.

๐Ÿ“ฅ
Input
feature map
โ†’
๐Ÿ”น
1ร—1 conv
fine detail
๐Ÿ”ธ
3ร—3 conv
medium
๐Ÿ”ถ
5ร—5 conv
coarse
๐Ÿ“‰
pool
context
โ†’
๐Ÿงท
Concat
glue all 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.

Worked example: 1ร—1 as a "bottleneck"

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,600 multiply-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.

A neat side effect

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.

Recap VGG bet on depth + simplicity: only 3ร—3 convs stacked deep (two 3ร—3s = one 5ร—5, but cheaper and with more non-linearity), at the cost of being parameter-heavy. Inception bet on width: run multiple filter sizes in parallel for multi-scale vision, and use 1ร—1 convolutions as cheap bottlenecks to keep it efficient. Both pushed accuracy higher in 2014.

4 ResNet & skip connections โ€” making "deeper" work again


Explain like I'm 5

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.

Why did this happen? The vanishing gradient

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.

๐Ÿ“ฅ
x (input)
copied two ways
โ†’
๐Ÿ”
Conv โ†’ ReLU
learn F(x)
โ†’
๐Ÿ”
Conv
F(x)
โ†’
โž•
Add x
F(x) + x
โ†’
โšก
ReLU
output
Why this fixes everything

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.

Worked example: a residual block in PyTorch

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.

What's BatchNorm doing there?

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.

Key takeaway

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.

Recap Plain deep networks suffered the degradation problem (deeper trained worse) caused by vanishing gradients. ResNet's residual block learns a residual 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


Explain like I'm 5

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

LeverWhat it meansPush it up andโ€ฆ
DepthHow 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).
WidthHow 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 countTotal learned numbers. Driven mostly by fully-connected layers and wide convs.More capacity โ€” but more memory, slower, and more prone to overfit.
Efficiency tricks1ร—1 bottlenecks, global average pooling, small 3ร—3 filters.Same or better accuracy for far fewer parameters.
The repeated lesson

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):

NetworkYearLayersParametersTop-5 errorKey idea
LeNet-519987~60 Kโ€” (MNIST)First conv+pool+dense CNN
AlexNet20128~60 M~16.4%ReLU, dropout, GPUs, scale
VGG-16201416~138 M~7.3%Deep stacks of 3ร—3 convs
GoogLeNet (Inception v1)201422~5 M~6.7%Multi-scale modules, 1ร—1 bottlenecks
ResNet-1522015152~60 M~3.6%Residual blocks / skip connections
Reading the table like a designer

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.
There's no universal "best"

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.

Recap The four levers are depth, width, parameter count, and efficiency tricks. The comparison shows the field's big lesson: smarter design (3ร—3 stacks, 1ร—1 bottlenecks, global average pooling, skip connections) beat raw size โ€” GoogLeNet matched VGG with 27ร— fewer params, and ResNet went 152 layers deep at AlexNet's parameter count while halving the error.

โ˜… 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