arXiv:2004.05150 · 中英对照阅读
Longformer:长文档 Transformer
Longformer: The Long-Document Transformer
中文速览
标准 Transformer 的注意力计算会随文本变长而变得非常耗时、占内存,因此难以一次读完长文档;Longformer 用“局部窗口注意力”处理邻近内容,再给少数关键位置加入能连接全文的“全局注意力”,让计算量随文本长度近似线性增长。实验显示,它在长文本语言建模上刷新了 text8 和 enwik8 的成绩,预训练后在多种长文档任务上稳定超过 RoBERTa,并在 WikiHop 和 TriviaQA 上取得新高;用于论文摘要的编码器—解码器版本也在 arXiv 数据集上表现有效。它的重要之处在于,模型能直接处理数千词乃至更长的文档,减少截断或分段造成的信息损失,也让长文问答、分类和摘要不必依赖复杂的拼接方案。
摘要
基于 Transformer 的模型由于其自注意力操作会随序列长度呈二次方扩展,因而无法处理长序列。为解决这一局限,我们提出 Longformer,其注意力机制随序列长度线性扩展,因此能够轻松处理数千个词元甚至更长的文档。Longformer 的注意力机制可直接替代标准自注意力,并结合了局部窗口注意力与由任务需求驱动的全局注意力。遵循先前关于长序列 Transformer 的研究,我们在字符级语言建模任务上评估 Longformer,并在 text8 和 enwik8 上取得了最先进的结果。与大多数先前研究不同,我们还对 Longformer 进行预训练,并在多种下游任务上对其进行微调。经过预训练的 Longformer 在长文档任务上的表现始终优于 RoBERTa,并在 WikiHop 和 TriviaQA 上取得了新的最先进结果。最后,我们提出 Longformer 编码器—解码器(LED),这是 Longformer 的一个变体,用于支持长文档生成式序列到序列任务,并展示了其在 arXiv 摘要数据集上的有效性。11 1 https://github.com/allenai/longformer
Transformer-based models are unable to process long sequences due to their self-attention operation, which scales quadratically with the sequence length. To address this limitation, we introduce the Longformer with an attention mechanism that scales linearly with sequence length, making it easy to process documents of thousands of tokens or longer. Longformer’s attention mechanism is a drop-in replacement for the standard self-attention and combines a local windowed attention with a task motivated global attention. Following prior work on long-sequence transformers, we evaluate Longformer on character-level language modeling and achieve state-of-the-art results on text8 and enwik8. In contrast to most prior work, we also pretrain Longformer and finetune it on a variety of downstream tasks. Our pretrained Longformer consistently outperforms RoBERTa on long document tasks and sets new state-of-the-art results on WikiHop and TriviaQA. We finally introduce the Longformer-Encoder-Decoder (LED), a Longformer variant for supporting long document generative sequence-to-sequence tasks, and demonstrate its effectiveness on the arXiv summarization dataset.11 1 https://github.com/allenai/longformer
术语表
- Transformer
- Transformer
- Longformer
- Longformer
- Longformer-Encoder-Decoder (LED)
- Longformer 编码器—解码器(LED)
- self-attention
- 自注意力
- sparse attention
- 稀疏注意力
- windowed local attention
- 窗口局部注意力
- global attention
- 全局注意力
- dilated attention
- 膨胀注意力
- attention pattern
- 注意力模式
- contextual representation
- 上下文表示
- sequence-to-sequence (seq2seq) learning
- 序列到序列(seq2seq)学习
- autoregressive language modeling
- 自回归语言建模
- character-level language modeling
- 字符级语言建模
- masked language modeling (MLM)
- 掩码语言建模(MLM)
- pretraining
- 预训练
- fine-tuning
- 微调
- transfer learning
- 迁移学习
- downstream task
- 下游任务
- document-level NLP
- 文档级自然语言处理
- question answering (QA)
- 问答(QA)
- coreference resolution
- 共指消解
- text classification
- 文本分类
- summarization
- 摘要生成
- Sparse Transformer
- Sparse Transformer
- BlockSparse
- BlockSparse
- BP-Transformer
- BP-Transformer
- Blockwise attention
- 分块注意力
- ETC
- ETC
- text8
- text8
- enwik8
- enwik8
- WikiHop
- WikiHop
- TriviaQA
- TriviaQA
- arXiv summarization dataset
- arXiv 摘要数据集