LongT5: Efficient Text-To-Text Transformer for Long Sequences

论文地址:

整体思路以及计算方式

利用Local Attention + Global Attention减少运算量:

Local Attention:

每个token只和附近2r+12r+1个token交互。

Global Attention:

nn个token按每组ll个划分,组内token取均值,这样一共得到n/ln/l个token,每个token和这n/ln/l个token交互。

时间复杂度

时间复杂度为O(n(2r+1)d+n2/ld)O(n(2r+1)d + n^2 /l d)

训练以及loss

不变。

代码

实验以及适用场景

论文测试了encoder-decoder结构。

细节

因为global token是通过求均值得到的,所以单向模型时实现起来较为复杂。

简评

很简单并且优雅的方式,可以考虑复现。

Last updated