Foundations to Frontier
Tests
E. Deep Learning › E8 CNN Architectures (one page each)

AlexNet

AlexNet (Krizhevsky, Sutskever and Hinton, 2012) won the ImageNet challenge with a top-5 error of 15.3% against 26.2% for the runner-up, and started the deep-learning era in vision. It scaled LeNet's recipe to 61 million parameters and 1.2 million images, trained on two GPUs, with ReLU activations, dropout, heavy data augmentation, local response normalisation and overlapping pooling. This page covers its layers, the two-GPU split, and which of its choices survived. In the exercises you compute its shapes and parameters, then test its claim that ReLU trains faster than tanh: true at equal learning rates (about 60% of the steps), but in a two-layer network tanh tolerated larger learning rates and was faster when each was tuned.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

The network that changed computer vision

In 2012 a team from Toronto entered a network called AlexNet in the ImageNet competition: recognise 1,000 kinds of object in photographs. It made 15.3% top-5 errors; the next best entry, built from hand-designed features, made 26.2%. AlexNet was LeNet made much bigger (eight learned layers and 61 million weights) and trained on 1.2 million images using two gaming graphics cards. Within two years almost every vision system used deep networks.

Architecture explorer: shapes, parameters and compute
stageoutput C × H × Wparametersmultiply–adds
conv164 × 27 × 27
23.3 k
70.28 M
conv2192 × 13 × 13
307.4 k
223.95 M
conv3-5256 × 6 × 6
2.14 M
361.34 M
fc6-81000 × 1 × 1
58.63 M
58.62 M
Total: 61,100,840 parameters (61.10 M), 714.19 M multiply–adds per image at 224 × 224.
Bars show each row's share of the total. Convolutions dominate compute because they run at every position; fully connected layers dominate parameters in older designs (AlexNet, VGG). Changing the input size changes the compute of every convolution but not its parameters. Parameter counts include biases and BatchNorm scale and shift and match torchvision's implementations.
Why engineers care

AlexNet showed that data, GPUs and a few training tricks (ReLU, dropout, augmentation) beat hand-designed features. That recipe now runs perception on robots, cars and spacecraft.

📝 Quick check (Level 0)
0/3 answered
  1. 1. AlexNet's ImageNet top-5 error was…
  2. 2. It was trained on…
  3. 3. Its parameter count is about…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

Original AlexNet on a 3 × 227 × 227 input. Counts are summed over both GPUs; conv2, conv4 and conv5 see only the channels on their own GPU.

layer operation output parameters
conv1 96 kernels 11 × 11, stride 4 96 × 55 × 55 34,944
pool1 max 3 × 3, stride 2 96 × 27 × 27 0
conv2 256 kernels 5 × 5 (2 groups) 256 × 27 × 27 307,456
pool2 max 3 × 3, stride 2 256 × 13 × 13 0
conv3 384 kernels 3 × 3 384 × 13 × 13 885,120
conv4 384 kernels 3 × 3 (2 groups) 384 × 13 × 13 663,936
conv5 256 kernels 3 × 3 (2 groups) 256 × 13 × 13 442,624
pool5 max 3 × 3, stride 2 256 × 6 × 6 0
fc6, fc7, fc8 9216 → 4096 → 4096 → 1000 1000 58,631,144
  • Total: 60,965,224 parameters, 96% in the fully connected layers.
  • Output sizes: (227 − 11)/4 + 1 = 55 and (55 − 3)/2 + 1 = 27.
  • Overlapping pooling: the window (3) is larger than the stride (2).
📝 Quick check (Level 1)
0/3 answered
  1. 1. conv1 output size for a 227 × 227 input:
  2. 2. Pooling is 'overlapping' because…
  3. 3. fc6 has how many inputs?

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

AlexNet in code

Exercise 1.

  • The spatial sizes were 55, 27, 27, 13, 13, 13, 13, 6.
  • Parameters came to 2,334,080 in convolutions and 58,631,144 in fully connected layers.
  • Local response normalisation divided each activation by (2 + 10⁻⁴·Σ a²)^0.75 over 5 neighbouring channels.

Practice.

  • torchvision’s alexnet is a single-GPU variant: 64, 192, 384, 256, 256 kernels with no groups or LRN, 61.1 million parameters, about 0.71 G multiply–adds. Its padding is chosen so a 224 × 224 input works.
  • Training recipe:
    • SGD with batch 128, momentum 0.9, weight decay 5·10⁻⁴;
    • learning rate 0.01, divided by 10 when validation error stopped improving (three times over 90 epochs);
    • dropout 0.5 in fc6 and fc7.
  • Augmentation: random 224 × 224 crops of 256 × 256 images with horizontal flips, and PCA colour jitter.
  • Test time: average the predictions on ten crops (four corners, the centre, and their flips).
