Skip to main content
QUICK REVIEW

[論文レビュー] Generating Long Sequences with Sparse Transformers

Rewon Child, Scott Gray|arXiv (Cornell University)|Apr 23, 2019
Topic Modeling参考文献 25被引用数 489
ひとこと要約

この論文は sparse factorized self-attention(Sparse Transformers)を導入し、長い系列に対して Transformer をスケールさせる。テキスト、画像、音声で最先端の密度モデリングを達成し、数百層の非常に長い文脈を可能にする。

ABSTRACT

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.

研究の動機と目的

  • 長い系列全体でテキスト、画像、音声にわたるスケーラブルな自己回帰モデリングを動機づける。
  • スパース因子化により注意機構のメモリと計算を二次からほぼ線形へ削減する。
  • アーキテクチャと最適化の変更により、非常に深いTransformer風モデルの学習を可能にする。
  • 複数のデータモダリティに跨る最先端の密度モデリングを実証する。

提案手法

  • 各位置が前の位置のスパースなサブセットにのみ注意する因子化自己注意を導入する。
  • 局所性と被覆範囲を制御可能なストライド付きと固定パターンの二次元因子化注意パターンを探る。
  • 深いネットワークを可能にするため、前活性化残差と層正規化を備えたSparse Transformerブロックを組み込む。
  • バックプロパゲーション時に注意機構と前向きフィードフォワードブロックの再計算を用いてメモリを節約する。
  • 混合スパース注意、局所窓、およびブロック単位の計算のための効率的なGPUカーネルを実装する。
  • 混合精度、ウォームアップ付きAdam、コサイン学習率減衰、勾配クリッピングで訓練する。
Figure 1: Unconditional samples from our neural autoregressive model on ImageNet 64 and a classical music dataset. We used the same self-attention based architecture for audio, images, and text. The samples above were generated with softmax temperature 1.0, and had lengths 12,288 and 65,536. Audio s
Figure 1: Unconditional samples from our neural autoregressive model on ImageNet 64 and a classical music dataset. We used the same self-attention based architecture for audio, images, and text. The samples above were generated with softmax temperature 1.0, and had lengths 12,288 and 65,536. Audio s

実験結果

リサーチクエスチョン

  • RQ1長い系列において、テキスト、画像、音声を横断して、スパースで因子化された注意は全注意と同等の性能を発揮できるか?
  • RQ2異なるデータモダリティに対して、どのスパースパターン(ストライド型 vs 固定型)が最良の性能を示すか?
  • RQ3Sparse Transformerはどれくらい深く訓練できるか、そしてどのメモリ/訓練技術がそれを可能にするか?
  • RQ4これらのパターンが密度モデリングのベンチマークとサンプル品質に与える影響は何か?

主な発見

モデルデータセット / タスクビット/バイトあたり
PixelCNNCIFAR-103.03
PixelCNN++CIFAR-102.92
Image TransformerCIFAR-102.90
PixelSNAILCIFAR-102.85
Sparse Transformer 59M (strided)CIFAR-102.80
Deeper Self-Attention (Al-Rfou et al., 2018)Enwik81.06
Transformer-XL 88M (Dai et al., 2018)Enwik81.03
Transformer-XL 277M (Dai et al., 2018)Enwik80.99
Sparse Transformer 95M (fixed)Enwik80.99
PixelCNN (Oord et al., 2016)ImageNet 64x643.57
Parallel Multiscale (Reed et al., 2017)ImageNet 64x643.70
Glow (Kingma & Dhariariwal, 2018)ImageNet 64x643.81
SPN (Menick & Kalchbrenner, 2018)ImageNet 64x643.52
Sparse Transformer 152M (strided)ImageNet 64x643.44
Sparse Transformer 152M (strided)Classical music (audio)1.97
  • Sparse TransformersはCIFAR-10、Enwik8、ImageNet-64、および音楽データで、dense注意と同等またはそれより優れた密度モデリング性能を達成する。
  • ストライド型および固定型のスパースパターンは、dense注意に対して大幅な速度向上をもたらし、場合によってはより良い圧縮(ビット毎のバイトあたりが低い)を実現する。
  • アーキテクチャの変更と勾配再計算により、何百層ものモデルを訓練でき、長い文脈のモデリングを可能にする。
  • CIFAR-10では、ストライドスパース注意が2.80–2.82ビット/次元に達し、以前の最先端(2.85)を上回る。
  • Enwik8では、固定注意を用いたSparse Transformerが0.99ビット/次元に達し、より多くのパラメータを持つTransformer-XLと同等またはそれを上回る。
  • ImageNet-64では、ストライドスパーストランスフォーマーが3.44ビット/次元を達成し、いくつかの従来の生成モデルより良い。
Figure 2: Learned attention patterns from a 128-layer network on CIFAR-10 trained with full attention. White highlights denote attention weights for a head while generating a given pixel, and black denotes the autoregressive mask. Layers are able to learn a variety of specialized sparse structures,
Figure 2: Learned attention patterns from a 128-layer network on CIFAR-10 trained with full attention. White highlights denote attention weights for a head while generating a given pixel, and black denotes the autoregressive mask. Layers are able to learn a variety of specialized sparse structures,

より良い研究を、今すぐ始めましょう

論文設計から論文執筆まで、研究時間を劇的に削減しましょう。

クレジットカード登録不要

このレビューはAIが作成し、人間の編集者が確認しました。