Neural Network layers that force the data to stay within a standard range (mean 0, variance 1) as it flows through the network. This prevents “co-variate shift” (where the data distribution changes wildly between layers).
Types
Batch Normalization
- Normalizes across the batch dimension.
- Standard for Images/Convolutional Neural Networks (CNN).
- Great for CNNs with large, consistent batches but struggles with small or variable batches.
Layer Normalization
- Normalizes across the feature dimension.
- Standard for NLP/Transformers and often used in GNNs where batch sizes vary.
Math is as follows:
x is the input.
- Calculate the Mean () and Variance () across the features:
- Normalize:
is a small constant to prevent divide by zero. - Scale and shift:
and are learnable parameters.
Instance Normalization
- Normalizes each sample individually. Used in Style Transfer (GANs).