arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2307.01694cs.NEcs.CV
收藏

脉冲驱动 Transformer

Spike-driven Transformer

Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);Peng Cheng Laboratory(鹏城实验室);Peking University(北京大学)

Man Yao, Jiakui Hu, Zhaokun Zhou, Li Yuan, Yonghong Tian, Bo Xu, Guoqi Li

AI总结:

本文提出脉冲驱动 Transformer,通过脉冲驱动自注意力 SDSA 将矩阵乘法转化为掩码和稀疏加法,实现事件驱动与二值脉冲通信,在 ImageNet-1K 上取得 SNN 领域最优的 77.1% top-1 准确率,并显著降低计算能耗。

摘要:

脉冲神经网络(SNNs)因其独特的基于脉冲的事件驱动(即脉冲驱动)范式,提供了一种高能效的深度学习选择。在本文中,我们通过所提出的脉冲驱动 Transformer 将脉冲驱动范式融入 Transformer,该模型具有四个独特性质:1)事件驱动,当 Transformer 的输入为零时不触发任何计算;2)二值脉冲通信,所有与脉冲矩阵相关的矩阵乘法都可以转化为稀疏加法;3)在 token 维度和通道维度上都具有线性复杂度的自注意力;4)脉冲形式的 Query、Key 和 Value 之间的操作是掩码和加法。综上,脉冲驱动 Transformer 中只存在稀疏加法操作。为此,我们设计了一种新颖的脉冲驱动自注意力(SDSA),它仅利用掩码和加法操作而不涉及任何乘法,因此其计算能耗比普通自注意力低至多 $87.2\ imes$。特别地,在 SDSA 中,Query、Key 和 Value 之间的矩阵乘法被设计为掩码操作。此外,我们将普通 Transformer 中的所有残差连接重新排列到激活函数之前,以确保所有神经元都传递二值脉冲信号。结果表明,脉冲驱动 Transformer 在 ImageNet-1K 上可以达到 77.1\% 的 top-1 准确率,这是 SNN 领域中最先进的结果。源代码可在 https://github.com/BICLab/Spike-Driven-Transformer 获取。

英文摘要:

Spiking Neural Networks (SNNs) provide an energy-efficient deep learning option due to their unique spike-based event-driven (i.e., spike-driven) paradigm. In this paper, we incorporate the spike-driven paradigm into Transformer by the proposed Spike-driven Transformer with four unique properties: 1) Event-driven, no calculation is triggered when the input of Transformer is zero; 2) Binary spike communication, all matrix multiplications associated with the spike matrix can be transformed into sparse additions; 3) Self-attention with linear complexity at both token and channel dimensions; 4) The operations between spike-form Query, Key, and Value are mask and addition. Together, there are only sparse addition operations in the Spike-driven Transformer. To this end, we design a novel Spike-Driven Self-Attention (SDSA), which exploits only mask and addition operations without any multiplication, and thus having up to $87.2\times$ lower computation energy than vanilla self-attention. Especially in SDSA, the matrix multiplication between Query, Key, and Value is designed as the mask operation. In addition, we rearrange all residual connections in the vanilla Transformer before the activation functions to ensure that all neurons transmit binary spike signals. It is shown that the Spike-driven Transformer can achieve 77.1\% top-1 accuracy on ImageNet-1K, which is the state-of-the-art result in the SNN field. The source code is available at https://github.com/BICLab/Spike-Driven-Transformer.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