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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
winnie279
September 06, 2022
Science
90
0
Share
もう一度理解するTransformer(後編)
もう一度理解するTransformer(後編), 中村勇士, 2022
winnie279
September 06, 2022
More Decks by winnie279
See All by winnie279
NowWay:訪⽇外国⼈旅⾏者向けの災害⽀援サービス
yjn279
0
20
「みえるーむ」(都知事杯Open Data Hackathon 2024 Final Stage)
yjn279
0
75
「みえるーむ」(都知事杯オープンデータ・ハッカソン 2024)
yjn279
0
79
5分で学ぶOpenAI APIハンズオン
yjn279
0
240
『確率思考の戦略論』
yjn279
0
160
Amazonまでのレコメンド入門
yjn279
1
190
金研究室 勉強会 『もう一度理解する Transformer(前編)』
yjn279
0
130
金研究室 勉強会 『U-Netとそのバリエーションについて』
yjn279
0
940
金研究室 勉強会 『Seismic Data Augmentation Based on Conditional Generative Adversarial Networks』
yjn279
0
110
Other Decks in Science
See All in Science
baseballrによるMLBデータの抽出と階層ベイズモデルによる打率の推定 / TokyoR118
dropout009
2
890
生成AIの現状と展望
tagtag
PRO
0
110
なぜ21は素因数分解されないのか? - Shorのアルゴリズムの現在と壁
daimurat
0
370
MATSUO Makiko
genomethica
0
130
Understanding CVP Waveforms: Interpretation and Clinical Implications in Anesthesiology
taka88
0
350
Non-Gaussian, nonlinear causal discovery with hidden variables and application
sshimizu2006
0
110
Distributional Regression
tackyas
0
470
ハミルトン・ヤコビ方程式の解の性質と物理的意味
enakai00
0
230
SHINOMIYA Nariyoshi
genomethica
0
120
データマイニング - コミュニティ発見
trycycle
PRO
0
240
プロジェクト「Azayaka」のSARの数式とジオメトリ
syuchimu
0
190
KH Coderチュートリアル(スライド版)
koichih
1
61k
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
270
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
340
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
68
38k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
420
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Information Architects: The Missing Link in Design Systems
soysaucechin
0
880
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
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