知识卡片
注意力矩阵按查询行归一
令Q=T Wqᵀ、K=T Wkᵀ、V=T Wvᵀ,则A=Softmax行(QKᵀ/√m),输出为AV。A的第i行描述第i个查询对各键的权重,因此应沿候选键轴归一化。批处理时通常是最后一个轴,不能随意选第0轴。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- · 查看原书依据
Finally, we have the attention equation: (26.20) (26.21) where the softmax is taken within each row (i.e., over the vector of matches for each separate query vector, like in equation (26.14)). In expanded detail, here are the full mechanics of a self-attention layer (figure 26.10): Figure 26.10: Self-attention layer expanded. The nodes with the dashed outline correspond to each other; they represent one query being
参考来源
- 位置:《Foundations of Computer Vision (Antonio Torralba, Phillip Isola etc.)》第26章《Transformer》(来源项目:a19c7933-4eda-4176-aebd-30fe7e1ad292;源文件:extracted/Foundations of Computer Vision (Antonio Torralba, Phillip Isola etc.)/_epub-src/OPS/xhtml/c026.xhtml)
- 结论依据:摘录中关于注意力矩阵按查询行归一的定义、比较或条件支撑卡片;原书表述不严谨的范围已在覆盖记录逐项限定,不把案例结果外推为普遍结论。
- 原始内容:Finally, we have the attention equation: (26.20) (26.21) where the softmax is taken within each row (i.e., over the vector of matches for each separate query vector, like in equation (26.14)). In expanded detail, here are the full mechanics of a self-attention layer (figure 26.10): Figure 26.10: Self-attention layer expanded. The nodes with the dashed outline correspond to each other; they represent one query being