Layer normalization is invariant under a common input shift

ID: layer-normalization-is-invariant-under-a-common-input-shift

Adding the same scalar to every coordinate leaves layer normalization unchanged, provided its layer-normalization gain and layer-normalization bias are held fixed. This is an exact statement even with positive layer-normalization epsilon. Write , let be the coordinate arithmetic mean, and define the coordinate variance . For any scalar , we have
Consequently , so both the numerator and denominator of layer normalization are unchanged. Applying the same coordinatewise layer-normalization gain and layer-normalization bias preserves the equality:
The positive layer-normalization epsilon is added to the coordinate variance before taking the square root.[ref]
The centering matrix makes the geometry explicit: and . Thus the common-offset direction lies in the kernel of a linear map represented by . For the normalized core , take and . Its coordinate arithmetic mean is 2 and its coordinate variance is , giving . The vector has exactly the same normalized core. An unequal coordinate shift need not be removed: instead gives .
This identifies a precise redundancy in a neural network. If the vector before layer normalization is an affine map , adding to its bias leaves the normalized result unchanged for every . A shift of the raw input by a vector produces , which need not be a common coordinate shift. The weight re-centering calculation in Layer Normalization by Jimmy Lei Ba and others uses the related transformation : its extra contribution is , which normalization removes separately for each input.[ref]

New to topics? Read the docs here!