TL;DR
Diagonal-Tiled Mixed-Precision Attention (DMA) is a novel Triton-based attention kernel designed to leverage ultra-low-bit Microscaling Floating-Point (MXFP) formats on next-generation hardware like NVIDIA Blackwell GPUs. By selectively applying higher precision (MXFP8) to critical diagonal attention tiles and aggressive low precision (MXFP4) elsewhere, combined with a heavily fused quantization pipeline, DMA achieves significant inference speedups with zero degradation in LLM generation quality.
What Problem Does This Paper Address?
Large Language Models (LLMs) are notoriously expensive to run during inference due to the quadratic memory and compute costs of the self-attention mechanism. While modern GPU architectures like NVIDIA Blackwell introduce native support for ultra-low-bit microscaling formats (such as 4-bit MXFP4 and NVFP4) to dramatically boost hardware throughput, directly applying 4-bit quantization across the entire attention matrix introduces massive quantization errors that severely degrade model accuracy.
Furthermore, the process of quantizing, encoding, packing, and converting data formats typically happens in separate, unfused operations. The authors discover that without deep kernel fusion, the overhead from redundant memory accesses and kernel launches completely wipes out the performance advantages of low-bit computation.
Methods
The authors propose Diagonal-Tiled Mixed-Precision Attention (DMA), the first attention workflow designed to operate on hybrid MX formats. It consists of two primary components:
- Diagonal-Tiled Mixed-Precision Strategy: Instead of uniform quantization, DMA partitions the attention matrix into tiles. Recognizing that the most critical attention scores concentrate along the diagonal, it retains higher-precision representations (MXFP8) for tiles near the diagonal. Meanwhile, it aggressively quantizes peripheral regions using faster, low-precision formats (MXFP4/NVFP4) to maximize throughput.
- Dual-MXFP Quantization Kernel Fusion: To eliminate intermediate memory traffic and kernel launch overhead, the authors implement a full-stack preprocessing pipeline fused into a single Triton kernel. This single implementation handles softmax scaling, quantization scale computation, shared scale extraction, FP4 encoding, bit-packing into
uint8, and scale conversion to theE8M0format.
Datasets
The authors evaluated DMA using LongBench, a bilingual, multitask benchmark specifically designed to assess long-context language understanding. The evaluation spanned sequence lengths ranging from 2.5K to 30K tokens across two models: LLaMA-3.1-8B and LLaMA-3.2-3B. Subtasks included question answering, summarization, and code synthesis (e.g., repobench-p, samsum, trec). No new datasets were introduced in this paper.
Key Insights and Ideas
- Channel-Wise Scaling is Incompatible with Attention Fusion: Quantization errors exhibit a distinct channel-wise structure in query and key matrices. However, because the channel dimension serves as the reduction axis during $QK^\top$ matrix multiplication, implementing channel-wise scaling within a fused attention kernel introduces prohibitive implementation complexity.
- Spatial Locality Saves Accuracy: Rather than relying on expensive compensation math (like extra GEMV operations used in prior work), DMA exploits the spatial locality of attention matrices. Keeping a narrow diagonal window in 8-bit precision is enough to achieve lossless generation quality.
- Fusion is Mandatory for Low-Bit Gains: The authors' ablation study reveals that an unfused MX encoding pipeline takes 18.32 ms, whereas their fused kernel takes just 116.48 µs. Without fusing the quantization and packing steps, low-bit attention is actually slower than standard precision due to memory bottlenecks.
Key Results
- Lossless (and Often Improved) Accuracy: Surprisingly, DMA slightly outperformed the native PyTorch full-precision (BF16) SDPA baseline on LongBench. The average score improved from 44.11 to 46.43 for LLaMA-3.1-8B and from 35.84 to 37.20 for LLaMA-3.2-3B. Notable gains were seen in code synthesis (
repobench-p), jumping from 42.23 to 54.00 on LLaMA-3.1-8B. - Substantial Speedups: Evaluated on an NVIDIA B200 GPU, DMA with a 128/128 block-size configuration achieved a total latency of 7.776 ms, significantly outperforming uniform low-bit baselines like MXFP4 (12.980 ms) and NVFP4 (13.404 ms).
- Massive Encoding Acceleration: Integrating mixed-precision quantization into a single fused kernel yielded a 74.2× speedup for sequence lengths of $L=2k$ and an 80.1× speedup for $L=8k$ compared to the fully unfused baseline.
Limitations and Future Work
The authors note several limitations in their current study:
- Scale of Evaluation: The kernel was only validated on relatively small model sizes (3B and 8B parameters).
- Modality Constraints: The evaluation focused strictly on text-based long-context workloads, leaving vision and vision-language (multimodal) settings unexplored.
- Hardware and Architectural Scope: The mixed-precision tiling policy has not yet been tested on extremely long sequence lengths, alternative hardware architectures beyond the NVIDIA Blackwell platform, or other attention variants (such as linear or sparse attention).
Summary updated