プリンキピア

第11章注意機構とTransformer

11.9.3. Decoder-Only11.9.3 デコーダのみ

We have reviewed encoder-only and encoder–decoder Transformers. Alternatively, decoder-only Transformers remove the entire encoder and the decoder sublayer with the encoder–decoder cross-attention from the original encoder–decoder architecture depicted in Fig. 11.7.1. Nowadays, decoder-only Transformers have been the de facto architecture in large-scale language modeling (Section 9.3), which leverages the world’s abundant unlabeled text corpora via self-supervised learning.
英語のヒント
ここまで、エンコーダのみとエンコーダ・デコーダのTransformerを見てきた。別のやり方として、デコーダのみのTransformerは、図11.7.1に描いた元のエンコーダ・デコーダの構造から、エンコーダ全体と、エンコーダ・デコーダのクロス注意をもつデコーダの副層を取り除く。今日では、デコーダのみのTransformerは大規模な言語のモデリング(9.3節)の事実上の標準の構造になっており、自己教師あり学習によって、世界の豊富なラベルのないテキストのコーパスを活用している。

11.9.3.1. GPT and GPT-211.9.3.1 GPTとGPT-2

Using language modeling as the training objective, the GPT (generative pre-training) model chooses a Transformer decoder as its backbone (Radford et al., 2018).
英語のヒント
言語のモデリングを訓練の目的として使い、GPT(generative pre-training)のモデルは、Transformerのデコーダを骨格として選ぶ(Radford et al., 2018)。
Fig. 11.9.6図11.9.6
Left: Pretraining GPT with language modeling. The target sequence is the input sequence shifted by one token. Both “<bos>” and “<eos>” are special tokens marking the beginning and end of sequences, respectively. Right: Attention pattern in the Transformer decoder. Each token along the vertical axis attends to only its past tokens along the horizontal axis (causal).
英語のヒント
左:言語のモデリングによるGPTの事前学習。目標系列は、入力系列を1トークンずらしたものである。「<bos>」と「<eos>」はどちらも特別なトークンで、それぞれ系列の始まりと終わりを示す。右:Transformerのデコーダの注意のパターン。縦軸に沿った各トークンは、横軸に沿った自分の過去のトークンにだけ注意を向ける(因果的)。
Following the autoregressive language model training as described in Section 9.3.3, Fig. 11.9.6 illustrates GPT pretraining with a Transformer encoder, where the target sequence is the input sequence shifted by one token. Note that the attention pattern in the Transformer decoder enforces that each token can only attend to its past tokens (future tokens cannot be attended to because they have not yet been chosen).
英語のヒント
9.3.3節で説明した自己回帰の言語モデルの訓練に従い、図11.9.6は、Transformerのエンコーダを使ったGPTの事前学習を示している。そこでは、目標系列は入力系列を1トークンずらしたものである。Transformerのデコーダの注意のパターンは、各トークンが自分の過去のトークンにだけ注意を向けられるよう強いることに注意してほしい(未来のトークンはまだ選ばれていないので、注意を向けられない)。
GPT has 100 million parameters and needs to be fine-tuned for individual downstream tasks. A much larger Transformer-decoder language model, GPT-2, was introduced one year later (Radford et al., 2019). Compared with the original Transformer decoder in GPT, pre-normalization (discussed in Section 11.8.3) and improved initialization and weight-scaling were adopted in GPT-2. Pretrained on 40 GB of text, the 1.5-billion-parameter GPT-2 obtained the state-of-the-art results on language modeling benchmarks and promising results on multiple other tasks without updating the parameters or architecture.
英語のヒント
GPTは1億のパラメータをもち、個々の下流の課題のために微調整する必要がある。1年後には、もっとずっと大きなTransformerのデコーダの言語モデル、GPT-2が紹介された(Radford et al., 2019)。GPTの元のTransformerのデコーダと比べて、GPT-2では、事前正規化(11.8.3節で論じた)と、改良した初期化と重みのスケーリングが採用された。40GBのテキストで事前学習した15億パラメータのGPT-2は、パラメータや構造を更新しなくても、言語のモデリングのベンチマークで最先端の結果を、ほかの複数の課題で有望な結果を得た。

