Group normalization

Also known as: GroupNorm

On this page 7

Group normalization (GroupNorm) is a normalization layer that divides the channels of each training example into fixed-size groups and standardizes the activations inside every group using that group’s own mean and variance. In neural networks, and especially in convolutional models used across artificial intelligence, it serves the same purpose as batch normalization, namely stabilizing and accelerating training, but it computes its statistics independently of the batch dimension.

Because the statistics never mix examples, the layer behaves identically during training and inference and keeps its accuracy when only one or two images fit on a GPU. That property made group normalization a standard choice in object detection, segmentation, diffusion models and other memory-heavy vision workloads.

How group normalization computes its statistics

Group normalization works on a feature tensor with shape N x C x H x W, where N is the batch size, C the number of channels and H x W the spatial size. The layer splits the C channels into G groups of C/G channels each, then computes one mean and one variance over all channels and spatial positions within a single group of a single sample.

Each activation is then normalized as x minus the group mean, divided by the square root of the group variance plus a small epsilon, typically 1e-5. Finally, a learnable per-channel scale (gamma) and shift (beta) restore the representational capacity that normalization alone would remove. Group normalization therefore adds only 2C trainable parameters to the layer.

The following table lists the main elements of the computation and their role.

ElementTypical valueRole
Number of groups G32 (common default)Sets how many channels share statistics
Channels per groupC / G, often 8 to 64Defines the size of each normalization set
Epsilon1e-5 or 1e-6Prevents division by zero
Gamma and betaOne pair per channelRestore scale and offset after normalization
Reduction axesGroup channels, H, WExclude the batch dimension entirely
Components of the group normalization computation

Group normalization sits on a continuum between layer normalization and instance normalization. With G = 1, all channels form a single group and the operation equals layer normalization over C, H and W. With G = C, every channel is its own group and the operation equals instance normalization. Intermediate values let the model share statistics among related feature channels without forcing all channels into one distribution.

The comparison below shows over which axes each common method computes its statistics.

MethodStatistics computed overDepends on batch sizeTypical domain
Batch normalizationN, H, W per channelYesCNNs with large batches
Layer normalizationC, H, W per sampleNoTransformers, RNNs
Instance normalizationH, W per channel and sampleNoStyle transfer
Group normalizationChannel group, H, W per sampleNoDetection, segmentation, diffusion
RMSNormFeatures per token, no meanNoLarge language models
Normalization layers compared by statistics axes

Unlike batch normalization, group normalization keeps no running averages. The statistics are recomputed for every input, so there is no train-test discrepancy caused by stale or unrepresentative moving estimates.

Why batch independence matters

Batch normalization estimates statistics from the mini-batch, and that estimate becomes noisy and biased when the batch is small. In the original ResNet-50 experiments on ImageNet, batch normalization lost substantial accuracy as the per-GPU batch fell from 32 to 2 images, while group normalization kept its error nearly constant across batch sizes. At large batches, batch normalization usually remains slightly ahead.

Batch independence also simplifies engineering. There is no need for synchronized batch normalization across devices, no special handling of evaluation mode and no sensitivity to how examples are grouped. This matters in high-resolution segmentation, video models, 3D medical imaging and the U-Net backbones of diffusion models, where memory limits often allow only one to four samples per device.

Choosing the number of groups and placement

The number of groups is the main hyperparameter. A value of 32 works well for most convolutional backbones, and results are usually robust between 8 and 64 groups. The channel count must be divisible by G; some implementations instead fix the channels per group, for example 16, which adapts better to narrow layers.

The decision table below summarizes common situations and sensible configurations.

SituationRecommended choiceReason
Batch of 1 to 8 per deviceGroupNorm with G = 32Statistics stay reliable without the batch
Large batch image classificationBatch normalizationSlightly higher accuracy and fused inference
Diffusion U-Net blocksGroupNorm, often 32 groupsSmall batches and stable denoising
Narrow layers below 64 channelsFewer groups or fixed group sizeAvoids groups with too few channels
Weight-standardized convolutionsGroupNorm plus weight standardizationCloses the gap to batch normalization
Practical configuration guidance

Placement follows the usual pattern: convolution, then group normalization, then the activation function such as ReLU or SiLU. In residual connections, initializing the last gamma of each block to zero can help very deep networks start close to an identity mapping.

Limitations and common mistakes

Group normalization is not free. Computing per-sample group statistics at inference time costs extra memory traffic and latency, whereas batch normalization can be folded into the preceding convolution after training. On edge devices this difference can be noticeable.

SymptomLikely causeFix
Shape error at constructionChannels not divisible by GChange G or pad channel counts
Poor accuracy in thin layersGroups contain only one or two channelsReduce the number of groups
Training diverges in mixed precisionVariance computed in half precisionCompute statistics in float32
Gap versus batch normalizationLarge batches availableConsider batch normalization or weight standardization
Frequent problems and their fixes
  • Group normalization is not a regularizer in the way batch normalization partly is, because it adds no batch noise.
  • Pretrained weights trained with batch normalization cannot be swapped to GroupNorm without fine-tuning.
  • For transformers operating on token sequences, layer normalization or RMSNorm remains the conventional choice.

In everyday language

A neural network passes numbers from layer to layer. If those numbers grow too large or too small, learning becomes slow or unstable. Normalization keeps the numbers in a steady range.

Group normalization does this inside each single picture. It sorts the picture’s features into small teams, such as 32 teams. Each team is then adjusted to a common average and spread. Other pictures in the batch play no role. That is why it still works when the computer can hold only one picture at a time.

Seen in the real world

A medical imaging team trains a 3D segmentation network to outline tumors in CT volumes of 512 x 512 x 128 voxels. Each volume is so large that a single GPU holds only two samples. With batch normalization, validation scores fluctuate strongly between epochs, and results at inference differ from those seen during training.

The team replaces every batch normalization layer with group normalization using 16 groups, because several layers have only 32 or 64 channels. Training becomes smooth and reproducible, the gap between training and evaluation behavior disappears, and the Dice score on the validation set rises by several points. The same configuration is then deployed for inference one scan at a time without any change to the normalization layers.