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]
LayerNorm in the PyTorch documentation. 2.15, equation and Variables/bias; Parameters/bias and elementwise_affine
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.
Layer-normalization epsilon 2026-11-05
The positive constant in layer normalization regularizes division by the coordinate standard deviation. For coordinates, write , and . The normalized core and the full output areHere 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]
LayerNorm in the PyTorch documentation. Equation; correction=0; Parameters/eps and elementwise_affine
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 isThus 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]
Layer Normalization by Jimmy Lei Ba and others. §3, equation 3, and §5.1, equations 6–7: normalization statistics and scaling analysis
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 .
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]
LayerNorm in the PyTorch documentation. 2.15, equation; Variables/weight and Parameters/elementwise_affine
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 givesThe 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.
Layer-normalization Jacobian 2026-11-05
The layer-normalization Jacobian describes the first-order response of the normalized core to a change in its input. Let be the core defined in layer-normalization epsilon, with . Its Jacobian matrix satisfiesThe closed formula and its derivation are given in layer-normalization epsilon. A matrix entry measures the local effect of changing input coordinate on normalized output coordinate .
An original two-coordinate calculation takes and . Here the centered variance is and the normalized core is . Substitution into the established derivative formula givesConsequentlyThe common-offset direction has no effect; the centered contrast direction changes the output. This is a local linear response, rather than an exact rule for arbitrary finite changes.
For the complete output with fixed layer-normalization gain and layer-normalization bias, the input Jacobian is . In the example, givesThe first output is suppressed, yet the first input still affects the second output. This distinguishes an output gain from removing an input feature. Parameter derivatives with respect to and are separate derivatives. Layer-normalization sensitivity measures the input Jacobian's amplification through an operator norm.
Layer-normalization sensitivity 2026-11-05
Layer-normalization sensitivity measures how strongly changes in an input can alter its normalized output. For the core and the Euclidean norm, its local first-order amplification is the operator norm . The derivation in layer-normalization epsilon gives the uniform boundIntegrating the derivative bound yields the corresponding global Lipschitz continuity bound. For at least two coordinates, the constant is attained locally in centered directions at constant inputs; it is a worst-case bound, not the amplification at every input.
An original finite perturbation check starts at and adds . The core at is zero. With , the norm ratio isclose to the derivative bound . Keeping the same perturbation but taking gives approximately , with bound . This probes the near-constant-input regime, where the coordinate variance is small compared with epsilon.
For fixed learned gains, the full output has bound ; a fixed layer-normalization bias does not change input differences. The layer-normalization gain can therefore amplify or suppress the core response. These are properties of this layer in a specified norm. They do not by themselves bound a complete network, whose other operations and composition also matter. The explicit matrix example in layer-normalization Jacobian illustrates why actual amplification can be smaller than the uniform bound.
