Gated Linear Attention Transformers with Hardware-Efficient Training

计算机科学 变压器 计算机硬件 培训(气象学) 工程类 电气工程 地理 电压 气象学
作者
Yang Song-lin,Bailin Wang,Yikang Shen,Rameswar Panda,Yoon Kim
出处
期刊:Cornell University - arXiv [Cornell University]
被引量:5
标识
DOI:10.48550/arxiv.2312.06635
摘要

Transformers with linear attention allow for efficient parallel training but can simultaneously be formulated as an RNN with 2D (matrix-valued) hidden states, thus enjoying linear-time inference complexity. However, linear attention generally underperforms ordinary softmax attention. Moreover, current implementations of linear attention lack I/O-awareness and are thus slower than highly optimized implementations of softmax attention. This work describes a hardware-efficient algorithm for linear attention that trades off memory movement against parallelizability. The resulting implementation, dubbed FLASHLINEARATTENTION, is faster than FLASHATTENTION-2 (Dao, 2023) as a standalone layer even on short sequence lengths (e.g., 1K). We then generalize this algorithm to a more expressive variant of linear attention with data-dependent gates. When used as a replacement for the standard attention layer in Transformers, the resulting gated linear attention (GLA) Transformer is found to perform competitively against the LLaMA-architecture Transformer (Touvron et al., 2023) as well recent linear-time-inference baselines such as RetNet (Sun et al., 2023a) and Mamba (Gu & Dao, 2023) on moderate-scale language modeling experiments. GLA Transformer is especially effective at length generalization, enabling a model trained on 2K to generalize to sequences longer than 20K without significant perplexity degradations. For training speed, the GLA Transformer has higher throughput than a similarly-sized Mamba model.

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
ML应助执着傲蕾采纳,获得10
刚刚
吴彦祖发布了新的文献求助10
刚刚
刚刚
小果发布了新的文献求助10
刚刚
刚刚
刚刚
明开夜合完成签到,获得积分10
1秒前
勋勋xxx发布了新的文献求助10
1秒前
端庄的立辉完成签到 ,获得积分20
2秒前
bkagyin应助15采纳,获得30
2秒前
2秒前
道儿发布了新的文献求助10
3秒前
3秒前
YXYYXYYXY发布了新的文献求助10
3秒前
刘6发布了新的文献求助10
3秒前
shenjuan1674发布了新的文献求助10
5秒前
我是老大应助澄铭采纳,获得10
5秒前
看海听风吹完成签到,获得积分10
5秒前
6秒前
6秒前
6秒前
7秒前
单薄海亦发布了新的文献求助10
7秒前
7秒前
ns123完成签到,获得积分10
8秒前
火山蜗牛发布了新的文献求助10
8秒前
8秒前
9秒前
9秒前
9秒前
Xiaopan发布了新的文献求助10
9秒前
lihuahui发布了新的文献求助10
10秒前
10秒前
野人完成签到,获得积分10
10秒前
Vaibhav完成签到,获得积分10
11秒前
务实青筠发布了新的文献求助10
11秒前
瘦瘦的睫毛膏完成签到,获得积分10
12秒前
13秒前
烟花应助zouzh采纳,获得10
13秒前
14秒前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
An Introduction to Foreign Language Learning and Teaching 750
China Pluperfect I: Epistemology of Past and Outside in Chinese Art 520
Matrix Methods in Data Mining and Pattern Recognition Second Edition 510
What is the Future of Psychotherapy in Digital Age? Technology, AI Bots, and Psychotherapy after Covid 444
Synthesis of P-Chiral Phosphine Ligands and Their Applications in Asymmetric Catalysis 400
Management and the Arts 310
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 工程类 有机化学 化学工程 生物化学 计算机科学 内科学 物理 复合材料 催化作用 细胞生物学 无机化学 光电子学 物理化学 电极 基因
热门帖子
关注 科研通微信公众号,转发送积分 7630649
求助须知:如何正确求助?哪些是违规求助? 9205152
关于积分的说明 19740475
捐赠科研通 7200150
什么是DOI,文献DOI怎么找? 3274513
关于科研通互助平台的介绍 2436522
邀请新用户注册赠送积分活动 2270845