Key ideas
| Model (year) | Key idea | Parameters |
|---|---|---|
| AlexNet (2012) | deep CNN on GPUs: ReLU, dropout, augmentation, first conv | 61.1 M |
| VGG-16 (2014) | blocks of convs + max-pool, then 3 FC layers | 138.4 M |
| NiN (2013) | convs after each conv; global average pooling instead of FC layers | – |
| GoogLeNet (2014) | Inception block: parallel branches concatenated | 6.6 M |
| ResNet-18 / 50 (2015) | residual (identity shortcut) blocks with batch norm | 11.7 M / 25.6 M |
| DenseNet-121 (2017) | concatenate all earlier feature maps | 8.0 M |
| MobileNet (2017) | depthwise separable convolutions | 4.2 M |
Counts are for torchvision's ImageNet models (see the code below); MobileNet's is from its paper.
- AlexNet made the 2012 breakthrough: ReLU instead of sigmoid (cheaper, trains more easily), dropout in the fully connected layers, heavy data augmentation, and an first convolution1. In d2l's version (one input channel, 10 classes) the two hidden FC layers need and weight matrices, over 40 million parameters and 164 MB1. Counted over that whole model, the FC layers hold about 92% of its 46.8 million parameters, while the convolutions, whose kernels are reused at every position, do about 95% of its 0.94 billion multiply–adds.
- VGG builds the network from blocks: several convolutions with stride 1 and padding 1 (size kept), then max-pooling with stride 2 (size halved)2. A deep net of small filters beat a shallow net of larger ones: two stacked layers see a region, three see with instead of weights and three ReLUs instead of one2. VGG-11 has 8 conv + 3 FC weight layers, VGG-16 13 + 3, VGG-19 16 + 32. Five poolings turn into , and the first FC layer, fed by the map, holds most of the parameters.
- NiN follows each ordinary convolution with two convolutions (a small MLP applied at every pixel) and ends with a block that outputs one channel per class, then global average pooling, with no FC layer at all3. Dropping the giant FC layers is the main reason it has far fewer parameters than AlexNet and VGG3.
- Inception (GoogLeNet): four parallel branches (; then ; then ; max-pool then ) whose outputs are concatenated along channels; the convs of the middle branches first reduce the channels to cut cost4. Like NiN it ends with global average pooling, followed by one FC layer4. Pooling instead of 4096-wide FC layers plus these channel reductions keep GoogLeNet small.
- ResNet: a residual block computes , so pushing the last layer's weights to zero gives the identity; extra blocks can always fall back to "do nothing", and the function classes are nested5. Each conv is followed by batch norm and ReLU; a conv on the shortcut matches channels or stride; the network ends with global average pooling and one FC layer5. The shortcut also passes gradients straight back. Nesting guarantees a training fit at least as good, not better test accuracy.
- ResNeXt uses grouped convolutions ( times cheaper; groups exchange no information) between convs that mix the channels again5.
- DenseNet concatenates each layer's output to its input instead of adding it. Each layer adds only channels (the growth rate), and transition layers ( conv + average pooling) cut the channels and halve the size6. The concatenations make it memory-hungry6.
- MobileNet replaces each standard convolution by a depthwise one (one filter per input channel) followed by a pointwise convolution that mixes the channels. With kernels this needs 8 to 9 times less computation; MobileNet has 4.2 M parameters and 569 M multiply–adds, against 29.3 M and 4866 M for the same network with full convolutions7.
- Graph neural networks pass messages: each node aggregates its neighbours' features (sum, mean or max) and updates its own. Such GNNs can tell two graphs apart at most as well as the Weisfeiler–Lehman test, and sum aggregation with injective functions reaches that bound8. With identical starting features, every node of a 6-cycle and of two disjoint triangles has two neighbours, so no message-passing GNN separates these graphs.
Formulas
Worked example
torchvision's VGG-16 on a image: the conv part outputs values. The first FC layer to 4096 units has parameters, 74% of the network's ; the three FC layers together hold 89%. At 4 bytes per float32 the whole model is about 553 MB. Stacking three convs with uses weights, against for one conv with the same receptive field. A dense block with 64 input channels, 4 layers and growth rate 32 feeds its fourth layer channels and outputs .
In code
import torchvision.models as M
names = ["alexnet", "vgg16", "resnet18", "resnet50", "densenet121"]
counts = {n: sum(p.numel() for p in getattr(M, n)(weights=None).parameters()) for n in names}
print(counts) # {'alexnet': 61100840, 'vgg16': 138357544, 'resnet18': 11689512, 'resnet50': 25557032, 'densenet121': 7978856}
vgg = M.vgg16(weights=None) # architecture only, no download
print(sum(p.numel() for p in vgg.classifier[0].parameters())) # 102764544
Common pitfalls
- ResNet adds the shortcut; DenseNet and Inception concatenate along channels.
- ResNet-50 has about 25.6 million parameters, not billions, and ends with global average pooling plus one FC layer, not two 4096-unit layers as VGG does.
- The original ResNet uses batch normalization, not layer normalization, and ReLU, not tanh; ResNeXt keeps that recipe.
- Highway networks (gated shortcuts) came before ResNet, which uses plain identity shortcuts instead5.
- In AlexNet and VGG the FC layers hold most parameters, but the conv layers do most of the computation.
- VGG's depth counts weight layers only; pooling, ReLU and dropout are not counted.
- A ViT has much less of a CNN's built-in locality and translation bias, so on small datasets a ResNet of similar size usually wins.
- A GNN that sees only the bond graph cannot distinguish a molecule from its mirror image; geometry must be part of the input.
References
- Dive into Deep Learning — Sec. 8.1.2 AlexNet (8.1.2.1 Architecture, 8.1.2.2 Activation Functions, 8.1.2.3 Capacity Control and Preprocessing), 8.1.4 Discussion
- Simonyan & Zisserman (2014), Very Deep Convolutional Networks for Large-Scale Image Recognition — Sec. 2.1 Architecture; 2.2 Configurations (Table 1); 2.3 Discussion; 4.1 Single Scale Evaluation
- Dive into Deep Learning — Sec. 8.3.1 NiN Blocks, 8.3.2 NiN Model, 8.3.4 Summary
- Dive into Deep Learning — Sec. 8.4.1 Inception Blocks, 8.4.2 GoogLeNet Model
- Dive into Deep Learning — Sec. 8.6.1 Function Classes, 8.6.2 Residual Blocks, 8.6.3 ResNet Model, 8.6.5 ResNeXt
- Dive into Deep Learning — Sec. 8.7.1 From ResNet to DenseNet, 8.7.2 Dense Blocks, 8.7.3 Transition Layers, 8.7.6 Summary and Discussion
- Howard et al. (2017), MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications — Sec. 3.1 Depthwise Separable Convolution; Table 4
- Xu et al. (2018), How Powerful are Graph Neural Networks? — Sec. 4 Building Powerful Graph Neural Networks (Lemma 2, Theorem 3), 4.1 Graph Isomorphism Network (Lemma 5)