arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.02486cs.CLcs.LG
收藏

LongNet:将Transformer扩展至1,000,000,000个Token

LongNet: Scaling Transformers to 1,000,000,000 Tokens

Microsoft Research(微软研究院);Xi’an Jiaotong University(西安交通大学)

Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, Nanning Zheng, Furu Wei

AI总结:

针对大语言模型序列长度扩展受限的问题,研究提出带扩张注意力的Transformer变体LongNet,可将序列扩展至超10亿token且不损失短序列性能,兼具线性复杂度等优势,在长序列和通用语言任务上表现优异。

摘要:

在大语言模型时代,扩展序列长度已成为一项关键需求。然而现有方法要么受限于计算复杂度,要么受限于模型表达能力,导致最大序列长度受到制约。为解决该问题,我们提出LongNet——一种Transformer变体,可将序列长度扩展至超过10亿个token,同时不会牺牲短序列上的性能。具体而言,我们提出了扩张注意力(dilated attention)机制,其注意力感受野会随着距离增长呈指数级扩大。LongNet具备显著优势:1)它拥有线性计算复杂度,且序列中任意两个token之间存在对数级依赖关系;2)它可作为分布式训练器处理极长序列;3)其扩张注意力可直接替换标准注意力,能无缝集成到现有基于Transformer的优化方案中。实验结果表明,LongNet在长序列建模和通用语言任务上均表现出色。我们的工作为极长序列建模开辟了新可能,例如将整个语料库乃至整个互联网视作一个序列。

英文摘要:

Scaling sequence length has become a critical demand in the era of large language models. However, existing methods struggle with either computational complexity or model expressivity, rendering the maximum sequence length restricted. To address this issue, we introduce LongNet, a Transformer variant that can scale sequence length to more than 1 billion tokens, without sacrificing the performance on shorter sequences. Specifically, we propose dilated attention, which expands the attentive field exponentially as the distance grows. LongNet has significant advantages: 1) it has a linear computation complexity and a logarithm dependency between any two tokens in a sequence; 2) it can be served as a distributed trainer for extremely long sequences; 3) its dilated attention is a drop-in replacement for standard attention, which can be seamlessly integrated with the existing Transformer-based optimization. Experiments results demonstrate that LongNet yields strong performance on both long-sequence modeling and general language tasks. Our work opens up new possibilities for modeling very long sequences, e.g., treating a whole corpus or even the entire Internet as a sequence.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