Fixing Causality in MXFP8 Attention: Preventing Masked Futures from Influencing the Past

MXFP8 attention's block-level scales leak future info; token-local scales fix causality while keeping speed.
MXFP8 attention's block-level shared quantization scales let masked future tokens influence earlier token rounding, breaking causality. A proposed causal attention kernel uses token-local scales folded into attention weights while keeping native MXFP8 forward matmuls. It cuts the full-sequence vs. prefix inconsistency rate from 0.416% to 0.021% (near BF16's 0.015%), boosts training throughput 4.9%, cuts peak memory 5.2%, and improves decoding throughput 3.8%–9.9% over vLLM's FP8 setup.
Title
Fixing Causality in MXFP8 Attention: Preventing Masked Futures from Influencing the Past
Meta Description
Block-level shared quantization scales in MXFP8 attention let masked future tokens affect past predictions, breaking causality. Researchers propose a causal attention kernel using token-local scales with weight folding, cutting the full-sequence vs. prefix inconsistency rate from 0.416% to 0.021% while preserving native MXFP8 speed—plus throughput gains and lower memory usage.
Article Content
Causal attention is the cornerstone of autoregressive language models: during parallel training and prompt prefill, it must ensure that future tokens do not affect predictions at earlier positions. However, as sequence length grows, attention computation scales quadratically, which drives researchers to adopt lower-precision arithmetic for acceleration. MXFP8 was created for exactly this purpose—it makes 8-bit matrix multiplication efficient on NVIDIA Blackwell GPUs. But shared quantization scales introduce a subtle side effect: masked future tokens can still change how earlier values are rounded, thereby breaking causality.

