# [2307.02486] LongNet: Scaling Transformers to 1,000,000,000 Tokens Source: https://arxiv.org/abs/2307.02486 Kiwi News: https://news.kiwistand.com/stories/230702486-LongNet-Scaling-Transformers-to-1000000000-Tokens?index=0x64a87e7e61d44b48a7037c5266087b7138fee15c19639eae879ab66c73638687d05840ad Submitted by m-j-r.eth on 2023-07-07 UTC, 1 upvote, 0 comments ## Summary LongNet is a Transformer variant that scales sequence length to more than 1 billion tokens without sacrificing performance on shorter sequences, according to the paper by Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, Nanning Zheng and Furu Wei. It introduces dilated attention, which expands the attentive field exponentially as the distance grows. The paper states that LongNet has linear computation complexity and a logarithmic dependency between any two tokens, and that its dilated attention can replace standard attention in existing Transformer optimization. Experiments reported in the paper show strong performance on long-sequence modeling and general language tasks. ## Article LongNet: Scaling Transformers to 1,000,000,000 Tokens Authors: Jiayu Ding, Shuming Ma, Li Dong, Xingxing Zhang, Shaohan Huang, Wenhui Wang, Nanning Zheng, Furu Wei 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.