AI Logic

Glossary

Layer Normalization

Updated:

A diagram showing along which axis layer normalization computes the mean and variance. In the two grids at the top, rows are the samples in a mini-batch and columns are the units of a layer. On the left, layer normalization shades one sample's row horizontally: the mean and variance are computed from that sample's features alone, so it does not depend on the mini-batch size. On the right, batch normalization is shown for comparison, shading one unit's column vertically. The box at the bottom shows the order of the layer normalization computation: from input x, compute the mean μ and variance σ², normalize to mean 0 and variance 1 with (x − μ) / σ, multiply by γ, add β, and pass the result to the next layer.

Description

Layer Normalization is a normalization method used in each layer of a neural network. Its defining feature is that it normalizes based on the feature dimension of each sample rather than on per-batch statistics. It adjusts each input vector using its mean and standard deviation, keeping the output distribution stable and thereby improving training efficiency. In particular, unlike Batch Normalization, Layer Normalization does not depend on the mini-batch size and can operate stably under a wide range of conditions. Concretely, it computes the mean and variance from each sample's features and then scales and shifts the result using learnable parameters (gamma and beta). This makes training in deep networks more efficient and speeds up convergence, which contributes to better model performance.

Use cases

Layer Normalization is used especially in the following situations. First, it is applied to the hidden states of recurrent neural networks (RNNs), where it is effective for data with temporal dependencies. It is also used in Transformer models, in each layer's self-attention mechanism and feed-forward network, enabling stable training. In reinforcement learning, it normalizes features of states and actions, helping learning algorithms converge faster. Finally, in generative models, particularly VAEs (variational autoencoders) and GANs (generative adversarial networks), it helps reduce the complexity of the data and supports generating diverse outputs. Layer Normalization is a technique that suppresses fluctuations in internal representations during training and enables more efficient model training.

FAQ

Q. What does Layer Normalization do?
A.

It normalizes each sample using the mean and variance of its features, stabilizing the scale of the output. This makes training easier.

Q. How does it differ from Batch Normalization?
A.

Batch Normalization uses statistics computed over the whole batch, whereas Layer Normalization normalizes over the internal features of each sample. As a result, it does not depend on the batch size.

Q. Where is it used?
A.

It is used in RNNs, Transformers, generative models, reinforcement learning, and more, and plays an important role especially in stabilizing training.