SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Downloaden Sie, um offline zu lesen
2017/6/2 1
Attention Is All You Need
東京⼤学松尾研究室
宮崎邦洋
Agenda
0. メタ情報
1. 背景
2. 背景(関連研究)
3. モデル構造
4. 何故Self-Attentionか
5. 実験
6. 結果
7. 結論
2017/6/2 2
メタ情報
• 著者
– Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit,
Llion Jones, Aidan N. Gomez, Lukasz Kaiser, Illia Polosukhin
– Google BrainとGoogle Researchのグループ
• 公開⽇
– Submitted on 12 Jun 2017
– https://arxiv.org/abs/1706.03762
• About
– RNN/CNNを使わず, Attentionのみを使⽤し翻訳のタスクで
SOTAを達成
• 選んだ理由
– 話題だった(主にタイトルが)
– Attentionの勉強
2017/6/2 3
1. 導⼊
• 現在,⾔語処理などの系列モデリングにはRNN, LSTM,
GRUがSOTA的アプローチとして使⽤されている
– 系列の依存関係を維持できる
• しかし,並列計算ができないため計算量が多くかかるこ
とが問題点
– ⼀つ⼀つしか依存関係を維持できない
• Attention機能ならば,シンボルの距離に関係なく依存関
係を構築できる
– 現状RNNとの併⽤のみで使⽤されている.
• 本研究では新しいモデル”Transformer“を提案
– リカレント構造を排除し,Attention機能のみを使⽤したネット
ワークを構築
2017/6/2 4
2. 背景(関連研究)
• 次計算を減らすという⽬的は、CNNで達成されてきた
– Extended Neural GPU
– ByteNet
– ConvS2S
– => CNNでは遠い距離の依存関係を学習できない
• Self-Attention
– 同じシーケンス内でAttentionを⾏う機能
– 読解⼒、抽象的な要約、テキストの含意、学習に依存しない⽂
の表現などのタスクに使⽤されている
2017/6/2 5
3. モデル構造
• 全体像
– EncoderとDecoderの両⽅に、スタックされ
たSelf-AttentionとポイントワイズのFully-
Connectedレイヤを使⽤
• エンコーダ
– N=6の同⼀レイヤのスタック
– 各層は2つのサブレイヤ
• マルチヘッドのSelf-Attention
• Fully-ConnectedのFeed Forward Network
• それぞれのサブレイヤでresidual connection
とlayer normalizationを採⽤
• デコーダ
– N=6の同⼀レイヤのスタック
– 各エンコーダ層の2つのサブレイヤに加え、
エンコーダからのアウトプットをMulti-
Head Attentionを⾏う3層⽬を挿⼊
– デコード時のself-attentionでは順番に注意
し,既知のアウトプットにのみ依存関係を
持つようにする
2017/6/2 6
3. モデル構造
Scaled Dot-Product Attention
• よく使⽤されるAttentionは以下
の2つ
– Additive attention
– dot-product (multiplicative)
attention
• dot-productの⽅が計算も早く,ス
パース性に強く,本研究のように応
⽤が⾏いやすい
• dkが⼤きい場合,dot積が⼤きくな
りすぎて勾配が⼩さくなることが想
定されるため,√dkでスケーリング
2017/6/2 7
3. モデル構造
Multi-Head Attention
• V, K ,Qを⼀度線形変換し,
Scaled Dot-Productにかけたあ
とConcatし,再び線形変換
• 異なる位置の異なる表現部分空
間からの情報を学習できる
• 以下の3箇所において使⽤
– エンコーダ/デコーダを繋ぐ部分
• 従来のAttention
– エンコーダ部分のSelf-Attention
– デコーダ部分のSelf-Attention
• 未来の情報を使わないように
Scaled Dot-ProductのSoftmax前
にマスキング
2017/6/2 8
3. モデル構造
• フィードフォワードネットワーク
– それぞれの位置に別々に同じように適⽤
– 2つの線形変換と、その間にReLUを起動することで構成
• Positional Encoding
– リカレント層がないので、位置情報を伝える⼯夫
2017/6/2 9
4.何故Self-Attentionか
• 3つの理由
– レイヤごとの合計計算複雑度
– 必要な順次操作の最⼩数によって測定される並列化可能な計算
量
– ネットワーク内の⻑距離依存関係間のパス⻑
• 副次的な利点
– ⾃⼰の注意がより解釈可能なモデルを⽣み出すことができる
2017/6/2 10
各レイヤタイプの計算量:Self-AttentionはO(1)に対し,ReccurentはO(n)
r the size of the neighborhood in restricted self-attention.
5. 実験
• データとバッチ処理
– WMT 2014英語 - ドイツ語データセットとWMT 2014英語 - フ
ランス語データ
• ドイツ語:4.5 million sentence pairsと37000 tokens
• フランス語: 36M sentences and split tokens into a 32000
– センテンスペアは、およそのシーケンス⻑でまとめてバッチ処理
• ハードウェアとスケジュール
– 8台のNVIDIA P100 GPUを搭載した1台のマシン
– ベースモデル
• 約0.4秒 per 各トレーニングステップに約0.4秒
• 合計10万ステップ学習=12時間訓練
– ⼤きなモデル(big)
• ステップ時間は1.0秒
• 30万step、3.5⽇で学習
2017/6/2 11
6. 結果
• 性能
– EN-DEの翻訳で以前のSOTAをBLEUで2.0以上上回る(28.4)
– EN-FRでは過去のシングルモデルを全て上回る(BLEU41.0)
• コスト
– 以前のSOTAの1/4以下
2017/6/2 12
6. 結果
• モデルの評価
– パラメータを変更
• (A)
– 計算量を⼀定に保ちながら、アテンションヘッドの数とアテンションキーとアトリビュートのディメンションを変更
– シングルヘッドのアテンションが最も良い設定よりも0.9 BLEU悪いが、ヘッドが多すぎると低下
• (B)
– アテンションキーサイズdkを⼩さくするとモデルの品質が低下
– 互換性の判断が容易ではなく、ドット製品よりも⾼度な互換機能が有益であることを⽰唆
• (C),(D)
– 予想通り⼤きなモデルが優れている
– ドロップアウトがオーバーフィッティングを回避するのに有効
• (E)
– 正弦波の位置符号化を学習されたPositional Encodingに置き換え、基本モデルとほぼ同じ結果を観測する。
2017/6/2 13
6. 結果
• 英語の構成構⽂解析
– 他のタスクに⼀般化できるかどうかを評価
• RNN⽂法を除いて全ての⼿法を上回る結果
2017/6/2 14
7. 結論
• 本研究では、リカレント層をMulti-headed self-
attentionに置き換え、アテンションのみで構築された最
初の配列変換モデルであるTransformerを提案
– ⾼速に学習可能
– WMT 2014 En-De、En-Fr共にSOTAを達成
• 特にEn-Deでは以前すべてのアンサンブルを上回る
• 英語の構成構⽂解析についての実験し、他タスクにも⼀般的に効果
があることを⽰した
– 画像、オーディオ、ビデオなどのなどにも応⽤予定
2017/6/2 15
関連リンク
• 著者によるtensorflow実装
– https://github.com/tensorflow/tensor2tensor
• Reddit
– https://www.reddit.com/r/MachineLearning/comments/6gwq
iw/r_170603762_attention_is_all_you_need_sota_nmt/
• PyTorchでの実装
– https://github.com/jadore801120/attention-is-all-you-need-
pytorch
• Chainerでの実装
– https://github.com/soskek/attention_is_all_you_need
2017/6/2 16

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Optimizer入門&最新動向
Optimizer入門&最新動向Optimizer入門&最新動向
Optimizer入門&最新動向
 
