[Paper Review] Attn-QAT: 4-Bit Attention With Quantization-Aware Training
This paper presents Attn-QAT, a 4-bit quantization-aware training method for attention that enables FP4 attention with stable training and BF16-level model quality, plus 1.1x–1.5x throughput gains on RTX 5090.
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 that "drop-in" QAT, which naively combines an FP4 forward pass with a 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 as well as 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. Video demos can be found at https://drive.google.com/drive/folders/190F6xbBDUF2kGQYIcXBt3ehSYij5jlim?usp=sharing.
Motivation & Objective
- Motivate the need for 4-bit attention to enable end-to-end FP4 computation on FP4-capable GPUs.
- Investigate why naive FP4 attention with existing backward passes is unstable.
- Identify precision coordination requirements for stable FP4 attention during QAT.
- Propose Attn-QAT with specialized forward/backward precision handling and kernels.
- Demonstrate that Attn-QAT recovers quality in diffusion and language models and offers speedups.
Proposed method
- Analyze the two main challenges in FP4 attention: extremely coarse value range and heavy-tailed activations.
- Adapt quantization-aware training to FlashAttention-style fused operators by simulating FP4 in the forward pass and maintaining high-precision gradients.
- Ensure backward recomputation of attention scores uses the same low precision as the forward pass.
- Provide a high-precision auxiliary output for correct softmax gradient computation.
- Implement forward and backward Triton kernels for training and FP4 inference kernels for deployment.

Experimental results
Research questions
- RQ1Can quantization-aware training stabilize 4-bit attention in FP4 while preserving model quality?
- RQ2What precision coordination is required between forward and backward passes to align FP4 attention with FlashAttention-style backends?
- RQ3Does Attn-QAT recover BF16-quality in diffusion and language models and how does it compare to SageAttention3?
- RQ4What performance gains (throughput) are achievable with FP4 attention on modern GPUs?
Key findings
- Attn-QAT recovers the quality loss caused by FP4 attention and matches BF16 performance across evaluated metrics.
- QA results show Attn-QAT outperforms SageAttention3 and eliminates the need for outlier-mitigation heuristics.
- Training stability relies on two design choices: (1) recomputation of attention scores in the forward pass uses FP4, and (2) high-precision output for accurate softmax gradients.
- Attn-QAT delivers approximately 1.1x–1.5x speedup over SageAttention3 on an RTX 5090 for FP4 attention.
- In LLM continued training, Attn-QAT restores near-BF16 performance on Qwen3-14B and partially recovers Llama3.1-70B performance, with room for further gains with longer training.
- Kernel benchmarks show Attn-QAT achieves near-identical forward outputs between Triton training kernels and CUDA inference kernels.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.