
摘要
常见的Transformer架构本质上受限于只能对整个标记序列进行操作,而不能逐个处理标记。因此,在时间序列数据的在线推理过程中,由于连续标记序列之间的重叠,其使用会导致相当大的冗余。在本研究中,我们提出了缩放点积注意力机制(Scaled Dot-Product Attention)的新公式,使得Transformer能够在持续输入流上高效地进行逐个标记的在线推理。重要的是,我们的修改仅涉及计算顺序,而输出结果和学习到的权重与原始Transformer编码器完全相同。我们通过在THUMOS14、TVSeries和GTZAN数据集上的实验验证了所提出的持续Transformer编码器,并取得了显著的结果:我们的单块和双块持续架构分别将每次预测所需的浮点运算量减少了最多63倍和2.6倍,同时保持了预测性能。
代码仓库
lukashedegaard/continual-transformers
官方
pytorch
GitHub 中提及
基准测试
| 基准 | 方法 | 指标 |
|---|---|---|
| online-action-detection-on-thumos-14 | OadTR-b2 | MFLOPs per pred: 1075.7 mAP: 64.5 |
| online-action-detection-on-thumos-14 | CoOadTR-b1 | MFLOPs per pred: 10.6 |
| online-action-detection-on-thumos-14 | OadTR | MFLOPs per pred: 2513.5 mAP: 64.2 |
| online-action-detection-on-thumos-14 | OadTR-b1 | MFLOPs per pred: 673 mAP: 63.9 |
| online-action-detection-on-thumos-14 | CoOadTR-b2 | MFLOPs per pred: 411.9 mAP: 64.4 |
| online-action-detection-on-tvseries | CoOadTR-b1 | mCAP: 87.7 |
| online-action-detection-on-tvseries | OadTR-b2 | mCAP: 88.3 |
| online-action-detection-on-tvseries | OadTR-b1 | mCAP: 88.1 |
| online-action-detection-on-tvseries | OadTR | mCAP: 88.6 |
| online-action-detection-on-tvseries | CoOadTR-b2 | mCAP: 87.6 |