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
79
もう一度理解する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
62
「みえるーむ」(都知事杯オープンデータ・ハッカソン 2024)
yjn279
0
68
5分で学ぶOpenAI APIハンズオン
yjn279
0
210
『確率思考の戦略論』
yjn279
0
140
Amazonまでのレコメンド入門
yjn279
1
170
金研究室 勉強会 『もう一度理解する Transformer(前編)』
yjn279
0
110
金研究室 勉強会 『U-Netとそのバリエーションについて』
yjn279
0
760
金研究室 勉強会 『Seismic Data Augmentation Based on Conditional Generative Adversarial Networks』
yjn279
0
100
金研究室 勉強会 『バックプロパゲーションと勾配消失問題』
yjn279
0
450
Other Decks in Science
See All in Science
baseballrによるMLBデータの抽出と階層ベイズモデルによる打率の推定 / TokyoR118
dropout009
2
610
デジタルアーカイブの教育利用促進を目指したメタデータLOD基盤に関する研究 / Research on a Metadata LOD Platform for Promoting Educational Uses of Digital Archives
masao
0
110
データベース10: 拡張実体関連モデル
trycycle
PRO
0
1k
Accelerated Computing for Climate forecast
inureyes
PRO
0
130
データベース02: データベースの概念
trycycle
PRO
2
950
【論文紹介】Is CLIP ideal? No. Can we fix it?Yes! 第65回 コンピュータビジョン勉強会@関東
shun6211
5
1.6k
サイコロで理解する原子核崩壊と拡散現象 〜単純化されたモデルで本質を理解する〜
syotasasaki593876
0
120
蔵本モデルが解き明かす同期と相転移の秘密 〜拍手のリズムはなぜ揃うのか?〜
syotasasaki593876
1
130
AI(人工知能)の過去・現在・未来 —AIは人間を超えるのか—
tagtag
1
200
イロレーティングを活用した関東大学サッカーの定量的実力評価 / A quantitative performance evaluation of Kanto University Football Association using Elo rating
konakalab
0
110
Ignite の1年間の軌跡
ktombow
0
170
AIによる科学の加速: 各領域での革新と共創の未来
masayamoriofficial
0
240
Featured
See All Featured
A designer walks into a library…
pauljervisheath
210
24k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
How STYLIGHT went responsive
nonsquared
100
5.9k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
2.9k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
34
It's Worth the Effort
3n
187
28k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.1k
The Cost Of JavaScript in 2023
addyosmani
55
9.3k
Bash Introduction
62gerente
615
210k
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