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
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
1秒前
1秒前
疯狂的书竹完成签到,获得积分10
1秒前
paws完成签到,获得积分10
1秒前
动听紫文完成签到,获得积分10
1秒前
2秒前
Copyright应助黄少阳采纳,获得10
2秒前
4秒前
4秒前
song芽芽完成签到,获得积分10
4秒前
fufu完成签到,获得积分10
5秒前
Aman发布了新的文献求助10
6秒前
aceman完成签到,获得积分10
6秒前
科研通AI6.4应助yzy采纳,获得10
7秒前
小学生发布了新的文献求助10
7秒前
CEO发布了新的文献求助10
7秒前
GHL发布了新的文献求助10
8秒前
8秒前
8秒前
852应助song芽芽采纳,获得10
9秒前
Jerrywen发布了新的文献求助10
9秒前
努力的排骨丁完成签到,获得积分10
9秒前
10秒前
10秒前
11秒前
Zephyrite应助心随以动采纳,获得10
11秒前
11秒前
天天快乐应助学术小白w采纳,获得10
12秒前
12秒前
12秒前
LY完成签到,获得积分10
12秒前
12秒前
13秒前
13秒前
13秒前
整点薯条完成签到,获得积分10
14秒前
14秒前
14秒前
sssss发布了新的文献求助30
14秒前
14秒前
高分求助中
Principles of Economics, 11th Edition 10000
University Physics with Modern Physics, 16th edition 10000
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
Tanning Chemistry: The Science of Leather (2nd Edition) 2000
Development of a Bridge Weigh-In-Motion System: A technology to convert the bridge response to the passage of traffic into data on vehicle configurations, speeds, times of travel and weights 1000
Molecular Mechanisms of Photosynthesis, 4th Edition 1000
Organic Reactions, Volume 116 1000
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 工程类 有机化学 化学工程 生物化学 计算机科学 内科学 物理 复合材料 催化作用 细胞生物学 无机化学 光电子学 物理化学 电极 基因
热门帖子
关注 科研通微信公众号,转发送积分 7261119
求助须知:如何正确求助?哪些是违规求助? 8882879
关于积分的说明 18771567
捐赠科研通 6940855
什么是DOI,文献DOI怎么找? 3202113
关于科研通互助平台的介绍 2375540
邀请新用户注册赠送积分活动 2177830