PAROAttention: Pattern-Aware ReOrdering for Efficient Sparse and Quantized Attention in Visual Generation Models

Tianchen Zhao, Ke Hong, Xinhao Yang, Xuefeng Xiao, Huixia Li, Feng Ling, Ruiqi Xie, SiQi Chen, Hongyu Zhu, Zhang Yichong, Yu Wang

Abstract

Diffusion Transformers (DiTs) have established a new state-of-the-art in high-fidelity image and video generation. However, the quadratic scaling of the attention mechanism remains a significant computational bottleneck, particularly as resolutions and sequence lengths increase. While sparsification and quantization are standard techniques for reducing overhead, they often struggle with the irregular, dispersed attention patterns characteristic of visual models. This paper introduces PAROAttention (Pattern-Aware ReOrdering), a novel approach that transforms complex, multi-diagonal attention patterns into hardware-friendly dense blocks through token permutation. By aligning data layout with the model's inherent attention focus, PAROAttention enables high-sparsity and low-bitwidth (INT4/INT8) quantization with minimal quality loss, achieving 1.9x to 2.7x end-to-end speedups on modern GPU architectures.

Introduction

Modern visual generation models, such as Flux.1 and CogVideoX, rely on Diffusion Transformers to capture complex spatial and temporal dependencies. Unlike Large Language Models (LLMs), where attention is often localized or follows a predictable sliding window, visual attention is frequently "dispersed." A single attention head may attend to pixels across distant spatial locations or different video frames simultaneously.

When these 3D structures (Frames, Height, Width) are flattened into a 1D sequence for processing, these natural relationships manifest as irregular, "multi-diagonal" patterns in the attention matrix. These patterns are notoriously difficult for hardware to process efficiently; they resist standard block-sparse kernels and introduce significant errors during quantization. PAROAttention addresses this by recognizing that these patterns are not inherently complex, but rather a byproduct of suboptimal data layout.

Methodology

Pattern-Aware Token Reordering (PARO)

The core innovation of PAROAttention is the reorganization of tokens to simplify attention patterns. In a standard video DiT, tokens are typically flattened in a fixed [F, H, W] order. PARO analyzes each attention head to identify which of the six possible permutations of these dimensions (e.g., [H, W, F], [W, F, H]) results in the most concentrated, block-wise attention pattern.

By reordering the tokens according to the optimal permutation for a specific head, the previously dispersed attention becomes a dense block. This transformation allows the model to leverage highly optimized, standard kernels like FlashAttention for both pruning and quantization without requiring specialized hardware or complex sparse masks.

Hybrid Metric Selection

To determine the optimal permutation for each head, the authors employ a hybrid metric that balances two critical factors:

  1. Sparsifiability: The degree to which the attention matrix can be represented by a limited number of blocks without losing critical information.
  2. Quantizability: The reduction of "incoherence"—defined as the ratio of the maximum value to the mean. By grouping similar values together through reordering, the method reduces the outliers that typically cause significant rounding errors in low-precision formats.

Hardware-Fused Kernels

To ensure theoretical gains translate to wall-clock speedups, the researchers implemented fused CUDA kernels. These kernels handle the token reordering and restoration with negligible overhead (less than 1% of total latency), allowing the system to benefit from the efficiency of block-wise operations on NVIDIA A100 and RTX 4090 GPUs.

Experimental Evaluation

Setup

The method was evaluated across several leading models and benchmarks:

  • Models: CogVideoX-5B, Wan 2.1 (video generation), and Flux.1.Dev (image generation).
  • Benchmarks: VBench for video quality (alignment and temporal consistency) and COCO for image generation calibration.
  • Metrics: Evaluation included CLIPScore, VQA, PSNR, and relative distance metrics such as Fréchet Video Distance (FVD) and Fréchet Inception Distance (FID).

Key Results

  • Efficiency Gains: PAROAttention achieved end-to-end latency speedups ranging from 1.9x to 2.7x.
  • High Sparsity: The models maintained generation quality comparable to full-precision baselines while utilizing only 20% to 30% of the attention weights (70-80% sparsity).
  • Quantization Breakthrough: While existing methods like SageAttention typically stop at FP8 to avoid degradation, PAROAttention successfully quantized the $PV$ matrix computation to INT8 and even INT4. This was made possible by reducing the "incoherence" of the attention values through reordering.
  • Visual Fidelity: Qualitative analysis confirmed that PAROAttention avoids common artifacts of compression, such as blurriness or blocky textures, even at high levels of sparsity.

Discussion and Insights

A primary insight of this work is that the perceived complexity of visual attention is often an artifact of 1D flattening. By "untangling" the data layout, the researchers demonstrated that static sparse masks—determined once offline—can perform as well as or better than computationally expensive dynamic masks that attempt to predict token importance on the fly.

Furthermore, the discovery that token reordering directly improves quantization viability by mitigating outliers suggests a new path forward for compressing large-scale visual models. By making the data layout more "coherent," the mathematical difficulty of low-bitwidth representation is significantly reduced.

Conclusion and Future Work

PAROAttention provides a hardware-efficient framework for accelerating Diffusion Transformers without sacrificing the high-fidelity output required for modern visual generation. While the current implementation focuses on the six primary permutations of [F, H, W], future research may explore more granular reordering techniques or "training-aware" reordering, where models are incentivized to learn hardware-friendly patterns from the outset. Additionally, the principles of PAROAttention could be extended to other domains, such as multi-modal LLMs and complex perception tasks, where dispersed attention patterns currently limit performance.

Summary updated

BibTeX
@inproceedings{zhao2025paroattention,
  author = {Tianchen Zhao and Ke Hong and Xinhao Yang and Xuefeng Xiao and Huixia Li and Feng Ling and Ruiqi Xie and SiQi Chen and Hongyu Zhu and Zhang Yichong and Yu Wang},
  title = {{PAROAttention: Pattern-Aware ReOrdering for Efficient Sparse and Quantized Attention in Visual Generation Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=UPELg2oUo3},
}
Figure