Table of Contents
Fetching ...

NiSNN-A: Non-iterative Spiking Neural Networks with Attention with Application to Motor Imagery EEG Classification

Chuhan Zhang, Wei Pan, Cosimo Della Santina

TL;DR

This work targets energy-efficient motor imagery EEG classification by marrying non-iterative spiking neuron dynamics with sequence-based attention. The core contributions are the NiLIF neuron, which mitigates gradient issues and yields sparse spikes, and a set of attention mechanisms tailored to EEG data (Seq-, ChanSeq-, and Global-attention). Evaluations on OpenBMI and BCIC IV 2a show NiSNN-A achieving strong accuracy among SNNs while delivering roughly twofold energy savings versus CNN baselines, highlighting practicality for edge devices. The results also provide attention visualizations that shed light on how the model focuses on informative temporal and channel regions in EEG signals. Overall, NiSNN-A demonstrates that attention can be effectively integrated into SNNs for EEG, delivering competitive performance with substantially lower energy consumption and enabling portable, real-time brain-computer interface applications.

Abstract

Motor imagery, an important category in electroencephalogram (EEG) research, often intersects with scenarios demanding low energy consumption, such as portable medical devices and isolated environment operations. Traditional deep learning algorithms, despite their effectiveness, are characterized by significant computational demands accompanied by high energy usage. As an alternative, spiking neural networks (SNNs), inspired by the biological functions of the brain, emerge as a promising energy-efficient solution. However, SNNs typically exhibit lower accuracy than their counterpart convolutional neural networks (CNNs). Although attention mechanisms successfully increase network accuracy by focusing on relevant features, their integration in the SNN framework remains an open question. In this work, we combine the SNN and the attention mechanisms for the EEG classification, aiming to improve precision and reduce energy consumption. To this end, we first propose a Non-iterative Leaky Integrate-and-Fire (LIF) neuron model, overcoming the gradient issues in the traditional SNNs using the Iterative LIF neurons. Then, we introduce the sequence-based attention mechanisms to refine the feature map. We evaluated the proposed Non-iterative SNN with Attention (NiSNN-A) model on OpenBMI, a large-scale motor imagery dataset. Experiment results demonstrate that 1) our model outperforms other SNN models by achieving higher accuracy, 2) our model increases energy efficiency compared to the counterpart CNN models (i.e., by 2.27 times) while maintaining comparable accuracy.

NiSNN-A: Non-iterative Spiking Neural Networks with Attention with Application to Motor Imagery EEG Classification

TL;DR

This work targets energy-efficient motor imagery EEG classification by marrying non-iterative spiking neuron dynamics with sequence-based attention. The core contributions are the NiLIF neuron, which mitigates gradient issues and yields sparse spikes, and a set of attention mechanisms tailored to EEG data (Seq-, ChanSeq-, and Global-attention). Evaluations on OpenBMI and BCIC IV 2a show NiSNN-A achieving strong accuracy among SNNs while delivering roughly twofold energy savings versus CNN baselines, highlighting practicality for edge devices. The results also provide attention visualizations that shed light on how the model focuses on informative temporal and channel regions in EEG signals. Overall, NiSNN-A demonstrates that attention can be effectively integrated into SNNs for EEG, delivering competitive performance with substantially lower energy consumption and enabling portable, real-time brain-computer interface applications.

Abstract

Motor imagery, an important category in electroencephalogram (EEG) research, often intersects with scenarios demanding low energy consumption, such as portable medical devices and isolated environment operations. Traditional deep learning algorithms, despite their effectiveness, are characterized by significant computational demands accompanied by high energy usage. As an alternative, spiking neural networks (SNNs), inspired by the biological functions of the brain, emerge as a promising energy-efficient solution. However, SNNs typically exhibit lower accuracy than their counterpart convolutional neural networks (CNNs). Although attention mechanisms successfully increase network accuracy by focusing on relevant features, their integration in the SNN framework remains an open question. In this work, we combine the SNN and the attention mechanisms for the EEG classification, aiming to improve precision and reduce energy consumption. To this end, we first propose a Non-iterative Leaky Integrate-and-Fire (LIF) neuron model, overcoming the gradient issues in the traditional SNNs using the Iterative LIF neurons. Then, we introduce the sequence-based attention mechanisms to refine the feature map. We evaluated the proposed Non-iterative SNN with Attention (NiSNN-A) model on OpenBMI, a large-scale motor imagery dataset. Experiment results demonstrate that 1) our model outperforms other SNN models by achieving higher accuracy, 2) our model increases energy efficiency compared to the counterpart CNN models (i.e., by 2.27 times) while maintaining comparable accuracy.
Paper Structure (27 sections, 3 theorems, 34 equations, 9 figures, 9 tables, 1 algorithm)

