用轻量循环结构压缩长序列信息,提升Transformer在边缘设备的效率
Compact Recurrent Transformer with Persistent Memory
- 将短段落Transformer与循环网络结合,用单个持久记忆向量传递全局信息
- 段长减半或四分之一,仍达全长度Transformer的预测精度,计算量大幅降低
- 适合资源受限场景,如边缘计算,尤其适用于视频分类任务
Transformer架构在语言和视觉任务中表现优异,但其自注意力机制随输入长度呈平方增长,难以高效处理长序列。现有方法通过分段处理并引入记忆机制缓解此问题,但通常带来额外计算开销,限制其在计算内存与功耗敏感场景(如边缘计算)的应用。本文提出一种新型高效的紧凑循环Transformer(CRT),将浅层Transformer处理短局部段落,并结合循环神经网络压缩和管理一个单一持久记忆向量,以捕捉段间长程全局信息。我们在WordPTB和WikiText-103上评估了其在下一个词预测任务中的表现,在Toyota Smarthome视频数据集上进行了分类任务测试。CRT在语言数据集上达到或超越全长度Transformer的性能,同时使用一半或四分之一的段长,且显著减少浮点运算量(FLOPs)。该方法在Toyota Smarthome数据集上也达到了当前最优性能。
原文摘要 · Abstract (English)
The Transformer architecture has shown significant success in many language processing and visual tasks. However, the method faces challenges in efficiently scaling to long sequences because the self-attention computation is quadratic with respect to the input length. To overcome this limitation, several approaches scale to longer sequences by breaking long sequences into a series of segments, restricting self-attention to local dependencies between tokens within each segment and using a memory mechanism to manage information flow between segments. However, these approached generally introduce additional compute overhead that restricts them from being used for applications where limited compute memory and power are of great concern (such as edge computing). We propose a novel and efficient Compact Recurrent Transformer (CRT), which combines shallow Transformer models that process short local segments with recurrent neural networks to compress and manage a single persistent memory vector that summarizes long-range global information between segments. We evaluate CRT on WordPTB and WikiText-103 for next-token-prediction tasks, as well as on the Toyota Smarthome video dataset for classification. CRT achieves comparable or superior prediction results to full-length Transformers in the language datasets while using significantly shorter segments (half or quarter size) and substantially reduced FLOPs. Our approach also demonstrates state-of-the-art performance on the Toyota Smarthome video dataset.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。