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

ResNeXt

ResNeXt (Xie, Girshick, Dollár, Tu and He, 2017) added a third dimension to network design besides depth and width: cardinality, the number of parallel paths in a block. A ResNeXt block splits its bottleneck into C identical narrow branches and sums them, which is the same as a grouped 3 × 3 convolution. At the same cost as ResNet-50, ResNeXt-50 (32 × 4d) cut top-1 error from 23.9% to 22.2%. This page covers aggregated transformations, their three equivalent forms, the complexity budget and the 32 × 4d design. In the exercises you check that the three forms compute the same function, then derive the paper's equal-cost table: as cardinality rises from 1 to 32, the block widens from 64 to 128 channels at the same cost.

Level 0: Foundation

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

Many small paths instead of one big one

A ResNet bottleneck squeezes 256 channels to 64, applies a 3 × 3 convolution, and expands back. ResNeXt instead uses 32 small paths, each squeezing to just 4 channels, and adds their results. Each path is cheap, so the block can afford more total channels for the same cost. The number of paths, called cardinality, turned out to be a better knob than making the network deeper or wider.

Architecture explorer: shapes, parameters and compute
stageoutput C × H × Wparametersmultiply–adds
stem64 × 56 × 56
9.5 k
118.01 M
stage2256 × 56 × 56
205.8 k
634.22 M
stage3512 × 28 × 28
1.20 M
1.09 G
stage41024 × 14 × 14
7.02 M
1.53 G
stage52048 × 7 × 7
14.54 M
865.44 M
head1000 × 1 × 1
2.05 M
2.05 M
Total: 25,028,904 parameters (25.03 M), 4.23 G multiply–adds per image at 224 × 224.
ResNet-5025.56 M parameters4.09 G MACs
ResNeXt-50 (32×4d)25.03 M parameters4.23 G MACs
Wide ResNet-50-268.88 M parameters11.40 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

Grouped convolutions are a cheap way to add capacity, used in ResNeXt detectors and in the efficient networks (MobileNet, ShuffleNet, RegNet) that run on drones and phones.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Cardinality is the number of…
  2. 2. ResNeXt sums the paths'…
  3. 3. ResNeXt-50 (32 × 4d) has 32 paths of width…

Level 1: Beginner

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

By hand

  • Aggregated transformation: y = x + Σᵢ₌₁ᶜ Tᵢ(x), where each Tᵢ is a 1 × 1 (256 → d), a 3 × 3 (d → d) and a 1 × 1 (d → 256).
  • Equivalent grouped form: a 1 × 1 convolution 256 → C·d, a 3 × 3 grouped convolution with C groups, then a 1 × 1 convolution C·d → 256.
  • Grouped convolution weights: k²·(C_in/g)·C_out. A 3 × 3 convolution 128 → 128 has 147,456 weights ungrouped and 4,608 with 32 groups.
  • Block cost: 256·Cd + 9·C·d² + Cd·256.
    • ResNet-50’s block (C = 1, d = 64) has 69,632 weights.
    • The 32 × 4d block has 65,536 + 4,608 = 70,144 weights, about the same cost with twice the width (128).
📝 Quick check (Level 1)
0/3 answered
  1. 1. Weights of a 3 × 3 conv 128 → 128 with 32 groups:
  2. 2. Total width of 32 × 4d:
  3. 3. The aggregated sum equals…

Level 2: Intermediate

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

ResNeXt in code

Exercise 1.

  • The three forms gave identical outputs:
    • a sum of narrow branches;
    • branches concatenated before one projection;
    • a single grouped convolution.
  • The weights of a 3 × 3 convolution fell 32-fold with 32 groups.

Practice.

  • Use nn.Conv2d(w, w, 3, padding=1, groups=C) for the grouped layer.
  • torchvision’s resnext50_32x4d has 25.0 M parameters and 4.23 G multiply–adds, almost the same as ResNet-50 (25.6 M, 4.09 G).
  • The training recipe is ResNet’s.
  • Grouped convolutions with very few channels per group can run slower on GPUs than their operation count suggests, because each group is a small matrix multiplication.
