ConvNeXt (Liu et al., 2022) asked whether convolutional networks fell behind vision transformers because of convolution itself or because of design and training details. Starting from ResNet-50 trained with a modern recipe (78.8% ImageNet top-1), the authors applied transformer-inspired changes one at a time and reached 82.0% at the same compute, beating Swin-T, with a purely convolutional network. The changes: a patchify stem, stage ratio 3:3:9:3, depthwise convolutions, inverted bottlenecks, 7 × 7 kernels, GELU, fewer activations and normalisations, LayerNorm and separate downsampling. In the exercises you build a ConvNeXt block, then count ConvNeXt-T exactly (28,589,128 parameters, 4.46 G multiply–adds) and show its large kernels cost under 1% of its parameters.
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.
Was it the convolutions, or the recipe?
By 2021 vision transformers were beating ResNets, and many concluded that convolution was outdated. The ConvNeXt authors tested that. They took a ResNet, trained it with the transformers’ modern recipe, and then changed its design step by step to borrow transformer habits: bigger patches at the start, larger filters, wider-then-narrower blocks, different normalisation and activation. Each change kept the network purely convolutional. At the end it matched or beat a transformer of the same size.
Architecture explorer: shapes, parameters and compute
stage
output C × H × W
parameters
multiply–adds
stem
64 × 56 × 56
9.5 k
118.01 M
stage2
256 × 56 × 56
215.8 k
667.94 M
stage3
512 × 28 × 28
1.22 M
1.03 G
stage4
1024 × 14 × 14
7.10 M
1.46 G
stage5
2048 × 7 × 7
14.96 M
809.24 M
head
1000 × 1 × 1
2.05 M
2.05 M
Total: 25,557,032 parameters (25.56 M), 4.09 G multiply–adds per image at 224 × 224.
ResNet-50
25.56 M parameters
4.09 G MACs
ResNeXt-50 (32×4d)
25.03 M parameters
4.23 G MACs
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
ConvNeXt shows that well-designed convolutional networks remain competitive, and they are often easier to deploy on embedded hardware than transformers, with no attention layers and good support for any input size, for robots, drones and satellites.
📝 Quick check (Level 0)
0/3 answered
1. ConvNeXt is…
2. It started from…
3. Its final accuracy compared with Swin-T was…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.
By hand
The roadmap from ResNet-50 at about 4.5 G FLOPs:
Modern training recipe: 76.1% → 78.8%.
Stage ratio 3:4:6:3 → 3:3:9:3.
Patchify stem: a 4 × 4 stride-4 convolution, so 224 → 56 at once.
ResNeXt-ify: depthwise 3 × 3 convolutions, width raised to 96.
Inverted bottleneck (C → 4C → C).
Move the depthwise convolution to the top of the block and enlarge it to 7 × 7.
Micro changes:
GELU;
one activation and one normalisation per block;
BN → LayerNorm;
separate 2 × 2 stride-2 downsampling layers.
The result is 82.0%.
Block: x + γ·W₂ GELU(W₁ LN(DW₇ₓ₇(x))), where γ is a learned per-channel layer scale initialised to 10⁻⁶.
Costs:
A ConvNeXt-T block at C = 96 has 79,296 parameters, of which the 7 × 7 depthwise holds 4,704 (6%).
A dense 3 × 3 at 96 channels would need 82,944 weights for the filter alone.
ConvNeXt-T has 28.6 M parameters and 4.46 G multiply–adds, against ResNet-50’s 25.6 M and 4.09 G.
📝 Quick check (Level 1)
0/3 answered
1. ConvNeXt-T's stage ratio:
2. The patchify stem is…
3. Layer scale γ is initialised to…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.
ConvNeXt in code
Exercise 1.
The ConvNeXt block kept its input shape.
With layer scale 10⁻⁶ it was almost exactly the identity.
LayerNorm normalised each pixel’s channels to mean 0 and standard deviation 1.
Mixup, CutMix, RandAugment, Random Erasing, label smoothing and stochastic depth;
an EMA of the weights.
Much of the gain over the original ResNet comes from this recipe (76.1% → 78.8% before any design change).
ConvNeXt V2 (2023) added masked-autoencoder pretraining and global response normalisation.
model = torchvision.models.convnext_tiny(weights="IMAGENET1K_V1") # 28.6 M parameters
🐍 Exercise 1: a ConvNeXt block
Implement GELU, channel LayerNorm, a same-padded depthwise convolution and the ConvNeXt block.
📝 Quick check (Level 2)
0/3 answered
1. ConvNeXt's optimiser:
2. The modern recipe alone moved ResNet-50 from 76.1% to…
3. ConvNeXt V2 added…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.
Theory
Separating design from training. Comparing a 2015 ResNet with a 2021 transformer mixes two changes: architecture and training recipe. ConvNeXt changed one thing at a time and measured each, which attributes the gap fairly. Roughly 2.7 points came from the recipe and 3.2 from design.
Which transformer ideas carried over.
Patchify stem and stage ratio: follow Swin.
Depthwise convolution: analogous to the per-channel spatial mixing of self-attention.
Inverted bottleneck: like a transformer’s MLP with expansion 4.
Large kernels: like attention’s large windows. Gains saturated at 7 × 7.
One activation and one norm per block, LayerNorm and GELU: as in transformer blocks.
Why large kernels are cheap here. Depthwise k × k costs k²·C weights per block, against 8C² for the two 1 × 1 layers. At C = 96, going from 3 × 3 to 7 × 7 adds 40·96 = 3,840 weights per block, about 5% of the block, and under 1% of the network (exercise 2).
Limits.
Convolutions still lack attention’s input-dependent weighting.
ConvNeXt’s advantage depends on the heavy modern recipe.
Depthwise 7 × 7 convolutions are memory-bound on some hardware.
📝 Quick check (Level 3)
0/3 answered
1. Depthwise convolution is analogous to…
2. Kernel-size gains saturated at…
3. The inverted bottleneck mirrors…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.
What do the large kernels cost?
History.
Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell and S. Xie (2022) introduced ConvNeXt at CVPR (“A ConvNet for the 2020s”).
Z. Liu et al. (2021) introduced the Swin Transformer, ConvNeXt’s main comparison.
S. Woo et al. (2023) introduced ConvNeXt V2.
Exercise 2. This is a calculation, not a training run. It counts ConvNeXt-T’s parameters and multiply–adds layer by layer and checks them against torchvision. It then repeats the count with 3 × 3 and 11 × 11 depthwise kernels, and compares with ResNet-50:
model
parameters
multiply–adds (G)
ConvNeXt-T, 7 × 7
28,589,128
4.46
ConvNeXt-T, 3 × 3
28,324,168
4.37
ConvNeXt-T, 11 × 11
29,066,056
4.61
ResNet-50
25,557,032
4.09
The count matches torchvision exactly.
Large kernels are nearly free: 7 × 7 instead of 3 × 3 adds 264,960 parameters (0.9%) and 2.0% compute. Almost all of the cost is in the 1 × 1 layers.
ConvNeXt-T is close to ResNet-50 in cost (12% more parameters, 9% more compute), yet 3.2 points more accurate with the same training recipe (82.0% against 78.8%, the paper’s figures). Accuracy is not computed here.
🐍 Exercise 2 (research): what do the large kernels cost?
Count ConvNeXt-T's parameters and multiply–adds, check them against torchvision, and vary the depthwise kernel size.
ConvNeXt in AI, robotics and aerospace
Backbones for dense prediction: ConvNeXt backbones are common in detection and segmentation (with UperNet or Mask R-CNN), including for aerial and satellite imagery.
Deployment: a purely convolutional design runs on accelerators and runtimes that lack efficient attention, and handles variable input sizes naturally.
Lesson: compare architectures with equal training recipes before drawing conclusions.
References
Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, S. Xie (2022). “A ConvNet for the 2020s.” Proc. CVPR.
Z. Liu et al. (2021). “Swin Transformer: hierarchical vision transformer using shifted windows.” Proc. ICCV.
S. Woo et al. (2023). “ConvNeXt V2: co-designing and scaling ConvNets with masked autoencoders.” Proc. CVPR.
Extra weights per block from 3 × 3 → 7 × 7 depthwise at C = 96?
40·96 = 3840.
Problem 7Level 1
GELU(1), three decimals?
Φ(1) ≈ 0.841.
Level 2
Problem 8Level 2
Parameters of ConvNeXt-T?
28589128.
Problem 9Level 2
Extra parameters of ConvNeXt-T with 7 × 7 instead of 3 × 3 kernels?
28,589,128 − 28,324,168 = 264960.
Problem 10Level 2
ConvNeXt-T multiply–adds in G?
4.46.
Problem 11Level 2
Share of a C = 96 block’s parameters in its 7 × 7 depthwise weights, three decimals?
4,704/79,296 ≈ 0.059.
Problem 12Level 2
Total blocks in ConvNeXt-T?
3 + 3 + 9 + 3 = 18.
Problem 13Level 2
Accuracy gain from design changes alone (78.8% → 82.0%), in points?
3.2.
Level 3
Problem 14Level 3
Show that enlarging a depthwise kernel from k₁ to k₂ adds (k₂² − k₁²)·C weights.
A depthwise k × k convolution has one k × k kernel per channel, k²·C weights. The difference between k₂ and k₁ is k₂²C − k₁²C = (k₂² − k₁²)·C. ∎
Problem 15Level 3
Explain why separating recipe from design matters when comparing ResNets and transformers.
Transformers were trained with long schedules, AdamW and heavy augmentation and regularisation, while ResNet baselines often used 2015 recipes. Part of the apparent gap was training: ResNet-50 itself gained 2.7 points from the modern recipe. Only by giving both the same recipe, and changing design elements one at a time, can one attribute the remaining difference to architecture. ∎
Problem 16Level 3
Explain why ConvNeXt uses one activation and one normalisation per block.
Transformer blocks have a single nonlinearity in the MLP and a normalisation before each sub-layer, and ResNet’s three ReLUs and three BNs per block turned out to be more than needed. Removing the extra activations and norms improved accuracy in the paper’s ablation (and reduces memory traffic). The block then behaves more like a pre-norm transformer MLP with a convolutional token mixer. ∎
Problem 17Level 3
Advise whether to use ConvNeXt or a vision transformer as the backbone of a drone’s onboard segmenter.
Prefer ConvNeXt (or a smaller ConvNeXt-style net) if the onboard accelerator and runtime handle convolutions well but attention poorly, or if inputs vary in size. Prefer a transformer if large-scale pretrained weights are essential and the hardware supports attention efficiently. In both cases measure latency and memory at the deployment resolution, and check 7 × 7 depthwise performance on the target chip. ∎
Level 4
Problem 18Level 4
ConvNeXt-T’s top-1 accuracy at the end of the roadmap, in percent?
82.0.
Problem 19Level 4
Parameters of ConvNeXt-T with 11 × 11 kernels (exercise 2)?
29066056.
Problem 20Level 4
Accuracy gain of ResNet-50 from the modern recipe alone (76.1% → 78.8%), in points?
2.7.
Coding practice
🐍 Code 1 (Level 1): block parameters
Depthwise, LN, MLP, layer scale.
🐍 Code 2 (Level 0): stage ratio
Share of blocks per stage.
🐍 Code 3 (Level 0): patchify
res // 4.
🐍 Code 4 (Level 1): depthwise vs dense
k²C over 9C².
🐍 Code 5 (Level 1): GELU
z·Φ(z).
Topic test
A timed test drawn at random from this topic's question bank. Each attempt gets new questions. For a longer test across the whole chapter, see the chapter test, or mix topics in the question bag.
ConvNeXt: topic test
10 questions, drawn at random from a bank of 21. Every attempt is different.
⏱ Time limit: 15 minutes. The test submits itself when time runs out.
Levels covered: 0, 1, 2, 3, 4. No hints or solutions until you submit.