Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
もう一度理解するTransformer(後編)
Search
winnie279
September 06, 2022
Science
0
77
もう一度理解するTransformer(後編)
もう一度理解するTransformer(後編), 中村勇士, 2022
winnie279
September 06, 2022
Tweet
Share
More Decks by winnie279
See All by winnie279
「みえるーむ」(都知事杯Open Data Hackathon 2024 Final Stage)
yjn279
0
54
「みえるーむ」(都知事杯オープンデータ・ハッカソン 2024)
yjn279
0
63
5分で学ぶOpenAI APIハンズオン
yjn279
0
190
『確率思考の戦略論』
yjn279
0
130
Amazonまでのレコメンド入門
yjn279
1
150
金研究室 勉強会 『もう一度理解する Transformer(前編)』
yjn279
0
100
金研究室 勉強会 『U-Netとそのバリエーションについて』
yjn279
0
580
金研究室 勉強会 『Seismic Data Augmentation Based on Conditional Generative Adversarial Networks』
yjn279
0
93
金研究室 勉強会 『バックプロパゲーションと勾配消失問題』
yjn279
0
370
Other Decks in Science
See All in Science
機械学習 - 授業概要
trycycle
PRO
0
210
地質研究者が苦労しながら運用する情報公開システムの実例
naito2000
0
220
Ignite の1年間の軌跡
ktombow
0
140
Transport information Geometry: Current and Future II
lwc2017
0
160
メール送信サーバの集約における透過型SMTP プロキシの定量評価 / Quantitative Evaluation of Transparent SMTP Proxy in Email Sending Server Aggregation
linyows
0
960
システム数理と応用分野の未来を切り拓くロードマップ・エンターテインメント(スポーツ)への応用 / Applied mathematics for sports entertainment
konakalab
1
340
機械学習 - ニューラルネットワーク入門
trycycle
PRO
0
820
データベース04: SQL (1/3) 単純質問 & 集約演算
trycycle
PRO
0
880
Quelles valorisations des logiciels vers le monde socio-économique dans un contexte de Science Ouverte ?
bluehats
1
420
Valuable Lessons Learned on Kaggle’s ARC AGI LLM Challenge (PyDataGlobal 2024)
ianozsvald
0
400
統計学入門講座 第4回スライド
techmathproject
0
150
データベース12: 正規化(2/2) - データ従属性に基づく正規化
trycycle
PRO
0
760
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Making Projects Easy
brettharned
116
6.3k
KATA
mclloyd
30
14k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Documentation Writing (for coders)
carmenintech
72
4.9k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Invisible Side of Design
smashingmag
301
51k
Automating Front-end Workflow
addyosmani
1370
200k
Transcript
もう一度理解する Transformer(後編) 金研 機械学習勉強会 2022/09/06 中村勇士
–––––––– 単語間の注目度 前編の復習 • RNN ◦ 再帰型ネットワークの導入 ◦ 前の単語に着目する •
Bi-RNN ◦ 再帰型ネットワークが双方向に ◦ 前後の単語に着目する • Encoder-Decoder ◦ 文脈ベクトルの導入 ◦ 文章全体の意味をもつ • Attention ◦ 注意機構の導入 ◦ 時間の重みを考慮した文脈ベクトル ◦ 翻訳前後の単語間の関係性を表す this h s h t h~ t c a is . a pen < > これ は は Attention –––––– 文脈ベクトル ––––––– 翻訳する単語の情報(隠れ状態)
• Transformer ◦ RNNからSelf-Attentionへ ・単語の流れではなく、単語間の関係性を学習 ・系列長に左右されない ・並列化が可能 ◦ Scaled Dot-Product
Attention・Muti-Head Attentionの導入 • どんなモデル? ◦ 『Attention Is All You Need』(2017) ◦ 高性能、様々な分野で使われる ・BERT → Google 翻訳 ・GPT-3 → 1ヶ月間ブログを書いたのにAIだと気づかれず ・ViT → 画像認識 後編の内容 Attention
• Multi-Head Attention ◦ Scaled Dot-Product Attentionを結合 Scaled Dot-Product /
Multi-Head Attention • Scaled Dot-Product Attention ◦ QueryとKeyから注目度を計算 ◦ Keyに対応するValueに注目度を反映 Q:Query K:Key(Valueと対応) V:Value(Keyと対応) √d k :次元の補正 softmax:確率に変換 –––––––––––––––––––––––––––– 注目度 Concat:結合 W:重み
• Multi-Head Attentionの使い方の話 ◦ 今まで: 翻訳前後の単語間の関係性に注目 ◦ Self-Attention: 文章内の単語間の関係性に注目 ◦
RNNからSelf-Attentionへ Self-Attention V K Q V K Q Self-Attention Attention
Concat:結合 W:重み • Multi-Head Attention ◦ Scaled Dot-Product Attentionを結合 Scaled
Dot-Product / Multi-Head Attention • Scaled Dot-Product Attention ◦ QueryとKeyから注目度を計算 ◦ Keyに対応するValueに注目度を反映 Q:Query K:Key(Valueと対応) V:Value(Keyと対応) √d k :次元の補正 softmax:確率に変換 Self-Attentionでは、 Q・K・Vは元々同じ値 それぞれ異なる重みをかける 1つの文章を 3つの角度 × 8つの領域で認識
• Feed Forward ◦ • Add & Norm ◦ スキップコネクション
◦ 正規化 • Embedding ◦ 単語をベクトルに埋め込み • Positional Encoding ◦ ベクトルの並び順を与える • Masked Multi-Head Attention ◦ 未来の情報をマスク その他の機構 Encoder Decoder
• Positional Encoding ◦ ベクトルの並び順を与える 吾輩 / は / 猫
/ で / ある or は / 猫 / ある / で / 吾輩 ◦ 埋め込みベクトル + ポジション固有の値 ◦ 三角関数だと学習しやすい ◦ Positional Encoding • Embedding ◦ 単語をベクトルに埋め込み ID 単語 ベクトル 1 りんご [0, 0, 0, 1] 2 みかん [0, 0, 1, 0] …… …… …… 7 ばなな [0, 1, 1, 0] …… …… …… pos:単語の順番 i:次元 d model : 全体の次元数
• Transformer ◦ RNNからSelf-Attentionへ ・単語の流れではなく、単語間の関係性を学習 ・系列長に左右されない ・並列化が可能 ◦ Scaled Dot-Product
Attention・Muti-Head Attentionの導入 • どんなモデル? ◦ 『Attention Is All You Need』(2017) ◦ 高性能、様々な分野で使われる ・BERT → Google 翻訳 ・GPT-3 → 1ヶ月間ブログを書いたのにAIだと気づかれず ・ViT → 画像認識 まとめ Attention