betaFeedback

WorksComputer Science

Stochastic Rounding in Low-Precision Transformer Inference: A Variable-Precision Emulation Study of a Small GPT-2

Abstract

Should low-precision transformer inference use stochastic rounding (SR) or round-to-nearest (RN)? The answer depends on where in the network you look. We isolate this effect by holding the numerical format fixed and varying only the rounding rule at individual operation sites. To enable experiments at freely chosen precisions, we extend the PRISM vectorized rounding library to arbitrary virtual precision via a variable-precision stochastic rounding (VPSR) algorithm, proving that the rounding decision is evaluated exactly in hardware floating point. We develop two analyses providing complementary insight into this site-level trade-off. First, a probabilistic forward-error bound for linear projections shows that SR's error envelope grows as O(nu)O(\sqrt{n} u) in reduction length nn, versus O(nu)O(n u) for RN, a gap that widens rapidly at low precision and is most pronounced in the long multilayer perceptron (MLP) down-projection. Second, a second-order decomposition of expected cross-entropy loss change at the output softmax into signed drift, drift curvature, and a Fisher-weighted variance penalty reveals why the two sites behave oppositely: MLP noise is predominantly a uniform logit shift to which softmax is invariant, so SR's variance is largely discounted; head noise is non-uniform across the vocabulary and is not. On DistilGPT-2 at t=6t=6 significand bits, observations match theory: SR in the MLP raises perplexity to 1.15x the full-precision reference, versus 2.21x for RN. At the language-model head, the ordering reverses because SR introduces non-uniform variance, whereas deterministic RN carries none. In a mixed-precision configuration (MLP output at t=6t=6), assigning SR to the MLP and RN to the head brings perplexity within 1.10x of the full-precision reference, a 28% reduction over matched-bit RN.

Editor:

Introduction

Transformer inference increasingly uses formats narrower than the binary64 arithmetic for which much of classical numerical analysis was developed. The dominant response is quantization: choose a target format, map weights and activations onto it, and recover accuracy through calibration, outlier handling, or per-channel scaling ([15, 46, 35, 21]). In that program, the rounding operator is usually fixed by the underlying hardware format. In post-training quantization, offline weight-rounding methods such as AdaRound (Nagel et al., [39]) optimize the rounding

©2026 Yohan Chatelain and Pablo de Oliveira Castro.

License: CC-BY 4.0, see https://creativecommons.org/licenses/by/4.0/. Attribution requirements are provided at http://jmlr.org/papers/v1/1.html. direction of static weights via a local second-order task loss surrogate. However, the rounding rule used for intermediate calculations during inference has received less attention. In contrast, dynamic rounding is already becoming explicit in low-precision training: NVIDIA’s microscaled NVFP4 recipe, for example, selectively uses stochastic rounding for gradient casts to reduce quantization bias ([1]). Whether this same selectivity is useful during inference remains an open question.

This paper isolates that question by holding the numerical format fixed and varying only the rounding rule. Round-to-nearest ([38]) (RN) returns the closer representable neighbor, whereas stochastic rounding ([20, 11]) (SR), proposed by Forsythe for controlling accumulated roundoff and pioneered in deep learning by Gupta et al. [27] to prevent gradient stagnation in low-precision training, selects either neighbor with probability proportional to proximity, making each rounding error zero in expectation. RN errors, by contrast, are deterministic functions of their operands and may align; sufficiently small addends can be absorbed by a large accumulator or repeated operations can drift away from the exact result. SR therefore trades systematic local drift for higher variance.

Whether stochastic rounding improves inference accuracy depends first on the operation. A long reduction is more exposed to accumulated RN drift than a short one. In a GPT-2-style block ([42]), the multilayer perceptron (MLP) down-projection reduces over dff=3072d_{\mathrm{ff}} = 3072 terms, while an attention-head score reduces over dhead=64d_{\mathrm{head}} = 64. At the same accumulator precision, these operations can therefore have very different exposure to accumulated roundoff.

The outcome also depends on the operation’s location, both because local input distributions affect how errors initially accumulate, and because downstream layers transform the resulting perturbations. A perturbation in an attention score passes through the softmax before changing the weighted value sum, whereas a perturbation from the MLP down-projection enters the residual stream and is transformed by later blocks. The same change of rounding rule can therefore reduce perplexity at one site and increase it at another. This leads to the research question of this paper: when and where does stochastic rounding improve transformer inference accuracy over round-to-nearest at low fixed precision?

We study this question in the GPT-2 architecture, using DistilGPT-2 as a six-block instance, and compare the two rounding rules site by site. Hardware SR is tied to particular formats, operations, and accelerators, so experiments at freely selected precisions require software emulation at every instrumented operation, and the arithmetic intensity of transformer inference requires that emulator to be fast and to vary precision and rounding rule at run time. The contributions of this paper are as follows:

  • We present the variable-precision stochastic rounding (VPSR) algorithm (§ 3), prove its correctness, and implement it in PRISM ([8]), where it runs up to 70× faster than Verificarlo’s Monte Carlo Arithmetic (MCA) random rounding (§ 4.3).

  • We analyze SR in transformer layers (§ 5): we establish a vector Bienaymé–Chebyshev bound that extends prior scalar probabilistic forward-error analysis to the full matrix multiplication of the MLP projection. We also analyze softmax error propagation by deriving an exact decomposition of the cross-entropy loss change into signed target

shift (DD) and Kullback–Leibler (KL) distortion, and perform a second-order Taylor expansion of the KL term into drift curvature (QQ) and variance penalty (VV) terms, characterizing the site-level trade-offs between SR and RN.

  • We evaluate on DistilGPT-2 and WikiText-2 (§ 6) by lowering tt site by site. SR is better in the MLP and RN at the language-model head, and the MLP gap widens as more down-projections are affected. At t=6t = 6 in the MLP, SR holds perplexity degradation to 15% over the full-precision reference against 121% for RN, and comes within 0.3% of the reference by t=8t = 8.

Disclaimer on AI usage. AI tools (specifically Anthropic Claude, Google Gemini, and OpenAI Codex) were used during the preparation of this manuscript to assist with prose drafting, editing, and checking the mathematical proofs. All derivations, empirical evaluations, and final text were independently verified by the authors, who take full responsibility for the contents of this work.

Background and related work

Stochastic rounding

Let a binary floating-point format have pp significand bits, including the implicit leading bit. We write u=21−pu = 2^{1-p} for its maximum relative ULP scale. Thus u=2−23u = 2^{-23} for binary32 (p=24p = 24) and u=2−52u = 2^{-52} for binary64 (p=53p = 53). This uu is the spacing at 1 and is twice the conventional RN unit roundoff. For a real xx that is not representable on pp bits, let ⌊x⌋\lfloor x\rfloor be the largest representable number below xx and ⌈x⌉\lceil x\rceil the smallest above it, so that ⌊x⌋<x<⌈x⌉\lfloor x\rfloor< x < \lceil x\rceil. Write ulp⁡(x)=⌈x⌉−⌊x⌋\operatorname{ulp}(x) = \lceil x\rceil- \lfloor x\rfloor for the spacing of the floating-point grid in the binade containing xx, which satisfies ([38])

u2∣x∣<ulp⁡(x)≤u∣x∣.(1)\frac{u}{2}|x| < \operatorname{ulp}(x) \le u|x|. \tag*{(1)}

Round-to-nearest returns whichever of ⌊x⌋\lfloor x\rfloor, ⌈x⌉\lceil x\rceil is closer, resolving ties by a fixed rule ([32]). For non-representable xx, stochastic rounding returns:

