稀疏注意力 | Big Bird: Transformers for Longer Sequences

参考:「芝麻街」Big Bird : Sparse Attention 再填新成员

背景:

原来的注意力机制复杂度高,q需要和每个key点乘,复杂度是n*n。

存在内存问题,自然也就存在token长度限制。

full attention  ->  small attention ?

big bird = longformer + random attention

三要点:

Random attention

Window attention

Global Attention

 三要点

Big Bird的稀疏注意力机制,将二次依赖降至线性,解决了BERT模型中的全注意力机制带来的序列长度二次依赖限制,同时兼顾更长的上下文。Big Bird主要由三个部分组成:

  • global attention:一组参与序列的所有部分的g全局token([cls])。 
  • random attention:对于每个查询 [公式] ,每个查询将处理的r个随机key的集合。
  • window attention:一个本地邻居块w,以便每个节点处理其本地结构(attention自己和邻居)。
原文地址:https://www.cnblogs.com/shona/p/13446715.html