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.
Articles by others on the same topic
There are currently no matching articles.