Manuscript Offprint

arXiv:2609.39813

Backward-State Policy Is Part of the Learning Algorithm

Shuxiao Xie, Shuyang Xie, Dezhi Ran, Wei Yang, Tao Xie

Abstract

Low-precision training rounds tensors that the backward pass reads again, often for several gradients; each use can read the forward's rounded value, the original, or a new random rounding. This backward-state policy looks like a memory and precision detail, settled by copy accuracy and final loss. We argue that it is part of the learning algorithm, and that neither check shows whether it is right. Copy accuracy does not decide the outcome: in three pairs of 390M runs with an emulated FP8 backward, training fails when attention's backward reuses the forward's rounded output and succeeds with a new rounding from the same distribution. Even the most accurate copy, the original itself, can be wrong by our reference: the gradient of the forward pass as it actually ran, with gradients passed through rounding unchanged. For example, a normalization output stored in low precision feeds two gradients: the gain's gradient needs the original, but the next layer's weight gradient needs the rounded value that layer multiplied. Final loss, the other check, does not rule out the error of reading the original for both: it persists in models trained with such a store, while planned loss comparisons stay within a margin fixed in advance. We therefore derive from this reference which value each use must read, or which substitute gives the same gradient on average with the forward held fixed, and check these per-use requirements on single operators, without training. In three tests using PyTorch and Transformer Engine, the requirements predicted beforehand whether reuse changes what the backward computes on average relative to an independent copy, and every prediction held. Backward-state policy is thus part of the learning algorithm: it should be specified and checked use by use, not settled by copy accuracy and final loss.

1 Introduction

Large language models are now trained in low precision, with FP8 (8-bit floating point) at scale [12, 27, 33] and 4-bit formats following [6, 9]. The forward pass rounds tensors before operations consume them, and the backward pass reads many of these tensors again, often for several gradients. Keeping them at full precision costs memory, so implementations decide what the backward receives: FlashAttention saves the attention output [11], activation-compressed training keeps few-bit copies of activations for the backward [8, 24], and checkpointing

∗^{*}Equal contribution.

†^{\dagger}Corresponding authors: dezhiran@pku.edu.cn and taoxie@pku.edu.cn.

PREPRINT

Same rounding distribution

Reuse the forward's rounding

New random rounding

Third run: no copy of O

D from probabilities

(a) Original software stack

(b) Newer software stack (replication)

Figure

Training step

Figure 1: Same rounding distribution, opposite outcomes. Training loss of 390M runs with an emulated FP8 attention backward, forked from one checkpoint; all consume a stochastic rounding of the attention output O, and within each panel they differ only in how the correction term D is computed. (a) The first of three pairs: reusing the forward's rounding fails (final loss 7.314); a new rounding from the same distribution trains (3.256), like a control whose D reads no copy of O. (b) The runs of (a), repeated on newer versions of PyTorch and Transformer Engine.

recomputes parts of the forward [34]. 3^{3} Once a tensor has been rounded, these choices decide which value each gradient reads: the rounded value the forward used, the original, or a new random rounding of the original. We call each gradient computation that reads a rounded tensor a use, and the choice made for every use the backward-state policy.

Viewed as ways of keeping a tensor, these choices look like a memory and precision detail, settled by two checks: whether the copy is close to the original, and whether the final loss looks normal. A use, however, reads its value to compute one particular gradient, so the value it reads can change the gradient that training follows. We argue that the backward-state policy is part of the learning algorithm, and that neither check shows whether it is right.

Low-precision attention shows what is at stake. FOG, a study of fully FP8 training, reports that FP8 attention training diverges on standard architectures and avoids the failure with new architectures [17]. In our runs, changing only the backward can prevent such a failure. In FOG's 390M setting, the FP8 attention of NVIDIA's Transformer Engine fails on all 3 seeds we ran, and replacing only its backward with a BF16 (bfloat16) one removes the failure while keeping the FP8 forward (Section 2). In a separate study of BF16 FlashAttention, Qiu and Yao [36] locate a failure in a correction term of the attention backward, D=rowsum(dO∘O)D = \text{rowsum}(dO \circ O), which reads the saved output O and its incoming gradient dO. They trace the term's error to biased rounding in computing O, which their change to the forward's softmax normalization prevents. Attn-QAT, a 4-bit attention method, instead gives D a separate high-precision attention output [55]. Qiu and Yao's fix and Attn-QAT's separate output both make the value that D reads more accurate.

If copy accuracy settled the choice, D could read either of two equally accurate copies of O without changing whether training succeeds. We test this directly, letting the forward round O at random [15] so that a new rounding from the same distribution is as accurate as the forward's own. The two differ in one respect: only the forward's rounding went into the loss, so dO can depend on it but not on the new one. In our 390M runs with an emulated FP8 attention backward, training fails when D reuses the forward's rounding and trains when D reads a new rounding from the same distribution (Figure 1).

These results show that what the backward reads can decide the outcome. A successful run still leaves open which gradient it followed and which choice is right. To check whether a policy preserves the gradient of the computation that produced the loss, we declare a reference: the gradient of the forward pass as it actually ran, with gradients passed through each rounding unchanged as in the straight-through convention [4, 51]. Under this reference, each use needs the value its forward operation used, rounded or original, or a substitute that gives

3^{3}The main text discusses related work where it bears on each result; Appendix A surveys it by area.

PREPRINT

the same gradient on average conditional on the realized forward and the incoming gradient the use actually receives.

Judged this way, even the most accurate copy can be wrong, because one tensor can feed gradients that need different values. A normalization output rounded to low precision in the forward feeds two: the gain's gradient needs the original, because the gain scaled unrounded values, and the next layer's weight gradient needs the rounded value, because that layer multiplied it. No single value read by both is always right for both. For the probabilities that FP8 attention rounds before multiplying them by V, we prove, under stated assumptions, that no single substitute is always right on average at both of their uses.

Final loss, the other check, does not reveal such an error either. In our 390M models trained with the rounded output feeding the next layer and the original read by both gradients, the error persists, yet the final loss stays within a margin, fixed in advance, of the policy that follows the reference. Loss can show that a policy fails to train; it cannot show that it keeps the reference.

We therefore check the policy at each use. From the reference we derive per-use requirements, which state the value each use must read or the substitutes it may read. Each can be checked on its operator without training, using the random dependencies of the incoming gradient it actually receives. An executable checker tests stated policies against the requirements on small finite cases. The requirements also predict when reuse matters, the contrast of Figure 1. Averaged over both roundings, handing a use the forward's rounding instead of a new one can change what the backward computes only if the use's incoming gradient depends on that rounding. We registered such predictions before testing three operators of PyTorch and Transformer Engine, and every one held, including predictions that reuse changes nothing.

References (49)