DashAttention: Differentiable and Adaptive Sparse Hierarchical Attention

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Huang, Yuxiang, Gonçalves, Nuno M. T., Alvetreti, Federico, Li, Lei, Han, Xu, Ponti, Edoardo M., Martins, André F. T., Treviso, Marcos V.
Natura: Preprint
Pubblicazione: 2026
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917508482596864
author Huang, Yuxiang
Gonçalves, Nuno M. T.
Alvetreti, Federico
Li, Lei
Han, Xu
Ponti, Edoardo M.
Martins, André F. T.
Treviso, Marcos V.
author_facet Huang, Yuxiang
Gonçalves, Nuno M. T.
Alvetreti, Federico
Li, Lei
Han, Xu
Ponti, Edoardo M.
Martins, André F. T.
Treviso, Marcos V.
contents Current hierarchical attention methods, such as NSA and InfLLMv2, select the top-k relevant key-value (KV) blocks based on coarse attention scores and subsequently apply fine-grained softmax attention on the selected tokens. However, the top-k operation assumes the number of relevant tokens for any query is fixed and it precludes the gradient flow between the sparse and dense stages. In this work, we propose DashAttention (Differentiable and Adaptive Sparse Hierarchical Attention), which leverages the adaptively sparse $α$-entmax transformation to select a variable number of blocks according to the current query in the first stage. This in turn provides a prior for the second-stage softmax attention, keeping the entire hierarchy fully differentiable. Contrary to other hierarchical attention methods, we show that DashAttention is non-dispersive, translating to better long-context modeling ability. Experiments with large language models (LLMs) show that DashAttention achieves comparable accuracy as full attention with 75% sparsity and a better Pareto frontier than NSA and InfLLMv2, especially in high-sparsity regimes. We also provide an efficient, GPU-aware implementation of DashAttention in Triton, which achieves a speedup of up to over FlashAttention-3 at inference time. Overall, DashAttention offers a cost-effective strategy to model long contexts.
format Preprint
id arxiv_https___arxiv_org_abs_2605_18753
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle DashAttention: Differentiable and Adaptive Sparse Hierarchical Attention
Huang, Yuxiang
Gonçalves, Nuno M. T.
Alvetreti, Federico
Li, Lei
Han, Xu
Ponti, Edoardo M.
Martins, André F. T.
Treviso, Marcos V.
Computation and Language
Artificial Intelligence
Machine Learning
Current hierarchical attention methods, such as NSA and InfLLMv2, select the top-k relevant key-value (KV) blocks based on coarse attention scores and subsequently apply fine-grained softmax attention on the selected tokens. However, the top-k operation assumes the number of relevant tokens for any query is fixed and it precludes the gradient flow between the sparse and dense stages. In this work, we propose DashAttention (Differentiable and Adaptive Sparse Hierarchical Attention), which leverages the adaptively sparse $α$-entmax transformation to select a variable number of blocks according to the current query in the first stage. This in turn provides a prior for the second-stage softmax attention, keeping the entire hierarchy fully differentiable. Contrary to other hierarchical attention methods, we show that DashAttention is non-dispersive, translating to better long-context modeling ability. Experiments with large language models (LLMs) show that DashAttention achieves comparable accuracy as full attention with 75% sparsity and a better Pareto frontier than NSA and InfLLMv2, especially in high-sparsity regimes. We also provide an efficient, GPU-aware implementation of DashAttention in Triton, which achieves a speedup of up to over FlashAttention-3 at inference time. Overall, DashAttention offers a cost-effective strategy to model long contexts.
title DashAttention: Differentiable and Adaptive Sparse Hierarchical Attention
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2605.18753