paper-with-me

홈 › Papers

Trainable Dynamic Mask Sparse Attention

2025-08-04 · Jingze Shi, Yifan Wu, Yiran Peng, Bingheng Wu, Liangdong Wang, Guang Liu, Yuyu Luo arxiv

The increasing demand for long-context modeling in large language models (LLMs) is bottlenecked by the quadratic complexity of the standard self-attention mechanism. The community has proposed sparse attention to mitigate this issue. However, position-aware sparse attention methods rely on static sparse structures that lack adaptability to diverse query contexts, while content-aware sparse attention methods depend on heuristic key-value selection, hindering full differentiability. We introduce a trainable dynamic mask sparse attention mechanism, a method that merges the advantages of both position-aware and content-aware approaches. Dynamic Mask Attention (DMA) achieves this through three key innovations: First, it leverages value vector representations to generate content-aware dynamic masks, enabling the model to adaptively identify and attend to critical information. Second, it computes position-aware sparse weights in a hardware-friendly manner, efficiently skipping unnecessary computational regions. Finally, we demonstrate that the introduced dynamic mask and sparse weights do not obstruct gradients, supporting end-to-end training. We have validated the performance of DMA through comprehensive experiments. A large body of experimental evidence shows that DMA consistently holds a Pareto advantage over state-of-the-art sparse attention baselines in tasks including scaling laws, multi-query associative recall, standard benchmarks, and needle in a haystack tests, while also delivering up to a 10x overall speedup. These results highlight its ability to effectively balance model efficiency with long-context modeling capabilities. Our computational kernel code is now open-source at https://github.com/SmallDoges/flash-dmattn to encourage further research and application by the community.

📄 PDF Abstract BibTeX arXiv:2508.02124

Code (0)

등록된 구현이 없습니다.

Similar Papers 제목 키워드 기반

SpargeAttention2: Trainable Sparse Attention via Hybrid Top-k+Top-p Masking and Distillation Fine-Tuning

2026-02-13 · Jintao Zhang, Kai Jiang, Chendong Xiang, Weiqi Feng 외 arxiv

Many training-free sparse attention methods are effective for accelerating diffusion models. Recently, several works suggest that making sparse attention trainable can further increase sparsity while preserving generatio…

Dynamic Sparse Training: Find Efficient Sparse Network From Scratch With Trainable Masked Layers

2020-05-14 · ICLR 2020 1 · Junjie Liu, Zhe Xu, Runbin Shi, Ray C. C. Cheung 외

We present a novel network pruning algorithm called Dynamic Sparse Training that can jointly find the optimal network parameters and sparse network structure in a unified optimization process with trainable pruning thres…

Network Pruning

Trainable Log-linear Sparse Attention for Efficient Diffusion Transformers

2025-12-18 · Yifan Zhou, Zeqi Xiao, Tianyi Wei, Shuai Yang 외 arxiv

Diffusion Transformers (DiTs) set the state of the art in visual generation, yet their quadratic self-attention cost fundamentally limits scaling to long token sequences. Recent Top-K sparse attention approaches reduce t…

Image Generation

Training Your Sparse Neural Network Better with Any Mask

2022-06-26 · Ajay Jaiswal, Haoyu Ma, Tianlong Chen, Ying Ding 외

Pruning large neural networks to create high-quality, independently trainable sparse masks, which can maintain similar performance to their dense counterparts, is very desirable due to the reduced space and time complexi…

Sparser, Better, Deeper, Stronger: Improving Sparse Training with Exact Orthogonal Initialization

2024-06-03 · Aleksandra Irena Nowak, Łukasz Gniecki, Filip Szatkowski, Jacek Tabor

Static sparse training aims to train sparse models from scratch, achieving remarkable results in recent years. A key design choice is given by the sparse initialization, which determines the trainable sub-network through…