Spiking neural networks (SNNs) are bio-inspired networks that mimic how neurons in the brain communicate through discrete spikes, which have great potential in various tasks due to their energy efficiency and temporal processing capabilities. SNNs with self-attention mechanisms (spiking Transformers) have recently shown great advancements in various tasks, and inspired by traditional Transformers, several studies have demonstrated that spiking absolute positional encoding can help capture sequential relationships for input data, enhancing the capabilities of spiking Transformers for tasks such as sequential modeling and image classification. However, how to incorporate relative positional information into SNNs remains a challenge. In this paper, we introduce several strategies to approximate relative positional encoding in spiking Transformers while preserving the binary nature of spikes. Firstly, we formally prove that encoding relative distances with Gray Code ensures that the binary representations of positional indices maintain a constant Hamming distance whenever their decimal values differ by a power of two, and we propose Gray-PE based on this property. In addition, we propose another RPE method called Log-PE, which combines the logarithmic form of the relative distance matrix directly into the spiking attention map. Furthermore, we extend our RPE methods to a two-dimensional form, making them suitable for processing image patches. We evaluate our RPE methods on various tasks, including time series forecasting, text classification, and patch-based image classification, and the experimental results demonstrate a satisfying performance gain by incorporating our RPE methods across many architectures. Our results provide fresh perspectives on designing spiking Transformers to advance their sequential modeling capability, thereby expanding their applicability across various domains.
Revisiting Direct Encoding: Learnable Temporal Dynamics for Static Image Spiking Neural Networks
School of Computer and Information Engineering, Henan University(河南大学计算机与信息工程学院);Henan Key Laboratory of Big Data Analysis and Processing, Henan University(河南大学大数据分析与处理重点实验室)
Exploiting a Stimuli Encoding Scheme of Spiking Neural Networks for Stream Learning
TECNALIA(泰克纳利亚);Télécom ParisTech(巴黎电信学院);University of Waikato(怀卡托大学);Basque Center for Applied Mathematics (BCAM)(巴斯克应用数学中心);University of the Basque Country UPV/EHU(巴斯克大学(UPV/EHU))
A Resource-efficient Spiking Neural Network Accelerator Supporting Emerging Neural Encoding
Institute of High Performance Computing, Agency for Science, Technology and Research(新加坡科技研究局高性能计算研究所);Future Network of Intelligence Institute, Chinese University of Hong Kong(香港中文大学(深圳)未来智联网络研究院)
Recent Advances and New Frontiers in Spiking Neural Networks
Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院)