Transformer中的attention区别?
(1) Encoder的Self-Attention中,Q、K、V相等,他们是上一层Encoder的输出,对于第一层Encoder,他们就是Word Embedding和Positional Embedding相加得到的输入
(2) Decoder的Self-Attention 中,Q、K、V相等,它们是上一层 Decoder 的输出,对于第一层Decoder,他们就是Word Embedding和Positional Embedding相加得到的输入
(3) 在Encoder-Decoder Attention中,Q来自于上一层Decoder的输出,K和V来自于 Encoder的输出
https://blog.youkuaiyun.com/weixin_45069761/article/details/107851875

本文详细探讨了Transformer模型中三种不同类型的注意力机制:Encoder的Self-Attention,Decoder的Self-Attention以及Encoder-Decoder Attention。在Encoder的Self-Attention中,Q、K、V均来自上一层Encoder的输出;Decoder的Self-Attention同样如此,但对于第一层,输入是Word Embedding和Positional Embedding的结合。而在Encoder-Decoder Attention中,Q来自Decoder上一层,而K和V来源于Encoder的输出。这些注意力机制是Transformer实现序列到序列学习的关键组件。
2万+

被折叠的 条评论
为什么被折叠?



