FLAMIA: FLAsh MIcroscaling Attention for Fast and Causally Safe Training on Blackwell
Organizations: Yandex Research
Abstract
Attention remains a substantial computational cost in Transformer training, particularly at long context lengths. NVIDIA Blackwell GPUs provide high-throughput low-precision matrix multiplication, but exploiting it in attention requires addressing quantization overhead, causal information leakage through shared scales, and numerical inconsistencies between the forward and backward passes. We present FLAMIA, a family of attention kernels for Blackwell with MXFP8 and mixed NVFP4/FP8 training paths. Our design combines token-block scaling that reuses quantized operands across matrix orientations, targeted safeguards against scale-induced leakage, and consistent forward and backward computations. Fused quantization and architecture-specific kernel optimizations reduce overhead, while document-local scaling and workload-aware scheduling support variable-length documents directly in packed layouts without repacking. Across various causal packed-document workloads, the MXFP8 path accelerates the combined forward and backward attention call, including quantization, by factors of -- on B200 and -- on B300 relative to the fastest evaluated baseline for each workload. We validate training stability and quality preservation on pretraining Llama-style models. These results show how jointly designing quantization, training numerics, and document scheduling translates low-bit hardware throughput into practical attention acceleration.
Figures & tables
| System | causal | non-causal |
|---|---|---|
| Ours, MXFP8 (token-block) | 0.9988 / 0.9979 | 0.9985 / 0.9978 |
| Ours, NVFP4 | 0.9920 / 0.9906 | 0.9899 / 0.9890 |
| Ours, all-4-bit | 0.9810 / 0.9456 | 0.9800 / 0.9509 |
| cuDNN FP8 | 0.9985 / 0.9975 | 0.9982 / 0.9974 |
| cuDNN MXFP8 (1 32) | 0.9988 / 0.9978 | 0.9985 / 0.9978 |
| LP-FA4 (1 32) | no causal mask | 0.9986 / 0.9978 |
| Scaling | ||
|---|---|---|
| Per-tensor | / | / |
| 4-bit by keys | below noise | |
| cuDNN MXFP8, default | ||
| cuDNN MXFP8, floor exp. | ||
| LP-FA4, default | ||
| LP-FA4, floor exp. |
| Task | BF16 | MXFP8 | NVFP4 |
|---|---|---|---|
| Baseline | Ours | Ours | |
| Training loss | 2.392 | 2.397 | 2.406 |
| ARC Challenge | 0.3925 | 0.3618 | 0.3677 |
| ARC Easy | 0.6481 | 0.6460 | 0.6557 |
| HellaSwag | 0.5711 | 0.5650 | 0.5610 |
| PIQA | 0.7280 | 0.7323 | 0.7258 |
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
| Hyperparameter | Value |
|---|---|
| Global batch size | tokens |
| Training steps | 100,000 |
| Optimizer | AdamW |
| Weight decay | 0.1 |
| Peak learning rate | |
| Warmup steps | 300 |
Efficient Attention
Efficient attention reduces the compute, memory traffic, and cache costs of Transformer attention while preserving useful long-range interactions.
See all 145 papers