model = torchvision.models.alexnet(weights="IMAGENET1K_V1")   # 61.1 M parameters
opt = torch.optim.SGD(model.parameters(), lr=0.01, momentum=0.9, weight_decay=5e-4)
🐍 Exercise 1: AlexNet shapes and parameters
Compute AlexNet's layer shapes and parameter counts, and implement local response normalisation.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Dropout in AlexNet was applied to…
  2. 2. Ten-crop testing averages…
  3. 3. torchvision's AlexNet omits…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

What made it work. The paper reports the effect of each choice on ImageNet:

  • ReLU: a four-layer CNN with ReLU reached 25% training error on CIFAR-10 six times faster than with tanh. Non-saturating units keep gradients alive.
  • Dropout: without it the network overfitted substantially; with it, training took about twice as many iterations to converge.
  • Data augmentation: crops and flips increase the training set by a factor of 2,048, the figure the paper uses. Colour PCA jitter cut top-1 error by over 1%.
  • LRN: reduced top-1 and top-5 errors by 1.4% and 1.2%.
  • Overlapping pooling: reduced them by 0.4% and 0.3%.

What survived.

  • ReLU, dropout, augmentation and GPU training became standard.
  • LRN was dropped after VGG found it did not help, and BatchNorm replaced it.
  • Large fully connected layers gave way to global average pooling.
  • Group convolutions, first a two-GPU memory workaround, returned on purpose in ResNeXt and MobileNets.

Why ReLU helps. The derivative of tanh is 1 − tanh², which is near 0 for large |z|; a saturated unit passes almost no gradient. ReLU’s derivative is 1 for positive inputs. In deep networks the product of many small derivatives vanishes. Exercise 2 shows that in a shallow network the advantage depends on the learning rate.

📝 Quick check (Level 3)
0/3 answered
  1. 1. ReLU's speed-up reported on CIFAR-10 was…
  2. 2. LRN was later…
  3. 3. tanh′(z) for large |z| is…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

Does ReLU really train faster?

History.

  • A. Krizhevsky, I. Sutskever, G. Hinton (2012) won ILSVRC 2012 with AlexNet. The model was trained for five to six days on two GTX 580 GPUs.
  • V. Nair and G. Hinton (2010) had introduced ReLUs for restricted Boltzmann machines; X. Glorot, A. Bordes, Y. Bengio (2011) for deep networks.
  • N. Srivastava et al. (2014) gave the full account of dropout.
  • M. Zeiler and R. Fergus (2014) visualised and improved AlexNet (ZFNet, E8-3).

Exercise 2. The network has two 3 × 3 convolutions (8 maps each), the chosen activation, 2 × 2 average pooling and a linear output. It is trained on 200 noisy shifted digits with full-batch SGD and momentum 0.9, using He initialisation for ReLU and LeCun initialisation for tanh. Steps to reach 25% training error (two seeds):

activation learning rate 0.1 0.3 1.0
ReLU 51, 47 30, 37 40, 115
tanh 94, 72 45, 35 22, 19
  • At the same learning rate ReLU was faster (about 60% of tanh’s steps at 0.1), the direction Krizhevsky et al. reported.
  • tanh tolerated a larger learning rate. At 1.0 ReLU became erratic, while tanh reached the target in about 20 steps. With each activation’s best learning rate, tanh was faster here. Seeds 2 to 4 gave the same pattern.
  • The paper chose each network’s learning rate for speed and still found a six-fold gain, but in a four-layer network on CIFAR-10. In two layers saturation matters little, and tanh’s bounded outputs keep large steps stable. A claim about training speed must state the learning rate and depth.
🐍 Exercise 2 (research): does ReLU train faster?
Train a two-layer CNN with ReLU and with tanh at several learning rates and count the steps to 25% training error.

AlexNet in AI, robotics and aerospace

  • Transfer learning: AlexNet’s ImageNet features, reused on small datasets, were the first widely used pretrained vision models, including for aerial-scene and terrain classification.
  • GPU computing: AlexNet’s two-GPU training made GPUs the standard hardware for training, and later for running networks on vehicles and robots.
  • Benchmark culture: its decisive ImageNet win made large public benchmarks the main way vision methods are compared.

References

  1. A. Krizhevsky, I. Sutskever, G. E. Hinton (2012). “ImageNet classification with deep convolutional neural networks.” Advances in NeurIPS.
  2. V. Nair, G. E. Hinton (2010). “Rectified linear units improve restricted Boltzmann machines.” Proc. ICML.
  3. N. Srivastava et al. (2014). “Dropout: a simple way to prevent neural networks from overfitting.” JMLR 15.
  4. O. Russakovsky et al. (2015). “ImageNet large scale visual recognition challenge.” IJCV 115.