Foundations to Frontier
Tests
E. Deep Learning › E7 CNN Building Blocks

Grouped Convolution

A grouped convolution splits the input and output channels into G groups and convolves each group separately, so each output channel sees only C_in/G input channels and the layer has G times fewer weights. It was born in AlexNet as a way to split work across two GPUs, became a design principle in ResNeXt (cardinality) and ShuffleNet, and in the limit G = C_in it is the depthwise convolution. This page covers the operation, its cost, why stacked groups never exchange information without help, and the channel shuffle that fixes this. In the exercises you show a grouped convolution is a block-diagonal standard convolution, then find that a branch reading one group stayed at chance on a task needing the other group's channels, while one channel shuffle raised it to 99%.

Level 0: Foundation

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

Split the channels into teams

In a grouped convolution the channels are divided into teams. Each team of output channels looks only at the matching team of input channels, as if several small convolutions ran side by side. That cuts the weights and computation by the number of teams. The catch is that teams never talk to each other unless something mixes them, such as a 1×1 convolution or a channel shuffle.

CNN building blocks
parameters (no bias): standard 73,728 · grouped (g = 1) 73,728 · depthwise separable 8,768 (8.4× fewer) · multiply–adds per image: 231.2 M vs 27.5 M
Deep-learning "convolution" slides a small learned kernel over the input (no flip). Stride shrinks the output, padding preserves borders, dilation spreads the kernel to see further without more weights. Pooling summarises windows. Stacking layers grows the receptive field. Depthwise-separable and grouped convolutions cut cost by not connecting every input channel to every output channel. Transposed convolution upsamples, but uneven kernel overlap leaves checkerboard patterns. Squeeze-and-excitation rescales whole channels by gates computed from their global averages; CBAM adds a per-pixel spatial gate. (Here the gates are fixed functions of the averages so you can see their effect; in a network the excitation is learned.)
Why engineers care

Grouped convolutions give accuracy for less compute in ResNeXt, ShuffleNet and RegNet backbones used for perception on embedded hardware. They also map naturally onto parallel hardware, which is how AlexNet first used them to fit on two GPUs.

📝 Quick check (Level 0)
0/3 answered
  1. 1. In a grouped conv, an output channel sees…
  2. 2. With G groups, weights shrink by a factor of…
  3. 3. Grouped convolutions first appeared in…

Level 1: Beginner

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

By hand

  • Weights: C_out·(C_in/G)·k². For 256 → 256, 3 × 3, G = 32: 18 432, against 589 824 for G = 1 (32 times fewer).
  • Extremes: G = 1 is a standard convolution; G = C_in = C_out is a depthwise convolution (576 weights for 64 channels, 3 × 3).
  • Connectivity: each output channel connects to C_in/G inputs: 8 for 256 channels in 32 groups.
  • Block-diagonal kernel: viewed as a C_out × C_in matrix of k × k filters, only the G diagonal blocks are non-zero.
  • Channel shuffle: reshape the C channels to (G, C/G), transpose, flatten. For 6 channels and 3 groups the order becomes 0, 2, 4, 1, 3, 5.
  • ResNeXt: a block with cardinality 32 and width 4 uses a grouped 3 × 3 convolution on 128 channels with 32 groups: 128 × 4 × 9 = 4608 weights.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Weights for 256 → 256, 3 × 3, 32 groups:
  2. 2. Grouped conv with G = C is…
  3. 3. Shuffle order of 4 channels, 2 groups:

Level 2: Intermediate

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

Grouped convolutions in code

Exercise 1.

  • A 4-group convolution equalled a standard convolution with a block-diagonal kernel.
  • Changing input channel 0 affected only output channels 0 and 1, its own group.
  • Channel shuffle reordered 8 channels in 4 groups to 0, 2, 4, 6, 1, 3, 5, 7.

