以下の内容はhttps://htn20190109.hatenablog.com/entry/2025/11/20/012210より取得しました。


Attention機構

https://qiita.com/qOpenDev/items/e388509324e29d338a84
https://www.nomuyu.com/multi-head-attention/
https://qiita.com/R-Tone/items/24d8a1e2b805d69a13c1
https://zenn.dev/yuto_mo/articles/72c07b702c50df
https://developers.agirobots.com/jp/multi-head-attention/
https://note.com/kikaben/n/nda0d7a609f88


・Scaled Dot-Product Attention


\displaystyle
\mathrm{Attention}(Q, K, V)
= \mathrm{softmax}\!\left( \dfrac{QK^{T}}{\sqrt{d_k}} \right) V



・Self-Attention
→ 自己注意機構
Query、Key、Valueが同じ入力

・SourceTarget Attention ( Cross-Attention )
→ 交差注意機構
Queryはデコーダーの出力由来
Key、Valueエンコーダーの出力由来




・Masked Attention
→ 単語の先読み禁止したAttention

・Single-Head Attention
→ 学習パラメータを持たないScaled Dot-Product Attentionの表現能力を広げるために、
各入力の直前に学習パラメータを持つLinear層を追加したもの


・Multi-Head Attention
→ Single-Head Attentionを多数並列に配置することで、さまざまな注意表現の学習を可能にしたAttention機構


\displaystyle
\mathrm{MultiHeadAttention}(Q, K, V)
= \mathrm{Concat}(\mathrm{head}_1, \dots, \mathrm{head}_h) W^O


\displaystyle
\mathrm{head}_i
= \mathrm{Attention}(Q W_i^Q, \, K W_i^K, \, V W_i^V)


フィードフォワード
→ 入力層に加えて1つの中間層と出力層をもつ、2層の順伝播型ニューラルネットワーク




以上の内容はhttps://htn20190109.hatenablog.com/entry/2025/11/20/012210より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14