TL;DR
When accelerating Large Language Models with ultra-fast 8-bit hardware math (MXFP8), standard implementations accidentally allow future words to leak backward in time and alter past predictions. This happens because numbers are compressed in blocks of 32 tokens, letting a large future value dictate how an earlier, visible value gets rounded—even when causal masking tries to hide it. The authors introduce a clever mathematical sleight-of-hand called "scale folding" that restores strict time-causality without sacrificing the speed or memory benefits of native 8-bit hardware.
What Problem Does This Paper Address?
Autoregressive language models live by one sacred rule: causality. When predicting word 48, the model can look at words 0 through 47, but word 55 must remain completely invisible. During training and prompt processing ("prefill"), models process entire sequences in parallel and enforce this rule by multiplying future attention scores by zero—a technique called causal masking.
To speed up attention's costly matrix multiplications on modern GPUs (like NVIDIA's Blackwell), engineers use MXFP8—a format that squeezes numbers into 8 bits, grouping 32 elements together under a single shared power-of-two scaling factor.
Here is the catch: when aggregating Value ($V$) vectors, each 32-element group spans 32 consecutive tokens. Consider a block covering tokens 32 to 63 when the model is at position 47. Tokens 32–47 are in the past (visible), while 48–63 are in the future (masked). Standard MXFP8 implementations compute the shared scale across all 32 tokens before masking happens. If token 55 suddenly has a massive number, it drives up the shared scale for the entire block, forcing a tiny visible number at token 32 to underflow and round to zero! Even though token 55 gets multiplied by zero later, its ghost has already altered token 32's value. A masked future is not a hidden future.
Methods
Only the "boundary block"—the 32-token chunk straddling the current position—suffers from this time-travel bug. Earlier blocks are 100% visible; later blocks are 100% zeroed out. Previous work fixed this by falling back to slower 16-bit (BF16) math at the boundary. This paper keeps everything in fast, native MXFP8 using three components:
- Token-Local Scale Folding (Forward/Prefill): For completed past blocks, the authors reuse standard, fast MXFP8 kernels. For the boundary block, instead of scaling across 32 tokens, they compute a scale across the features of each individual visible token. Hardware MXFP8 units hate this—they expect a uniform scale across tokens. So the authors pull an algebraic trick: since attention multiplies weights ($P$) by values ($V$), they "fold" (multiply) each token's unique value scale directly into its scalar attention weight, leaving the values with a uniform dummy scale ($1/256$). Both matrices can now be multiplied in native MXFP8 with zero future dependency!
- Dequantized-Input Backward Pass: Standard MXFP8 backward passes also leak future info via sequence-wide scaling. Instead of saving bulky 16-bit $Q, K, V$ tensors, the authors save the compact 8-bit forward payloads and decode them to BF16 on the fly for a FlashAttention-4 backward pass.
- Paged Incremental KV Cache (Decode): During token-by-token generation, all cached tokens are already in the past. The cache maintains running MXFP8 scales in the open 32-token block, rescaling up to 31 prior 8-bit values only after the current step reads them, preserving causality.
Datasets
- English C4 (Colossal Clean Crawled Corpus): Validation split used for leakage and consistency evaluations (at 4K and 32K context lengths), plus ~5B tokens used for end-to-end training runs from scratch and prefill fidelity checks.
- Synthetic Benchmarks: Controlled tensor shapes used to stress-test gradient accuracy and kernel microbenchmarks, plus repeated-sentence prompts for vLLM serving throughput. No new datasets were introduced.
Key Insights and Ideas
- Subnormal rounding breaks power-of-two invariance: You might assume scaling by powers of two just shifts exponents without losing precision. The authors prove with a clean counterexample that a future spike can push a visible value into the subnormal range (or flush it to zero), erasing real signal.
- Models don't "learn away" the leak: Training a model from scratch with leaky MXFP8 does not teach it to ignore future scale interference. Checkpoints trained for 5B tokens still flip their top-1 next-word predictions 3.6× to 4.2× more often than causal kernels when comparing a full sequence against its prefix alone.
- Hardware harmony via algebra: Rather than fighting tensor core layouts or dropping to higher precision at causal boundaries, moving scaling factors across operands ($p \cdot (s \cdot u) = (p \cdot s) \cdot u$) satisfies both hardware constraints and strict mathematical causality.
Key Results
Evaluated on NVIDIA B200 GPUs using Qwen3-4B-Base and Qwen3-14B-Base:
- Zero Leakage: When amplifying masked future values by $2^{10}$, stock MXFP8 altered earlier logits in 100% of at-risk positions (up to 1.41 median max logit shift). The authors' causal MXFP8 kernel produced bitwise-identical prefix outputs.
- Restored Prediction Consistency: On Qwen3-4B at 32K context, comparing next-token predictions on a full sequence vs. just its prefix dropped top-1 disagreement from 0.416% (681 flips in stock MXFP8) down to 0.021% (34 flips)—nearly matching the BF16 reference of 0.015% (25 flips).
- Faster, Lighter Training: At 32K context on Qwen3-4B, the complete causal recipe boosts end-to-end training throughput by 4.9% and cuts peak memory by 5.2% vs. BF16 (and beats the BF16-boundary fallback by 3.0% in speed and 13.1% in memory).
- Inference Speedups: Single-request vLLM decode throughput improves by 3.8–9.9% on Qwen3-4B over standard FP8 attention/KV-cache (and 0.5–4.2% on Qwen3-14B) with slightly better prefill log-likelihood.
Limitations and Future Work
- Short-Context Overhead: At 4K context, operand preparation costs aren't fully amortized—training runs 2.1% slower and uses 1.2% more memory than BF16.
- Implementation Constraints: The training/prefill kernel currently requires head dimension 128, zero dropout, and sequence lengths divisible by 128. The vLLM integration only supports single-token decoding and unchunked prefill without prefix caching.
- Surrogate & Rescaling Approximations: The backward pass is a close surrogate rather than an exact derivative, and prefill vs. decode still use slightly different boundary representations (meaning causality is preserved, though bitwise identity between prefill and decode is not guaranteed). Evaluating downstream impacts in reinforcement learning (RL)—where models generate sequentially and score in parallel—is left for future work.
Summary updated