Gated Linear Attention Transformers with Hardware-Efficient Training

计算机科学 变压器 计算机硬件 培训(气象学) 工程类 电气工程 地理 电压 气象学
作者
Yang Song-lin,Bailin Wang,Yikang Shen,Rameswar Panda,Yoon Kim
出处
期刊:Cornell University - arXiv [Cornell University]
被引量:311
标识
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.
最长约 10秒,即可获得该文献文件

科研通智能强力驱动
Strongly Powered by AbleSci AI
科研通是完全免费的文献互助平台,具备全网最快的应助速度,最高的求助完成率。 对每一个文献求助,科研通都将尽心尽力,给求助人一个满意的交代。
实时播报
1秒前
huahua完成签到 ,获得积分10
2秒前
2秒前
柳树完成签到,获得积分10
3秒前
负责忆南发布了新的文献求助30
4秒前
瑞rui完成签到 ,获得积分10
4秒前
DL_zhai完成签到,获得积分10
5秒前
碳水大王发布了新的文献求助10
5秒前
小耳朵完成签到 ,获得积分10
5秒前
SLT完成签到 ,获得积分10
6秒前
快让我滚蛋毕业完成签到 ,获得积分10
15秒前
开朗大地完成签到,获得积分10
15秒前
春天完成签到 ,获得积分10
19秒前
韩先喆完成签到 ,获得积分10
20秒前
Eric完成签到,获得积分10
25秒前
苹果松完成签到,获得积分10
28秒前
光亮的小甜瓜完成签到 ,获得积分10
30秒前
在九月完成签到 ,获得积分10
30秒前
白bai完成签到 ,获得积分10
33秒前
聪慧天真完成签到,获得积分10
34秒前
37秒前
泥嚎完成签到,获得积分10
38秒前
Rita完成签到 ,获得积分10
38秒前
41秒前
令狐冲完成签到,获得积分0
41秒前
诸葛小哥哥完成签到 ,获得积分0
42秒前
香蕉新儿完成签到,获得积分10
43秒前
望向天空的鱼完成签到 ,获得积分10
45秒前
molihuakai的应助被科研通管家采纳,获得10
45秒前
玖月完成签到 ,获得积分0
45秒前
45秒前
荆棘鸟发布了新的文献求助10
50秒前
负责忆南完成签到 ,获得积分20
57秒前
梨落南山雪完成签到 ,获得积分10
1分钟前
哥哥发布了新的文献求助10
1分钟前
Alice完成签到 ,获得积分10
1分钟前
Richard完成签到 ,获得积分10
1分钟前
杨树完成签到 ,获得积分10
1分钟前
gzp完成签到,获得积分10
1分钟前
369ninja发布了新的文献求助10
1分钟前
高分求助中
(应助此贴封号)【重要!!请各用户(尤其是新用户)详细阅读】【科研通的精品贴汇总】 10000
IRTSD: Open-Source Data and Toolset for Electromagnetic Transient Analysis of Disturbances and IBR Control Malfunctions in Transmission Systems 1000
Spec 401: Standards for Jet Fuel Facility and Equipment Commissioning and Flushing at Airports, 2026.1 (Original Issue) 1000
Spec 103: Standard for Jet Fuel Quality Control at Airports, Revision 2026.1 1000
Les Mots du discours 600
A Consideration on Use of Material Grades for Hull Structural Members Based on Fracture Toughness(Second Report) 500
AI Disclosure in Annual Reports: Evolution, Determinants, and Capital Market Participants’ Perceptions 500
热门求助领域 (近24小时)
化学 材料科学 医学 生物 纳米技术 计算机科学 工程类 有机化学 化学工程 生物化学 物理 复合材料 内科学 催化作用 光电子学 人工智能 细胞生物学 无机化学 物理化学 数学
热门帖子
关注 科研通微信公众号,转发送积分 8108810
求助须知:如何正确求助?哪些是违规求助? 9516611
关于积分的说明 21503574
捐赠科研通 7685494
什么是DOI,文献DOI怎么找? 3411013
关于科研通互助平台的介绍 2538302
邀请新用户注册赠送积分活动 2450932