Layer-normalization bias 2026-11-05
The layer-normalization bias is the learned coordinatewise offset applied after the normalized core and layer-normalization gain. Writing the core as ,
The offset is a model parameter, rather than an estimate of statistical bias. The PyTorch implementation provides an optional learned additive parameter for each normalized element.[ref]
An original constant-input example isolates its effect. Choose and any positive layer-normalization epsilon. The core is zero, so for the output is exactly , regardless of the fixed gain. Its coordinate arithmetic mean is : the output of the full learned layer need not have zero mean even though its normalized core does.
For a scalar loss with incoming output gradient , the chain rule gives . For the original loss in this example, the bias gradient is therefore . If the same parameter vector is reused at several positions, their gradient contributions add.
An equal shift of every coordinate before normalization is removed, as shown in layer normalization is invariant under a common input shift. The offset here is applied after normalization and persists. When differentiating only with respect to while parameters are fixed, contributes zero to the layer-normalization Jacobian.
The positive constant in layer normalization regularizes division by the coordinate standard deviation. For coordinates, write , and . The normalized core and the full output are
Here is the Hadamard product, and are fixed when studying the dependence on . This placement of , the divisor in the coordinate variance, and the elementwise layer-normalization gain and layer-normalization bias define the stabilized convention used here.[ref] If all coordinates of are equal, then and : positive makes the normalized core well defined and equal to 0, so the full output is .
Positive also changes the normalization away from constant inputs. The arithmetic mean of the normalized core is 0, but its normalized coordinate variance in layer normalization is
Thus it approaches 1 when is large, equals when , and approaches 0 when approaches 0. This formula describes the normalized core; learned, unequal coordinate gains or biases can change the coordinate arithmetic mean and variance of the full output. For , changing from to changes the core from to .
Although layer normalization is invariant under a common input shift, a fixed positive prevents exact positive scaling invariance on a nonconstant input. For ,
For and fixed , this equals only when . With , the normalized core is exactly invariant for every wherever . The unstabilized scaling argument in Layer Normalization by Jimmy Lei Ba and others therefore needs this qualification when used for the stabilized formula.[ref]
The same constant controls layer-normalization sensitivity. With the centering matrix , we have , and . Taking a derivative gives the layer-normalization Jacobian:
The common-offset vector is an eigenvector with eigenvalue . For , the radial direction has eigenvalue ; a vector orthogonal to both and has eigenvalue . At a constant input, the Jacobian matrix is . These formulas give the operator norm bound for the Euclidean norm. Integrating this derivative along a line segment proves Lipschitz continuity of the normalized core with constant . The bound for the full output is multiplied by , the operator norm of the diagonal matrix of its layer-normalization gain. For , the core bound is attained in centered directions at a constant input: smaller permits larger local amplification near zero coordinate variance.
For the input family , the third coordinate of the normalized core is , with derivative . The dashed lines mark ; the forward response approaches these values for large positive or negative .
Figure 1.
Original layer-normalization response and sensitivity for ; unit gains and zero biases.
Details.
Layer-normalization gain 2026-11-05
The layer-normalization gain is the learned coordinatewise multiplier applied to the normalized core. With layer-normalization bias , the output is , where is the Hadamard product. The multiplier can differ between coordinates and need not be positive.[ref] It permits the model to rescale the features after normalization.
For an original example, choose and layer-normalization epsilon . The coordinate mean is zero, the coordinate variance is , and the normalized core is . Taking and zero bias gives
The output coordinate arithmetic mean is and its coordinate variance is . Thus the core's centering and variance properties do not automatically survive unequal gains. A negative gain also reverses the sign of its coordinate in this example.
If is the incoming loss gradient, then . For above, the gain gradient is . This concerns a derivative with respect to the learned parameter; the layer-normalization Jacobian instead differentiates with respect to the input with parameters fixed.
Setting one to zero makes that output coordinate equal to its bias, but does not remove input coordinate from the shared normalization statistics. It can still influence other output coordinates through those statistics. The input derivative is obtained by multiplying the core Jacobian on the left by the diagonal matrix of gains. Layer-normalization epsilon contains the general derivative and bound.
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]
The normalized coordinate variance in layer normalization is the variance across coordinates of the normalized core, with divisor equal to the number of coordinates. This is not a variance across training cases. If the input's centered coordinate variance is and layer-normalization epsilon is , the core has zero coordinate mean and variance
The calculation is given in layer-normalization epsilon. The divisor convention agrees with the implementation's correction-zero variance.[ref]
An original inverse calculation asks how large must be to attain a desired core variance . Solving the displayed relation gives
For chosen and target , we need . The two-coordinate input has that variance and normalized core , whose variance is exactly . Reaching instead requires . With fixed positive epsilon, exact unit core variance is never attained at finite .
The restriction applies to the core, before the learned affine transformation. For the first example, uniform layer-normalization gain and zero layer-normalization bias produce coordinate variance . Unequal gains or biases can change both the mean and variance. A test that assumes the full output must always have unit variance would therefore reject valid layer-normalization computations.