Spiking Transformer 之硬體友善模型與平行化設計

Hardware Friendly Model and Parallel Design for Spiking Transformer

檔案

全文將於 2029年8月28日 起公開。

日期

2024

類型

語言

英文

摘要

人工神經網絡近年來在電腦視覺任務中蓬勃發展,例如 Transformer 在圖像分類任務中獲得良好的成績。然而,Transformer 需要大量複雜的乘加(MAC)操作,使 Transformer 無可避免地面臨大量能量消耗的問題。因此,擁有二進制脈衝傳輸和高稀疏特性的脈衝神經網絡(SNN)正逐漸作為傳統人工神經網絡的替代方案。SNN 的二進制輸入特性可以使硬體在實現低能耗的同時也具有硬體設計友善的優勢。我們認為這些優勢適用於需要大量 MAC 操作的 Transformer 架構,因此促使我們研究相關演算法並開發適用於 Vision Transformer 的 SNN 加速器。

我們的演算法架構是以 Spikformer 為原型。雖然 Spikformer 解決了 self-attention 中會遇到的非脈衝計算問題,但因為 residual block 的相加,導致在後續的網絡層中存在非脈衝計算的問題。這不僅限制了 SNN 應用於 Transformer 的能源效率優勢,也使得加速器的設計更為困難。因此,我們將 Spikformer 中的 residual block 以 element-wise-IAND 取代原先的 element-wise-ADD,以解決非脈衝計算的問題。此外,我們還利用逐步時間步驟剪枝的方式,訓練出時間步長為 1 的模型,大大降低了 SNN 的推理時間。

在硬體設計方面,為了降低 SNN 加速器因時間步長造成的計算延遲問題,我們提出了一個全新的空間-時間並行處理的可重組 LIF 架構。透過對所有時間步長的輸出進行並行處理,我們不僅降低了硬體計算延遲,也避免了對膜電位記憶體的訪問需求,從而有效地降低了硬體的能耗。我們的加速器還能支援具有不同時間步長的 SNN 模型。硬體的數據流採用了向量化的處理方式,以支援 3x3 卷積、1x1 卷積和矩陣運算,來符合 Spike-IAND-Former 的計算需求。加速器實現在台積電 28 奈米製程,模擬結果顯示,只需要 198.46K 個邏輯閘數和 139.25KB 的 SRAM,即可達到 3456 GSOPS(每秒百萬次脈衝操作),其功率效率在工作頻率為 500 MHz 時可達到 38.334 TSOPS/W(每瓦特百萬次脈衝操作)。

據我們所知,我們是第一個開發適用於 Vision Transformer 的 SNN 加速器。我們的加速器在降低 SNN 運行時間的同時,還實現了更佳的功率效率。我們相信,這項技術將對低能耗的 SNN 加速器的發展有所助益。
In recent years, artificial neural networks have seen significant development in computer vision tasks, with models like Transformers achieving excellent results in image classification. However, Transformers require a large number of complex multiply-accumulate (MAC) operations, inevitably leading to substantial energy consumption issues. As a result, spiking neural networks (SNNs), which feature binary spike transmission and high sparsity, are gradually emerging as an alternative to traditional artificial neural networks. The binary input characteristic of SNNs allows hardware to achieve low energy consumption while also being advantageous in hardware design. We believe these advantages are applicable to the Transformer architecture, which requires extensive MAC operations, thus motivating us to study related algorithms and develop an SNN accelerator suitable for Vision Transformers.

Our algorithm architecture is based on Spikformer. Although Spikformer addresses the non-spike computation problem encountered in self-attention, the residual block's addition leads to non-spike computation issues in subsequent network layers. This not only limits the energy efficiency advantages of SNNs when applied to Transformers but also complicates accelerator design. Therefore, we replace the residual block in Spikformer with element-wise-IAND instead of the original element-wise-ADD to solve the non-spike computation issue. Additionally, we employ progressive time-step pruning to train a model with a time step of 1, significantly reducing the inference time of the SNN.

In terms of hardware design, to reduce the computation delay caused by time steps in SNN accelerators, we propose a novel reconfigurable LIF architecture for spatial-temporal parallel processing. By parallel processing the outputs of all time steps, we reduce hardware computation delay while also avoiding the need for accessing membrane memory, effectively lowering the hardware's energy consumption. Our accelerator also supports SNN models with different time steps. The hardware data flow adopts a vectorized processing approach to support 3x3 convolution, 1x1 convolution, and matrix operations, meeting the computational requirements of Spike-IAND-Former. The accelerator is implemented in TSMC’s 28nm process, and simulation results show that it only requires 198.46K logic gates and 139.25KB of SRAM to achieve a throughput of 3456 GSOPS (giga spike operations per second). Its power efficiency reaches up to 38.334 TSOPS/W (tera spike operations per second per watt) when operating at a frequency of 500 MHz.

To the best of our knowledge, we are the first to develop a spiking neural network accelerator suitable for Vision Transformers. Our accelerator not only reduces the runtime of spiking neural networks but also achieves superior power efficiency. We believe it can contribute to the development of low-power spiking neural network accelerators.

所屬典藏

電子研究所
顯示完整詮釋資料 統計資料

引用此條目

Chen, B.-Y. (2024). Hardware Friendly Model and Parallel Design for Spiking Transformer. https://thesis.lib.nycu.edu.tw/handle/20.500.14371/4041

BibTeX RIS

引用文字依 APA 第 7 版格式自動產生,使用前請再核對。

分享

永久網址:https://thesis.lib.nycu.edu.tw/handle/20.500.14371/4041