利用稀疏 Transformer 生成长序列

Generating Long Sequences with Sparse Transformers

亚历克·拉德福德 Alec Radford · OpenAI · 2019-04-23 · arXiv:1904.10509 ↗ · 被引 2553

打开互动全文版(逐段中英对照 + 图/公式 + 论文问答)→

摘要 · Abstract

Transformer 是强大的序列模型,但其时间和内存需求随序列长度呈二次方增长。本文引入了注意力矩阵的稀疏分解,将其降至 O(n√n)。我们还提出了:a) 一种架构和初始化的变体以训练更深的网络,b) 重新计算注意力矩阵以节省内存,以及 c) 用于训练的快速注意力内核。我们将具有这些变化的网络称为稀疏 Transformer,并展示了它们可以使用数百层网络建模数万时间步长的序列。我们使用相同的架构从原始字节建模图像、音频和文本,在 Enwik8、CIFAR-10 和 ImageNet-64 的密度建模上创造了新的最先进水平。我们生成了无条件样本,展示了全局一致性和极大的多样性,并表明原则上可以使用自注意力建模长度超过一百万的序列。

Transformers are powerful sequence models, but require time and memory that grows quadratically with the sequence length. In this paper we introduce sparse factorizations of the attention matrix which reduce this to $O(n \sqrt{n})$. We also introduce a) a variation on architecture and initialization to train deeper networks, b) the recomputation of attention matrices to save memory, and c) fast attention kernels for training. We call networks with these changes Sparse Transformers, and show they can model sequences tens of thousands of timesteps long using hundreds of layers. We use the same architecture to model images, audio, and text from raw bytes, setting a new state of the art for density modeling of Enwik8, CIFAR-10, and ImageNet-64. We generate unconditional samples that demonstrate global coherence and great diversity, and show it is possible in principle to use self-attention to model sequences of length one million or more.

核心贡献 · Key contributions

局限 · Limitations

论文章节 · Sections(共 23)

阅读逐段中英对照全文 →