Machine learning

layer normalizationLN

层归一化

Layer normalization standardizes a single input over specified feature dimensions and then applies learned scales and offsets. The statistics are computed independently for each input.

In a transformer, a token is represented by a vector of features. Layer normalization commonly computes the mean and variance across that vector, standardizes its values, and applies a separate learned gain and offset to each feature. The next token supplies its own statistics. Changing other inputs or the batch size therefore leaves this calculation for an individual token unchanged.

Both training and inference compute statistics from the current input, so inputs can be processed individually. The normalization axes determine which values contribute to each mean and variance. An image model may normalize a different set of axes, and transformer designs can place the operation at different points relative to attention and the residual connection.

Sources
  1. Ba JL, Kiros JR, Hinton GE. Layer Normalization. 2016. arxiv.org/abs/1607.06450

Key works · 1

Key2016arXiv14,938 citations

Layer Normalization

Jimmy Lei Ba, Jamie Ryan Kiros, Geoffrey E. Hinton

Layer normalization computes the mean and variance across a layer's units for one training example, making the operation independent of other examples in the batch. The authors applied it to recurrent networks and reported more stable dynamics and faster convergence in several sequence experiments.

SignificanceNormalization within an example made the operation usable in sequence models without relying on batch-level estimates. The original Transformer uses layer normalization after the residual addition in each sublayer, establishing a common use in later attention-based networks.