paper-with-me

홈 › Papers

XAttention: Block Sparse Attention with Antidiagonal Scoring

2025-03-20 · Ruyi Xu, Guangxuan Xiao, Haofeng Huang, Junxian Guo, Song Han

Long-Context Transformer Models (LCTMs) are vital for real-world applications but suffer high computational costs due to attention's quadratic complexity. Block-sparse attention mitigates this by focusing computation on critical regions, yet existing methods struggle with balancing accuracy and efficiency due to costly block importance measurements. In this paper, we introduce XAttention, a plug-and-play framework that dramatically accelerates long-context inference in Transformers models using sparse attention. XAttention's key innovation is the insight that the sum of antidiagonal values (i.e., from the lower-left to upper-right) in the attention matrix provides a powerful proxy for block importance. This allows for precise identification and pruning of non-essential blocks, resulting in high sparsity and dramatically accelerated inference. Across comprehensive evaluations on demanding long-context benchmarks-including RULER and LongBench for language, VideoMME for video understanding, and VBench for video generation. XAttention achieves accuracy comparable to full attention while delivering substantial computational gains. We demonstrate up to 13.5x acceleration in attention computation. These results underscore XAttention's ability to unlock the practical potential of block sparse attention, paving the way for scalable and efficient deployment of LCTMs in real-world applications. Code is available at https://github.com/mit-han-lab/x-attention.

📄 PDF Abstract BibTeX arXiv:2503.16428

Code (1)

mit-han-lab/x-attention 공식 구현 pytorch

Tasks

Video GenerationVideo Understanding

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Position-Wise Feed-Forward Layer 설명 없음
Layer Normalization Unlike batch normalization, Layer Normalization directly estimates the normalization statistics from the summed inputs…
BPE Byte Pair Encoding, or BPE, is a subword segmentation algorithm that encodes rare and unknown words as sequences of subword units. The intuition is that various word…
Softmax The Softmax output function transforms a previous layer's output into a vector of probabilities. It is commonly used for multiclass classification. Given an input vector $x$…
Label Smoothing Label Smoothing is a regularization technique that introduces noise for the labels. This accounts for the fact that datasets may have mistakes in them, so maximizing the…
Multi-Head Attention 설명 없음

Similar Papers 제목 키워드 기반

Flashlight: PyTorch Compiler Extensions to Accelerate Attention Variants

2025-11-03 · Bozhi You, Irene Wang, Zelal Su Mustafaoglu, Abhinav Jangda 외 arxiv

Attention is a fundamental building block of large language models (LLMs), so there have been many efforts to implement it efficiently. For example, FlashAttention leverages tiling and kernel fusion to optimize attention…

A Unified Sparse Attention via Multi-Granularity Compression

2025-12-16 · Siran Liu, Zane Cao, Yongchao He arxiv

Efficient long-context understanding and reasoning are increasingly vital for large language model (LLM) applications such as multi-turn dialogue and program analysis. However, the core self-attention mechanism scales qu…

Long-Context Understanding

Inference-Friendly Models With MixAttention

2024-09-23 · Shashank Rajput, Ying Sheng, Sean Owen, Vitaliy Chiley

The size of the key-value (KV) cache plays a critical role in determining both the maximum context length and the number of concurrent requests supported during inference in modern language models. The KV cache size grow…

Flex Attention: A Programming Model for Generating Optimized Attention Kernels

2024-12-07 · Juechu Dong, Boyuan Feng, Driss Guessous, Yanbo Liang 외

Over the past 7 years, attention has become one of the most important primitives in deep learning. The primary approach to optimize attention is FlashAttention, which fuses the operation together, drastically improving b…

Block Sparse Attention with Log-Linear Complexity

2026-09-25 · Bohao Tang, Zhen Qin, Yuqi Pan, Zheng Li 외 hf

Scaling language models to long contexts is limited by the quadratic cost of self-attention. Block sparse attention offers an efficient alternative, but selecting the retained blocks remains a bottleneck. Conventional bl…