Last updated 2 years ago
论文地址:
利用点乘的方式计算Attention:
输入:Q,K,V∈Rn×d,p1,p2∈Rn×d1\mathbf Q, \mathbf K, \mathbf V\in \mathbb R^{n\times d}, \mathbf p_1,\mathbf p_2\in \mathbb R^{n\times d_1}Q,K,V∈Rn×d,p1,p2∈Rn×d1
计算W=p1p2⊤∈Rn×n\mathbf W= \mathbf p_1\mathbf p_2 ^\top \in \mathbb R^{n\times n}W=p1p2⊤∈Rn×n
输出:
O(d2n+n2d1)O(d^2n + n^2d_1)O(d2n+n2d1)
不变。
暂无,但是论文里有伪代码。
Encoder和Decoder情形都进行了实验,总体来说效果还不错。
因为没有计算Attention matrix,所以token之间的交互是通过W\mathbf WW矩阵。
挺好的一个思路,可以考虑复现。