Attn-QAT: 4-Bit Attention With Quantization-Aware Training

Peiyuan Zhang, Matthew Noto, Wenxuan Tan, Chengquan Jiang, Will Lin, Wei Zhou, Hao Zhang
Proceedings of the 43rd International Conference on Machine Learning, PMLR 306:157947-157965, 2026.

Abstract

Achieving reliable 4-bit attention is a prerequisite for end-to-end FP4 computation on emerging FP4-capable GPUs, yet attention remains the main obstacle due to FP4’s tiny dynamic range and attention’s heavy-tailed activations. This paper presents the first systematic study of 4-bit quantization-aware training (QAT) for attention. We find “drop-in” QAT – naively combining an FP4 forward pass with high-precision Flash Attention (FA)-style backward pass – leads to training instability. We identify two key principles for stable FP4 attention: (1) matching low-precision recomputation of attention scores in the backward pass and (2) resolving implicit precision assumptions in FA’s gradient calculation. Based on these insights, we propose Attn-QAT and implement fused Triton kernels for training plus FP4 inference kernels. Across diffusion and language models, Attn-QAT recovers the quality drop from FP4 attention without explicit outlier-mitigation heuristics used in prior FP4 attention, and delivers up to a 1.5x speedup on an RTX 5090 over SageAttention3 and up to a 1.74x speedup over FA4 on a GB300.

Cite this Paper


BibTeX
@InProceedings{pmlr-v306-zhang26eq, title = {Attn-{QAT}: 4-Bit Attention With Quantization-Aware Training}, author = {Zhang, Peiyuan and Noto, Matthew and Tan, Wenxuan and Jiang, Chengquan and Lin, Will and Zhou, Wei and Zhang, Hao}, booktitle = {Proceedings of the 43rd International Conference on Machine Learning}, pages = {157947--157965}, year = {2026}, editor = {Zhang, Tong and Dudik, Miroslav and Jaggi, Martin and Agarwal, Alekh and Li, Sharon and Schuurmans, Dale and Zhu, Jerry and Berkenkamp, Felix and Dong, Hanze and Bietti, Alberto}, volume = {306}, series = {Proceedings of Machine Learning Research}, month = {06--11 Jul}, publisher = {PMLR}, pdf = {https://raw.githubusercontent.com/mlresearch/v306/main/assets/zhang26eq/zhang26eq.pdf}, url = {https://proceedings.mlr.press/v306/zhang26eq.html}, abstract = {Achieving reliable 4-bit attention is a prerequisite for end-to-end FP4 computation on emerging FP4-capable GPUs, yet attention remains the main obstacle due to FP4’s tiny dynamic range and attention’s heavy-tailed activations. This paper presents the first systematic study of 4-bit quantization-aware training (QAT) for attention. We find “drop-in” QAT – naively combining an FP4 forward pass with high-precision Flash Attention (FA)-style backward pass – leads to training instability. We identify two key principles for stable FP4 attention: (1) matching low-precision recomputation of attention scores in the backward pass and (2) resolving implicit precision assumptions in FA’s gradient calculation. Based on these insights, we propose Attn-QAT and implement fused Triton kernels for training plus FP4 inference kernels. Across diffusion and language models, Attn-QAT recovers the quality drop from FP4 attention without explicit outlier-mitigation heuristics used in prior FP4 attention, and delivers up to a 1.5x speedup on an RTX 5090 over SageAttention3 and up to a 1.74x speedup over FA4 on a GB300.} }
Endnote
%0 Conference Paper %T Attn-QAT: 4-Bit Attention With Quantization-Aware Training %A Peiyuan Zhang %A Matthew Noto %A Wenxuan Tan %A Chengquan Jiang %A Will Lin %A Wei Zhou %A Hao Zhang %B Proceedings of the 43rd International Conference on Machine Learning %C Proceedings of Machine Learning Research %D 2026 %E Tong Zhang %E Miroslav Dudik %E Martin Jaggi %E Alekh Agarwal %E Sharon Li %E Dale Schuurmans %E Jerry Zhu %E Felix Berkenkamp %E Hanze Dong %E Alberto Bietti %F pmlr-v306-zhang26eq %I PMLR %P 157947--157965 %U https://proceedings.mlr.press/v306/zhang26eq.html %V 306 %X Achieving reliable 4-bit attention is a prerequisite for end-to-end FP4 computation on emerging FP4-capable GPUs, yet attention remains the main obstacle due to FP4’s tiny dynamic range and attention’s heavy-tailed activations. This paper presents the first systematic study of 4-bit quantization-aware training (QAT) for attention. We find “drop-in” QAT – naively combining an FP4 forward pass with high-precision Flash Attention (FA)-style backward pass – leads to training instability. We identify two key principles for stable FP4 attention: (1) matching low-precision recomputation of attention scores in the backward pass and (2) resolving implicit precision assumptions in FA’s gradient calculation. Based on these insights, we propose Attn-QAT and implement fused Triton kernels for training plus FP4 inference kernels. Across diffusion and language models, Attn-QAT recovers the quality drop from FP4 attention without explicit outlier-mitigation heuristics used in prior FP4 attention, and delivers up to a 1.5x speedup on an RTX 5090 over SageAttention3 and up to a 1.74x speedup over FA4 on a GB300.
APA
Zhang, P., Noto, M., Tan, W., Jiang, C., Lin, W., Zhou, W. & Zhang, H.. (2026). Attn-QAT: 4-Bit Attention With Quantization-Aware Training. Proceedings of the 43rd International Conference on Machine Learning, in Proceedings of Machine Learning Research 306:157947-157965 Available from https://proceedings.mlr.press/v306/zhang26eq.html.

Related Material