11.9.3.2. GPT-3 and Beyond11.9.3.2 GPT-3とその先

GPT-2 demonstrated potential of using the same language model for multiple tasks without updating the model. This is more computationally efficient than fine-tuning, which requires model updates via gradient computation.
英語のヒント
GPT-2は、モデルを更新せずに同じ言語モデルを複数の課題に使える可能性を示した。これは、勾配の計算によるモデルの更新を必要とする微調整より、計算の効率がよい。
Fig. 11.9.7図11.9.7
Zero-shot, one-shot, few-shot in-context learning with language models (Transformer decoders). No parameter update is needed.
英語のヒント
言語モデル(Transformerのデコーダ)によるゼロショット、ワンショット、フューショットの文脈内学習。パラメータの更新は要らない。
Before explaining the more computationally efficient use of language models without parameter update, recall Section 9.5 that a language model can be trained to generate a text sequence conditional on some prefix text sequence. Thus, a pretrained language model may generate the task output as a sequence without parameter update, conditional on an input sequence with the task description, task-specific input–output examples, and a prompt (task input). This learning paradigm is called in-context learning (Brown et al., 2020), which can be further categorized into zero-shot, one-shot, and few-shot, when there is no, one, and a few task-specific input–output examples (Fig. 11.9.7).
英語のヒント
パラメータを更新せずに言語モデルをもっと計算効率よく使う方法を説明する前に、9.5節で、言語モデルが何らかの最初のテキスト系列を条件としてテキスト系列を生成するよう訓練できたことを思い出そう。したがって、事前学習した言語モデルは、課題の説明、課題に特化した入力と出力の例、プロンプト(課題の入力)からなる入力系列を条件として、パラメータを更新せずに、課題の出力を系列として生成できるかもしれない。この学習のパラダイムは文脈内学習と呼ばれ(Brown et al., 2020)、課題に特化した入力と出力の例が、ない、一つ、少しあるときに、それぞれゼロショット、ワンショット、フューショットにさらに分類できる(図11.9.7)。
Image omitted because its reuse rights could not be verified.権利の確認ができないため画像を割愛。
Fig. 11.9.8図11.9.8
Aggregate performance of GPT-3 for all 42 accuracy-denominated benchmarks (caption adapted and figure taken from Brown et al. (2020)).
英語のヒント
精度で評価する42個のベンチマークすべてについての、GPT-3の総合的な性能(キャプションは改変、図はBrown et al. (2020)より)。
These three settings were tested in GPT-3 (Brown et al., 2020), whose largest version uses data and model size about two orders of magnitude larger than those in GPT-2. GPT-3 uses the same Transformer decoder architecture as its direct predecessor GPT-2 except that attention patterns (at the right in Fig. 11.9.6) are sparser at alternating layers. Pretrained with 300 billion tokens, GPT-3 performs better with larger model size, where few-shot performance increases most rapidly (Fig. 11.9.8).
英語のヒント
これら三つの設定は、GPT-3(Brown et al., 2020)で試された。その最大の版は、GPT-2よりおよそ2桁大きいデータとモデルの大きさを使う。GPT-3は、交互の層で注意のパターン(図11.9.6の右)がもっとまばらである点を除けば、直接の前身であるGPT-2と同じTransformerのデコーダの構造を使う。3000億トークンで事前学習したGPT-3は、モデルが大きいほど性能がよく、フューショットの性能が最も速く上がる(図11.9.8)。
The subsequent GPT-4 model did not fully disclose technical details in its report (OpenAI, 2023). By contrast with its predecessors, GPT-4 is a large-scale, multimodal model that can take both text and images as input and generate text output.
英語のヒント
その後のGPT-4のモデルは、報告書で技術的な詳細を完全には開示しなかった(OpenAI, 2023)。前身とは対照的に、GPT-4は、テキストと画像の両方を入力としてとり、テキストを出力として生成できる、大規模なマルチモーダルのモデルである。