Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention

计算机科学 稀疏逼近 计算机硬件 人工智能
作者
Jingyang Yuan,Huazuo Gao,Damai Dai,Junyu Luo,Liang Zhao,Zhengyan Zhang,Zhenda Xie,Yunxie Wei,Lean Wang,Zhiping Xiao,Yuqing Wang,Chong Ruan,Ming Zhang,Wenfeng Liang,Wangding Zeng
出处
期刊:Cornell University - arXiv
标识
DOI:10.48550/arxiv.2502.11089
摘要

Long-context modeling is crucial for next-generation language models, yet the high computational cost of standard attention mechanisms poses significant computational challenges. Sparse attention offers a promising direction for improving efficiency while maintaining model capabilities. We present NSA, a Natively trainable Sparse Attention mechanism that integrates algorithmic innovations with hardware-aligned optimizations to achieve efficient long-context modeling. NSA employs a dynamic hierarchical sparse strategy, combining coarse-grained token compression with fine-grained token selection to preserve both global context awareness and local precision. Our approach advances sparse attention design with two key innovations: (1) We achieve substantial speedups through arithmetic intensity-balanced algorithm design, with implementation optimizations for modern hardware. (2) We enable end-to-end training, reducing pretraining computation without sacrificing model performance. As shown in Figure 1, experiments show the model pretrained with NSA maintains or exceeds Full Attention models across general benchmarks, long-context tasks, and instruction-based reasoning. Meanwhile, NSA achieves substantial speedups over Full Attention on 64k-length sequences across decoding, forward propagation, and backward propagation, validating its efficiency throughout the model lifecycle.

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
刚刚
李健应助ctttt采纳,获得10
刚刚
刚刚
万声完成签到 ,获得积分10
1秒前
1秒前
1秒前
情怀应助淡然的芹采纳,获得10
2秒前
P_Zh_CN完成签到,获得积分20
2秒前
无花果应助欧阳必胜采纳,获得10
2秒前
2秒前
瘦瘦的大白菜真实的钥匙完成签到,获得积分10
2秒前
2秒前
molihuakai应助RoyChen采纳,获得10
2秒前
搞怪蓝发布了新的文献求助10
3秒前
3秒前
清脆的连虎完成签到,获得积分10
3秒前
之之完成签到,获得积分10
3秒前
飞飞完成签到 ,获得积分10
3秒前
叶揽风声发布了新的文献求助10
4秒前
Liyx123Aa完成签到,获得积分20
4秒前
ll发布了新的文献求助10
4秒前
廉6666发布了新的文献求助10
4秒前
善良书蕾发布了新的文献求助10
5秒前
yuyuxiaoyu发布了新的文献求助10
5秒前
SZY发布了新的文献求助10
5秒前
6秒前
又声发布了新的文献求助10
6秒前
牛大壮完成签到,获得积分10
6秒前
6秒前
6秒前
连战完成签到,获得积分10
6秒前
上官若男应助Queen采纳,获得10
6秒前
天天快乐应助活力的盈采纳,获得10
7秒前
彭于晏完成签到,获得积分0
7秒前
SharonDu发布了新的文献求助10
7秒前
Jasmine发布了新的文献求助10
7秒前
8秒前
茉莉雨发布了新的文献求助10
9秒前
LXY完成签到,获得积分10
9秒前
CodeCraft应助karry采纳,获得10
9秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
The Organometallic Chemistry of the Transition Metals 800
Chemistry and Physics of Carbon Volume 18 800
The Organometallic Chemistry of the Transition Metals 800
Leading Academic-Practice Partnerships in Nursing and Healthcare: A Paradigm for Change 800
The formation of Australian attitudes towards China, 1918-1941 640
Signals, Systems, and Signal Processing 610
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 工程类 有机化学 化学工程 生物化学 计算机科学 物理 内科学 复合材料 催化作用 物理化学 光电子学 电极 细胞生物学 基因 无机化学
热门帖子
关注 科研通微信公众号,转发送积分 6437245
求助须知:如何正确求助?哪些是违规求助? 8251654
关于积分的说明 17555845
捐赠科研通 5495538
什么是DOI,文献DOI怎么找? 2898406
邀请新用户注册赠送积分活动 1875220
关于科研通互助平台的介绍 1716268