When do you use LayerNorm instead of BatchNorm?
medium- Use LayerNorm when batch size is small or varies (RNNs, transformers, sequence data).
- LayerNorm computes statistics across features within a single example, so it doesn't depend on batch statistics.
- That's why it's standard in transformers and language models where sequence lengths vary and batches can be tiny.
#normalizationPermalink & quiz →