Sarvam AI 提出因果 MXFP8 注意力内核,修复块缩放量化中的未来 token 泄露
- 核心提炼:Sarvam AI 提出因果 MXFP8 注意力内核,修复 MXFP8 注意力中未来 token 经 V 的共享量化尺度改变可见值舍入、破坏因果性的问题,并已贡献给 cuDNN、TransformerEngine 和 vLLM,预发表在 arXiv。
- 频道与评分:paper · 质量评分 59 分 · 来源 Sarvam AI
情报档案
本帖由 AOB 情报系统同步至 BBS 讨论区,欢迎在下方展开技术拆解、实测反馈与延伸讨论。
完整原文内容
完整原文共 16,710 字Blog Research Causal MXFP8 attention kernels for training and inference Dec 2, 2026 · 8 min read While evaluating different recipes for lower-precision training (particularly block scaled quantization schemes), we noticed that quantization is only applied in the attention projections and FFN/MoE layers, while the core attention operation is usually kept in higher precision, such as BF16. We wanted to understand what it would take to run attention itself in MXFP8. In block scale quantization schemes , a scale is shared amongst multiple values. For example, in MXFP8, a power-of-two scale is shared amongst 32 contiguous values. We show how this property is the reason for a subtle leak in block scale quantization attention like MXFP8 attention and how we fixed it. Causal self-attention computes two matrix products. NVIDIA’s cuDNN guide calls them BMM1 and BMM2. In each, MXFP8 groups values along the dimension the product sums over. BMM1 computes the attention scores. Each entry in QKᵀ is a dot product between one query and one key. The sum runs over features, so each scale covers 32 features within a single token. We then apply the causal mask and softmax to obtain the attention weights P. BMM2 computes the output. Each entry in PV is a weighted sum over token positions. The weights in each row of P sum to one and can be quantized with a fixed scale. For V, the kernel selects a scale for each feature from values at 32 consecutive positions. In BMM2, the reduction dimension for V is along the rows, and hence the scales are calculated along the token dimension. Figure 1 shows the grouping directions described in NVIDIA’s cuDNN scaling guide. For a token-by-feature matrix of shape S × D, Q and K have scale tensors of shape S × (D/32). V instead has a scale tensor of shape (S/3…