This paper contains 27 sections, 3 theorems, 34 equations, 9 figures, 9 tables, 1 algorithm.

Key Result

Proposition 1

Given a LIF neuron with stimulus, accumulation, and firing dynamics formula.11, the inequality always holds where $O \in \mathbb{R}^{1 \times (t_{\mathrm{n}}+1)}$ is the output spike matrix, $I_{\mathrm{1}} \in \mathbb{R}^{1 \times (t_{\mathrm{n}}+1)}$ is the all-ones matrix and ${\bm{\mathcal{L}_{\mathrm{out}}}}$ is defined in formula.6.

Figures (9)

  • Figure 1: The Iterative LIF neuron model and the NiLIF neuron model. (a) Iterative LIF neuron model. The membrane potential $u^{\text{t}+1}$ is computed recurrently, with each time step depends on its previous state $u^{\text{t}}$ and the output spikes $o^{\text{t}}$ from the preceding time step. (b) The NiLIF neuron model. The matrix $\bm{\mathcal{L}}_{\mathrm{in}}$ is used to calculate the input stimulus and accumulation processes, and the matrix $\bm{\mathcal{L}}_{\mathrm{out}}$ is used to approximate the output spikes. The final membrane potential $U$ and output spikes $O$ are obtained simultaneously rather than iteratively.
  • Figure 2: The illustrative comparison between the Iterative LIF and NiLIF models. Both models utilize the same input spike train as shown in the uppermost figure, however, with different outputs. From the third figure, both models produce an output spike at time step $4$. Notably, the NiLIF model does not generate a second spike at time step $9$ due to higher sparsity.
  • Figure 3: Illustration of linear attention model. The linear attention model integrates position embedding with the input data. This model employs three linear layers to obtain the Query, Key, and Value matrices. The attention score is computed through the multiplication of the query and key matrices, then undergoing normalization through a Softmax function. To produce the final enhanced output, an additional linear layer is utilized in the final step.
  • Figure 4: Illustration of convolutional attention model. Two convolutional layers are employed to get the Query and Key matrices in the convolutional attention model. The attention score is computed through matrix multiplication and subsequently normalized by the Softmax function. A matrix operation then integrates the attention score with the input data. Depending on the model variant, this can manifest as matrix multiplication in the Seq-attention model (refer to Section \ref{['Methods.attention.seq_attention']}) and the ChanSeq-attention model (detailed in Section \ref{['Methods.attention.chanseq_attention']}), or as an element-wise product in the Global-attention model (see Section \ref{['Methods.attention.global']}). In the final step, a trainable parameter, denoted as $\beta$, is introduced to balance the original and refined features.
  • Figure 5: Network architecture overview. (a) NiSNN-A architecture. The SNN has a residual block containing two spiking layers. Instead of traditional batch normalization layers and activation functions, the model employs LIF neurons to transform real-valued data streams into spikes. Notably, the proposed NiLIF neurons are utilized, leveraging the Heaviside function during the feed-forward phase and the surrogate derivation during backpropagation. Max pooling layers are adopted after spiking layers to maintain a binary data flow. After the second spiking layer, an attention mechanism is integrated to refine the feature maps. The final stage of the model consists of two fully connected layers for classification. (b) Attention CNN architecture. The overarching architecture of the CNN closely mirrors that of the SNN, encompassing a single residual block with two 2D convolutional layers. A batch normalization layer follows the convolutional layer and utilizes the ReLU function as its activation function. The network employs average pooling layers for down-sampling.
  • ...and 4 more figures

Theorems & Definitions (3)

  • Proposition 1
  • Proposition 2
  • Proposition 3