Batch norm normalizes each feature across the mini-batch to zero mean and unit variance, then applies learnable scale and shift; it speeds up and stabilizes training and reduces sensitivity to initialization.
It depends on batch statistics, so it works poorly with tiny batches and sequence models, and behaves differently at training and inference time (running averages).
Layer norm normalizes across the features of each example, independent of batch size, so it is the standard choice in transformers.
Loading…