Why MXFP8 Attention "Leaks the Future"
In Transformer Engine's default MXFP8 attention implementation, quantization scales are shared at the token-block level. This means a block containing both visible tokens and future tokens shares a single scale. Although the numerical values of future tokens are masked out and do not participate in computing attention weights, they do participate in determining the scale, which in turn changes the quantization rounding results of the visible tokens. In one sentence: masking prevents the "content" of future tokens from entering, but it fails to prevent their "statistics" from influencing the past.
This is not theoretical nitpicking. The research demonstrates this dependency in a released language model: for the same prefix, the most likely next token differs between the full-sequence input and the prefix-only input. In other words, the causal structure the model learned during training diverges from its behavior at inference time.
MXFP8 (Microscaling FP8) is an 8-bit floating-point microscaling format standard proposed by OCP, part of the MX family (alongside MXFP6 and MXFP4). Its core idea is to divide tensors into fixed-size blocks (typically 32 elements each), share a single E8M0 power-of-two scaling factor per block, and represent elements within the block in FP8 (E4M3 or E5M2). Compared with traditional per-tensor quantization, block-level scales strike a compromise between precision and implementation complexity, and are natively supported by the NVIDIA Blackwell architecture, enabling matrix multiplication at near-FP8 throughput on tensor cores. It is precisely this "shared scale within a block" design that is the root of the causality problem discussed below: as long as future tokens are mixed into a block, their values participate in determining that block's scale, thereby indirectly affecting the quantization results of visible tokens in the same block.
Cutting the Dependency with Token-Local Scales
To address this problem, the authors propose a causal attention kernel. The core idea is not complicated: within a value block that contains both visible and future tokens, abandon the block-level shared scale, switch to token-local quantization scales, and fold these scales into the corresponding attention weights. This way, the statistics of future tokens can no longer affect the rounding of earlier tokens, and causality is restored.
Crucially, this change does not sacrifice MXFP8's speed advantage: the two forward matrix multiplications still use native MXFP8. To cover the full training and inference pipeline, the authors also implement a causal dequantize-input backward pass (for training) and an MXFP8 KV cache (for inference).
Dequantize-input backward refers to a strategy for handling gradients of quantized matrix multiplication during the backward training phase. In the forward pass, a matrix multiplication is C = A·B, where A and B are approximations obtained by scaling and then quantizing under MXFP8; when computing dA and dB in the backward pass, one must decide whether gradients are computed with respect to the original high-precision inputs or the quantized inputs. Differentiating with respect to the "dequantized input" means treating the quantization operator as a straight-through approximation and using the dequantized high-precision values in gradient computation, thereby preventing quantization noise from blocking gradients. Causality additionally requires that the backward path must not mix block-level statistics across tokens, so the authors retain token-local scales in the backward pass to ensure consistent causal semantics in both training and inference stages.
What the Experimental Data Shows
On Qwen3-4B-Base with a 32K context, the kernel reduces the inconsistency rate between "full sequence vs. prefix" on the most likely next token from 0.416% to 0.021%, very close to the BF16 reference implementation's 0.015%. This number is telling: the original MXFP8 attention's inconsistency rate is more than an order of magnitude higher than BF16's, while the fixed version essentially returns to the same order of magnitude.
For end-to-end training, in Qwen3-4B training with a 32K context, the approach improves throughput by 4.9% and reduces peak memory by 5.2% relative to BF16. In single-request inference scenarios, across the 4K–32K context range, Qwen3-4B decoding throughput improves by 3.8%–9.9% compared with vLLM using FP8 attention and FP8 KV cache; on Qwen3-14B, throughput is roughly comparable.
Implications for Low-Precision Attention Practices
This work reveals an easily overlooked engineering detail: the correctness of low-precision attention depends not only on whether the mask is applied correctly, but also on the design of quantization granularity. Block-level shared scales offer advantages in matrix multiplication efficiency, but they "secretly" bring information from future tokens into the computation path of the past. The token-local scale plus weight folding approach provides a feasible path to restore causality while preserving native MXFP8 speed.
For teams doing long-context training or inference on the Blackwell platform, this means it is worth checking the consistency between full-sequence and prefix inputs before switching to MXFP8 attention. An inconsistency rate of 0.416% may not seem high, but in long-context and large-scale deployments, it can affect the reproducibility of model behavior in ways that are hard to trace. The fixed version compresses this gap to near-BF16 levels while retaining the throughput and memory benefits of reduced precision—a compromise worth including in evaluations.
One-line Summary
MXFP8 attention's block-level shared scales leak future-token information; token-local scales restore causality while preserving speed.
Paragraph Summary
The article points out that although MXFP8 attention accelerates long-sequence computation on Blackwell, its block-level shared quantization scales let masked future tokens participate in determining the scale, thereby altering the rounding results of visible tokens and breaking causality; this dependency is observable in released language models—the same prefix yields different most likely next tokens under full-sequence versus prefix-only input. The authors' causal attention kernel switches to token-local quantization scales within value blocks containing both visible and future tokens and folds them into attention weights, while forward matrix multiplications remain native MXFP8, with accompanying causal backward propagation and an MXFP8 KV cache. Experiments show the inconsistency rate drops from 0.416% to 0.021% (close to BF16's 0.015%), training throughput improves by 4.9% with peak memory reduced by 5.2%, and inference decoding throughput improves by 3.8%–9.9% over vLLM's FP8 solution.
Related articles

The Most Detailed Codex Tutorial on Bilibili: 5 Hours from Installation to 80% Cost Reduction
Based on Bilibili creator Wei Fanshi's detailed Codex tutorial, this guide covers official download, connecting DeepSeek API via CCSwitch, and tuning methods including guided mode, memory, the Agent manual, and the Ponytail and Caveman Skills—helping domestic users bypass network and account barriers and reduce token consumption.

Codex for Beginners: Connecting DeepSeek and Token-Saving Tips
Beginner Codex tutorial: skip network hassles using CC Switch to connect the domestic DeepSeek model, plus practical tips to cut Token usage and boost efficiency, including installation, configuration, and advanced techniques.

Codex Getting Started in Practice: A Full Breakdown of the Four Forms of AI Coding Agents
Codex is OpenAI's AI coding agent, fundamentally different from ChatGPT. This article breaks down Codex's four forms (CLI, web, IDE plugin, standalone app), compares their use cases, and explores why developers in the AI era need to master agent tools like Codex.