SNN-BERT: Training-efficient Spiking Neural Networks for energy-efficient BERT.

Journal: Neural networks : the official journal of the International Neural Network Society
Published Date:

Abstract

Spiking Neural Networks (SNNs) are naturally suited to process sequence tasks such as NLP with low power, due to its brain-inspired spatio-temporal dynamics and spike-driven nature. Current SNNs employ "repeat coding" that re-enter all input tokens at each timestep, which fails to fully exploit temporal relationships between the tokens and introduces memory overhead. In this work, we align the number of input tokens with the timestep and refer to this input coding as "individual coding". To cope with the increase in training time for individual encoded SNNs due to the dramatic increase in timesteps, we design a Bidirectional Parallel Spiking Neuron (BPSN) with following features: First, BPSN supports spike parallel computing and effectively avoids the issue of uninterrupted firing; Second, BPSN excels in handling adaptive sequence length tasks, which is a capability that existing work does not have; Third, the fusion of bidirectional information enhances the temporal information modeling capabilities of SNNs; To validate the effectiveness of our BPSN, we present the SNN-BERT, a deep direct training SNN architecture based on the BERT model in NLP. Compared to prior repeat 4-timestep coding baseline, our method achieves a 6.46× reduction in energy consumption and a significant 16.1% improvement, raising the performance upper bound of the SNN domain on the GLUE dataset to 74.4%. Additionally, our method achieves 3.5× training acceleration and 3.8× training memory optimization. Compared with artificial neural networks of similar architecture, we obtain comparable performance but up to 22.5× energy efficiency. We would provide the codes.

Authors

  • Qiaoyi Su
    School of Artificial Intelligence, University of Chinese Academy of Sciences, Beijing 100049, China; Institute of Automation, Chinese Academy of Sciences, Beijing 100190, China. Electronic address: suqiaoyi2020@ia.ac.cn.
  • Shijie Mei
    Institute of Automation, Chinese Academy of Sciences, Beijing 100190, China.
  • Xingrun Xing
    Institute of Automation, Chinese Academy of Sciences, Beijing 100190, China.
  • Man Yao
    School of Automation Science and Engineering, Xi'an Jiaotong University, Xi'an, Shaanxi 710049, China; Peng Cheng Laboratory, Shenzhen 518000, China. Electronic address: manyao@stu.xjtu.edu.cn.
  • Jiajun Zhang
  • Bo Xu
    State Key Laboratory of Cardiovascular Disease, Fuwai Hospital, National Center for Cardiovascular Diseases, Chinese Academy of Medical Sciences and Peking Union Medical College, Beijing 100037, China.
  • Guoqi Li
    University of Chinese Academy of Sciences, Beijing 100049, China.