论文地址:
https://arxiv.org/abs/2107.11906arrow-up-right
参考资料:
https://www.mis.mpg.de/scicomp/Fulltext/WS_HMatrices.pdfarrow-up-right
利用层次化的方式计算Attention(本质上任然是稀疏的方法),核心思路是只计算如下位置的Attention:
计算公式为:
其中P(i)\mathbf P^{(i)}P(i)为预先计算好的矩阵,A(i)\mathbf A^{(i)}A(i)的计算方式如下:
O(knd)O(knd)O(knd)。
不变。
https://github.com/lucidrains/h-transformer-1darrow-up-right
适用于所有场景。
具体实现需要细读代码。
很新颖的思路,可以趁此机会学习Hierarchical Matrix。
Last updated 2 years ago