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.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
xiaodiandian发布了新的文献求助10
刚刚
刚刚
刚刚
轻松小张给司徒文青的求助进行了留言
刚刚
刚刚
CodeCraft应助过时的千柔采纳,获得10
1秒前
小明发布了新的文献求助10
1秒前
追寻海冬发布了新的文献求助10
1秒前
1秒前
钟钟钟完成签到,获得积分20
1秒前
1秒前
2秒前
2秒前
xgx984完成签到,获得积分10
2秒前
mudiboyang发布了新的文献求助20
3秒前
坦率邪欢完成签到,获得积分10
3秒前
淡淡白梦发布了新的文献求助10
4秒前
4秒前
Hcollide发布了新的文献求助10
5秒前
5秒前
6秒前
6秒前
哈哈哈哈完成签到,获得积分10
6秒前
淡定可乐完成签到,获得积分10
7秒前
超级觅风发布了新的文献求助10
7秒前
7秒前
弓长三金完成签到,获得积分10
7秒前
7秒前
ding应助小心采纳,获得10
8秒前
称心的菲鹰完成签到,获得积分10
8秒前
科目三应助拉长的沛芹采纳,获得10
9秒前
失眠醉易应助中国大陆采纳,获得10
9秒前
1464565388发布了新的文献求助10
9秒前
jie367发布了新的文献求助10
10秒前
roundtree发布了新的文献求助10
10秒前
10秒前
11秒前
U123456发布了新的文献求助10
11秒前
丫丫发布了新的文献求助10
11秒前
共享精神应助qqa采纳,获得10
11秒前
高分求助中
Les Mantodea de Guyane Insecta, Polyneoptera 2500
One Man Talking: Selected Essays of Shao Xunmei, 1929–1939 (PDF!) 1000
Technologies supporting mass customization of apparel: A pilot project 450
A Field Guide to the Amphibians and Reptiles of Madagascar - Frank Glaw and Miguel Vences - 3rd Edition 400
China Gadabouts: New Frontiers of Humanitarian Nursing, 1941–51 400
The Healthy Socialist Life in Maoist China, 1949–1980 400
Walking a Tightrope: Memories of Wu Jieping, Personal Physician to China's Leaders 400
热门求助领域 (近24小时)
化学 材料科学 医学 生物 工程类 有机化学 物理 生物化学 纳米技术 计算机科学 化学工程 内科学 复合材料 物理化学 电极 遗传学 量子力学 基因 冶金 催化作用
热门帖子
关注 科研通微信公众号,转发送积分 3787003
求助须知:如何正确求助?哪些是违规求助? 3332619
关于积分的说明 10256691
捐赠科研通 3047851
什么是DOI,文献DOI怎么找? 1672796
邀请新用户注册赠送积分活动 801549
科研通“疑难数据库(出版商)”最低求助积分说明 760271