SSII2022 [SS2] 少ないデータやラベルを効率的に活用する機械学習技術 〜 足りない情報をどのように補うか?〜
SSII2022 [SS2] 少ないデータやラベルを効率的に活用する機械学習技術 〜 足りない情報をどのように補うか?〜SSII2022 [SS2] 少ないデータやラベルを効率的に活用する機械学習技術 〜 足りない情報をどのように補うか?〜
SSII2022 [SS2] 少ないデータやラベルを効率的に活用する機械学習技術 〜 足りない情報をどのように補うか?〜
 
Recent Advances on Transfer Learning and Related Topics Ver.2
Recent Advances on Transfer Learning and Related Topics Ver.2Recent Advances on Transfer Learning and Related Topics Ver.2
Recent Advances on Transfer Learning and Related Topics Ver.2
 
最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情最近のDeep Learning (NLP) 界隈におけるAttention事情
最近のDeep Learning (NLP) 界隈におけるAttention事情
 
自己教師学習(Self-Supervised Learning)
自己教師学習(Self-Supervised Learning)自己教師学習(Self-Supervised Learning)
自己教師学習(Self-Supervised Learning)
 
近年のHierarchical Vision Transformer
近年のHierarchical Vision Transformer近年のHierarchical Vision Transformer
近年のHierarchical Vision Transformer
 