Practice.

  • nn.Conv2d(C_in, C_out, k, groups=G) (C_in and C_out divisible by G).
  • Follow grouped layers by a 1×1 convolution (ResNeXt) or a channel shuffle (ShuffleNet) so groups exchange information.
  • Many groups make each layer memory-bound on GPUs; measure speed, not just operation counts.
def channel_shuffle(x, g):  # x: (N, C, H, W)
    n, c, h, w = x.shape; return x.view(n, g, c // g, h, w).transpose(1, 2).reshape(n, c, h, w)
🐍 Exercise 1: block-diagonal kernels and channel shuffle
Implement a grouped convolution, check it equals a block-diagonal standard convolution, check which outputs each input can affect, and implement channel shuffle.
📝 Quick check (Level 2)
0/3 answered
  1. 1. ResNeXt mixes groups with…
  2. 2. ShuffleNet mixes groups with…
  3. 3. Many groups can make GPU kernels…

Level 3: Advanced

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

Theory

Block-diagonal structure. A grouped convolution is a standard convolution constrained to a block-diagonal kernel over channels. Its expressiveness per layer is that of G independent convolutions with C/G channels each.

Information flow. In a stack of grouped layers with the same grouping, the channels of group g depend only on the input channels of group g: the network splits into G separate subnetworks. Mixing requires an operation that crosses blocks: a dense 1×1 convolution, a channel permutation (shuffle) or a different grouping in the next layer.

Cardinality. Xie et al. (2017) found that, at a fixed computational budget, increasing the number of groups (cardinality) and widening the layers improved accuracy more than going deeper or wider alone: many cheap parallel paths are a good use of compute.

AlexNet’s accident. Krizhevsky et al. split their network across two GPUs, so some layers saw only half the channels; the two halves learned different kinds of filters (colour-agnostic versus colour-specific), an early observation that groups specialise.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Stacked same-group layers form…
  2. 2. ResNeXt found cardinality is…
  3. 3. AlexNet's two GPU halves learned…

Level 4: Expert

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

Do groups talk to each other?

History.

  • A. Krizhevsky, I. Sutskever and G. Hinton (2012) split AlexNet across two GPUs.
  • S. Xie et al. (2017) introduced ResNeXt and cardinality.
  • X. Zhang et al. (2018) introduced ShuffleNet and the channel shuffle; I. Radosavovic et al. (2020) RegNet used grouped convolutions throughout.

Exercise 2. Per-pixel data with 4 channels in two groups (A: channels 0–1, B: channels 2–3); the label is whether channels 0 and 2 have the same sign. Two grouped 1×1 layers (2 groups, 16 hidden channels, ReLU) and a head that reads only group A’s channels, trained with Adam; three seeds:

channel shuffle between layers test accuracy
no 0.506
yes 0.992
  • Without shuffle, group A’s branch never saw channel 2 and was at chance.
  • One shuffle let information cross groups, and the branch learned the rule.
  • Lesson: grouped layers need explicit mixing; otherwise they are several independent networks.
🐍 Exercise 2 (research): do groups talk to each other?
Train two grouped layers with and without a channel shuffle on a rule that needs channels from both groups, reading the decision from one group.

Grouped convolutions in AI, robotics and aerospace

  • Efficient backbones (ResNeXt, RegNet, ShuffleNet) in detection and segmentation for robots and vehicles.
  • Multi-sensor fusion: groups can keep sensor-specific channels apart before deliberate mixing.
  • Hardware partitioning: groups map onto parallel compute units, as in AlexNet’s two GPUs.

References

  1. A. Krizhevsky, I. Sutskever, G. Hinton (2012). “ImageNet classification with deep convolutional neural networks.” Advances in NeurIPS.
  2. S. Xie, R. Girshick, P. Dollár, Z. Tu, K. He (2017). “Aggregated residual transformations for deep neural networks.” Proc. CVPR.
  3. X. Zhang, X. Zhou, M. Lin, J. Sun (2018). “ShuffleNet: an extremely efficient convolutional neural network for mobile devices.” Proc. CVPR.