Rounded Normalization Certificates #
This module connects TorchLean's mathematical normalization core to its rounded NF execution.
The proof is rank-generic: reductions such as a row mean or variance are certified separately and
then supplied as inputs here. The resulting theorem covers the numerical part shared by LayerNorm,
RMSNorm, BatchNorm, GroupNorm, and related affine normalizations.
The conditioning assumptions are explicit. If the exact stabilized variance is at least η > 0,
the square-root stage is controlled by 1 / sqrt η. Division is accepted only when the computed
square-root error is strictly smaller than sqrt η, so a rounded denominator cannot cross zero.
References:
- J. L. Ba, J. R. Kiros, G. E. Hinton, Layer Normalization (2016), https://arxiv.org/abs/1607.06450.
- B. Zhang, R. Sennrich, Root Mean Square Layer Normalization (2019), https://arxiv.org/abs/1910.07467.
- N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd ed. (2002), Chapters 2-3.
Stage-by-stage infinity-norm budget for an affine normalization.
Keeping the intermediate errors is useful for auditing a failed certificate: a caller can see whether the loss of margin came from centering, variance stabilization, square root, division, or the final affine map instead of receiving only one opaque final number.
Instances For
Compute the compositional error trace for Spec.normalizeCore on rounded runtime tensors.
Instances For
Rounded execution of the shared affine-normalization core approximates its real semantics.
The five input tensor hypotheses can themselves come from reductions or earlier graph nodes. The
epsilon scalar is treated like any other rounded constant. The exact stabilized variance must have
the pointwise lower bound η; the two strict margin checks are directly computable from
normalizeCoreErrorTrace.