ドメイン適応の原理と応用
ドメイン適応の原理と応用ドメイン適応の原理と応用
ドメイン適応の原理と応用
 
【メタサーベイ】数式ドリブン教師あり学習
【メタサーベイ】数式ドリブン教師あり学習【メタサーベイ】数式ドリブン教師あり学習
【メタサーベイ】数式ドリブン教師あり学習
 
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
【DL輪読会】"Secrets of RLHF in Large Language Models Part I: PPO"
 
Transformerを多層にする際の勾配消失問題と解決法について
Transformerを多層にする際の勾配消失問題と解決法についてTransformerを多層にする際の勾配消失問題と解決法について
Transformerを多層にする際の勾配消失問題と解決法について
 
【メタサーベイ】基盤モデル / Foundation Models
【メタサーベイ】基盤モデル / Foundation Models【メタサーベイ】基盤モデル / Foundation Models
【メタサーベイ】基盤モデル / Foundation Models
 
【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル【DL輪読会】マルチモーダル 基盤モデル
【DL輪読会】マルチモーダル 基盤モデル
 
[DL輪読会]Objects as Points
[DL輪読会]Objects as Points[DL輪読会]Objects as Points
[DL輪読会]Objects as Points
 
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
[DL輪読会]Vision Transformer with Deformable Attention (Deformable Attention Tra...
 
[DL輪読会]NVAE: A Deep Hierarchical Variational Autoencoder
[DL輪読会]NVAE: A Deep Hierarchical Variational Autoencoder[DL輪読会]NVAE: A Deep Hierarchical Variational Autoencoder
[DL輪読会]NVAE: A Deep Hierarchical Variational Autoencoder
 
You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話
You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話
You Only Look One-level Featureの解説と見せかけた物体検出のよもやま話
 
[DL輪読会]ICLR2020の分布外検知速報
[DL輪読会]ICLR2020の分布外検知速報[DL輪読会]ICLR2020の分布外検知速報
[DL輪読会]ICLR2020の分布外検知速報
 
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
勾配ブースティングの基礎と最新の動向 (MIRU2020 Tutorial)
 
Triplet Loss 徹底解説
Triplet Loss 徹底解説Triplet Loss 徹底解説
Triplet Loss 徹底解説
 
【DL輪読会】"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding"
【DL輪読会】"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding"【DL輪読会】"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding"
【DL輪読会】"Instant Neural Graphics Primitives with a Multiresolution Hash Encoding"
 

Andere mochten auch

Andere mochten auch (6)

NIPS2013読み会 DeViSE: A Deep Visual-Semantic Embedding Model
NIPS2013読み会 DeViSE: A Deep Visual-Semantic Embedding ModelNIPS2013読み会 DeViSE: A Deep Visual-Semantic Embedding Model
NIPS2013読み会 DeViSE: A Deep Visual-Semantic Embedding Model
 
Zero shot learning through cross-modal transfer
Zero shot learning through cross-modal transferZero shot learning through cross-modal transfer
Zero shot learning through cross-modal transfer
 
[DL輪読会]Convolutional Sequence to Sequence Learning
[DL輪読会]Convolutional Sequence to Sequence Learning[DL輪読会]Convolutional Sequence to Sequence Learning
[DL輪読会]Convolutional Sequence to Sequence Learning
 
Matching networks for one shot learning
Matching networks for one shot learningMatching networks for one shot learning
Matching networks for one shot learning
 
Meta-Learning with Memory Augmented Neural Network
Meta-Learning with Memory Augmented Neural NetworkMeta-Learning with Memory Augmented Neural Network
Meta-Learning with Memory Augmented Neural Network
 
K meansによるクラスタリングの解説と具体的なクラスタリングの活用方法の紹介
K meansによるクラスタリングの解説と具体的なクラスタリングの活用方法の紹介K meansによるクラスタリングの解説と具体的なクラスタリングの活用方法の紹介
K meansによるクラスタリングの解説と具体的なクラスタリングの活用方法の紹介
 

Mehr von Deep Learning JP

Mehr von Deep Learning JP (20)

【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
【DL輪読会】AdaptDiffuser: Diffusion Models as Adaptive Self-evolving Planners
 
【DL輪読会】事前学習用データセットについて
【DL輪読会】事前学習用データセットについて【DL輪読会】事前学習用データセットについて
【DL輪読会】事前学習用データセットについて
 
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
【DL輪読会】 "Learning to render novel views from wide-baseline stereo pairs." CVP...
 
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
【DL輪読会】Zero-Shot Dual-Lens Super-Resolution
 
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
【DL輪読会】BloombergGPT: A Large Language Model for Finance arxiv
 
【DL輪読会】マルチモーダル LLM
【DL輪読会】マルチモーダル LLM【DL輪読会】マルチモーダル LLM
【DL輪読会】マルチモーダル LLM
 
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
 【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo... 【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
【 DL輪読会】ToolLLM: Facilitating Large Language Models to Master 16000+ Real-wo...
 
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
【DL輪読会】AnyLoc: Towards Universal Visual Place Recognition
 
【DL輪読会】Can Neural Network Memorization Be Localized?
【DL輪読会】Can Neural Network Memorization Be Localized?【DL輪読会】Can Neural Network Memorization Be Localized?
【DL輪読会】Can Neural Network Memorization Be Localized?
 
【DL輪読会】Hopfield network 関連研究について
【DL輪読会】Hopfield network 関連研究について【DL輪読会】Hopfield network 関連研究について
【DL輪読会】Hopfield network 関連研究について
 
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
【DL輪読会】SimPer: Simple self-supervised learning of periodic targets( ICLR 2023 )
 
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
【DL輪読会】RLCD: Reinforcement Learning from Contrast Distillation for Language M...
 
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
【DL輪読会】"Language Instructed Reinforcement Learning  for Human-AI Coordination "【DL輪読会】"Language Instructed Reinforcement Learning  for Human-AI Coordination "
【DL輪読会】"Language Instructed Reinforcement Learning for Human-AI Coordination "
 
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
【DL輪読会】Llama 2: Open Foundation and Fine-Tuned Chat Models
 
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
【DL輪読会】"Learning Fine-Grained Bimanual Manipulation with Low-Cost Hardware"
 
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
【DL輪読会】Parameter is Not All You Need:Starting from Non-Parametric Networks fo...
 
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
【DL輪読会】Drag Your GAN: Interactive Point-based Manipulation on the Generative ...
 
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
【DL輪読会】Self-Supervised Learning from Images with a Joint-Embedding Predictive...
 
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
【DL輪読会】Towards Understanding Ensemble, Knowledge Distillation and Self-Distil...
 
【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...
【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...
【DL輪読会】VIP: Towards Universal Visual Reward and Representation via Value-Impl...
 

Kürzlich hochgeladen

Kürzlich hochgeladen (7)

新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 

[DL輪読会]Attention Is All You Need

  • 1. 2017/6/2 1 Attention Is All You Need 東京⼤学松尾研究室 宮崎邦洋
  • 2. Agenda 0. メタ情報 1. 背景 2. 背景(関連研究) 3. モデル構造 4. 何故Self-Attentionか 5. 実験 6. 結果 7. 結論 2017/6/2 2
  • 3. メタ情報 • 著者 – Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, Illia Polosukhin – Google BrainとGoogle Researchのグループ • 公開⽇ – Submitted on 12 Jun 2017 – https://arxiv.org/abs/1706.03762 • About – RNN/CNNを使わず, Attentionのみを使⽤し翻訳のタスクで SOTAを達成 • 選んだ理由 – 話題だった(主にタイトルが) – Attentionの勉強 2017/6/2 3
  • 4. 1. 導⼊ • 現在,⾔語処理などの系列モデリングにはRNN, LSTM, GRUがSOTA的アプローチとして使⽤されている – 系列の依存関係を維持できる • しかし,並列計算ができないため計算量が多くかかるこ とが問題点 – ⼀つ⼀つしか依存関係を維持できない • Attention機能ならば,シンボルの距離に関係なく依存関 係を構築できる – 現状RNNとの併⽤のみで使⽤されている. • 本研究では新しいモデル”Transformer“を提案 – リカレント構造を排除し,Attention機能のみを使⽤したネット ワークを構築 2017/6/2 4
  • 5. 2. 背景(関連研究) • 次計算を減らすという⽬的は、CNNで達成されてきた – Extended Neural GPU – ByteNet – ConvS2S – => CNNでは遠い距離の依存関係を学習できない • Self-Attention – 同じシーケンス内でAttentionを⾏う機能 – 読解⼒、抽象的な要約、テキストの含意、学習に依存しない⽂ の表現などのタスクに使⽤されている 2017/6/2 5
  • 6. 3. モデル構造 • 全体像 – EncoderとDecoderの両⽅に、スタックされ たSelf-AttentionとポイントワイズのFully- Connectedレイヤを使⽤ • エンコーダ – N=6の同⼀レイヤのスタック – 各層は2つのサブレイヤ • マルチヘッドのSelf-Attention • Fully-ConnectedのFeed Forward Network • それぞれのサブレイヤでresidual connection とlayer normalizationを採⽤ • デコーダ – N=6の同⼀レイヤのスタック – 各エンコーダ層の2つのサブレイヤに加え、 エンコーダからのアウトプットをMulti- Head Attentionを⾏う3層⽬を挿⼊ – デコード時のself-attentionでは順番に注意 し,既知のアウトプットにのみ依存関係を 持つようにする 2017/6/2 6
  • 7. 3. モデル構造 Scaled Dot-Product Attention • よく使⽤されるAttentionは以下 の2つ – Additive attention – dot-product (multiplicative) attention • dot-productの⽅が計算も早く,ス パース性に強く,本研究のように応 ⽤が⾏いやすい • dkが⼤きい場合,dot積が⼤きくな りすぎて勾配が⼩さくなることが想 定されるため,√dkでスケーリング 2017/6/2 7
  • 8. 3. モデル構造 Multi-Head Attention • V, K ,Qを⼀度線形変換し, Scaled Dot-Productにかけたあ とConcatし,再び線形変換 • 異なる位置の異なる表現部分空 間からの情報を学習できる • 以下の3箇所において使⽤ – エンコーダ/デコーダを繋ぐ部分 • 従来のAttention – エンコーダ部分のSelf-Attention – デコーダ部分のSelf-Attention • 未来の情報を使わないように Scaled Dot-ProductのSoftmax前 にマスキング 2017/6/2 8
  • 9. 3. モデル構造 • フィードフォワードネットワーク – それぞれの位置に別々に同じように適⽤ – 2つの線形変換と、その間にReLUを起動することで構成 • Positional Encoding – リカレント層がないので、位置情報を伝える⼯夫 2017/6/2 9
  • 10. 4.何故Self-Attentionか • 3つの理由 – レイヤごとの合計計算複雑度 – 必要な順次操作の最⼩数によって測定される並列化可能な計算 量 – ネットワーク内の⻑距離依存関係間のパス⻑ • 副次的な利点 – ⾃⼰の注意がより解釈可能なモデルを⽣み出すことができる 2017/6/2 10 各レイヤタイプの計算量:Self-AttentionはO(1)に対し,ReccurentはO(n) r the size of the neighborhood in restricted self-attention.
  • 11. 5. 実験 • データとバッチ処理 – WMT 2014英語 - ドイツ語データセットとWMT 2014英語 - フ ランス語データ • ドイツ語:4.5 million sentence pairsと37000 tokens • フランス語: 36M sentences and split tokens into a 32000 – センテンスペアは、およそのシーケンス⻑でまとめてバッチ処理 • ハードウェアとスケジュール – 8台のNVIDIA P100 GPUを搭載した1台のマシン – ベースモデル • 約0.4秒 per 各トレーニングステップに約0.4秒 • 合計10万ステップ学習=12時間訓練 – ⼤きなモデル(big) • ステップ時間は1.0秒 • 30万step、3.5⽇で学習 2017/6/2 11
  • 12. 6. 結果 • 性能 – EN-DEの翻訳で以前のSOTAをBLEUで2.0以上上回る(28.4) – EN-FRでは過去のシングルモデルを全て上回る(BLEU41.0) • コスト – 以前のSOTAの1/4以下 2017/6/2 12
  • 13. 6. 結果 • モデルの評価 – パラメータを変更 • (A) – 計算量を⼀定に保ちながら、アテンションヘッドの数とアテンションキーとアトリビュートのディメンションを変更 – シングルヘッドのアテンションが最も良い設定よりも0.9 BLEU悪いが、ヘッドが多すぎると低下 • (B) – アテンションキーサイズdkを⼩さくするとモデルの品質が低下 – 互換性の判断が容易ではなく、ドット製品よりも⾼度な互換機能が有益であることを⽰唆 • (C),(D) – 予想通り⼤きなモデルが優れている – ドロップアウトがオーバーフィッティングを回避するのに有効 • (E) – 正弦波の位置符号化を学習されたPositional Encodingに置き換え、基本モデルとほぼ同じ結果を観測する。 2017/6/2 13
  • 14. 6. 結果 • 英語の構成構⽂解析 – 他のタスクに⼀般化できるかどうかを評価 • RNN⽂法を除いて全ての⼿法を上回る結果 2017/6/2 14
  • 15. 7. 結論 • 本研究では、リカレント層をMulti-headed self- attentionに置き換え、アテンションのみで構築された最 初の配列変換モデルであるTransformerを提案 – ⾼速に学習可能 – WMT 2014 En-De、En-Fr共にSOTAを達成 • 特にEn-Deでは以前すべてのアンサンブルを上回る • 英語の構成構⽂解析についての実験し、他タスクにも⼀般的に効果 があることを⽰した – 画像、オーディオ、ビデオなどのなどにも応⽤予定 2017/6/2 15
  • 16. 関連リンク • 著者によるtensorflow実装 – https://github.com/tensorflow/tensor2tensor • Reddit – https://www.reddit.com/r/MachineLearning/comments/6gwq iw/r_170603762_attention_is_all_you_need_sota_nmt/ • PyTorchでの実装 – https://github.com/jadore801120/attention-is-all-you-need- pytorch • Chainerでの実装 – https://github.com/soskek/attention_is_all_you_need 2017/6/2 16