model = torchvision.models.resnext50_32x4d(weights="IMAGENET1K_V2")
conv2 = nn.Conv2d(128, 128, 3, padding=1, groups=32, bias=False)   # the grouped 3x3 of a 32x4d block
🐍 Exercise 1: three equivalent forms
Implement ResNeXt's aggregated, concatenated and grouped forms and check that they agree.
📝 Quick check (Level 2)
0/3 answered
  1. 1. PyTorch's grouped convolution argument:
  2. 2. resnext50_32x4d vs resnet50 compute:
  3. 3. Grouped convs can be slower than expected because…

Level 3: Advanced

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

Theory

Split–transform–merge. Inception modules (E8-6) split the input into branches with different, hand-designed transformations. ResNeXt keeps the idea but makes all branches identical, so there are only two hyperparameters (C and d) and the block can be written as one grouped convolution. This is a simple, repeatable design rule.

Why cardinality helps. At fixed cost, grouping the middle convolution makes it cheaper, which frees budget for more total width in the 1 × 1 layers. Each group learns its own small subspace transformation, and the sum combines them. In the paper’s ablations at twice ResNet-50’s cost, raising cardinality (2 × 64d → 64 × 4d) gave lower error than going deeper (ResNet-200) or wider (ResNet-101 with doubled width).

Equivalence. The three forms are equal because a sum of branch outputs B_i·hᵢ equals the concatenation [B₁ … B_C] times [h₁; …; h_C]. Branch-wise middle layers are exactly a block-diagonal matrix, which is a grouped convolution.

Limits. The gains come from better use of a fixed budget. Very many groups reduce each group’s width to a few channels, where information cannot mix across groups until the next 1 × 1 layer. ShuffleNet (E8-18) addresses this.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Compared with Inception, ResNeXt branches are…
  2. 2. At 2× cost, the best improvement came from…
  3. 3. A sum of branch outputs equals…

Level 4: Expert

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

What does a fixed budget buy?

History.

  • S. Xie, R. Girshick, P. Dollár, Z. Tu and K. He (2017) introduced ResNeXt; it came second in ILSVRC 2016 classification.
  • D. Mahajan et al. (2018) trained ResNeXt-101 32 × 48d on 3.5 billion Instagram images, reaching 85.4% top-1 accuracy on ImageNet.
  • ResNeXt backbones powered many detection and segmentation systems, such as Mask R-CNN variants.

Exercise 2. This is a calculation, not a training run. For cardinalities C = 1, 2, 4, 8 and 32, it finds the group width d that keeps a conv2-stage bottleneck block’s cost nearest that of ResNet-50’s block (69,632 weights), and compares with the paper’s Table 2:

cardinality C width per group d total width C·d block weights paper’s d paper’s top-1 error
1 64 64 69,632 64 23.9%
2 40 80 69,760 40 23.0%
4 24 96 69,888 24 22.6%
8 14 112 71,456 14 22.3%
32 4 128 70,144 4 22.2%
  • The widths match the paper exactly. More groups make the 3 × 3 layer cheaper, and the saving buys width: 64 channels at C = 1 become 128 at C = 32.
  • The error column comes from the paper’s ImageNet experiments, not from this exercise. It falls steadily with cardinality at equal cost, with diminishing returns beyond C = 8.
🐍 Exercise 2 (research): what does a fixed budget buy?
Find the group width that keeps a ResNeXt block's cost equal to ResNet-50's for each cardinality, and compare with the paper's table.

ResNeXt in AI, robotics and aerospace

  • Detection backbones: ResNeXt-101 backbones are common in high-accuracy detectors for aerial and satellite imagery.
  • Large-scale pretraining: weakly supervised ResNeXt models trained on billions of images provided strong transfer features.
  • Efficient design: grouped convolutions are a basic tool for fitting networks into embedded compute budgets.

References

  1. S. Xie, R. Girshick, P. Dollár, Z. Tu, K. He (2017). “Aggregated residual transformations for deep neural networks.” Proc. CVPR.
  2. D. Mahajan et al. (2018). “Exploring the limits of weakly supervised pretraining.” Proc. ECCV.
  3. C. Szegedy et al. (2015). “Going deeper with convolutions.” Proc. CVPR.