プリンキピア

第11章注意機構とTransformer

11.7. The Transformer Architecture11.7 Transformerの構造

We have compared CNNs, RNNs, and self-attention in Section 11.6.2. Notably, self-attention enjoys both parallel computation and the shortest maximum path length. Therefore, it is appealing to design deep architectures by using self-attention. Unlike earlier self-attention models that still rely on RNNs for input representations (Cheng et al., 2016, Lin et al., 2017, Paulus et al., 2017), the Transformer model is solely based on attention mechanisms without any convolutional or recurrent layer (Vaswani et al., 2017). Though originally proposed for sequence-to-sequence learning on text data, Transformers have been pervasive in a wide range of modern deep learning applications, such as in areas to do with language, vision, speech, and reinforcement learning.
英語のヒント
11.6.2節では、CNN、RNN、自己注意を比べた。特に、自己注意は並列計算と最短の最大経路長の両方の恩恵を受ける。そのため、自己注意を使って深い構造を設計するのは魅力的である。入力の表現にまだRNNに頼っていた以前の自己注意のモデル(Cheng et al., 2016、Lin et al., 2017、Paulus et al., 2017)とは違って、Transformerのモデルは、畳み込み層や再帰的な層をまったくもたず、注意機構だけにもとづいている(Vaswani et al., 2017)。もともとはテキストデータでの系列から系列への学習のために提案されたが、Transformerは、言語、視覚、音声、強化学習に関わる分野など、幅広い現代の深層学習の応用に広く行き渡っている。
import math
import pandas as pd
import torch
from torch import nn
from d2l import torch as d2l