Architecture

Scaling Transformer to 1 Billion Tokens (LongNet)

First page
Scaling Transformer to 1 Billion Tokens (LongNet)
Paper summary

Microsoft's Transformer variant scaling sequence length past 1B tokens.

Ask this paper

Key points
01

Dilated attention: Introduces dilated attention that exponentially grows the attention field, enabling linear complexity in sequence length.

02

No short-sequence loss: Achieves extreme long-context scaling with no degradation on shorter sequences.

03

1B token demo: Demonstrates viability at the 1-billion token context scale - an order of magnitude beyond anything previously attempted.

04

Long-context frontier: Pushed the frontier of what's theoretically possible for ultra-long-context Transformers, even though production models stayed in the hundreds-of-thousands-of-tokens range.

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. 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.

Every Monday
Get next week’s papers.
Subscribe on Substack