TensorX
返回文献探索

Paper · arXiv 2307.02486

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

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

82 upvotesJuly 5, 2023arXiv 预印本
AI 摘要

LongNet, a Transformer variant with dilated attention, enables scaling to over 1 billion tokens with linear computational complexity and maintains performance on shorter sequences.

Transformerdilated attentionsequence lengthcomputational complexitylong-sequence modelinggeneral language tasks

Abstract

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. In this work, 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 tokens; 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.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
LongNet: Scaling Transformers to 1,000,000,000 Tokens | TensorX