SR⁡(x)={⌈x⌉,with probability px=x−⌊x⌋⌈x⌉−⌊x⌋,⌊x⌋,with probability 1−px,\operatorname{SR}(x) = \begin{cases} \lceil x\rceil, & \text{with probability } p_x = \dfrac{x-\lfloor x\rfloor}{\lceil x\rceil-\lfloor x\rfloor},\\ \lfloor x\rfloor, & \text{with probability } 1-p_x, \end{cases}

so that E[SR⁡(x)]=x\mathbb{E}[\operatorname{SR}(x)] = x. SR commits an error of magnitude at most ulp⁡(x)\operatorname{ulp}(x); RN commits at most 12ulp⁡(x)\frac{1}{2}\operatorname{ulp}(x). Consequently, for normal results, RN has relative error at most u/2u/2 and SR at most uu. RN therefore has the smaller worst-case error per operation, while SR is unbiased on average.

Deterministic worst-case analysis of a length-nn dot product under RN yields an error bound proportional to nunu, and the bound is attained when the individual errors align ([29]). The mathematical properties of stochastic rounding are well established ([11]). Under SR the errors form a martingale difference sequence, and probabilistic backward error analysis replaces the nunu factor by one of order nu\sqrt{nu} ([30, 10]). While this extends to other multilinear kernels (e.g., polynomial evaluation and sum-product trees [12], these bounds do not apply across nonlinear operations. Under RN, an addend small enough relative to the accumulator is absorbed entirely, so a sum of many small equal terms stalls at a value set by uu rather than by the terms [29]. While stochastic rounding is sometimes criticized for the hardware overhead of pseudorandom number generation, hardware implementations based on linear-feedback shift registers make SR highly efficient in time, energy, and area [4].

Emulating stochastic rounding in software

The standard construction uses error-free transforms (EFTs). For an elementary operation x=a∘bx = a \circ b, an EFT computes a pair (σ,τ)(\sigma,\tau) of representable numbers with σ=fl⁡(a∘b)\sigma= \operatorname{fl}(a \circ b), where fl⁡(⋅)\operatorname{fl}(\cdot) denotes floating-point rounding to nearest, and σ+τ=x\sigma+ \tau= x exactly, recovering the rounding residual. TwoSum [13] does this for addition in six operations, and TwoProdFMA [25] does it for multiplication in two when a fused multiply-add is available. Given (σ,τ)(\sigma,\tau), SR reduces to comparing τ\tau against a uniform threshold drawn on [0,ulp⁡(σ))[0,\operatorname{ulp}(\sigma)).

Verrou [19] implemented this scheme, and Fasi and Mikaitis subsequently formalized and analyzed it, giving pseudocode and correctness arguments for all five elementary operations [18]. A second mechanism is to use extended precision for the intermediate result and then to round back to the working precision. This is implemented in Monte Carlo Arithmetic [41] with the random rounding (MCA RR) mode, available as a backend of Verificarlo [14]. Contrary to the EFT route, MCA RR leaves the virtual precision tt free to be chosen by the user, at the cost of evaluating each operation in higher precision.

In deep learning, simulation frameworks such as QPyTorch [48] support stochastic rounding across tensors, but evaluate composite operations (such as matrix multiplications) using an uninstrumented high-precision accumulator (binary32). Capturing error accumulation or stagnation occurring along intermediate reduction chains requires instruction-level emulation instead.

By contrast, compiler tools like Verificarlo [14] transparently intercept elementary floating-point operations, allowing PRISM [8] to vectorize EFT rounding at the instruction level. However, standard EFT methods round strictly at hardware precision (t=pt = p); § 3 resolves this limitation with the VPSR algorithm, decoupling virtual precision from the hardware format without extended-precision overhead.

While hardware support exists, it is currently restricted to a few architectures and formats/instructions. SR is not an IEEE-754 rounding attribute [32], and commodity CPUs do not expose it. Graphcore IPUs couple random generation to supported floating-point arithmetic [26]; AWS NeuronCore-v2 exposes an SR/RNE mode for FP32-to-BF16 autocasting [2]; and NVIDIA PTX provides cvt.rs conversions with caller-supplied random bits on supported Blackwell targets [40]. These mechanisms are tied to particular formats, operations, and accelerators. Software emulation is therefore a practical way to study SR on CPUs at a freely selected precision, including precisions that have no hardware format.

Low-precision transformer inference

The quantization literature attacks a different part of the problem. LLM.int8() (Dettmers et al., [15]) is an 8-bit integer quantization scheme for transformer inference; it isolates the activation outliers that dominate quantization error in large transformers into a higher-precision path. SmoothQuant migrates activation difficulty into the weights through a per-channel rescaling so that both become quantizable (Xiao et al., [46]). AWQ selects salient weight channels by activation statistics and protects them (Lin et al., [35]). An empirical study by Gong et al. [21] frames all of these as perturbation control and asks which perturbations matter.

All of these hold the rounding rule fixed and design the mapping of values onto the grid. We do the opposite: the mapping is fixed and the rule is the variable. The two address different error sources and can be applied together, and the mechanism studied here, the interaction of rounding choice with network propagation and downstream loss, is invisible to a formulation in which rounding is a black box.

Stochastic rounding in the forward pass. The prevailing consensus confines SR to backward-pass gradient quantization and rejects it for the forward pass. Chmiel et al. [9] give an explicit mathematical argument: because activation functions are nonlinear, the unbiasedness SR provides at the tensor level (E[SR⁡(x)]=x\mathbb{E}[\operatorname{SR}(x)] = x) does not survive composition with a nonlinear ff, so that E[f(SR⁡(x))]≠f(x)\mathbb{E}[f(\operatorname{SR}(x))] \ne f(x). They conclude that SR provides no benefit in the forward pass and that RN, which minimises mean-squared error, should be preferred. NVIDIA’s NVFP4 pretraining recipe (Abecassis et al., [1]) follows the same split, mandating SR only for gradient casts and using RN in the forward path. In the forward pass, standard quantization recipes typically address representation error by managing activation outliers, for example, using random Hadamard transforms ([3, 1]). However, outlier mitigation leaves the arithmetic reduction operator unaddressed: in long inner products, deterministic RN errors still accumulate systematically into directional drift.

Our analysis in § 5 shows that this categorical rejection of SR in the forward pass is too coarse: the performance of SR versus RN differs across parts of the network. In MLP projections, the long linear reduction allows deterministic RN errors to accumulate into non-uniform drift, whereas SR limits this accumulation and propagates predominantly as a uniform shift that the output softmax ignores (§ 5.2). Conversely, at the output of the network (the language-model head), SR introduces non-uniform fluctuations directly across classes, which cross-entropy loss penalizes, shifting the advantage to RN. A site-selective application of SR—using it at MLP projections while retaining RN at pre-softmax sites—exploits these site-dependent dynamics to control reduction drift directly at the arithmetic level.

The architecture under study

We use the sequential pre-LayerNorm GPT-2 block ([42, 44]). Each layer first applies its attention residual and then feeds the resulting stream to a separately normalized MLP residual:

aℓ=xℓ+Attn⁡ℓ(LN⁡1,ℓ(xℓ)),xℓ+1=aℓ+MLP⁡ℓ(LN⁡2,ℓ(aℓ)),a_{\ell} = x_{\ell} + \operatorname{Attn}_{\ell}(\operatorname{LN}_{1,\ell}(x_{\ell})), \qquad x_{\ell+1} = a_{\ell} + \operatorname{MLP}_{\ell}(\operatorname{LN}_{2,\ell}(a_{\ell})),

where xℓ,aℓ∈RT×dmodelx_{\ell}, a_{\ell} \in\mathbb{R}^{T \times d_{\mathrm{model}}} are residual streams at layer ℓ\ell for a sequence of TT tokens, LN1,ℓ\mathrm{LN}_{1,\ell} and LN2,ℓ\mathrm{LN}_{2,\ell} are separate layer normalizations, Attnℓ\mathrm{Attn}_{\ell} is multi-head self-attention, and MLPℓ\mathrm{MLP}_{\ell} is the position-wise feedforward network. The normalization sits inside the residual branch rather than after it (Xiong et al., [47]), so the stream xℓx_{\ell} is never renormalized and a perturbation introduced at layer ℓ\ell propagates additively to the output.

The MLP is a pair of affine maps around a GELU nonlinearity ϕ\phi (Hendrycks and Gimpel, [28]),

z=a~W1+b1,h=ϕ(z),y=hW2+b2,(2)z = \tilde{a}W_{1} + b_{1}, \qquad h = \phi(z), \qquad y = hW_{2} + b_{2}, \tag*{(2)}

with W1∈Rdmodel×dffW_{1} \in\mathbb{R}^{d_{\mathrm{model}} \times d_{\mathrm{ff}}} and W2∈Rdff×dmodelW_{2} \in\mathbb{R}^{d_{\mathrm{ff}} \times d_{\mathrm{model}}}. Attention first forms queries, keys and values by a single projection of the normalized stream, [Q∣K∣V]=x~W~qkv+bqkv[Q \mid K \mid V] = \tilde{x}\widetilde{W}_{\mathrm{qkv}} + b_{\mathrm{qkv}} (the attn_c_attn matrix multiplication), splits the result across HH heads, and for each head computes

S=QKTdhead,A=softmax⁡(S),O=AV,S = \frac{QK^{\mathsf{T}}}{\sqrt{d_{\mathrm{head}}}}, \qquad A = \operatorname{softmax}(S), \qquad O = AV,

where the softmax is taken row-wise under a causal mask. The per-head outputs are concatenated and projected back to the stream by WoW_{\mathrm{o}} (the attn_c_proj matrix multiplication). After the last block, a final linear map Whead∈Rdmodel×VW_{\mathrm{head}} \in\mathbb{R}^{d_{\mathrm{model}} \times V} produces logits over a vocabulary of VV tokens, which are scored by cross-entropy against the next token.

The dimensions matter for what follows, because they set reduction lengths. The lower panel of Figure 1 places the reductions of one block on the dataflow. Three of the four matrix multiplications reduce over dmodeld_{\mathrm{model}} (attn_c_attn, attn_c_proj, mlp_c_fc) and the fourth over dffd_{\mathrm{ff}} (mlp_c_proj), while inside attention the score product reduces over dheadd_{\mathrm{head}} and the value product over the sequence length. The specific dimensions of the evaluated model are detailed in § 6.

Complete DistilGPT-2 architecture and evaluation path

Figure 1. Complete DistilGPT-2 architecture and evaluation path. Token and position embeddings form x0x_0, which passes sequentially through six pre-LayerNorm GPT-2 blocks. The lower panel expands the repeated block into its attention and MLP sublayers. Yellow nodes identify the groups instrumented by the rounding experiments.

Figure 1 places the block-level dataflow inside the complete DistilGPT-2 evaluation path, from token and position embeddings through the six-block stack to the final normalization, language-model head, cross-entropy, and perplexity.

Variable-precision stochastic rounding (VPSR)

This section presents the variable-precision stochastic rounding (VPSR) algorithm, which decouples the rounding decision from the hardware format by decomposing each exact arithmetic result onto a coarser virtual grid. We prove that the rounding decision is evaluated exactly in hardware floating point, with no extended-precision overhead.

At hardware precision, the EFT of § 2.2 recovers the exact result x=σ+τx = \sigma+ \tau with σ=fl⁡(x)\sigma= \operatorname{fl}(x), and the stochastic rounding algorithm formalized by Fasi and Mikaitis [18] compares the hardware residual τ\tau against a uniform threshold on [0,ulp⁡hw(σ))[0, \operatorname{ulp}_{\mathrm{hw}}(\sigma)).

Variable-precision stochastic rounding (VPSR) extends this algorithmic framework to a coarser virtual grid at a precision t≤pt \le p instead, where pp is the hardware precision. Truncating the head to that grid, σ~=trunc⁡t(σ)\tilde{\sigma} = \operatorname{trunc}_{t}(\sigma), splits the distance from xx down to the virtual grid point into a virtual truncation error ρ=σ−σ~\rho= \sigma- \tilde{\sigma} and the hardware residual τ\tau (Figure 2),

Geometric intuition for variable-precision stochastic rounding

Figure 2. Geometric intuition for variable-precision stochastic rounding (VPSR). An exact value xx lies between virtual grid points at precision tt. The hardware rounding σ\sigma is truncated to σ~\tilde{\sigma}, leaving a virtual truncation error ρ\rho and hardware residual τ\tau. A threshold π\pi is sampled on [0,ulpt)[0,\mathrm{ulp}_t) to determine the virtual rounding direction.

x=σ~+ρ+τ.x = \tilde{\sigma} + \rho+ \tau.

To perform ideal stochastic rounding, Algorithm 1 draws a continuous threshold π∼U[0,ulpt)\pi\sim\mathcal{U}[0,\mathrm{ulp}_t) and rounds away from σ~\tilde{\sigma} when the signed threshold does not exceed the signed distance ρ+τ\rho+\tau. Fixing π=12ulpt\pi=\frac{1}{2}\mathrm{ulp}_t instead gives untied round-to-nearest at precision tt.

Algorithm 1 Variable-precision stochastic rounding

Require: Exact inputs σ\sigma, τ\tau, virtual precision tt

Ensure: Rounded value rr at virtual precision tt

1: σ~←trunc⁡t(σ)\tilde{\sigma} \leftarrow\operatorname{trunc}_{t}(\sigma) ▷ Truncated value at precision tt

2: ρ←σ−σ~\rho\leftarrow\sigma-\tilde{\sigma} ▷ Exact virtual truncation error

3: if ρ=0\rho=0 and τ=0\tau=0 then return σ~\tilde{\sigma} ▷ Flattened to a mask in SIMD

4: sdir←{−1if (ρ=0 and τ<0) or ρ<01otherwises_{\mathrm{dir}} \leftarrow\begin{cases} -1 & \text{if }(\rho=0\text{ and }\tau<0)\text{ or }\rho<0 \\ 1 & \text{otherwise} \end{cases} ▷ Determine rounding direction sign

▷ The choice of η\eta ensures ulp⁡t\operatorname{ulp}_{t} will be the ULP of the exact value xx at precision tt, i.e.,

ulp⁡t(x)\operatorname{ulp}_{t}(x)

5: η←{exponent⁡(predecessor_abs⁡(σ~))if (sdir<0)≠(σ~<0)exponent⁡(σ~)otherwise\eta\leftarrow\begin{cases} \operatorname{exponent}(\operatorname{predecessor\_abs}(\tilde{\sigma})) & \text{if }(s_{\mathrm{dir}}<0)\ne(\tilde{\sigma}<0) \\ \operatorname{exponent}(\tilde{\sigma}) & \text{otherwise} \end{cases}

6: ulp⁡t←sdir⋅2η−(t−1)\operatorname{ulp}_{t}\leftarrow s_{\mathrm{dir}}\cdot2^{\eta-(t-1)} ▷ Compute signed ULP at virtual precision tt using exponent η\eta

7: S←{264if η−(t−1)≤emin⁡1otherwiseS\leftarrow\begin{cases} 2^{64} & \text{if }\eta-(t-1)\le e_{\min} \\ 1 & \text{otherwise} \end{cases} ▷ Scale subnormals to normal range

8: ρS←ρ⋅S,τS←τ⋅S,ulp⁡t,S←ulp⁡t⋅S\rho_{S}\leftarrow\rho\cdot S,\quad\tau_{S}\leftarrow\tau\cdot S,\quad\operatorname{ulp}_{t,S}\leftarrow\operatorname{ulp}_{t}\cdot S

9: Sample zz uniformly from {k2−r:0≤k<2r}\{k2^{-r}:0\le k<2^{r}\}

10: π←ulp⁡t,S⋅z\pi\leftarrow\operatorname{ulp}_{t,S}\cdot z ▷ Random threshold

11: D←(ρS−π)+τSD\leftarrow(\rho_{S}-\pi)+\tau_{S} ▷ Decision boundary term

12: Δ←{ulp⁡tif D⋅sdir≥00otherwise\Delta\leftarrow\begin{cases} \operatorname{ulp}_{t} & \text{if }D\cdot s_{\mathrm{dir}}\ge0 \\ 0 & \text{otherwise} \end{cases}

13: return σ~+Δ\tilde{\sigma}+\Delta

Because hardware generators provide discrete bits rather than continuous draws, PRISM approximates the uniform distribution using rr random bits (r=24r=24 for binary32 and r=53r=53 for binary64). Let SR⁡t,r\operatorname{SR}_{t,r} denote this finite-bit implementation. This discretization introduces a negligible bias bounded by the number of random bits rr:

∣E[SR⁡t,r(x)]−x∣≤2−r∣ulp⁡t(x)∣.\left|\mathbb{E}[\operatorname{SR}_{t,r}(x)]-x\right|\le2^{-r}\left|\operatorname{ulp}_{t}(x)\right|.

Three steps that are trivial at hardware precision require care at virtual precision:

  1. Two-term decision. The relevant distance from xx to the virtual grid point is ρ+τ\rho+\tau, not τ\tau alone. These terms can differ by the full hardware precision, making the sign of their floating-point sum fragile. § 3.1 proves that evaluating (ρ−π)+τ(\rho-\pi)+\tau in hardware arithmetic nevertheless preserves the exact sign, requiring no compensated arithmetic.

  1. Power-of-two boundaries. When the rounding direction carries xx across a binade boundary, line 5 of Algorithm 1 selects the predecessor exponent so that ulp⁡t\operatorname{ulp}_{t} reflects the grid spacing at xx rather than at σ~\tilde{\sigma}.

  1. Subnormal virtual grid. When ulp⁡t\operatorname{ulp}_{t} is subnormal, the threshold product ulp⁡t⋅z\operatorname{ulp}_{t}\cdot z loses precision. Lines 7–8 scale all quantities by S=264S=2^{64} (exact as a power of two) and compare in the normal range; the decision is invariant under common positive scaling.

Exactness of the rounding decision

We assume IEEE 754 floating-point arithmetic with round-to-nearest. Let fl⁡(x+y)\operatorname{fl}(x+y) and fl⁡(x−y)\operatorname{fl}(x-y) denote floating-point addition and subtraction, respectively.

We define the rounding direction sign sdirs_{\mathrm{dir}} (equivalently to line 4 of Algorithm 1, noting that the ρ=0,τ=0\rho=0,\tau=0 case is handled on line 3):

sdir={1if ρ>0 or (ρ=0 and τ>0)−1if ρ<0 or (ρ=0 and τ<0)s_{\mathrm{dir}} = \begin{cases} 1 & \text{if } \rho>0 \text{ or } (\rho=0 \text{ and } \tau>0) \\ -1 & \text{if } \rho<0 \text{ or } (\rho=0 \text{ and } \tau<0) \end{cases}

Throughout the theorem and its proof, ulp⁡hw\operatorname{ulp}_{\mathrm{hw}} abbreviates ulp⁡hw(x)\operatorname{ulp}_{\mathrm{hw}}(x), the hardware grid spacing at xx. This is an absolute spacing, not the relative ULP scale u=21−tu=2^{1-t} of Eq. (1).

Theorem 1 (Exact sign evaluation of the rounding decision). Let ρ\rho, π\pi, and τ\tau be floating-point numbers. If the following properties hold:

  1. ∣τ∣≤ulp⁡hw/2|\tau|\leq\operatorname{ulp}_{\mathrm{hw}}/2

  2. ρ=0\rho=0 or ∣ρ∣≥ulp⁡hw|\rho|\geq\operatorname{ulp}_{\mathrm{hw}}

  3. ρ\rho and π\pi share the same sign

Then the floating-point evaluation of the decision boundary preserves the sign:

(ρ−π+τ)⋅sdir≥0⟺fl⁡(fl⁡(ρ−π)+τ)⋅sdir≥0(\rho-\pi+\tau)\cdot s_{\mathrm{dir}}\geq0 \Longleftrightarrow\operatorname{fl}(\operatorname{fl}(\rho-\pi)+\tau)\cdot s_{\mathrm{dir}}\geq0

The three hypotheses hold in Algorithm 1: (1) is the standard RN bound ∣τ∣≤ulp⁡hw/2|\tau|\leq\operatorname{ulp}_{\mathrm{hw}}/2; (2) holds because truncation zeros trailing bits without changing the exponent, making ρ\rho an integer multiple of ulp⁡hw(σ)\operatorname{ulp}_{\mathrm{hw}}(\sigma); since IEEE 754 monotonicity gives ∣x∣≥2k⇒∣fl⁡(x)∣≥2k|x|\geq2^k\Rightarrow|\operatorname{fl}(x)|\geq2^k, the rounded value σ\sigma cannot cross a binade boundary toward zero, so ulp⁡hw(σ)≥ulp⁡hw\operatorname{ulp}_{\mathrm{hw}}(\sigma)\geq\operatorname{ulp}_{\mathrm{hw}}; (3) follows from ∣ρ∣≥ulp⁡hw≥2∣τ∣|\rho|\geq\operatorname{ulp}_{\mathrm{hw}}\geq2|\tau|, which prevents τ\tau from flipping the sign of ρ\rho, combined with the algorithm assigning π\pi the sign of sdirs_{\mathrm{dir}}. The subnormal scaling on lines 7–8 preserves all three by multiplying distances and spacing by a common exact power of two.

Proof sketch. We normalize the variables by the rounding direction sign sdir∈{−1,1}s_{\mathrm{dir}}\in\{-1,1\}, setting ρ′=ρ⋅sdir\rho'=\rho\cdot s_{\mathrm{dir}}, π′=π⋅sdir\pi'=\pi\cdot s_{\mathrm{dir}}, and τ′=τ⋅sdir\tau'=\tau\cdot s_{\mathrm{dir}}, so that the equivalence becomes

(ρ′−π′)+τ′≥0⟺fl⁡(fl⁡(ρ′−π′)+τ′)≥0.(\rho'-\pi')+\tau'\geq0 \Longleftrightarrow\operatorname{fl}(\operatorname{fl}(\rho'-\pi')+\tau')\geq0.

When ρ=0\rho=0, the first subtraction fl⁡(0−π′)=−π′\operatorname{fl}(0-\pi')=-\pi' is exact in IEEE 754 arithmetic. The decision then reduces to a single floating-point addition fl⁡(−π′+τ′)\operatorname{fl}(-\pi'+\tau'), whose sign matches the exact sign by monotonicity.

When ρ≠0\rho\ne0, monotonicity directly ensures the forward implication. For the backward implication, the only scenario where the signs could disagree is an artificial collapse to zero, fl⁡(fl⁡(ρ′−π′)+τ′)=0\operatorname{fl}(\operatorname{fl}(\rho'-\pi')+\tau')=0, while the exact sum is strictly negative, (ρ′−π′)+τ′<0(\rho'-\pi')+\tau'<0. Under the bounds from Hypotheses 1 and 2, such a collapse requires the intermediate difference fl⁡(ρ′−π′)\operatorname{fl}(\rho'-\pi') to equal −τ′-\tau', forcing ρ′/2≤π′≤2ρ′\rho'/2\leq\pi'\leq2\rho'. This condition satisfies the hypotheses of Sterbenz’s Lemma ([43]), which guarantees that the floating-point subtraction fl⁡(ρ′−π′)\operatorname{fl}(\rho'-\pi') is exact. Exact subtraction then yields (ρ′−π′)+τ′=0(\rho'-\pi')+\tau'=0, contradicting the assumption that the exact sum is strictly negative. Thus, no sign discrepancy can occur. The complete formal proof is deferred to Section A. ▪

PRISM: vectorized probabilistic rounding at variable precision

This section describes how Algorithm 1 is applied to every floating-point operation of a PyTorch model and what it costs. We implement VPSR in PRISM (Probabilistic Rounding with Instruction Set Management), an open-source C++17 library that previously applied vectorized SR only at hardware precision [22]. The Verificarlo compiler pass [14] replaces each floating-point instruction of the compiled framework with a call to a PRISM kernel, which computes the exact result as an EFT pair and rounds it at a virtual precision tt taken from a run-time configuration (Figure 3). In compiler-instrumented loops, PRISM SR costs 8.5–32.1×\times native time, 4.4–70.5×\times less than Verificarlo’s MCA random rounding (Section 4.3).

Execution of one instrumented operation

Figure 3. Execution of one instrumented operation. At compile time, the Verificarlo pass replaces a 512-bit binary32 multiplication with a call to the PRISM entry point for 16 lanes. At run time, the kernel rounds all lanes with Algorithm 1 at the precision set.

Instrumentation and kernels

The Verificarlo pass maps each scalar or vector floating-point instruction to a PRISM entry point for the same operation, format and lane count, so PyTorch’s source is unchanged. Each call rounds all its lanes in one kernel invocation. We use PRISM’s static build, which fixes the instruction set at compile time.

Each kernel computes the EFT pair (σ,τ)(\sigma,\tau) of § 2.2 and then applies Algorithm 1. SR and RN share the kernel: SR draws zz from rr random bits, and RN fixes z=1/2z = 1/2. Because the final comparison of Algorithm 1 is non-strict, an exact midpoint rounds away from σ~\tilde{\sigma}, and hence away from zero; giving untied RN. FMA is rounded as one operation, using the ErrFmaNearest transform [7] to represent ab+cab+c exactly.

The kernels are branch-free. Every data-dependent condition, in Algorithm 1 and in the EFTs, is computed as a lane mask and resolved by selection, so all lanes follow one instruction stream whatever their values, including infinities and NaNs. The kernels are written once against Google Highway (Google, 2024), a C++ SIMD abstraction, and compile to its x86, Arm, RISC-V and WebAssembly targets; where no hardware FMA exists, TwoProdFMA uses the emulated FMA of Graillat and Muller (2023).

Run-time configuration

The virtual precisions for binary32 and binary64, the rounding mode and the generator state are run-time settings, so changing them requires no recompilation. In our experiments, PyTorch module hooks change them before and after each target module (§ 6.1). Kernels read the settings from a per-thread cache. A process-wide setter publishes new settings and advances a configuration epoch, and each worker thread reloads its cache when it observes a new epoch on its next operation, so a change made from the Python thread reaches all of PyTorch’s worker threads.

Performance

Cost model. Emulation replaces one instruction with an EFT (two to six operations), about twenty-five vector operations for the rounding decision, and part of a random draw. The control flow is fixed, so this cost does not depend on the operands. The slowdown relative to native execution is therefore smaller when native execution is memory-bound and larger when a call covers few lanes.

Benchmark. We time elementwise addition, multiplication, division and FMA over arrays of 65,536 values in binary32 and binary64. Each loop is compiled with -O3 for 512-bit AVX-512 vectors in three builds: without instrumentation (the native baseline), with the PRISM SR pass, and with Verificarlo’s MCA QUAD backend in random-rounding (RR) mode (§ 2.2). We repeat the measurement 30 times on Intel Xeon Gold 6130 @ 2.1 GHz CPU (cache sizes: 32 KB L1, 1 MB L2, 22 MB L3 shared).

Results. PRISM SR incurs an overhead of ×8.5\times8.5–32.132.1, whereas MCA RR incurs ×88\times88–597597 (Table 1). Compared to MCA RR, PRISM SR is up to ×4.7\times4.7 faster than for binary32 operations and up to ×70.5\times70.5 faster for binary64. The gap comes from how each backend obtains the exact result it rounds. MCA RR computes the result in a wider format and adds its random perturbation there: in binary64 for binary32 operations, which the hardware supports, and in binary128 for binary64 operations, which most CPUs emulate in software. PRISM recovers the exact result with EFTs in the working format, so both formats use hardware instructions only. Performance is nearly independent of the virtual precision: across precisions, PRISM times vary by less than 1% and MCA times by at most 5%.

OperationPRISMMCAMCA/PRISMPRISMMCAMCA/PRISM
\multicolumn?
add31.1142.44.711.6115.610.0
mul32.1143.74.511.3163.114.6
div25.6112.74.412.0229.919.2
fma19.188.34.78.5597.470.5

Table 1. Slowdown of PRISM SR versus MCA RR relative to native execution (N=65,536N = 65{,}536, 30 runs; t=24t = 24 for binary32, t=53t = 53 for binary64). PRISM and MCA entries are the median ratios to native time for the same operation and data type (lower is better); MCA/PRISM is the median per-run ratio of MCA to PRISM time.

Theoretical error analysis of SR versus RN

The GPT-2 architecture contains projections with very different reduction lengths—the MLP down-projection accumulates over n=3072n = 3072 terms, whereas the attention projections accumulate over n=768n = 768—and the language-model head applies the softmax directly to the perturbed logits. These structural differences create distinct opportunities for SR’s variance–drift trade-off. This section analyzes both regimes: first, establishing a probabilistic forward error bound for the affine projection layers (attn_c_proj and mlp_c_proj) via a vector Bienaymé–Chebyshev construction (§ 5.1); second, deriving an analytical decomposition of cross-entropy loss change into drift and variance components at the output softmax (§ 5.2); and third, empirically validating this trade-off on DistilGPT-2 (§ 5.3). Throughout, statements concern the precision at which a reduction accumulates. On physical hardware, a kernel nominally in bfloat16 may store in bfloat16, multiply into a wider product, and accumulate in binary32; under PRISM, every elementary operation rounds at the same virtual precision, usto=umul=uacc=21−tu_{\mathrm{sto}} = u_{\mathrm{mul}} = u_{\mathrm{acc}} = 2^{1-t}, so the relative ULP scale uu below is 21−t2^{1-t} for the significand precision tt swept by our harness.

Forward error analysis of linear projection layers

The multilayer perceptron (MLP) block in the GPT-2 architecture consists of two consecutive linear projections surrounding an element-wise activation function. Following the row-vector convention of Eq. (2),

MLP⁡(x)=ϕ(xW1+b1)W2+b2,\operatorname{MLP}(x) = \phi(xW_1 + b_1)W_2 + b_2,

where ϕ\phi is the GELU activation function (Hendrycks and Gimpel, [28]), W1∈Rdmodel×dffW_1 \in\mathbb{R}^{d_{\mathrm{model}} \times d_{\mathrm{ff}}} is the expansion matrix (mlp_c_fc), and W2∈Rdff×dmodelW_2 \in\mathbb{R}^{d_{\mathrm{ff}} \times d_{\mathrm{model}}} is the projection matrix (mlp_c_proj). In DistilGPT-2, dmodel=768d_{\mathrm{model}} = 768 and dff=3072d_{\mathrm{ff}} = 3072.

Limitations of backward error frameworks for nonlinear activations. The backward error framework of Beuzeville et al. [5] analyzes multi-layer networks by absorbing rounding errors into equivalent weight perturbations ΔW\Delta W. For a layer followed by an activation ϕ\phi, the componentwise backward error bound includes a term proportional to lϕ/κϕ(z)l_\phi/\kappa_\phi(z), where κϕ(z)=∣zϕ′(z)/ϕ(z)∣\kappa_\phi(z) = \lvert z\phi'(z)/\phi(z) \rvert is the relative condition number of ϕ\phi and lϕul_\phi u bounds the evaluation error of ϕ\phi.

For GELU, this framework does not yield a uniform backward guarantee due to the vanishing derivative at its local minimum. Specifically, at z∗≈−0.752z^* \approx-0.752, ϕ′(z∗)=0\phi'(z^*) = 0 while ϕ(z∗)≈−0.170≠0\phi(z^*) \approx-0.170 \ne0. Consequently, the condition number vanishes (κϕ(z∗)=0\kappa_\phi(z^*) = 0), causing the backward error bound lϕ/κϕ(z)l_\phi/\kappa_\phi(z) to diverge in the neighborhood of z∗z^*.

Although each ideal SR step is conditionally unbiased, propagating SR perturbations through a nonlinear activation generally introduces composition bias (El Arar et al., [17], Section 4). To isolate the reduction error from this nonlinear composition, we focus on the affine down-projection mlp_c_proj (and, by extension, the attention projection attn_c_proj):

y=hW+b,y = hW + b,

where h∈Rnh \in\mathbb{R}^{n} is the input row vector, W∈Rn×mW \in\mathbb{R}^{n \times m} is the projection matrix, b∈Rmb \in\mathbb{R}^{m} is the bias vector, and y∈Rmy \in\mathbb{R}^{m} is the output (m=dmodel=768m = d_{\mathrm{model}} = 768). For mlp_c_proj, n=dff=3072n = d_{\mathrm{ff}} = 3072 and h=ϕ(xW1+b1)h = \phi(xW_{1} + b_{1}); for attn_c_proj, n=dmodel=768n = d_{\mathrm{model}} = 768 and hh is the concatenated multi-head attention output. Because these projection layers have no subsequent activation (ϕ=id\phi= \mathrm{id}), the forward error e=y^−ye = \hat{y} - y directly quantifies the perturbation injected into the residual stream.

Error model. Each component of yy is evaluated as a left-to-right sequential inner product followed by a bias addition:

yi=∑j=1nhjWji+bi,i=1,…,m,y_i = \sum_{j=1}^{n} h_j W_{ji} + b_i, \qquad i = 1,\ldots,m,

totaling 2n2n operations per output component with a longest error-product chain of n+1n + 1 rounding factors (one multiplication, n−1n - 1 accumulations, and the final bias addition). Let u=21−tu = 2^{1-t} denote the relative ULP scale at virtual significand precision tt. Assuming no overflow, underflow, or NaNs occur, every elementary operation satisfies fl⁡(aop⁡b)=(aop⁡b)(1+δ)\operatorname{fl}(a\mathbin{\operatorname{op}} b) = (a\mathbin{\operatorname{op}} b)(1 + \delta), where:

  • under RN, ∣δ∣≤u/2|\delta| \le u/2;

  • under SR (mode-1, nearness), ∣δ∣≤u|\delta| \le u, with the mean-independence property E[δk∣δ1,…,δk−1]=0\mathbb{E}[\delta_k \mid\delta_1,\ldots,\delta_{k-1}] = 0 (Connolly et al., [10], Lemma 5.2).

Deterministic forward error bound (RN). Under deterministic RN, rounding errors may align in the worst case. Applying Higham’s exact forward error bound for inner products (Higham, [29], Lemma 3.1), each component and then the vector satisfy

∣y^i−yi∣≤((1+u/2)n+1−1)(∑j=1n∣hj∣∣Wji∣+∣bi∣),|\hat{y}_i - y_i| \le\left((1 + u/2)^{n+1} - 1\right)\left(\sum_{j=1}^{n}|h_j||W_{ji}| + |b_i|\right),
∥y^−y∥2≤((1+u/2)n+1−1)∥∣h∣ ∣W∣+∣b∣∥2.\lVert\hat{y} - y\rVert_2 \le\left((1 + u/2)^{n+1} - 1\right)\lVert|h|\,|W| + |b|\rVert_2.

In the high-precision regime where nu≪1nu \ll1, the coefficient linearizes to ≈n+12u\approx\frac{n+1}{2}u; when nu≫1nu \gg1, it grows exponentially, reaching ≈8.11×1080\approx8.11 \times10^{80} at t=4t = 4 for n=3072n = 3072.

Probabilistic rounding and scalar bounds. In the first-order regime, mean-independence allows SR forward error bounds proportional to O(nu)O(\sqrt{n}u) rather than the O(nu)O(nu) deterministic RN bound. Existing probabilistic frameworks for bounding scalar inner product errors ei=y^i−yie_i = \hat{y}_i - y_i follow one of two strategies:

  • Azuma–Hoeffding (AH) method (Connolly et al., [10]; Ipsen and Zhou, [33]; de Oliveira Castro et al., [12]): Martingale bounds provide exponential probability tails, which tolerate a union bound over dimensions with only a mild O(ln⁡m)O(\sqrt{\ln m}) penalty. However, the bound on the increments contains a factor (1+u)n+1(1+u)^{n+1} (El Arar et al., [17], § 7). When nu≫1nu \gg1, this factor explodes exponentially, rendering AH uninformative at low precisions.

  • Bienaymé–Chebyshev (BC) method ([16, 17]): Bounding the variance of the accumulated error avoids this exponential explosion: because the precision enters squared in the variance bound, (1+u2)n+1−1≈(n+1)u2(1+u^2)^{n+1}-1\approx(n+1)u^2 remains small even at low precisions where nu≫1nu\gg1.

The core variance bound for error products under SR is given by the following lemma.

Lemma 2 (El Arar et al., [16], Lemma 3.1) Let φ=∏k=1K(1+δk)\varphi=\prod_{k=1}^{K}(1+\delta_k), where δk\delta_k are SR-nearness rounding errors satisfying ∣δk∣≤u|\delta_k|\le u and E[δk∣δ1,…,δk−1]=0\mathbb{E}[\delta_k\mid\delta_1,\ldots,\delta_{k-1}]=0. Then E[φ]=1\mathbb{E}[\varphi]=1 and Var⁡(φ)≤(1+u2)K−1\operatorname{Var}(\varphi)\le(1+u^2)^K-1.

Applying Chebyshev’s inequality to each scalar component eie_i yields an error bound scaling with 1α(1+u2)n+1−1\frac{1}{\sqrt{\alpha}}\sqrt{(1+u^2)^{n+1}-1}.

Vector L2L_2-norm bound: combining BC with a multivariate Markov bound. Extending the scalar analysis to the full output vector e∈Rme\in\mathbb{R}^m exposes a limitation in existing bounds: AH survives the union bound across mm components but fails at low precision tt, whereas scalar BC remains stable at low precision but grows rapidly under the union bound. Because Chebyshev’s inequality has a polynomial tail, setting the per-component failure probability to α/m\alpha/m inflates the confidence multiplier by m\sqrt{m}, from 1/α≈4.471/\sqrt{\alpha}\approx4.47 to m/α≈124\sqrt{m/\alpha}\approx124 (m=768m=768, α=0.05\alpha=0.05). This penalty inflates the bound to ≈6870u\approx6870u, wiping out SR’s advantage over RN.

To circumvent this limitation, our approach combines the low-precision robustness of BC with a single multivariate Markov step applied directly to the expected squared L2L_2-norm E[∥e∥22]\mathbb{E}[\lVert e\rVert_2^2]. This bypasses the union bound, keeping the confidence multiplier 1/α1/\sqrt{\alpha} independent of the output dimension mm.

Theorem 3 (Vector Bienaymé–Chebyshev Bound) Under SR-nearness, the forward error e=y^−ye=\hat{y}-y of the projection y=hW+by=hW+b satisfies, for any α∈(0,1)\alpha\in(0,1), with probability at least 1−α1-\alpha:

∥y^−y∥2≤1α(1+u2)n+1−1∥∣h∣∣W∣+∣b∣∥2.\lVert\hat{y}-y\rVert_2\le\frac{1}{\sqrt{\alpha}}\sqrt{(1+u^2)^{n+1}-1}\lVert|h||W|+|b|\rVert_2.

The confidence multiplier 1/α1/\sqrt{\alpha} is independent of the output dimension mm.

Proof The error in output component ii is

ei=∑j=1nhjWji(φij−1)+bi(φb,i−1),e_i=\sum_{j=1}^{n}h_jW_{ji}(\varphi_{ij}-1)+b_i(\varphi_{b,i}-1),

where φij\varphi_{ij} and φb,i\varphi_{b,i} represent the error products along the accumulation chains, containing at most n+1n+1 and 1 rounding factors, respectively. By mean-independence, E[φij]=1\mathbb{E}[\varphi_{ij}]=1, E[φb,i]=1\mathbb{E}[\varphi_{b,i}]=1, and E[ei]=0\mathbb{E}[e_i]=0.

Although the terms φij−1\varphi_{ij}-1 share common rounding errors across additions, Minkowski’s inequality in L2L_2 bounds the standard deviation of their linear combination:

Var⁡(ei)≤∑j=1n∣hj∣∣Wji∣Var⁡(φij)+∣bi∣Var⁡(φb,i).\sqrt{\operatorname{Var}(e_i)}\le\sum_{j=1}^{n}|h_j||W_{ji}|\sqrt{\operatorname{Var}(\varphi_{ij})}+|b_i|\sqrt{\operatorname{Var}(\varphi_{b,i})}.

Applying Lemma 2 with Var⁡(φij)≤(1+u2)n+1−1\operatorname{Var}(\varphi_{ij}) \le(1+u^2)^{n+1}-1 and Var⁡(φb,i)≤u2≤(1+u2)n+1−1\operatorname{Var}(\varphi_{b,i}) \le u^2 \le(1+u^2)^{n+1}-1 yields

Var⁡(ei)≤((1+u2)n+1−1)(∑j=1n∣hj∣∣Wji∣+∣bi∣)2\operatorname{Var}(e_i) \le\left((1+u^2)^{n+1}-1\right)\left(\sum_{j=1}^{n}|h_j||W_{ji}|+|b_i|\right)^2

By linearity of expectation, the expected squared L2L_2-norm satisfies

E[∥e∥22]=∑i=1mVar⁡(ei)≤((1+u2)n+1−1)∥∣h∣∣W∣+∣b∣∥22.\mathbb{E}[\lVert e\rVert_2^2]=\sum_{i=1}^{m}\operatorname{Var}(e_i)\le\left((1+u^2)^{n+1}-1\right)\lVert|h||W|+|b|\rVert_2^2.

Applying Markov’s inequality to the squared L2L_2-norm ∥e∥22\lVert e\rVert_2^2 (which constitutes the multivariate Bienaymé–Chebyshev inequality) gives P(∥e∥22≥1αE[∥e∥22])≤α\mathbb{P}\left(\lVert e\rVert_2^2\ge\frac{1}{\alpha}\mathbb{E}[\lVert e\rVert_2^2]\right)\le\alpha. Taking the square root completes the proof. ▪

Numerical evaluation on DistilGPT-2. While Theorem 3 holds for any affine projection of reduction length nn, we evaluate the bounds concretely on the feedforward down-projection mlp_c_proj (n=dff=3072n=d_{\mathrm{ff}}=3072, m=dmodel=768m=d_{\mathrm{model}}=768) at 95% confidence (α=0.05\alpha=0.05, 1/α=20≈4.471/\sqrt{\alpha}=\sqrt{20}\approx4.47). Because mlp_c_proj has four times the reduction length of attn_c_proj (n=768n=768), it has the longest accumulation chains and therefore tests the error bounds in the most demanding regime. In the limiting first-order regime u→0u\to0 (equivalently, t→∞t\to\infty):

  • RN deterministic: (1+u/2)n+1−1≈n+12u≈1537u(1+u/2)^{n+1}-1\approx\frac{n+1}{2}u\approx1537u;

  • SR vector BC: 1α(1+u2)n+1−1≈20n+1u≈248u\frac{1}{\sqrt{\alpha}}\sqrt{(1+u^2)^{n+1}-1}\approx\sqrt{20}\sqrt{n+1}u\approx248u.

The SR coefficient is asymptotically smaller than the RN coefficient by a factor of approximately 6.2. At finite precision the exact ratio approaches this limit from above: it is 14.37 at t=11t=11 and 6.35 at t=16t=16.

As shown in Figure 4, the deterministic RN bound suffers from exponential error compounding at low precision (nu≫1nu\gg1), reaching 2.43×10102.43\times10^{10} at t=7t=7 and 8.11×10808.11\times10^{80} at t=4t=4. In contrast, because precision enters squared under stochastic rounding, the SR vector BC bound grows much more slowly (4.73 at t=7t=7). At t=11t=11 the exact RN and SR coefficients are 3.482 and 0.242, a ratio of 14.37; the ratio decreases toward 6.2 only in the limit t→∞t\to\infty.

Figure 4. Deterministic RN and SR forward-error bound coefficients for mlp_c_proj in DistilGPT-2 (n=3072n = 3072).

For fixed α\alpha in the first-order regime, Theorem 3 yields an O(nu)O(\sqrt{n}u) bound for SR, whereas deterministic RN scales as O(nu)O(nu). Both bounds are worst-case over the inputs and normalize by ∥∣h∣∣W∣+∣b∣∥2\lVert|h||W|+|b|\rVert_2, but they treat arithmetic errors differently. Under RN, rounding errors are deterministic functions of the data that can align constructively in the worst case. Under SR, mean-independence yields the n\sqrt{n} factor via the Bienaymé–Chebyshev variance bound. While both results are upper bounds, and realized RN errors rarely achieve worst-case alignment, the comparison illustrates the fundamental contrast between the two modes: deterministic rounding permits systematic linear drift along the reduction chain, whereas stochastic rounding restricts error growth to a sub-linear O(nu)O(\sqrt{nu}) envelope.

The downstream captures in § 5.3 show larger RN than SR sample logit drift after reducing mlp_c_proj. These propagated measurements do not directly test the single-reduction bounds above.

Error propagation and loss decomposition at the output softmax

Section 5.1 bounds the perturbation that low-precision arithmetic injects into one layer. At the network output, the error travels to the logits and alters each token’s cross-entropy loss. This subsection analyzes that interface to identify, term by term, why SR and RN affect the language-model head differently.

Exact decomposition of the cross-entropy loss change. Fix one token with reference logits λ∈RV\lambda\in\mathbb{R}^{V}, target class yy, and predictive distribution p=softmax⁡(λ)p = \operatorname{softmax}(\lambda). Its cross-entropy loss is

L(λ)=−λy+log⁡∑j=1Veλj.(3)\mathcal{L}(\lambda) = -\lambda_y + \log\sum_{j=1}^{V} e^{\lambda_j}. \tag*{(3)}

Let the low-precision run perturb logit jj by Δj\Delta_j. Substituting λ+Δ\lambda+ \Delta into Eq. (3) and subtracting gives the exact signed loss change

δL(Δ):=L(λ+Δ)−L(λ)=−Δy+log⁡∑j=1VpjeΔj.\delta\mathcal{L}(\Delta) := \mathcal{L}(\lambda+ \Delta) - \mathcal{L}(\lambda) = -\Delta_y + \log\sum_{j=1}^{V} p_j e^{\Delta_j}.

Let p~=softmax⁡(λ+Δ)\widetilde{p} = \operatorname{softmax}(\lambda+ \Delta) and let DKL(p∥p~)D_{\mathrm{KL}}(p \mathbin\Vert\widetilde{p}) denote the Kullback–Leibler (KL) divergence from pp to p~\widetilde{p}. Direct substitution gives

DKL(p∥p~)=∑j=1Vpjlog⁡pjp~j=log⁡∑j=1VpjeΔj−pTΔ,D_{\mathrm{KL}}(p \mathbin\Vert\widetilde{p}) = \sum_{j=1}^{V} p_j \log\frac{p_j}{\widetilde{p}_j} = \log\sum_{j=1}^{V} p_j e^{\Delta_j} - p^{\mathsf{T}}\Delta,

and therefore, with g:=p−eyg := p - e_y, the exact decomposition

δL(Δ)=gTΔ+DKL(p∥p~).(4)\delta\mathcal{L}(\Delta) = g^{\mathsf{T}}\Delta+ D_{\mathrm{KL}}(p \mathbin\Vert\widetilde{p}). \tag*{(4)}

The linear term is signed and records the target-specific shift, whereas the KL term is non-negative and records the change in the full predictive distribution.

Local quadratic form of the KL term. The KL divergence satisfies DKL(p∥p)=0D_{\mathrm{KL}}(p \mathbin\Vert p)=0 and has vanishing gradient at Δ=0\Delta=0. Its local quadratic approximation is governed by the Fisher information matrix of the categorical distribution parameterized by logits,

H=diag⁡(p)−ppT,H=\operatorname{diag}(p)-pp^{\mathsf{T}},

which coincides with the Hessian of the cross-entropy loss ∇λ2L(λ)\nabla_{\lambda}^{2}\mathcal{L}(\lambda) (Martens [36], Section 6). Although the KL divergence is asymmetric, both orientations share the same second-order expansion at Δ=0\Delta=0:

DKL(p∥p~)=12ΔTHΔ+r,r=O(∥Δ∥3).(5)D_{\mathrm{KL}}(p\mathbin\Vert\tilde{p})=\frac{1}{2}\Delta^{\mathsf{T}}H\Delta+r,\qquad r=O(\lVert\Delta\rVert^{3}). \tag*{(5)}

Because HH is the covariance matrix of a single categorical draw with probabilities pp, for any perturbation Δ∈RV\Delta\in\mathbb{R}^{V} the quadratic form equals the variance across classes:

ΔTHΔ=∑j=1VpjΔj2−(pTΔ)2=Var⁡p(Δ)≥0,(6)\Delta^{\mathsf{T}}H\Delta=\sum_{j=1}^{V}p_j\Delta_j^{2}-(p^{\mathsf{T}}\Delta)^{2}=\operatorname{Var}_{p}(\Delta)\geq0, \tag*{(6)}

confirming that H⪰0H\succeq0 and that the local KL penalty charges variations in Δ\Delta across classes considered plausible by pp. Fisher information similarly guides parameter sensitivity in post-training quantization (e.g., SqueezeLLM, Kim et al. [34]); in logit space, HH arises analytically to penalize non-uniform operational perturbations directly.

An exact consequence of the logit formulation is shift invariance (Blanchard et al. [6]): any uniform perturbation Δ=c1\Delta=c\mathbf{1} leaves the predictive distribution identical (p~=softmax⁡(λ+c1)=p\tilde{p}=\operatorname{softmax}(\lambda+c\mathbf{1})=p), so that DKL(p∥p~)=0D_{\mathrm{KL}}(p\mathbin\Vert\tilde{p})=0. Likewise, gT(c1)=c(p−ey)T1=0g^{\mathsf{T}}(c\mathbf{1})=c(p-e_y)^{\mathsf{T}}\mathbf{1}=0, ensuring that δL(c1)=0\delta\mathcal{L}(c\mathbf{1})=0 exactly. The one-dimensional subspace span⁡(1)\operatorname{span}(\mathbf{1}) constitutes the null space of the Fisher metric (H1=0H\mathbf{1}=0).

The two probability spaces. Conditional on a fixed token ww, two distinct probability spaces arise for SR and RN.

  1. Under SR, every rounded elementary operation along the trajectory draws fresh pseudorandom bits. This operational randomness makes the logit perturbation ΔSR\Delta_{\mathrm{SR}} a random vector, driven by elementary rounding errors that satisfy the mean-independence of § 5.1.

  1. Under RN, every operation returns one deterministic value: there is no operational randomness. Conditional on a fixed token,

ERN[ΔRN(w)∣w]=ΔRN(w),ΣRN:=Cov⁡RN(ΔRN(w)∣w)=0.(7)\mathbb{E}_{\mathrm{RN}}\left[\Delta_{\mathrm{RN}}^{(w)}\mid w\right]=\Delta_{\mathrm{RN}}^{(w)},\qquad\Sigma_{\mathrm{RN}}:=\operatorname{Cov}_{\mathrm{RN}}\left(\Delta_{\mathrm{RN}}^{(w)}\mid w\right)=0. \tag*{(7)}

Drift–variance decomposition. For either mode m∈{SR,RN}m\in\{\mathrm{SR},\mathrm{RN}\}, decompose the logit perturbation as

Δm=bm+ξm,Em[ξm]=0,(8)\Delta_m=b_m+\xi_m,\qquad\mathbb{E}_m[\xi_m]=0, \tag*{(8)}

where bm:=Em[Δm]b_m := \mathbb{E}_m[\Delta_m] is the drift and ξm\xi_m is the centered fluctuation, with covariance Σm:=Cov⁡m(ξm)\Sigma_m := \operatorname{Cov}_m(\xi_m). By Eq. (7), on a fixed token RN carries bRN=ΔRNb_{\mathrm{RN}} = \Delta_{\mathrm{RN}} and ΣRN=0\Sigma_{\mathrm{RN}} = 0: its entire perturbation is drift.

Substituting Δm=bm+ξm\Delta_m = b_m + \xi_m into the local KL expansion Eq. (5) and taking expectations Em[⋅]\mathbb{E}_m[\cdot] over operational randomness (over rounding draws for SR, and degenerate for deterministic RN), the linear term in Eq. (4) yields Em[gTΔm]=gTbm\mathbb{E}_m[g^{\mathsf{T}}\Delta_m] = g^{\mathsf{T}}b_m. The quadratic term expands as

ΔmTHΔm=bmTHbm+2bmTHξm+ξmTHξm.\Delta_m^{\mathsf{T}}H\Delta_m = b_m^{\mathsf{T}}Hb_m + 2b_m^{\mathsf{T}}H\xi_m + \xi_m^{\mathsf{T}}H\xi_m.

Taking expectations, the cross term vanishes since Em[ξm]=0\mathbb{E}_m[\xi_m] = 0, and the quadratic fluctuation term evaluates to Em[ξmTHξm]=tr⁡(HΣm)\mathbb{E}_m[\xi_m^{\mathsf{T}}H\xi_m] = \operatorname{tr}(H\Sigma_m). Thus the KL contribution itself separates as

Em[DKL(p∥p~m)]=12bmTHbm+12tr⁡(HΣm)+Rm,\mathbb{E}_m[D_{\mathrm{KL}}(p \mathbin{\|} \widetilde{p}_m)] = \frac{1}{2}b_m^{\mathsf{T}}Hb_m + \frac{1}{2}\operatorname{tr}(H\Sigma_m) + R_m,

where Rm:=Em[r]R_m := \mathbb{E}_m[r]. Combining this KL decomposition with the linear target-shift term yields the expected excess loss:

Em[δL]=gTbm+12bmTHbm+12tr⁡(HΣm)+Rm(9)\mathbb{E}_m[\delta\mathcal{L}] = g^{\mathsf{T}}b_m + \frac{1}{2}b_m^{\mathsf{T}}Hb_m + \frac{1}{2}\operatorname{tr}(H\Sigma_m) + R_m \tag*{(9)}

where DmD_m is signed; QmQ_m and VmV_m are non-negative by H⪰0H \succeq0. Removing drift is not free: an unbiased mode avoids the drift terms Dm+QmD_m + Q_m, but pays the variance penalty VmV_m.

Empirical validation of the drift–variance trade-off

We evaluate this trade-off on DistilGPT-2 using N=1020N = 1020 scored WikiText-2 positions, with reference loss L0=4.1354\mathcal{L}_0 = 4.1354 nats. The decomposition uses 32 SR seeds at t=4,…,10t = 4,\ldots,10, with one deterministic RN run per precision. We use bias-corrected quadratic estimators. The logit measurement protocol and the estimators are detailed in Section B.

SR avoids systematic drift but incurs local fluctuation. The decomposition Δm=bm+ξm\Delta_m = b_m + \xi_m (Eq. (8)) splits each logit perturbation into drift bm=Em[Δm]b_m = \mathbb{E}_m[\Delta_m] and centered fluctuation ξm\xi_m. For RN the split is trivial: bRN=ΔRNb_{\mathrm{RN}} = \Delta_{\mathrm{RN}} and ξRN=0\xi_{\mathrm{RN}} = 0, so the perturbation at each token–coordinate pair is entirely deterministic drift. For SR, the perturbation is stochastic, so its expected magnitude is measured by its operational root mean square. All plotted quantities represent the operational statistics of a single forward pass; multiple seeds (S=32S = 32) are used exclusively to construct empirical estimators for these quantities.

Figure 5 visualizes the three quantities that enter the loss decomposition (Eq. (9)). Row (i) shows the operational perturbation magnitude per run across all token–coordinate pairs. At the MLP down-projection, RN accumulates deterministic drift, whereas SR’s per-run perturbation is smaller. At the head, however, SR’s per-run perturbation is larger than RN’s. This does not contradict the worst-case bounds of Theorem 3. At the head, inputs are centered by LayerNorm; empirically, we observe that this centering induces cancellation in RN rounding errors, preventing the accumulation of systematic drift. Because the projection is linear, SR guarantees unbiasedness, but incurs higher local variance to do so (local errors up to 1.0u1.0u, compared to RN’s strict 0.5u0.5u bound). In the absence of systematic drift, the accumulated perturbation is governed by this local variance, which is consistent with SR perturbations being larger than RN at the head.

Figure 5. Operational decomposition of logit perturbations across all 51,262,140 token–coordinate pairs (for the MLP, rounding errors are injected at the down-projection and propagated to the final logits). (i) Per-run RMS perturbation for pair jj: ∣Δj∣\lvert\Delta_j\rvert for deterministic RN (ξj=0\xi_j=0), and E[Δj2]=bj2+std⁡(ξj)2\sqrt{\mathbb{E}[\Delta_j^2]}=\sqrt{b_j^2+\operatorname{std}(\xi_j)^2} for SR. (ii) Centered drift b~j\tilde{b}_j (per-token vocabulary mean removed): non-uniform component charged via QmQ_m. (iii) Operational standard deviation of the pp-centered fluctuation std⁡(ξ~j)\operatorname{std}(\tilde{\xi}_j), where ξ~j=ξj−p⊤ξ\tilde{\xi}_j=\xi_j-p^\top\xi; RN: ξRN=0\xi_{\mathrm{RN}}=0. Boxes IQR, median line, 1st–99th-percentile whiskers; vertical scales differ.

Nevertheless, not all of this perturbation magnitude translates to excess loss. By shift invariance (Eq. (6)), a per-token uniform shift leaves softmax probabilities unchanged, so only the non-uniform component feeds into QmQ_m. Row (ii) isolates this loss-relevant component by centering the drift (subtracting each token’s vocabulary mean from bjb_j). The reduction is pronounced at the MLP: RN’s spread shrinks by an order of magnitude, confirming that most of its accumulation was uniform. SR’s centered drift is near-zero everywhere.

Row (iii) removes the uniform component of the fluctuation (to which the softmax is insensitive by shift invariance). Let ξ~j=ξj−pTξ\tilde{\xi}_j = \xi_j - p^{\mathsf{T}}\xi denote the pp-centered operational fluctuation; the row reports its standard deviation std⁡(ξ~j)\operatorname{std}(\tilde{\xi}_j). RN is deterministic (ξRN=0\xi_{\mathrm{RN}} = 0). The centered fluctuation is smaller at the MLP than at the head. MLP noise is predominantly a uniform shift of the logits, whereas head noise changes the differences between logits and therefore the softmax output.

The role of input distributions. The accumulation of deterministic rounding errors in inner products depends heavily on the distribution of the operands ([16]). When inputs are predominantly positive (such as the outputs of the GELU activation at the MLP down-projection), RN rounding errors become biased and, depending on the weight distribution, systematically accumulate into a large drift. Conversely, when inputs are zero-centered (such as the outputs of LayerNorm at the language-model head), positive and negative RN errors tend to cancel, preventing the accumulation of systematic drift.

Loss decomposition at the language-model head. Although SR produces smaller logit drift at the head, it incurs higher excess loss than RN throughout t=4,…,10t = 4, \ldots, 10 (Table 4 and Figure 6). The decomposition in Eq. (9) explains the reversal. RN is deterministic (VRN=0V_{\mathrm{RN}} = 0), so its perturbation contributes only through DRND_{\mathrm{RN}}, QRNQ_{\mathrm{RN}}, and RRNR_{\mathrm{RN}}. SR’s operational randomness introduces non-uniform fluctuations—the large pp-centered fluctuation visible in Figure 5 (iii)—that incur the quadratic cost VSR=12tr⁡(HΣSR)V_{\mathrm{SR}} = \frac{1}{2}\operatorname{tr}(H\Sigma_{\mathrm{SR}}). At the head the noise is genuinely non-uniform across the vocabulary, so the softmax cannot ignore it.

Figure 6. Stacked decomposition of expected excess loss Em[δL]=Dm+Qm+Vm+Rm\mathbb{E}_m[\delta\mathcal{L}] = D_m + Q_m + V_m + R_m at the head and MLP down-projection at t=6,7,8t = 6, 7, 8. Positive components stack upward from zero and negative components downward; solid horizontal marks indicate the measured mean excess loss (with one standard error for SR; RN is deterministic). At the head, the variance penalty VV dominates SR excess loss; at the MLP down-projection, RN is dominated by drift curvature QQ. Full values are in Table 4.

ComponentModettDDQQVVRRE[δL]\mathbb{E}[\delta\mathcal{L}]
lm_head (n=768n = 768)SR40.049±0.0430.049 \pm0.043−0.002±0.011-0.002 \pm0.01123.204±0.04723.204 \pm0.047−5.860±0.046-5.860 \pm0.04617.392±0.04517.392 \pm0.045
lm_head (n=768n = 768)SR5−0.009±0.021-0.009 \pm0.021−0.001±0.006-0.001 \pm0.00610.446±0.02110.446 \pm0.021−1.141±0.022-1.141 \pm0.0229.295±0.0259.295 \pm0.025
lm_head (n=768n = 768)SR60.015±0.0160.015 \pm0.0160.002±0.0020.002 \pm0.0024.606±0.0094.606 \pm0.009−0.223±0.009-0.223 \pm0.0094.400±0.0164.400 \pm0.016
lm_head (n=768n = 768)SR70.016±0.0100.016 \pm0.0100.001±0.0010.001 \pm0.0011.951±0.0031.951 \pm0.003−0.062±0.003-0.062 \pm0.0031.907±0.0111.907 \pm0.011
lm_head (n=768n = 768)SR8−0.008±0.008-0.008 \pm0.008−0.0003±0.0004-0.0003 \pm0.00040.766±0.0010.766 \pm0.001−0.017±0.001-0.017 \pm0.0010.740±0.0070.740 \pm0.007
lm_head (n=768n = 768)SR90.003±0.0030.003 \pm0.0030.000±0.0000.000 \pm0.0000.270±0.0010.270 \pm0.001−0.003±0.000-0.003 \pm0.0000.271±0.0030.271 \pm0.003
lm_head (n=768n = 768)SR100.003±0.0020.003 \pm0.0020.000±0.0000.000 \pm0.0000.084±0.0000.084 \pm0.0000.000±0.0000.000 \pm0.0000.087±0.0020.087 \pm0.002
lm_head (n=768n = 768)RN4−0.016-0.0163.1663.166001.9741.9745.1245.124
lm_head (n=768n = 768)RN50.1040.1042.4022.402001.1001.1003.6053.605
lm_head (n=768n = 768)RN60.0410.0411.5761.576000.5000.5002.1172.117
lm_head (n=768n = 768)RN70.0300.0300.8300.830000.1680.1681.0281.028
lm_head (n=768n = 768)RN80.0190.0190.3460.346000.0380.0380.4040.404
lm_head (n=768n = 768)RN9−0.012-0.0120.1240.124000.0070.0070.1200.120
lm_head (n=768n = 768)RN10−0.014-0.0140.0390.039000.0000.0000.0250.025
mlp_c_proj (n=3072n = 3072)SR4−0.2553±0.0064-0.2553 \pm0.00640.9690±0.00420.9690 \pm0.00420.4566±0.00200.4566 \pm0.00200.8280±0.00620.8280 \pm0.00621.9983±0.00851.9983 \pm0.0085
mlp_c_proj (n=3072n = 3072)SR5−0.1300±0.0047-0.1300 \pm0.00470.1645±0.00220.1645 \pm0.00220.2245±0.00120.2245 \pm0.00120.0680±0.00240.0680 \pm0.00240.3270±0.00540.3270 \pm0.0054
mlp_c_proj (n=3072n = 3072)SR6−0.0532±0.0026-0.0532 \pm0.00260.0165±0.00050.0165 \pm0.00050.0828±0.00050.0828 \pm0.00050.0040±0.00040.0040 \pm0.00040.0501±0.00270.0501 \pm0.0027
mlp_c_proj (n=3072n = 3072)SR7−0.0169±0.0019-0.0169 \pm0.00190.0014±0.00010.0014 \pm0.00010.0252±0.00020.0252 \pm0.00020.0006±0.00010.0006 \pm0.00010.0104±0.00180.0104 \pm0.0018
mlp_c_proj (n=3072n = 3072)SR8−0.0043±0.0008-0.0043 \pm0.00080.0001±0.00000.0001 \pm0.00000.0067±0.00010.0067 \pm0.00010.0001±0.00000.0001 \pm0.00000.0026±0.00070.0026 \pm0.0007
mlp_c_proj (n=3072n = 3072)SR9−0.0013±0.0004-0.0013 \pm0.00040.0000±0.00000.0000 \pm0.00000.0017±0.00000.0017 \pm0.00000.0000±0.00000.0000 \pm0.00000.0005±0.00040.0005 \pm0.0004
mlp_c_proj (n=3072n = 3072)SR10−0.0004±0.0002-0.0004 \pm0.00020.0000±0.00000.0000 \pm0.00000.0004±0.00000.0004 \pm0.00000.0000±0.00000.0000 \pm0.00000.0001±0.00020.0001 \pm0.0002
mlp_c_proj (n=3072n = 3072)RN4−0.1676-0.16762.42042.4204001.17921.17923.43213.4321
mlp_c_proj (n=3072n = 3072)RN5−0.1250-0.12501.05041.0504000.46070.46071.38611.3861
mlp_c_proj (n=3072n = 3072)RN6−0.1148-0.11480.28670.2867000.07020.07020.24210.2421
mlp_c_proj (n=3072n = 3072)RN7−0.0288-0.02880.06860.0686000.00550.00550.04530.0453
mlp_c_proj (n=3072n = 3072)RN8−0.0101-0.01010.01660.0166000.00060.00060.00710.0071
mlp_c_proj (n=3072n = 3072)RN9−0.0043-0.00430.00400.0040000.00000.0000−0.0002-0.0002
mlp_c_proj (n=3072n = 3072)RN10−0.0020-0.00200.00100.0010000.00000.0000−0.0009-0.0009

Table 4. Loss decomposition terms (Eq. (9)) in nats, averaged over N=1020N = 1020 positions. SR reports mean ±\pm 1 SE (S=32S = 32 seeds); RN is deterministic (VRN=0V_{\mathrm{RN}} = 0).

Over t=6,…,9t = 6, \ldots, 9, the variance penalty VSRV_{\mathrm{SR}} accounts for 100–105% of SR’s excess loss, while DSRD_{\mathrm{SR}} and QSRQ_{\mathrm{SR}} lie within 1.6 standard errors of zero. For RN, the perturbation carries no fluctuation (VRN=0V_{\mathrm{RN}} = 0); its non-uniform drift produces QRN=1.58Q_{\mathrm{RN}} = 1.58 and RRN=0.50R_{\mathrm{RN}} = 0.50 nats at t=6t = 6, for a total excess of 2.12 nats—less than half of SR’s 4.40 nats.

Loss decomposition at the MLP down-projection. At the MLP down-projection, the loss ordering reverses: SR has an excess loss of 0.05 nats against RN’s 0.24 at $t = 6 (Figure 6 and Table 4). The 3072-length inner product allows deterministic rounding errors under RN to align across many terms, producing a wide, non-uniform drift dispersion that incurs a curvature penalty of QRN=0.29Q_{\mathrm{RN}} = 0.29 nats.

SR prevents this systematic alignment, keeping QSRQ_{\mathrm{SR}} at 0.017 nats. Although SR’s raw fluctuation is comparable to or larger than at the head (6.23 versus 4.27 logits RMS at t=6t = 6), the noise has far fewer degrees of freedom. At the head, SR injects rounding errors directly into all 50,257 logits, scrambling the differences between them. At the MLP down-projection, SR injects noise into the 768-dimensional hidden state. Restricted to these 768 degrees of freedom, the 50,257 logits are highly coupled. This dimensionality restriction likely explains why the MLP fluctuation manifests predominantly as a uniform shift across the vocabulary, which the softmax simply ignores. The near-uniform shift also depends on the trained output weights and the directions of the propagated error. As a result, the pp-centered fluctuation in Figure 5(iii) collapses at the MLP relative to the head, yielding VSR=0.083V_{\mathrm{SR}}=0.083 nats, fifty times smaller than at the head. The reduction in drift curvature therefore more than compensates for SR’s variance penalty.

Experiments

§ 5 bounds the forward error of a single reduction and decomposes its effect on the loss at the output softmax. Neither result predicts the perplexity ordering of SR and RN once rounding errors propagate through the network: the bounds are worst-case and per reduction, and the loss decomposition is evaluated one site at a time. This section measures that ordering on DistilGPT-2 at matched significand precision, with the scope of reduced precision ranging from the whole network to one projection in one block (Table 2). The sweeps address three questions: which rounding rule gives lower perplexity at each site, how per-site effects combine across sites and across depth, and whether the per-site preferences yield a mixed-rounding assignment that improves on RN at identical per-site precisions.

LevelTarget scopett sweptQuestion
GlobalWhole model4–14SR vs. RN comparison under uniform precision
Componentattention, mlp, lm_head, attn_qkav (all blocks)4–14Site-dependent sensitivity across main modules
SublayerFour projections attn_*, mlp_* (all blocks)4–14Impact of reduction length (n=768n = 768 vs. 3072)
Depthmlp_c_proj (single blocks; prefixes 00–kk)4, 5, 6Dependence on position; additivity of per-block effects
Mixed recipeSR at output projections, RN elsewhere6, 7, 8Mixed rounding versus all-RN at identical per-site precisions

Table 2. Sweep levels. All levels compare SR and untied RN at matched significand precision tt; operations outside the target scope run at t=24t = 24 under RN.

Experimental setup

Model and evaluation benchmark. We evaluate the public distilbert/distilgpt2 checkpoint ([31, 45]). The architecture retains the layer widths of GPT-2 small (dmodel=768d_{\mathrm{model}} = 768, dff=3072d_{\mathrm{ff}} = 3072, H=12H = 12 heads, dhead=64d_{\mathrm{head}} = 64, vocabulary V=50257V = 50257, as illustrated in Figure 1) and distills the depth to six blocks. It therefore has the reduction lengths that enter the bounds of § 5.1: n=768n = 768 for attn_c_attn, attn_c_proj, and mlp_c_fc, and n=3072n = 3072 for mlp_c_proj. Six blocks keep per-operation software emulation tractable. All evaluations use the pretrained weights without fine-tuning, calibration, or quantization-aware adjustment, so that configurations differ only in the arithmetic under test.

Evaluation uses the WikiText-2 test split ([37]. The harness selects the leading 1% of lines, joins them with double newlines, tokenizes the resulting text, and evaluates its first 1024 tokens. These are divided into four non-overlapping contexts of 256 tokens, with context reset between them. Each context contributes 255 next-token targets, giving 1020 scored positions. Perplexity is the exponential of the mean cross-entropy over these positions; the PRISM RN reference at binary32 significand precision (t=24t = 24) is PPL0=62.51\mathrm{PPL}_0 = 62.51. When effects are compared or summed, we also report the excess loss ℓ=ln⁡(PPL/PPL0)\ell= \ln(\mathrm{PPL}/\mathrm{PPL}_0) in nats, which equals the increase in mean cross-entropy over the 1020 positions and is the quantity decomposed in Eq. (9).

Instrumented arithmetic and scoping. Inference is executed within Fuzzy PyTorch ([22]. During the framework’s compilation, the Verificarlo compiler pass ([14]) intercepts native floating-point operations and redirects them to PRISM’s vectorized C++ backend (§ 4). Instrumented operations within the target scope are rounded to a virtual significand precision t≤24t \le24 using either SR or untied RN, in which half-ULP ties round away from zero rather than to even (§ 4). All SR–RN comparisons in this section use untied RN and not IEEE round-to-nearest with ties-to-even (RNE) at reduced precision. The two differ only on exact ties. RN introduces no randomness, and repeated RN runs are bitwise reproducible.

The harness attaches PyTorch forward pre-hooks that set precision tt and the rounding mode immediately before the target module executes, and forward post-hooks that restore t=24t = 24 under RN on exit. Inference runs in PyTorch eager mode without cross-module operator fusion. Every operation outside the target scope, including the final loss and perplexity computation, runs at t=24t = 24 under RN, so an SR run and its paired RN control differ only in the rounding rule applied within the target scope.

The component and sublayer sweeps reduce precision at the target in all six blocks at once; the depth sweeps reduce it in one block or in a prefix of blocks (Table 2). The attention and mlp scopes cover every operation inside the corresponding module of each block: the query–key–value and output projections, the score and value products, and the softmax for attention; mlp_c_fc, the GELU, and mlp_c_proj for mlp. The attn_qkav scope covers only the products QKTQK^{\mathsf{T}} (reduction length dhead=64d_{\mathrm{head}} = 64) and AVAV (at most T=256T = 256), with the softmax at t=24t = 24. The lm_head scope is the projection onto the vocabulary logits.

Statistical protocol. The global, component, sublayer, and depth sweeps use five independent seeds per SR configuration, and the mixed-rounding comparison in § 6.3 uses five seeds per mixed configuration. Results are reported as sample mean ±\pm standard deviation; for SR, excess loss is averaged over seeds. RN is deterministic at a fixed execution configuration and is run once. We define the perplexity gap as Δ=SR‾−RN\Delta= \overline{\mathrm{SR}} - \mathrm{RN}, so negative values favor SR. We regard the gap as statistically indistinguishable from zero when the RN value falls outside the two-sided 95% Student-tt confidence interval for the SR mean (df=4df = 4). The evaluated text is fixed, so every interval is conditional on the 1020 scored positions and does not describe variation across texts.

Results

The experiments yield four findings:

  1. RN is better under uniform rounding. Reducing only the language-model head reproduces most of the SR–RN gap, suggesting that the head drives the global preference for RN (Figure 7 and Figure 8).

Figure 7. Global sweep at uniform precision across all model operations, showing mean perplexity and SR standard deviation on a logarithmic axis. RN’s advantage is statistically significant across t∈[4,11]t \in[4, 11].

Figure 8. Per-component sweep across precisions t∈[4,14]t \in[4, 14]. Bands show ±1 sample SD over five SR seeds; dotted line indicates the full-precision reference (62.51).

  1. The preferred rounding rule depends on the site. SR gives lower perplexity in the MLP, whereas RN is preferred at the head and attention input projection. The loss decomposition attributes the MLP advantage to reduced drift and the head disadvantage to SR fluctuations (Figure 8 and Figure 9).

Figure 9. Per-sublayer sweep across the four primary projection matrices, with reduction lengths nn indicated and perplexity on a shared logarithmic scale. The feedforward down-projection (mlp_c_proj, n=3072n = 3072) exhibits the largest low-precision SR advantage (Δ=−1473.15\Delta= -1473.15 at t=4t = 4).

  1. RN loss compounds more strongly across blocks. For mlp_c_proj at t=5t = 5–66, RN excess loss exceeds the sum of single-block losses more than SR excess loss does. At t=6t = 6, SR is approximately additive (Figure 10).

Figure 10. Cumulative propagation across block prefixes 0 to 0–kk for mlp_c_proj at t∈{4,5,6}t \in\{4,5,6\}. Bands show ±1\pm1 sample SD over five SR seeds.

  1. Mixed-rounding improves on full RN. Using SR at the attention and MLP output projections and RN elsewhere lowers perplexity, even with one fewer significand bit at the MLP down-projection (Table 3).

(a) Precision and rounding configurations
Sitett bitsMixed
Attention input (attn_c_attn)8RN
Attention output (attn_c_proj)6SR
MLP input (mlp_c_fc)8RN
MLP output (mlp_c_proj)k∈{6,7,8}k \in\{6,7,8\}SR
Language-model head (lm_head)11RN
All other operations24RN
Configurations apply across all six blocks; μ±σ\mu\pm\sigma over five seeds. Negative Δ\Delta favors mixed rounding. CIs are 95% Student-tt (df=4df=4). Relative baseline column shows percentage increase over the full-precision reference (62.51) for Mixed (Full RN).
(b) Perplexity gaps
kkMixed (μ±σ\mu\pm\sigma)Full RNGap Δ\Delta (%)95% CI Δ\DeltaRel. baseline Δ\Delta (Full RN)
864.63 ±\pm 0.6866.66−2.03 (−3.04%)[−2.87, −1.18]+3.38% (+6.64%)
764.89 ±\pm 0.9868.89−4.00 (−5.81%)[−5.22, −2.79]+3.80% (+10.20%)
669.01 ±\pm 2.0796.07−27.06 (−28.17%)[−29.63, −24.49]+10.39% (+53.68%)

Table 3. Mixed rounding versus RN at identical per-site significand precisions on WikiText-2. Lower perplexity is better.

Global uniform-precision sweep. Under uniform precision, RN consistently outperforms SR across the entire low-to-moderate precision range, with statistically significant differences at every t∈[4,11]t \in[4, 11] (Figure 7). At t=8t = 8, perplexity is 97.68 under RN and 139.27±3.58139.27 \pm3.58 under SR. Reducing only the head reproduces this gap: the SR–RN difference in excess loss is 2.03 nats globally and 2.27 nats with only lm_head reduced at t=6t = 6, and 0.35 against 0.37 nats at t=8t = 8. The RN advantage is therefore consistent with the head’s SR fluctuation penalty (§ 5.3) dominating the whole-network result. This general performance agrees with the forward-pass preference for RN reported by Chmiel et al. [9], establishing RN as the appropriate default for global precision reduction.

Site performance: MLP versus language-model head. In the MLP, SR gives lower perplexity than RN at every t≤8t \le8, with statistically significant differences (Figure 8). At t=6t = 6, perplexity is 71.97±1.1671.97 \pm1.16 under SR and 137.93 under RN, a degradation of 15% against 121% over the reference. At t=8t = 8, SR is within 0.3% of the reference (62.69) and RN within 2.0% (63.75). At t≤5t \le5 both rules more than double the reference perplexity (at t=5t = 5, 175.65 under SR against 2029.83 under RN); the ordering there is statistically significant but concerns configurations that neither rule makes usable.

At the language-model head the ordering reverses: RN gives lower perplexity at every t∈[4,12]t \in[4, 12], with statistically significant differences. At t=8t = 8, perplexity is 135.56 ± 5.22 under SR and 93.60 under RN; at t=6t = 6, 5054 ± 464 against 519.18. § 5.3 decomposes the head’s excess loss at these precisions. Over t=6,…,9t = 6, \ldots, 9 the fluctuation term VSRV_{\mathrm{SR}} accounts for

100% of SR’s excess loss, whereas RN, which has no fluctuation, pays only for its non-uniform drift (2.12 against 4.40 nats at t=6t = 6). SR noise injected at the head changes the differences between logits, which the cross-entropy penalizes; SR noise injected in the MLP reaches the logits predominantly as a uniform shift, to which the softmax is invariant.

The attention module favors SR at t≤6t \le6 but do not favor any rounding mode at higher precisions; at t≥7t \ge7 the two rules differ by less than 2% of the reference (at t=7t = 7, 64.60±\pm0.49 under SR against 63.42 under RN). Restricted to the score and value products (attn_qkav), reduced precision raises perplexity by at most 14% at t=4t = 4 (71.26 ±\pm 1.26 under SR, 65.90 under RN) and by at most 2.9% at t≥5t \ge5. These products have the shortest reductions in the model (dhead=64d_{\mathrm{head}} = 64 and at most T=256T = 256 terms), which may explain their small sensitivity to either rule.

The attention module does not decompose into its parts. At t=4t = 4, the excess losses of attn_c_attn, attn_c_proj, and attn_qkav, each reduced separately, sum to 1.20 nats under RN and 1.66 nats under SR, which favors RN; reducing the whole module gives 2.56 and 2.29 nats, which favors SR. At t=6t = 6 the sums are equal under both rules (0.094 nats), whereas the whole module gives 0.182 under RN and 0.120 under SR.

Reduction length and sublayer sensitivity. Figure 9 separates the four projections, each reduced in all six blocks. The MLP down-projection (mlp_c_proj, n=3072n = 3072) has the largest SR advantage, statistically significant at every t≤7t \le7: at t=6t = 6, perplexity is 66.24 ±\pm 0.63 under SR and 79.64 under RN, a degradation of 6.0% against 27%. Among the three projections with n=768n = 768, the preferred rule depends on the site. The attention input projection (attn_c_attn) favors RN wherever the difference is statistically significant (t=4,5,7t = 4, 5, 7; at t=4t = 4, 251.58±16.05251.58 \pm16.05 under SR against 154.08154.08 under RN). The attention output projection (attn_c_proj) favors SR at t=4t = 4–66, and the MLP input projection (mlp_c_fc) favors SR at t=5t = 5–66; at t≥7t \ge7 neither difference is statistically significant.

The largest SR advantage occurring at the longest reduction is consistent with § 5.1: RN rounding errors can align across the nn terms of a reduction, whereas SR errors have zero conditional mean, so RN drift can grow faster with nn than SR fluctuation. The sweep does not isolate nn, however. Only one site has n=3072n = 3072, and it also differs from the others in its input, the GELU output, which is bounded below by approximately −0.17-0.17. The opposite preferences of three sites with identical n=768n = 768 show that factors other than nn, such as the input distribution, the weights, and the downstream operations, also determine the ordering.

SR’s advantage across depth. The cumulative sweep in Figure 10 reduces mlp_c_proj in progressively longer block prefixes, from block 0 to all six blocks. For every tested precision, SR yields statistically significantly lower perplexity than RN at every prefix, except 0 and 0–1 at t=6t = 6, where the differences are not statistically significant.

The advantage of SR becomes more pronounced as more blocks use reduced precision. At t=4t = 4, perplexities are initially close (83.24 under SR and 85.13 under RN for block 0), but extending the reduction to all six blocks increases perplexity by a factor of 5.5 under SR and 22.7 under RN. At t=6t = 6, the difference becomes statistically significant from prefix 0–2 onward, reaching 66.24±0.6366.24 \pm0.63 under SR versus 79.64 under RN with all six blocks reduced, as in Figure 9. These results show that SR limits the perplexity degradation from reducing the MLP down-projection across multiple blocks. The growing SR–RN gap is consistent with RN introducing systematic drift and SR limiting its accumulation across blocks.

This compounding effect illustrates a key structural difference between the rounding rules. The deterministic drift introduced by RN in one block acts as a correlated error that systematically shifts activations in subsequent blocks. In contrast, the noise introduced by SR accumulates without compounding directional drift across depth. While SR’s unbiasedness does not survive non-linear operations, empirically, the downstream propagated noise remains far less biased for SR than for RN, validating its theoretical benefits across network depth.

Mixed rounding beats full RN at matched precision

The sweeps above reduce one site or one module at a time, and per-site effects do not add (§ 6.2). We therefore test whether the per-site preferences hold when five sites are reduced together. Each mixed configuration assigns SR or RN per site and is compared with an all-RN configuration at identical per-site precisions (Table 3).

The assignment follows the sublayer sweeps. SR is used at the two output projections, where it is preferred in isolation: attn_c_proj at t=6t = 6 (62.10±0.4262.10 \pm0.42 under SR against 62.91 under RN) and mlp_c_proj at k∈{6,7,8}k \in\{6, 7, 8\} (statistically significant at k=6,7k = 6, 7; not statistically significant at k=8k = 8). RN is used at the two input projections at t=8t = 8, where neither sublayer difference is statistically significant and attn_c_attn favors RN at every lower precision with a statistically significant difference. The head runs under RN at t=11t = 11, where head-only RN is within 0.8% of the reference (63.00). All remaining operations run at

t=24t=24 under RN. The all-RN control replaces SR by RN at the two output projections and changes nothing else.

These results confirm that combining mixed rounding with mixed precision consistently improves overall performance compared to using RN alone. At identical per-site precisions, the mixed configuration gives lower perplexity than all-RN from 3.04% to 28.17% for all three values of kk. The gain grows as the MLP down-projection loses precision, as in the sublayer sweep. Across rows, the mixed configuration at k=6k=6 (69.01 ±\pm 2.07) is not distinguishable from all-RN at k=7k=7 (68.89), and the mixed configuration at k=7k=7 (64.89 ±\pm 0.98) is below all-RN at k=8k=8 (66.66), which lies outside its 95% interval. In this recipe, replacing RN by SR at the two output projections compensates for removing one significand bit at the MLP down-projection.

Limitations

PRISM emulates reduced significand precision while retaining the binary32 exponent range. These results concern significand and accumulator precision under emulation; they do not model the exponent-range restrictions of narrow hardware formats such as FP8 or NVFP4. Transfer to native hardware also depends on its reduction order and arithmetic implementation. Non-target operations in these sweeps use PRISM’s untied RN at t=24t = 24, rather than native ties-to-even (RNE); while exact tie events are rare in continuous floating-point activations, their frequency and impact have not been characterized. Incorporating explicit exponent-range limitations remains future work.

The complete sweeps use one six-block model and one leading text prefix. The measured site ordering and composition effects need replication across texts, larger models, and broader tasks. The reduction bounds and loss decomposition identify relevant quantities, but do not establish a universal rounding assignment or quantitative portability of the observed gains.

Discussion and conclusion

The rounding rule, when treated as a site-specific design variable rather than a network-wide constant, affects perplexity in opposite directions depending on where it is applied. Inside the feedforward network, SR outperforms RN by a wide margin at low precision, reaching an 11.6× perplexity reduction at t=5t = 5. Cumulatively, reducing all six MLP down-projections to t=6t = 6 holds perplexity degradation to 6.0% over the full-precision baseline under SR, against 27% under RN (66.24 against 79.64 perplexity). At the language-model head, the ranking reverses and RN yields substantially lower excess loss. While Chmiel et al. [9] found that RN is generally preferred in the forward pass, and contemporary low-precision formats such as NVIDIA’s NVFP4 (Abecassis et al. [1]) employ SR selectively for gradient casts during training, our results demonstrate that operation-level granularity is equally consequential at inference: scoping SR specifically to the long reductions of the MLP down-projections mitigates accumulated drift, while retaining RN at the output softmax avoids the severe variance penalty that SR incurs there. These site-specific preferences also enable mixed-rounding recipes: assigning SR to the attention and MLP down-projections and RN to the remaining sites yields relative perplexity reductions of 3.04%–28.17% over matched all-RN configurations across the three tested configurations.

§ 5 identifies which quantities determine the site-level trade-off. An exact decomposition separates the signed shift of the target logit from the relative KL distortion of competing classes; a second-order expansion further splits the distortion into a drift-curvature term QQ and a variance penalty VV. At the MLP down-projection, RN’s deterministic errors accumulate into a non-uniform logit shift whose curvature cost exceeds SR’s variance penalty, which is small because the propagated SR noise is predominantly a uniform vocabulary shift that the softmax ignores. At the language-model head, SR’s fluctuation ξ\xi is genuinely non-uniform and is penalized directly by cross-entropy. The decomposition establishes that the comparative advantage of either rounding rule is governed not by raw error magnitude, but by whether the resulting perturbations propagate as a uniform vocabulary shift or disperse as non-uniform distortion across logits.

Establishing the broader generality of this trade-off requires evaluating the decomposition across larger models, varied architectures, and diverse downstream tasks. Porting PRISM directly to GPUs (where an early prototype is in development) and incorporating exponent-range checks into variable-precision frameworks will be essential steps to scale this analysis to modern billion-parameter architectures and complete narrow hardware formats.

Reproducibility. All evaluation pipelines, experiment scripts, and aggregated data are publicly available at https://github.com/big-data-lab-team/fuzzy-llm.

Acknowledgments and Disclosure of Funding

This work was partially funded by the FPT-4 (ANR-24-CE46-7572) project.

Proof of Exactness of the Rounding Decision

This appendix provides the complete proof of Theorem 1 from § 3.1, establishing that the floating-point evaluation of the decision boundary in Algorithm 1 preserves the exact mathematical sign under Hypotheses 1–3.

Sign normalization. Define the sign-normalized variables ρ′=ρ⋅sdir\rho^{\prime} = \rho\cdot s_{\mathrm{dir}}, π′=π⋅sdir\pi^{\prime} = \pi\cdot s_{\mathrm{dir}}, and τ′=τ⋅sdir\tau^{\prime} = \tau\cdot s_{\mathrm{dir}}. Since sdir∈{−1,1}s_{\mathrm{dir}} \in\{-1,1\}, the theorem’s conclusion is equivalent to

(ρ′−π′)+τ′≥0⟺fl⁡(fl⁡(ρ′−π′)+τ′)≥0.(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime} \ge0 \Longleftrightarrow\operatorname{fl}(\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime}) \ge0.

When ρ≠0\rho\ne0, sdir=sgn⁡(ρ)s_{\mathrm{dir}} = \operatorname{sgn}(\rho), so ρ′=∣ρ∣≥0\rho^{\prime} = |\rho| \ge0 and π′=∣π∣≥0\pi^{\prime} = |\pi| \ge0 (since ρ\rho and π\pi share the same sign by Hypothesis 3). When ρ=0\rho= 0, sdir=sgn⁡(τ)s_{\mathrm{dir}} = \operatorname{sgn}(\tau), so ρ′=0\rho^{\prime} = 0 and τ′=∣τ∣≥0\tau^{\prime} = |\tau| \ge0.

Lemma 4 (No collapse to zero) Under Hypotheses 1–3 of Theorem 1, if ρ′≥ulp⁡hw\rho^{\prime} \ge\operatorname{ulp}_{\mathrm{hw}} and (ρ′−π′)+τ′<0(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime} < 0, then fl⁡(fl⁡(ρ′−π′)+τ′)≠0\operatorname{fl}(\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime}) \ne0.

Proof Assume for contradiction that the evaluated result collapses to zero: fl⁡(fl⁡(ρ′−π′)+τ′)=0\operatorname{fl}(\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime}) = 0. An IEEE 754 addition rounds to 0 if and only if the exact sum is 0. Thus, fl⁡(ρ′−π′)+τ′=0⟹fl⁡(ρ′−π′)=−τ′\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime} = 0 \Longrightarrow\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) = -\tau^{\prime}. We now establish the conditions for Sterbenz’s Lemma (Sterbenz, [43]) (ρ′2≤π′≤2ρ′\frac{\rho^{\prime}}{2} \le\pi^{\prime} \le2\rho^{\prime}):

  • Lower bound (π′≥ρ′2\pi^{\prime} \ge\frac{\rho^{\prime}}{2}): Our starting assumption (ρ′−π′)+τ′<0(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime} < 0 rearranges directly to π′>ρ′+τ′\pi^{\prime} > \rho^{\prime} + \tau^{\prime}. By Hypotheses 1 and 2, τ′≥−ulp⁡hw/2≥−ρ′/2\tau^{\prime} \ge-\operatorname{ulp}_{\mathrm{hw}}/2 \ge-\rho^{\prime}/2. Therefore, π′>ρ′−ρ′/2=ρ′/2\pi^{\prime} > \rho^{\prime} - \rho^{\prime}/2 = \rho^{\prime}/2.

  • Upper bound (π′≤2ρ′\pi^{\prime} \le2\rho^{\prime}): The absolute rounding error of the subtraction is bounded by 12ulp⁡hw(−τ′)\frac{1}{2}\operatorname{ulp}_{\mathrm{hw}}(-\tau^{\prime}). By Hypothesis 1, ∣τ′∣≤ulp⁡hw/2|\tau^{\prime}| \le\operatorname{ulp}_{\mathrm{hw}}/2, and ulp⁡hw(⋅)\operatorname{ulp}_{\mathrm{hw}}(\cdot) is nondecreasing in magnitude, so 12ulp⁡hw(−τ′)≤12ulp⁡hw(ulp⁡hw/2)≤ulp⁡hw/2\frac{1}{2}\operatorname{ulp}_{\mathrm{hw}}(-\tau^{\prime}) \le\frac{1}{2}\operatorname{ulp}_{\mathrm{hw}}(\operatorname{ulp}_{\mathrm{hw}}/2) \le\operatorname{ulp}_{\mathrm{hw}}/2. Thus, ∣fl⁡(ρ′−π′)−(ρ′−π′)∣=∣−τ′−(ρ′−π′)∣=∣(ρ′−π′)+τ′∣≤ulp⁡hw/2|\operatorname{fl}(\rho^{\prime} - \pi^{\prime}) - (\rho^{\prime} - \pi^{\prime})| = |-\tau^{\prime} - (\rho^{\prime} - \pi^{\prime})| = |(\rho^{\prime} - \pi^{\prime}) + \tau^{\prime}| \le\operatorname{ulp}_{\mathrm{hw}}/2. Applying the reverse triangle inequality yields ∣ρ′−π′∣−∣τ′∣≤ulp⁡hw/2|\rho^{\prime} - \pi^{\prime}| - |\tau^{\prime}| \le\operatorname{ulp}_{\mathrm{hw}}/2. Since ∣τ′∣≤ulp⁡hw/2|\tau^{\prime}| \le\operatorname{ulp}_{\mathrm{hw}}/2 and ulp⁡hw≤ρ′\operatorname{ulp}_{\mathrm{hw}} \le\rho^{\prime}, we obtain ∣ρ′−π′∣≤ulp⁡hw≤ρ′|\rho^{\prime} - \pi^{\prime}| \le\operatorname{ulp}_{\mathrm{hw}} \le\rho^{\prime}. This bound implies ρ′−π′≥−ρ′\rho^{\prime} - \pi^{\prime} \ge-\rho^{\prime}, which gives π′≤2ρ′\pi^{\prime} \le2\rho^{\prime}.

Sterbenz’s Lemma guarantees the subtraction is exact: fl⁡(ρ′−π′)=ρ′−π′\operatorname{fl}(\rho' - \pi') = \rho' - \pi'. Substituting this exactness back into our derivation yields (ρ′−π′)+τ′=0(\rho' - \pi') + \tau' = 0, which contradicts our starting assumption that (ρ′−π′)+τ′<0(\rho' - \pi') + \tau' < 0. Therefore, the collapse to 0 is impossible.

Proof of Theorem 1. Case ρ=0\rho= 0. When ρ′=0\rho' = 0, the subtraction fl⁡(ρ′−π′)=fl⁡(−π′)=−π′\operatorname{fl}(\rho' - \pi') = \operatorname{fl}(-\pi') = -\pi' is exact, since negation is exact in IEEE 754. The evaluation reduces to a single rounding fl⁡(−π′+τ′)\operatorname{fl}(-\pi' + \tau'). For the forward direction (⟹\Longrightarrow), assume (ρ′−π′)+τ′≥0(\rho' - \pi') + \tau' \ge0; then fl⁡(−π′+τ′)≥0\operatorname{fl}(-\pi' + \tau') \ge0 by monotonicity. For the backward direction (⟸\Longleftarrow), assume fl⁡(−π′+τ′)≥0\operatorname{fl}(-\pi' + \tau') \ge0 but, for contradiction, (ρ′−π′)+τ′<0(\rho' - \pi') + \tau' < 0. Monotonicity forces fl⁡(−π′+τ′)≤0\operatorname{fl}(-\pi' + \tau') \le0, hence the result is exactly 0. But an IEEE 754 addition of representable inputs rounds to 0 only when the exact sum is 0, a contradiction.

Case ρ≠0\rho\ne0. Hypothesis 2 gives ρ′=∣ρ∣≥ulp⁡hw\rho' = \lvert\rho\rvert\ge\operatorname{ulp}_{\mathrm{hw}}. For the forward direction (⟹\Longrightarrow), assume (ρ′−π′)+τ′≥0(\rho' - \pi') + \tau' \ge0, i.e., ρ′−π′≥−τ′\rho' - \pi' \ge-\tau'. By monotonicity, fl⁡(ρ′−π′)≥fl⁡(−τ′)=−τ′\operatorname{fl}(\rho' - \pi') \ge\operatorname{fl}(-\tau') = -\tau', so fl⁡(ρ′−π′)+τ′≥0\operatorname{fl}(\rho' - \pi') + \tau' \ge0. Applying monotonicity once more, fl⁡(fl⁡(ρ′−π′)+τ′)≥0\operatorname{fl}(\operatorname{fl}(\rho' - \pi') + \tau') \ge0. For the backward direction (⟸\Longleftarrow), assume fl⁡(fl⁡(ρ′−π′)+τ′)≥0\operatorname{fl}(\operatorname{fl}(\rho' - \pi') + \tau') \ge0 but, for contradiction, (ρ′−π′)+τ′<0(\rho' - \pi') + \tau' < 0. By the same monotonicity argument with reversed inequalities, fl⁡(fl⁡(ρ′−π′)+τ′)≤0\operatorname{fl}(\operatorname{fl}(\rho' - \pi') + \tau') \le0. Combined with the assumption, the floating-point result is exactly 0. But Lemma 4 shows this collapse is impossible, a contradiction.

Drift and variance measurements

Table 4 provides the numerical decomposition behind § 5.3. All estimates condition on the same N=1020N = 1020 scored positions.

Logit measurement protocol. The evaluation uses the same DistilGPT-2 checkpoint and N=1020N = 1020 scored WikiText-2 positions as the perplexity sweeps (§ 6.1), with full-precision reference loss L0=4.1354\mathcal{L}_0 = 4.1354 nats (PPL0=62.51\mathrm{PPL}_0 = 62.51). Unlike the RN-background sweeps in § 6.1, instrumented operations outside the lowered site use the matching rounding rule at t=24t = 24 (SR background for SR; RN for RN). The SR perturbations therefore include full-precision background rounding; an eight-seed SR control with no lowered site yields mean excess loss of (6.66±14.48)×10−8(6.66 \pm14.48) \times10^{-8} nats, verifying that the background contribution is negligible. As noted in § 5.3, the decomposition estimates condition on this text using S=32S = 32 SR seeds and one deterministic RN run per precision (t=4,…,10t = 4,\ldots,10).

Finite-seed estimators. With b^=S−1∑sΔs\hat{b} = S^{-1}\sum_s \Delta_s, A=12S∑sVar⁡p(Δs)A = \frac{1}{2S}\sum_s \operatorname{Var}_{p}(\Delta_s), and B=12Var⁡p(b^)B = \frac{1}{2}\operatorname{Var}_{p}(\hat{b}), the unbiased quadratic estimators are Q^=SB−AS−1=B−V^S\hat{Q} = \frac{SB-A}{S-1} = B - \frac{\hat{V}}{S} and V^=S(A−B)S−1\hat{V} = \frac{S(A-B)}{S-1}. We use D^=gTb^\hat{D} = g^\mathsf{T}\hat{b} and define R^\hat{R} by subtracting these three terms from the measured mean excess loss; agreement of their sum is therefore not an independent validation. Standard errors are estimated by leaving out each seed in turn and recomputing the estimator. Although Q≥0Q \ge0, its unbiased estimate can be negative: at the head and t=8t = 8, Q^\hat{Q} is −0.0017±0.0013-0.0017 \pm0.0013 at S=8S = 8 and −0.0003±0.0004-0.0003 \pm0.0004 at S=32S = 32. Both estimates lie within two standard errors of zero. We compute the variance penalty without forming the full covariance matrix via 2V=tr⁡(HΣ)=∑jpjΣjj−Var⁡p(τTΔ)2V = \operatorname{tr}(H\Sigma) = \sum_j p_j\Sigma_{jj} - \operatorname{Var}_p(\tau^\mathsf{T}\Delta), which requires only the coordinate variances and the variance of pTΔp^\mathsf{T}\Delta.

References

  1. [1]F. Abecassis, A. Agrusa, D. Ahn, J. Alben, et al. Pretraining large language models with NVFP4. arXiv preprint arXiv:2509.25149, 2025.arxiv.org/abs/2509.25149
  2. [2]Amazon Web Services. NeuronCore-v2 architecture. Neuron Documentation, https://awsdocs-neuron.readthedocs-hosted.com, 2023.
  3. [3]S. Ashkboos, A. Mohtashami, M. L. Croci, B. Li, P. Cameron, M. Jaggi, D. Alistarh, T. Hoefler, and J. Hensman. QuaRot: Outlier-free 4-bit inference in rotated LLMs. In Advances in Neural Information Processing Systems, volume 37, pages 100213–100240, 2024. doi: 10.52202/079017-3180.DOI
  4. [4]S. Ben Ali, S.-I. Filip, and O. Sentieys. A stochastic rounding-enabled low-precision floating-point MAC for DNN training. In 2024 Design, Automation & Test in Europe Conference & Exhibition (DATE), pages 1–6. IEEE, 2024. doi: 10.23919/DATE58400.2024.10546735.DOI
  5. [5]T. Beuzeville, A. Buttari, S. Gratton, and T. Mary. Deterministic and probabilistic rounding error analysis of neural networks in floating-point arithmetic. IMA Journal of Numerical Analysis, 2026. doi: 10.1093/imanum/draf130.DOI
  6. [6]P. Blanchard, D. J. Higham, and N. J. Higham. Accurately computing the log-sum-exp and softmax functions. IMA Journal of Numerical Analysis, 41(4):2311–2330, 2021. doi: 10.1093/imanum/draa038.DOI
  7. [7]S. Boldo and J.-M. Muller. Exact and approximated error of the FMA. IEEE Transactions on Computers, 60(2):157–164, 2011. doi: 10.1109/TC.2010.139.
  8. [8]Y. Chatelain. PRISM: Probabilistic rounding with instruction set management. https://github.com/verificarlo/prism, 2026.
  9. [9]B. Chmiel, R. Banner, E. Hoffer, H. Ben-Yaacov, and D. Soudry. Accurate neural training with 4-bit matrix multiplications at standard formats. In International Conference on Learning Representations, 2023.arxiv.org/abs/2112.10769
  10. [10]M. P. Connolly, N. J. Higham, and T. Mary. Stochastic rounding and its probabilistic backward error analysis. SIAM Journal on Scientific Computing, 43(1):A566–A585, 2021. doi: 10.1137/20M1334796.
  11. [11]M. Croci, M. Fasi, N. J. Higham, T. Mary, and M. Mikaitis. Stochastic rounding: implementation, error analysis and applications. Royal Society Open Science, 9(3):211631, 2022. doi: 10.1098/rsos.211631.DOI
  12. [12]P. de Oliveira Castro, E.-M. El Arar, E. Petit, and D. Sohier. Error analysis of sum-product algorithms under stochastic rounding. SIAM Journal on Scientific Computing, 47(6):B1481–B1502, 2025. doi: 10.1137/24M1710966.DOI
  13. [13]T. J. Dekker. A floating-point technique for extending the available precision. Numerische Mathematik, 18(3):224–242, 1971. doi: 10.1007/BF01397083.DOI
  14. [14]C. Denis, P. de Oliveira Castro, and E. Petit. Verificarlo: checking floating point accuracy through Monte Carlo arithmetic. In 2016 IEEE 23rd Symposium on Computer Arithmetic (ARITH), pages 55–62, 2016. doi: 10.1109/ARITH.2016.31.DOI
  15. [15]T. Dettmers, M. Lewis, Y. Belkada, and L. Zettlemoyer. LLM.int8(): 8-bit matrix multiplication for transformers at scale. In Proceedings of the 36th International Conference on Neural Information Processing Systems, NIPS ’22, pages 30318–30332, Red Hook, NY, USA, 2022. Curran Associates Inc. ISBN 9781713871088. doi: 10.52202/068431-2198.DOI
  16. [16]E.-M. El Arar, D. Sohier, P. de Oliveira Castro, and E. Petit. Stochastic rounding variance and probabilistic bounds: A new approach. SIAM Journal on Scientific Computing, 45 (5):C255–C275, 2023. doi: 10.1137/22M1510819.DOI
  17. [17]E.-M. El Arar, D. Sohier, P. de Oliveira Castro, and E. Petit. Bounds on non-linear errors for variance computation with stochastic rounding. SIAM Journal on Scientific Computing, 46(5):B579–B599, 2024. doi: 10.1137/23M1563001.DOI
  18. [18]M. Fasi and M. Mikaitis. Algorithms for stochastically rounded elementary arithmetic operations in IEEE 754 floating-point arithmetic. IEEE Transactions on Emerging Topics in Computing, 9(3):1451–1466, 2021. doi: 10.1109/TETC.2021.3069165.DOI
  19. [19]F. Févotte and B. Lathuilière. VERROU: Assessing floating-point accuracy without recompiling. Technical report, EDF R&D, 2016. HAL: hal-01383417.DOI
  20. [20]G. E. Forsythe. Reprint of a note on rounding-off errors. SIAM Review, 1(1):66–67, 1959. doi: 10.1137/1001011.DOI
  21. [21]Z. Gong, J. Liu, J. Wang, X. Cai, D. Zhao, and R. Yan. What makes quantization for large language model hard? an empirical study from the lens of perturbation. Proceedings of the AAAI Conference on Artificial Intelligence, 38(16):18082–18089, 2024. doi: 10.1609/aaai.v38i16.29765.DOI
  22. [22]I. González-Pepe, H. Akhaddar, T. Glatard, and Y. Chatelain. Fuzzy PyTorch: Rapid numerical variability evaluation for deep learning models. Transactions on Machine Learning Research, 2026. arXiv:2605.25991.
  23. [25]S. Graillat, P. Langlois, and N. Louvet. Improving the compensated Horner scheme with a fused multiply and add. In Proceedings of the 2006 ACM Symposium on Applied Computing, pages 1323–1327, 2006. doi: 10.1145/1141277.1141585.DOI
  24. [26]Graphcore. AI-Float: Mixed-precision arithmetic for AI, a hardware perspective. Technical white paper, https://docs.graphcore.ai, 2020.
  25. [27]S. Gupta, A. Agrawal, K. Gopalakrishnan, and P. Narayanan. Deep learning with limited numerical precision. In Proceedings of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of Machine Learning Research, pages 1737–1746. PMLR, 2015.
  26. [28]D. Hendrycks and K. Gimpel. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415, 2016.
  27. [29]N. J. Higham. Accuracy and Stability of Numerical Algorithms. SIAM, Philadelphia, PA, 2nd edition, 2002. doi: 10.1137/1.9780898718027.
  28. [30]N. J. Higham and T. Mary. A new approach to probabilistic rounding error analysis. SIAM Journal on Scientific Computing, 41(5):A2815–A2835, 2019. doi: 10.1137/18M1226312.DOI
  29. [31]Hugging Face. DistilGPT2 model card. https://huggingface.co/distilbert/distilgpt2, 2020.
  30. [32]IEEE. IEEE standard for floating-point arithmetic. IEEE Std 754-2019, 2019.
  31. [33]I. C. F. Ipsen and H. Zhou. Probabilistic error analysis for inner products. SIAM Journal on Matrix Analysis and Applications, 41(4):1726–1741, 2020. doi: 10.1137/19M1270434.DOI
  32. [34]S. Kim, C. Hooper, A. Gholami, Z. Dong, X. Li, S. Shen, M. W. Mahoney, and K. Keutzer. SqueezeLLM: Dense-and-sparse quantization. In Proceedings of the 41st International Conference on Machine Learning, volume 235 of Proceedings of Machine Learning Research, pages 23901–23923. PMLR, 2024.arxiv.org/abs/2306.07629
  33. [35]J. Lin, J. Tang, H. Tang, S. Yang, W.-M. Chen, W.-C. Wang, G. Xiao, X. Dang, C. Gan, and S. Han. AWQ: Activation-aware weight quantization for on-device LLM compression and acceleration. In Proceedings of Machine Learning and Systems, volume 6, pages 87–100, 2024.DOI
  34. [36]J. Martens. New insights and perspectives on the natural gradient method. Journal of Machine Learning Research, 21(146):1–76, 2020. URL https://www.jmlr.org/papers/v21/17–678.html.
  35. [37]S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations, 2017.arxiv.org/abs/1609.07843
  36. [38]J.-M. Muller, N. Brunie, F. de Dinechin, C.-P. Jeannerod, M. Joldes, V. Lefèvre, G. Melquiond, N. Revol, and S. Torres. Handbook of Floating-Point Arithmetic. Birkhäuser, 2nd edition, 2018. doi: 10.1007/978-3-319-76526-6.DOI
  37. [39]M. Nagel, R. A. Amjad, M. van Baalen, C. Louizos, and T. Blankevoort. Up or down? Adaptive rounding for post-training quantization. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 7197–7206. PMLR, 2020.arxiv.org/abs/2004.10568
  38. [40]NVIDIA. Parallel thread execution ISA: The cvt.rs stochastic-rounding instruction. CUDA Documentation, https://docs.nvidia.com/cuda, 2025.
  39. [41]D. S. Parker. Monte carlo arithmetic: exploiting randomness in floating-point arithmetic. Technical Report CSD-970002, University of California, Los Angeles, 1997.
  40. [42]A. Radford, J. Wu, R. Child, D. Luan, D. Amodei, and I. Sutskever. Language models are unsupervised multitask learners. Technical report, OpenAI, 2019.
  41. [43]P. H. Sterbenz. Floating-Point Computation. Prentice-Hall, Englewood Cliffs, NJ, 1974.
  42. [44]A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30, pages 5998–6008, 2017.arxiv.org/abs/1706.03762
  43. [45]T. Wolf, L. Debut, V. Sanh, J. Chaumond, C. Delangue, A. Moi, P. Cistac, T. Rault, R. Louf, M. Funtowicz, et al. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38–45, 2020. doi: 10.18653/v1/2020.emnlp-demos.6.DOI
  44. [46]G. Xiao, J. Lin, M. Seznec, H. Wu, J. Demouth, and S. Han. SmoothQuant: Accurate and efficient post-training quantization for large language models. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 38087–38099. PMLR, 2023.arxiv.org/abs/2211.10438
  45. [47]R. Xiong, Y. Yang, D. He, K. Zheng, S. Zheng, C. Xing, H. Zhang, Y. Lan, L. Wang, and T.-Y. Liu. On layer normalization in the transformer architecture. In Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 10524–10533. PMLR, 2020.arxiv.org/abs/2002.04745
  46. [48]T. Zhang, Z. Lin, G. Yang, and C. De Sa. QPyTorch: A low-precision arithmetic simulation framework. In 2019 Fifth Workshop on Energy Efficient Machine Learning and Cognitive Computing - NeurIPS Edition (EMC2-NIPS), pages 10–13, 2019. doi: 10.1109/EMC2-NIPS553020.2019.00010.arxiv.org/abs/1910.04540

Paper details

vlnc:W_uf7uhxq8
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 10

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Not recorded for this paper

View statement
Looking for related papers…
Contents