Title: QKFormer: Hierarchical Spiking Transformer using Q-K Attention
Venue: NeurIPS 2024
Accepted: yes
Keywords: Spiking Neural Network; Neuromorphic Computing; Event-driven; Transformer; Spatio-temporal
Abstract: Spiking Transformers, which integrate Spiking Neural Networks (SNNs) with Transformer architectures, have attracted significant attention due to their potential for low energy consumption and high performance. However, there remains a substantial gap in performance between SNNs and Artificial Neural Networks (ANNs). To narrow this gap, we have developed QKFormer, a direct training spiking transformer with the following features: i) _Linear complexity and high energy efficiency_, the novel spike-form Q-K attention module efficiently models the token or channel attention through binary vectors and enables the construction of larger models. ii) _Multi-scale spiking representation_, achieved by a hierarchical structure with the different numbers of tokens across blocks. iii) _Spiking Patch Embedding with Deformed Shortcut (SPEDS)_, enhances spiking information transmission and integration, thus improving overall performance. It is shown that QKFormer achieves significantly superior performance over existing state-of-the-art SNN models on various mainstream datasets. Notably, with comparable size to Spikformer (66.34 M, 74.81\%), QKFormer (64.96 M) achieves a groundbreaking top-1 accuracy of **85.65\%** on ImageNet-1k, substantially outperforming Spikformer by **10.84\%**. To our best knowledge, this is the first time that directly training SNNs have exceeded 85\% accuracy on ImageNet-1K.

QKFormer: Hierarchical Spiking Transformer using Q-K Attention

Abstract

Spiking Transformers, which integrate Spiking Neural Networks (SNNs) with Transformer architectures, have attracted significant attention due to their potential for low energy consumption and high performance. However, there remains a substantial gap in performance between SNNs and Artificial Neural Networks (ANNs). To narrow this gap, we have developed QKFormer, a direct training spiking transformer with the following features: i) Linear complexity and high energy efficiency , the novel spike-form Q-K attention module efficiently models the token or channel attention through binary vectors and enables the construction of larger models. ii) Multi-scale spiking representation , achieved by a hierarchical structure with the different number of tokens across blocks. iii) Spiking Patch Embedding with Deformed Shortcut (SPEDS) , enhances spiking information transmission and integration, thus improving overall performance. It is shown that QKFormer achieves significantly superior performance over existing state-of-the-art SNN models on various mainstream datasets. Notably, with comparable size to Spikformer (66.34 M, 74.81%), QKFormer (64.96 M) achieves a groundbreaking top-1 accuracy of 85.65% on ImageNet-1k, substantially outperforming Spikformer by 10.84% . To our best knowledge, this is the first time that directly training SNNs have exceeded 85% accuracy on ImageNet-1K. The code and models are available at https://github.com/zhouchenlin2096/QKFormer.

1 Introduction

Regarded as the third generation of neural networks [1], the brain-inspired Spiking Neural Networks (SNNs) are potential competitors to Artificial Neural Networks (ANNs) due to their high biological plausibility and high energy efficiency attributed to their event-driven properties [2]. Transformer, originally designed for natural language processing [3], has flourished in various computer vision tasks, including image classification [4, 5], object detection [6, 7, 8] and semantic segmentation [9, 10]. Spiking Transformers (Transformer-based SNNs) [11, 12, 13, 14, 15], which integrate spiking neural networks with transformer architecture, have attracted significant attention. This innovative combination provides great potential to develop advanced AI algorithms with high performance and low energy consumption.

As the architecture of the transformers is essential to the model's performance [4, 5, 16, 8, 10], designing new architectures for transformer-based SNNs is quite challenging in terms of space requirements for the following reasons [11, 13, 15]. i). Spiking Self Attention (SSA) [11], the core module of spiking transformers, encodes Query, Key, and Value with sparse spikes. However, the

Spike input

Token: N

Channel: D

Linear

Linear



1

0

0

0

0

0

0

0

0

1

0

1

0

0

1

0

1

0

0

1

0

1

0

0

0

0

0

1

0

1

0

1

0

0

0

0

0

0

0

1

7

1

2

9

4

1

0

0

1

1

0

1

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

1

0

1

1

0

0

0

0

0

0

1

1

1

0

1

0

1

0

1

0

1



Row summation

Token mask

N D

Q



Token Attention Vector

Spike Output



0

1

0

0

0

0

0

1

0

1

0

1

0

0

0

0

0

0

0

1

N D

K



Channel Attention Vector

0

1

1

0

2

8

5

3

0

1

0

0

0

0

0

0

0

1

0

1

0

0

0

0

0

0

0

0



Column summation

Channel mask

Spiking Neuron

Spike Output

N D

K



1



N

A

1



N

A

D

A



1

D

A



1

N D

X



N D

X





D

N

X





(a) Q-K Token Attention (QKTA)

(b) Q-K Channel Attention (QKCA)

computational complexity (especially space complexity) of SSA scales quadratically to the number of tokens (#tokens), and is the main obstacle to explore architecture that incorporate multi-level features. ii). SNNs process data across the time domain, necessitating a high level of computational and memory resources. This combination leads to considerable consumption of computational resources, making the training process highly demanding in terms of both memory and processing power.

To address these issues, we propose QKFormer with three innovations. i) Q-K attention with linear complexity and high energy efficiency. ii) A hierarchical architecture with decreasing number of tokens across blocks. iii) A novel patch embedding with deformed shortcut module. The linear complexity of Q-K attention is originated from the binary spike-form vector attention. This design lower the energy consumption and the space requirement. The hierarchical architecture starts from small patches and gradually merges neighboring patches in deeper spiking transformer layers with gradually decreasing #tokens, which enables multi-level spiking feature representation and benefits the model performance. The patch embedding with deformed shortcut facilitates spiking information transmission and integration. These merits make QKFormer achieve state-of-the-art performance in the SNN domain, in contrast to the previous transformer-based SNNs with spiking feature maps of a single resolution. Our main contributions are as follows:

We develop a novel spike-form Q-K attention mechanism, tailor-made for the spatio-temporal spiking patterns of SNNs, which can easily model the importance of token or channel dimensions with binary values. The Q-K attention has linear complexity to #tokens (or #channels) and only adopts two spike-form components: Query ( Q ) and Key ( K ).

We design a versatile and powerful Spiking Patch Embedding with Deformed Shortcut (SPEDS) module, which enhances spiking information transmission and integration thus improving the performance of spiking transformers significantly.

We build a direct-training hierarchical spiking transformer with different number of tokens across blocks, incorporating Q-K attention and SPEDS, named QKFormer. This marks the effective exploration of hierarchical spiking representation in Transformer-based SNNs.

Extensive experiments show that the proposed model outperforms the state-of-the-art (SOTA) SNNs on various static and neuromorphic datasets. Notably, QKFormer has achieved a significant milestone, surpassing 85% top-1 accuracy on ImageNet with 4 time steps using the direct training approach for the first time.

2 Related Work

Learning Methods of Spiking Neural Networks. At present, there are mainly two ways to obtain trained SNNs. One involves converting pre-trained ANNs to SNNs (ANN2SNN) [17, 18, 19, 20, 21, 22, 23], replacing the ReLU activation function in ANN with spiking neurons. However, This converted SNN suffers from long converting time steps and constraints on the original ANN design.

Another method is to directly train SNNs[24], using surrogate gradient[25, 26, 27, 28] to address the non-differentiability of spike excitation function during backpropagation. The direct training method has received more attention due to its low latency and supporting flexible architectural exploration.

Direct Trained SNN Models. [28] proposed the Spike-Element-Wise block, which further addressed gradient explosion and gradient vanishing problems, and prolonged the directly trained SNNs beyond a depth of 100 layers with 69.26% accuracy on ImageNet-1k. Spikformer [11] designed a novel spikeform self-attention named Spiking Self Attention (SSA), using sparse spike-form Query, Key, and Value without softmax operation, which was used to construct the Spikformer. Spikformer achieved 74.81 % accuracy on ImageNet-1k with 4 time steps, showing the great potential of transformer-based SNNs for the first time. Spikingformer [12] modified Spikformer with a pre-activation shortcut, which can avoid the floating-point multiplications in synaptic computing and has a lower firing rate. Spikingformer achieved 75.85 % accuracy on ImageNet-1k. [13] designed a novel Spike-Driven SelfAttention (SDSA), which used only masks and addition operations without any multiplication, thus significantly reducing the computation energy compared to the vanilla self-attention. In addition, the proposed Spike-driven Transformer based on SDSA has achieved 77.07 % on ImageNet-1k. However, all of these SNN models above remain a large performance gap compared with ANN.

3 Method

3.1 Preliminary

Vanilla Self Attention. Vanilla self-attention (VSA) [3] in transformers has three floating-point key components: query ( Q F ), key ( K F ), value ( V F ) which are calculated by learnable linear matrics and input X . The calculation of VSA can be formulated as follows:

where F denotes the floating-point form. Both floating-point matrix multiplication and softmax operation which contains exponent calculation and division, do not align with the properties of SNNs.

Spiking Self Attention. Spikformer [11] demonstrated a novel spike-form self-attention named Spiking Self Attention (SSA), using sparse spike-form Q , K , V without softmax operation and floating-point matrix multiplication. The calculation process of SSA is formulated as follows:

where Q , K , V ∈ R T × N × D , the spike-form Q , K , V are computed by learnable linear layers. s is a scaling factor. SN means spiking neuron layer. The calculation of SSA avoids floating-point multiplication, meeting the property of SNNs.

3.2 Q-K Attention

An overview of Q-K attention is shown in Figure 1. Both VSA and SSA use three key components and have O ( N 2 d ) or O ( Nd 2 ) computational complexity, while our proposed Q-K Attention which has linear complexity and only uses two spike-form components: Q and K , which are produced through learnable linear matrics.

where X is the input spiking map. According to the detailed calculation mechanism of Q , K , Q-K Attention can be divided into Q-K Token Attention (QKTA) and Q-K Channel Attention (QKCA).

Q-K Token Attention. Wehere assume T = 1 and single head attention for mathematical description. After obtaining spike-form Q , K ∈ R T × N × D , both Q and K can be formed as a spike matrix N × D ( N is the token number, D is the channel number). QKTA process can be formulated as follows:

where A t is the N ∗ 1 token attention vector, which models the binary importance of different tokens. A t is a spike-form vector, which is obtained by addition operations (row summation) of Q spike matrix and a following spiking neuron. ⊗ is the Hadamard product between spike tensors, which is equivalent to the mask operation. We apply the spike-form token attention vector A t to the K spike matrix through the column mask operation (token mask), to obtain the output X ′ of QKTA.

Q-K Channel Attention. The calculation process of Q-K channel attention is similar to the previous Q-K token attention, and can be formulated as : A c = SN( ∑ N j =0 Q i,j ) , X ′ = A c ⊗ K , where A c is the 1 ∗ D channel attention vector, which models the binary importance of different channels. A t is a spike-form vector, which is obtained by addition operations (column summation) of Q spike matrix and a following spiking neuron. Then, the output X ′ of Q-K Channel Attention is obtained by the row mask operation (channel mask) between A t and K .

As shown in Formula.7, a post-linear layer is also required after obtaining X ′ of Q-K Token or Channel Attention. In addition, the channel dimension is D/h in the multi-head Q-K attention, where h is the head number. In this work, the spiking neuron uses the LIF model [28]. Same with [11], time step T is an independent dimension for the spiking neuron layer. In other layers, it is merged with the batch size. We exploit QKTA in our experiments by default.

Linear Computational Complexity of Q-K Attention. As shown in Table 1, the time complexity of Q-K attention varies based on the implementation approach. Specifically, when utilizing spike-form broadcasted element-wise multiplication, ⊗ , the time complexity can reach up to O ( N ∗ D ) . When applying mask operation, the time complexity of Q-K attention is only O ( N ) or O ( D ) . The space complexity of Q-K attention with the whole process is O ( N ∗ D ) at most, which is caused by the self-storage consumption Q and K matrix. In terms of the space complexity of attention operation, Q-K attention only requires an extra 1 ∗ D or N ∗ 1 space to store the attention vector with the space complexity of O ( N ) or O ( D ) . The linear complexity of Q-K attention makes it possible to successfully explore the large-scale hierarchical architecture SNN model.

High Energy Efficiency of Q-K Attention. As a spike-driven attention module, the linear multiplication is transformed into sparse addition. Mask operation can be implemented on neuromorphic chips through addressing algorithms [29] or AND logic operations[30] with negligible power consumption. Compared with SSA, Q-K attention is much more energy-efficient, which comes from the following reasons: i) Q-K attention only adopts two spike-form components for spike [0, 1] operation without the V input and thus has less synaptic computing. ii) Q-K attention has much fewer spiking matrix operations due to its linear complexity of O ( N ) or O ( D ) . iii) Q-K attention discards the scale operation of SSA, which leads to reduced power consumption further.

3.3 No Scaling Factors in Q-K Attention

In VSA [3], assume that q i ( q i ∈ R 1 × d , Q ∈ R m × d ) and k i ( k i ∈ R 1 × d , K ∈ R m × d ) are independent random variables with a mean of 0 and a variance of 1, then each element in the product of QK T has mean 0 and variance d . The variance magnitude of QK T grows with the embedding dimension d , which can result in gradient vanishing issues after softmax operation. Therefore, The product of matrices Q and K in VSA [3] is scaled by a factor 1 √ d in Eq. 2 to normalize the product to variance 1. Though the softmax function is not adopted due to its non-spike operations (division, exponential operation) in SNNs, SSA-based [11] SNNs will suffer obvious performance degradation even cannot converge without scaling because the variance of QK T V output is too large (Assuming that all the spiking elements are independent random variables and subject to Bernoulli Distribution). However, Q-K attention can discard scaling operations thus reducing power consumption because the variance of Q-K attention is much smaller than SSA (e.g. the max theoretical variance of Q-K token attention is only about 1 / 200 of SSA). The detailed analysis can be found in the Appendix.7.2 and Section.4.3.

3.4 QKFormer

Spiking Neuron

Linear

0

0

0

1

0

1

0

0

1

1

1

0

1

0

0

0

1

0

1

1

7

1

2

9

4

1

0

0

1

1

A



A

N



1

Row summation

Token mask

Token Attention Vector

As the computational complexity (especially space complexity) of SSA is quadratic to #tokens, previous direct training spiking transformers are all limited to straight-through structures. Combining SSA with hierarchical architecture directly will lead to memory explosion easily when training spiking transformers. To overcome these issues, we proposed a hierarchical spiking transformer based on Q-K attention, named QKFormer, which constructs hierarchical spiking feature maps with linear computational complexity to #tokens or #channels. Spike input Token: N Channel: D Linear 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 N D Q  Spike Output N D K  1  N N D X  D N X   (a) Q-K Token Attention (QKTA)

Overall Hierarchical Architecture. The overview of QKFormer is presented in Figure 2. The input form can be formulated as ( T 0 × H × W × n ) . In static RGB image datasets, T 0 = 1 and n = 3 . In temporal neuromorphic datasets, the input T 0 = T , while n = 2 . In our implementation, we use a patch size of 4 × 4 and thus the input feature dimension ( 4 × 4 × n ) of each patch is projected into a spike-form arbitrary dimension (denoted as C ) in Spiking Patch

2

0

0

0

1

0

0

8

1

1

0

0

1

0

5

1

A



1

0

0

1

0

0

3

0

0

0

0

0

1

Column summation

Channel mask

Channel Attention Vector

0

1

0

0

0

0

0

0

0

1

0

1

0

0

0

0

0

0

0

0

K



N D

Spike Output

N D

X





(b) Q-K Channel Attention (QKCA)

Q-K Attention

SMLP

Stage 1:

푇

×

퐻

4

×

푊

4

×

퐶

SPEDS-2

Q-K Attention

SMLP

Stage 2:

푇

×

퐻

8

×

푊

8

×

2퐶

SPEDS-3

SSA

SMLP

Stage 3:

푇

×

퐻

16

×

푊

16

×

4퐶

×

푁￿

×

푁￿

×

푁￿

QKFormer Blocks

QKFormer Blocks

Spikformer Blocks

Input:

푇￿

×

퐻

×

푊

×

푛

Embedding with Deformed Shortcut 1 (SPEDS-1), which together with the following QKFormer blocks are referred to as "Stage 1". The number of tokens in Satge 1 is ( H 4 × W 4 ) . To produce a hierarchical spiking representation, the number of tokens is reduced in SPEDS-2 and SPEDS-3 as the network goes deeper. Both SPEDS-2 and SPEDS-3 reduce the number of tokens by a patch size of 2 × 2 ( 2 × downsampling of resolution), and the number of channels is transformed into 2 C and 4 C , respectively. We denote the SPEDS-2 and the following QKFormer blocks as "Stage 2", which reduces the number of tokens ( H 8 × W 8 ) . While SPEDS-3 and the following Spikformer or QKormer blocks are referred to as "Stage 3" with ( H 16 × W 16 ) tokens. The number of spiking transformer blocks (QKFormer or Spikformer) in each stage are N 1 , N 2 , and N 3 , respectively. These stages jointly produce a hierarchical spike-form representation.

Mixed Spiking Attention Integration. In the former stage of a hierarchical architecture model, the number of channels is small while the number of tokens is large. In the latter stage, the channel number is large while the token number is small. Thus it leads to suboptimal performance when we only use a single type of Q-K attention in a hierarchical architecture model. Therefore, we use mixed spiking attention integration in QKFormer. QKTA is conducted in the former stage in hierarchical architecture, and we could choose QKCA or SSA in the latter stage. In the subsequent experiments, we use SSA in the last stage of QKFormer and QKTA in the former stages by default.

QKFormer Blocks. Similar to the standard transformer encoder block, a QKFormer block contains a Q-K Attention module (QKTA or QKCA) and a Spiking MLP (SMLP) block, which can be formulated as follows:

At last, a fully connected layer is used as the classifier behind the last block.

3.5 Spiking Patch Embedding with Deformed Shortcut.

Residual shortcuts in SNNs [28] can implement identity mapping, which reduces information loss (facilitates information transmission and integration) in spike communication, thus ensuring the network can be well-behaved in a depth-insensitive way. Previous spiking transformers [11, 12, 13] use the residual shortcuts to achieve identity mapping, mainly focusing on the spiking attention block and spiking MLP block, and lacking identity mapping in patch embedding across the downsampling block. The input and output of a spiking patch embedding block in QKFormer have different channel and token numbers. To realize residual learning in spiking patch embedding, we can perform a lightweight linear projection W d in the shortcut connections to match the channel and token numbers, thus realizing the identity mapping cross downsampling blocks in spiking patch embedding. Given the input spiking map X , the process of patch embedding can be formulated as follows:





D



A

1



D

In this work, the deformed linear projection W d is set as a lightweight convolutional layer with 1 × 1 kernel and stride > 1 , to meet the channel and token numbers of the patch embedding block. The function F involved in this work is set as { Conv2D-BN-MaxPooling-SN-Conv2D-BN-SN } or { Conv2D-BN-SN-Conv2D-BN-MaxPooling-SN } , while more layers or more variants are possible.

There are mainly two types of residual shortcuts in deep SNNs. Formula.10 shows the patch embedding in the way of activation-before-addition [28, 11]. The other way of the patch embedding with the pre-activation residual shortcut [31, 12, 13] can be formulated as follows:

where the function G correspondingly could be set as { Conv2D-BN-MaxPooling-SN-Conv2D-BN } or { Conv2D-BN-SN-Conv2D-BN-MaxPooling } . The intuitive representation of SPEDS is shown in Appendix 7.4.

In this work, the spiking patch embedding of stage 2 or stage 3 in QKFormer can be formulated as Formula.10. The spiking patch embedding in stage 1 uses an extra { Conv2D-BN-SN } for spiking encoding in front of the block (Formula.10) to transform the non-spike input data into spikes.

4 Experiments

4.1 Results on ImageNet-1k Classification

Experimental Setup on ImageNet. In this experiment, we use AdamW as the optimizer, which is adopted with a base learning rate of 6 × 10 -4 . The actual learning rate was calculated as BatchSize/256 multiplied by the base learning rate. The batch size is set to 512 , which is realized by accumulated gradient iterations [33] and distributed across 8 Nvidia V100 GPUs. We trained QKFormer for 200 epochs. In addition, following DeiT [32], data augmentation techniques including RandAugment [34], random erasing [35], and stochastic depth [36] are employed in this study. The number of blocks in the three stages is set as {1, 2, 7} respectively.

Main Results on ImageNet. The experimental results demonstrate the superior performance of our proposed QKFormer, surpassing previous works' performance by a large margin (Table 2). QKFormer ( 64.96 M ) achieves 85.65% top-1 accuracy and 97.74% top-5 accuracy on ImageNet. To begin with, we compare our model with the baseline spiking transformer (i.e., Spikformer [11]). Our QKFormer models have slightly fewer parameters but much higher performance. For example, our QKFormer (64.96 M, 85.65%) significantly outperforms Spikformer (66.34 M, 74.81%) by 10.84% . In addition, compared with SDSA, our Q-K attention has lower computational complexity (shown in Table 1) and our QKFormer has much higher performance than S-Transformer (built by SDSA) [13]. In detail, QKFormer outperforms S-Transformer by 7.55%, 7.47%, and 8.58% respectively on three models with comparable #parameters. Finally, Our QKFormer outperforms the SOTA ANN-to-SNN model MST [23] by 7.14% and has much fewer time steps meanwhile. To our best knowledge, this is the first time that a direct training SNN model has achieved an accuracy of over 85% on ImageNet-1k.

Comparing with ANN Models on ImageNet. Our QKFormer is an event-driven SNN model, whose output is in binary form (either 0 or 1), the multiplications of activations and weights can be transformed into sparse addition, thus enjoying high energy efficiency. It should be noted that hierarchical architecture will lead to the power increment of QKFormer. This is still very cost-effective compared with ANN models. For instance, QKFormer ( 64.96M, 85.65%, SNN, 113.64mJ ) Vs. Swin Transformer ( 88M, 84.5%, ANN, 216.20mJ ) [8] Vs. DeiT-B (86M, 83.1%, ANN, 254.84mJ) [32] Vs. ViT (85.59M, 77.9%, ANN, 254.84mJ). [4]. Under the same experiment conditions without pretraining or extra training data, our QKFormer has surpassed the most well-known Transformer-based ANNs in performance while maintaining high energy efficiency.

4.2 Results on CIFAR and Neuromorphic Datasets

CIFAR Classification. In this experiment, the QKFormer is trained for 400 epochs with a batch size of 64 following previous works: Spikformer [11], Spikingformer [12]. Following Spikformer, we use 4 blocks in QKFormer in total, which are distributed {1, 1, 2} in three stages. Due to the hierarchical architecture design, our QKFormer model has only 6.74 M parameters in this case. The results on CIFAR datasets are shown in Table 3. For CIFAR10, our model achieved 96.18% accuracy with 6.74 M parameters. Our proposed QKFormer outperforms Spikformer by 0.67% and reduces 2.58 M

K

Stage 1

Stage 2

t

A

X



(a)

20

40

60

80

100

120

140

160

N

0

500

1000

1500

2000

2500

QKTA

SSA

(b)

0

20

40

60

80

100

0

20

40

60

80

100

0

0

20

10

0

20

40

60

80

100

0

20

40

60

80

100

0

T

0

10

I

20

0

20

40

60

T

80

100

0

20

40

60

80

100

f_Q

0.0

0.2

0.4

0.6

0.8

f_K

0.0

0.2

0.4

0.6

0.8

f_V

0.0

0.2

0.4

0.6

0.8

Variance of SSA

0

500

1000

1500

2000

2500

3000

f_Q

0.0

0.2

0.4

0.6

0.8

f_K

0.0

0.2

0.4

0.6

0.8

f_V

0.0

0.2

0.4

0.6

0.8

Expectation of SSA

0

2000

4000

6000

8000

(a)

0.0

0.2

0.4

0.6

0.8

1.0

f_Q

0

10

20

30

40

50

60

Variance of QKTA

Expectation of QKTA

(b)

parameters meanwhile. For CIFAR100, our model achieved 81.15% with 6.74 M parameters. Our proposed QKFormer outperforms Spikformer by 2.94% and reduces 2.58 M parameters meanwhile.

Neuromorphic Classification. We compare our method with SOTA methods on both CIFAR10-DVS and DVS-Gesture datasets. In this experiment, We utilize a mini QKFormer model with 1.50 M parameter, which has {0, 1, 1} blocks in three stages. The max patch embedding dimension is set to 256. The training process involves 200 epochs for DVS128 Gesture and 106 epochs for CIFAR10-DVS. The number of time steps of the spiking neuron is 10 or 16. The experimental results of temporal neuromorphic classification are presented in Table 3. For DVS128-Gesture dataset, our model with 1.50 M parameters achieves 98.6% accuracy using 16 time steps and 98.3% accuracy using 10 time steps. For CIFAR10-DVS dataset, our model achieves 84.0% accuracy with only 1.50 M parameters using 16 time steps. Our proposed QKFormer significantly outperforms Spikformer by 3.1% while reducing 1.07 M parameters. In addition, our model with 10 time steps achieves 83.8% accuracy, which outperforms Spikformer by 4.9% and outperforms the SOTA model (Spikingformer) by 3.9%.

4.3 Analyses on Q-K Attention

Attention Visualization. In this part, we visualize the Q-K token attention (Stage 1 and Stage 2 of the QKFormer model) on ImageNet. As shown in Figure 3(a), A t is the N ∗ 1 token attention vector, and X ′ is the output of the attention process, which is obtained by the mask operation between matrix K and attention vector A t . Specifically, the longitudinal axis denotes the channel index of one head, while the horizontal axis denotes the token index. The #tokens in stage 1 and stage 2 are 56 2 and 28 2 , respectively. To facilitate visualization, we choose a continuous segment with a length of 100 extracted from the whole token vector. The visualization shows Q-K attention can lead to high sparsity of spikes.

Memory Consumption. In this experiment, we compare the memory consumption between QKTA (Formula.6) and SSA (Formula.4) under different token numbers. We calculate the memory consumption of a QKTA and an SSA on a GPU by forwarding the input tensor ( T, B, C, N ) . To facilitate the statistics of the impact of #tokens N on memory consumption, the #channels C is set to 256, and the time step T and batch size B are set to 1. The experiment result is shown in Figure 3(b). With the increment of #Tokens, SSA consumes much more GPU memory than QKTA, of which the complexity is linear to #Tokens. For example, SSA consumes about 10 × GPU memory than QKTA when √ N = 50 .

Spike Firing Rates in QKFormer Blocks. In this experiment, we calculate the spike firing rates of QKFormer blocks of the trained QKFormer (64.9M) on the ImageNet-1K test set with the 224 × 224 input resolution. The average spike firing rates of the QKFormer blocks in Stage1 and Stage2 are shown in Table 4. Note that the spike-form X ′ is obtained by column mask operation (token mask) between A t and K . In fact, the summation operation in the QK attention causes Q to become significantly

sparser compared to K when the network converges. Specifically, Q in stage 1 has a fire rate of 0.0432, while K has 0.1784. After the accumulation operation along D/h of the multi-head QKTA version, the LIF neuron ( A t ) exhibits a typical averaged fire rate of 0.3477.

The Variance and Expectation of QKTA. Figure.4 visualize the variance and expectation of QKTA (Formula.15 and 16 in Appendix.7.2) and SSA (Formula.19 and 20 in Appendix.7.2). N is set as 196 and d is set as 64, respectively. We can find SSA has a much larger variance and expectation than QKTA on the whole. For example, the maximum theoretical variance of QKTA is 16, but the maximum theoretical variance of SSA is over 3000. This is the main reason that Q-K attention can discard scaling operations thus reducing power consumption, but SSA can not.

4.4 Ablation Study

SPEDS Module. In this experiment, We replaced the Spiking Patch Splitting (SPS) module in Spikformer with Spiking Patch Embedding with Deformed Shortcut (SPEDS) module, while other conditions remain unchanged. The results (Table 5) show that the SPEDS module is essential to QKFormer on both static and neuromorphic datasets. In addition, the addition of SPEDS to Spikformer leads to great gains in CIFAR100 (+2.05%) and CIFAR10-DVS (+1.30%), which further verified the effectiveness of SPEDS.

Mixed Spiking Attention Integration with Q-K Attention. In this part, we show different integration strategies of QKCA, QKTA, and SSA. The baseline is our QKFormer (QKTA + SSA, 6.70M). The experimental results (Table 6) show that using a single type of Q-K attention (QKTA or QKCA only) in a hierarchical architecture model leads to suboptimal performance. In particular, the performance decline in QKTA is more obvious. While the mixed spiking attention solutions, such as QKFormer(QKTA + QKCA), QKFormer(QKTA + SSA), and QKFormer(QKCA + SSA) can achieve comparable performance to QKFormer(SSA) while requiring fewer parameters and much fewer memory resources (Figure 3(b)). Consequently, the mixed spiking attention solutions are wellsuited for larger architectures and more challenging scenarios when considering both computational efficiency and performance.

Residual Connection (RC) & Spiking Neuron (SN) & Time Step (TS). The experimental results are shown in Table 7. In this block, we replaced the Activation-Before-Addition (ABA) [28, 11] residual connection of QKFormer with the Pre-activation (PA) [31, 37] way, and the performance slightly improved. In addition, we replaced the LIF spiking neuron with Integrateand-Fire (IF) and Parametric-Leaky-Integrateand-Fire (PLIF) [38], which led to slight performance degradation. The accuracy regarding different simulation time steps of QKFormer is shown in the last column. When we increase

the simulation time steps, the performance of QKFormer can be further improved. Specifically, QKFormer achieves 81.30 % accuracy on CIFAR 100 when T=6.

5 Conclusion

In this work, we design a novel spike-form Q-K attention considering the properties of SNNs, which can easily model the importance of token or channel dimensions through binary vectors. Q-K attention has linear complexity to #tokens (or #channels) and only adopts two spike-form components: Query ( Q ) and Key ( K ). We design a versatile and powerful Spiking Patch Embedding with Deformed Shortcut (SPEDS), which enhances spiking information transmission and integration, thus improving the performance of spiking transformers. In addition, we develop a hierarchical spiking transformer based on the proposed Q-K attention and SPEDS in a direct training way, named QKFormer, which marks the effective exploration of hierarchical spiking representation in Transformer-based SNNs. Extensive experiments show that the proposed model achieves SOTA performance on both static and neuromorphic datasets. Note that QKFormer achieved top-1 accuracy beyond 85% on ImageNet-1k with 4 time steps using the direct training way for the first time. With its powerful performance, we aim for our investigations to instill optimism in the application of SNNs.

Limitation. Currently, our model is limited to image / DVS classification tasks. We will extend this work to more tasks, such as segmentation, detection, and language tasks, to test the generalizability in the further. In addition, we will explore efficient and high-performance network architectures with fewer time steps based on Q-K attention and other efficient modules, to further reduce the training consumption.

6 Acknowledgments and Disclosure of Funding

This work is supported by grants from the National Natural Science Foundation of China (62236009, 62206141, 62027804, and 62425101), and the major key project of the Pengcheng Laboratory (PCL2021A13). Computing support was provided by Pengcheng Cloudbrain.

References

Wolfgang Maass. Networks of spiking neurons: the third generation of neural network models. Neural networks , 10(9):1659-1671, 1997.

Kaushik Roy, Akhilesh Jaiswal, and Priyadarshini Panda. Towards spike-based machine intelligence with neuromorphic computing. Nature , 575(7784):607-617, 2019.

Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS) , volume 30, 2017.

Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representa- tions (ICLR) , 2020.

Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zi-Hang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) , pages 558-567, 2021.

Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In Proceedings of the European Conference on Computer Vision (ECCV) , pages 213-229. Springer, 2020.

Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159 , 2020.

Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) , pages 10012-10022, 2021.

Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) , pages 568-578, 2021.

Li Yuan, Qibin Hou, Zihang Jiang, Jiashi Feng, and Shuicheng Yan. Volo: Vision outlooker for visual recognition. arXiv preprint arXiv:2106.13112 , 2021.

Zhaokun Zhou, Yuesheng Zhu, Chao He, Yaowei Wang, Shuicheng YAN, Yonghong Tian, and Li Yuan. Spikformer: When spiking neural network meets transformer. In The Eleventh International Conference on Learning Representations , 2023.

Chenlin Zhou, Liutao Yu, Zhaokun Zhou, Han Zhang, Zhengyu Ma, Huihui Zhou, and Yonghong Tian. Spikingformer: Spike-driven residual learning for transformer-based spiking neural network, 2023.

Man Yao, Jiakui Hu, Zhaokun Zhou, Li Yuan, Yonghong Tian, Bo Xu, and Guoqi Li. Spikedriven transformer, 2023.

Chenlin Zhou, Han Zhang, Zhaokun Zhou, Liutao Yu, Zhengyu Ma, Huihui Zhou, Xiaopeng Fan, and Yonghong Tian. Enhancing the performance of transformer-based spiking neural networks by improved downsampling with precise gradient backpropagation, 2023.

Yuchen Wang, Kexin Shi, Chengzhuo Lu, Yuguo Liu, Malu Zhang, and Hong Qu. Spatialtemporal self-attention for asynchronous spiking neural networks. In Edith Elkind, editor, Proceedings of the Thirty-Second International Joint Conference on Artificial Intelligence, IJCAI-23 , pages 3085-3093. International Joint Conferences on Artificial Intelligence Organization, 8 2023. Main Track.

Rong Wang, Mianxin Liu, Xinhong Cheng, Ying Wu, Andrea Hildebrandt, and Changsong Zhou. Segregation, integration, and balance of large-scale resting brain networks configure different cognitive abilities. Proceedings of the National Academy of Sciences , 118(23):e2022288118, 2021.

Yongqiang Cao, Yang Chen, and Deepak Khosla. Spiking deep convolutional neural networks for energy-efficient object recognition. International Journal of Computer Vision , 113(1):54-66, 2015.

Eric Hunsberger and Chris Eliasmith. Spiking deep networks with lif neurons. arXiv preprint arXiv:1510.08829 , 2015.

Tong Bu, Wei Fang, Jianhao Ding, PengLin Dai, Zhaofei Yu, and Tiejun Huang. Optimal annsnn conversion for high-accuracy and ultra-low-latency spiking neural networks. In International Conference on Learning Representations (ICLR) , 2021.

Yuhang Li, Shi-Wee Deng, Xin Dong, Ruihao Gong, and Shi Gu. A free lunch from ann: Towards efficient, accurate spiking neural networks calibration. ArXiv , abs/2106.06984, 2021.

Bing Han, Gopalakrishnan Srinivasan, and Kaushik Roy. Rmp-snn: Residual membrane potential neuron for enabling deeper high-accuracy and low-latency spiking neural network. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 13558-13567, 2020.

Tong Bu, Wei Fang, Jianhao Ding, PengLin Dai, Zhaofei Yu, and Tiejun Huang. Optimal ann-snn conversion for high-accuracy and ultra-low-latency spiking neural networks. arXiv preprint arXiv:2303.04347 , 2023.

Ziqing Wang, Yuetong Fang, Jiahang Cao, Qiang Zhang, Zhongrui Wang, and Renjing Xu. Masked spiking transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision , pages 1761-1771, 2023.

Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, and Luping Shi. Spatio-temporal backpropagation for training high-performance spiking neural networks. Frontiers in neuroscience , 12:331, 2018.

Emre O Neftci, Hesham Mostafa, and Friedemann Zenke. Surrogate gradient learning in spiking neural networks: Bringing the power of gradient-based optimization to spiking neural networks. IEEE Signal Processing Magazine , 36(6):51-63, 2019.

Mingqing Xiao, Qingyan Meng, Zongpeng Zhang, Yisen Wang, and Zhouchen Lin. Training feedback spiking neural networks by implicit differentiation on the equilibrium state. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS) , volume 34, pages 14516-14528, 2021.

Sumit B Shrestha and Garrick Orchard. Slayer: Spike layer error reassignment in time. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS) , volume 31, 2018.

Wei Fang, Zhaofei Yu, Yanqi Chen, Tiejun Huang, Timothée Masquelier, and Yonghong Tian. Deep Residual Learning in Spiking Neural Networks. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS) , volume 34, pages 2105621069, 2021.

Ole Juri Richter, QIAO Ning, Qian Liu, and Sadique Ul Ameen Sheik. Event-driven spiking convolutional neural network, June 16 2022. US Patent App. 17/601,939.

Jing Pei, Lei Deng, Sen Song, Mingguo Zhao, Youhui Zhang, Shuang Wu, Guanrui Wang, Zhe Zou, Zhenzhi Wu, Wei He, et al. Towards artificial general intelligence with hybrid tianjic chip architecture. Nature , 572(7767):106-111, 2019.

Yifan Hu, Yujie Wu, Lei Deng, and Guoqi Li. Advancing residual learning towards powerful deep spiking neural networks. arXiv preprint arXiv:2112.08954 , 2021.

Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In International conference on machine learning , pages 10347-10357. PMLR, 2021.

Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 16000-16009, 2022.

Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition workshops , pages 702-703, 2020.

Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI conference on artificial intelligence , volume 34, pages 13001-13008, 2020.

Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In Computer Vision-ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part IV 14 , pages 646-661. Springer, 2016.

Chenlin Zhou, Han Zhang, Liutao Yu, Yumin Ye, Zhaokun Zhou, Liwei Huang, Zhengyu Ma, Xiaopeng Fan, Huihui Zhou, and Yonghong Tian. Direct training high-performance deep spiking neural networks: A review of theories and methods. arXiv preprint arXiv:2405.04289 , 2024.

Wei Fang, Zhaofei Yu, Yanqi Chen, Timothée Masquelier, Tiejun Huang, and Yonghong Tian. Incorporating learnable membrane time constant to enhance learning of spiking neural networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) , pages 2661-2671, 2021.

Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) , pages 248-255, 2009.

Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.

Hongmin Li, Hanchao Liu, Xiangyang Ji, Guoqi Li, and Luping Shi. Cifar10-dvs: an eventstream dataset for object classification. Frontiers in neuroscience , 11:309, 2017.

Arnon Amir, Brian Taba, David Berg, Timothy Melano, Jeffrey McKinstry, Carmelo Di Nolfo, Tapan Nayak, Alexander Andreopoulos, Guillaume Garreau, Marcela Mendoza, Jeff Kusnitz, Michael Debole, Steve Esser, Tobi Delbruck, Myron Flickner, and Dharmendra Modha. A low power, fully event-based gesture recognition system. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) , pages 7243-7252, 2017.

Hanle Zheng, Yujie Wu, Lei Deng, Yifan Hu, and Guoqi Li. Going Deeper With DirectlyTrained Larger Spiking Neural Networks. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI) , pages 11062-11070, 2021.

Shikuang Deng, Yuhang Li, Shanghang Zhang, and Shi Gu. Temporal Efficient Training of Spiking Neural Network via Gradient Re-weighting. In International Conference on Learning Representations (ICLR) , 2021.

Xiaohan Ding, Yuchen Guo, Guiguang Ding, and Jungong Han. Acnet: Strengthening the kernel skeletons for powerful cnn via asymmetric convolution blocks. In Proceedings of the IEEE/CVF international conference on computer vision , pages 1911-1920, 2019.

Xiaohan Ding, Xiangyu Zhang, Ningning Ma, Jungong Han, Guiguang Ding, and Jian Sun. Repvgg: Making vgg-style convnets great again. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 13733-13742, 2021.

Yangfan Hu, Huajin Tang, and Gang Pan. Spiking deep residual networks. IEEE Transactions on Neural Networks and Learning Systems , 2021.

Guangyao Chen, Peixi Peng, Guoqi Li, and Yonghong Tian. Training full spike neural networks via auxiliary accumulation pathway. arXiv preprint arXiv:2301.11929 , 2023.

Souvik Kundu, Massoud Pedram, and Peter A Beerel. Hire-snn: Harnessing the inherent robustness of energy-efficient deep spiking neural networks by training with crafted input noise. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV) , pages 5209-5218, 2021.

Mark Horowitz. 1.1 computing's energy problem (and what we can do about it). In 2014 IEEE International Solid-State Circuits Conference Digest of Technical Papers (ISSCC) , pages 10-14. IEEE, 2014.

Priyadarshini Panda, Sai Aparna Aketi, and Kaushik Roy. Toward scalable, efficient, and accurate deep spiking neural networks with backward residual connections, stochastic softmax, and hybridization. Frontiers in Neuroscience , 14:653, 2020.

Man Yao, Guangshe Zhao, Hengyu Zhang, Yifan Hu, Lei Deng, Yonghong Tian, Bo Xu, and Guoqi Li. Attention spiking neural networks. IEEE Transactions on Pattern Analysis and Machine Intelligence , 2023.

Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS) , volume 32, 2019.

Wei Fang, Yanqi Chen, Jianhao Ding, Zhaofei Yu, Timothée Masquelier, Ding Chen, Liwei Huang, Huihui Zhou, Guoqi Li, and Yonghong Tian. Spikingjelly: An open-source machine learning infrastructure platform for spike-based intelligence. Science Advances , 9(40):eadi1480, 2023.

Ross Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models , 2019.

7 Appendix

7.1 Spiking Neuron Model

Spiking neuron is the fundamental unit of SNNs, we choose the Leaky Integrate-and-Fire (LIF) model as the spiking neuron in our work. The dynamics of a LIF neuron can be formulated as follows:

where τ is the membrane time constant, and X [ t ] is the input current at time step t . When the membrane potential H [ t ] exceeds the firing threshold V th , the spiking neuron will trigger a spike S [ t ] . Θ( v ) is the Heaviside step function, which equals to 1 when v ≥ 0 and 0 otherwise. V [ t ] represents the membrane potential after the triggered event, which equals to H [ t ] if no spike is generated and otherwise equals to the reset potential V reset .

7.2 Q-K Attention Vs. SSA in Scaling Factors

Mathematical Characteristics of Q-K Attention. All the elements in Q-K attention are spikeform, thus we assume that each Q i,j [ t ] are independent random variables and subject to Bernoulli distribution B ( f Q ) . f Q is the average firing rate of Q . The expectation and variance of Q-K attention can be formulated as:

where d = D/h is the feature dimension of a head in the multi-head Q-K attention and N is the token number.

Mathematical Characteristics of SSA. Similar to the above analysis process, assume that all elements Q i,j [ t ] , K j,i [ t ] , V i,j [ t ] in SSA are independent random variables and subject to Bernoulli distribution B ( f Q ) , B ( f K ) , B ( f V ) , respectively. f Q , f K and f V are the average firing rate of Q , K and V , respectively. We can calculate the expectation and variance of SSA as follows.

Figure.4 visualize the variance and expectation of QKTA (Formula.15 and 16) and SSA (Formula.19 and 20). N is set as 196 and d is set as 64, respectively. We can find SSA has a much larger variance and expectation than QKTA on the whole. For example, the maximum theoretical variance of QKTA is 16, but the maximum theoretical variance of SSA is over 3000. This is the main reason that Q-K attention can discard scaling operations thus reducing power consumption, but SSA can not.

7.3 Futher Discussion on Q-K Attention

The Complexity of Attention Mechanisms. The computational complexity of SSA: Q,K ∈ [0 , 1] N × D . The attention map ( Q × K T ∈ Z N × N ) is obtained by matrix multiplication of matrix [0 , 1] N × D and matrix [0 , 1] D × N , which thus need O ( N 2 D ) computation. The computational complexity of SDSA: Q,K ∈ [0 , 1] N × D . The attention map ( Q ⊗ K ∈ [0 , 1] N × D ) is obtained by the Hadamard product of matrix [0 , 1] N × D and matrix [0 , 1] N × D , which thus need O ( ND ) computation. The computational complexity of Q-K Attention: Our attention vector ( A t ∈ [0 , 1] N × 1 ) is computed by A t = SN ( ∑ D i =0 Q i,j ) , which depends on the row or column accumulation of the Q matrix ( Q ∈ [0 , 1] N × D ), thus only needs O ( N ) or O ( D ) computation.

PLIF for Scaling. Q-K attention can discard scaling operations to reduce power consumption On these datasets used in this article's experiments because the variance of Q-K attention is much smaller than SSA (e.g. the max theoretical variance of Q-K token attention is only about 1 / 200 of SSA). For generality, we can also replace the LIF after attention calculation with PLIF (LIF with trainable parameters) allowing for adaptively controlling the fire rate of that spiking neuron, which can be seen as a learnable scaling. It can be expressed as A t = PLIF( ∑ D i =0 Q i,j ) . The results show that this modification brings a 0.2% performance improvement on CIFAR 100 (Acc = 81.17%, the firing rate of A t is 0.2952 in stage1 and 0.4008 in stage 2), while increasing the training time to 1.3 times.

7.4 Supplementary for Method 3.5

MultiStep LIF

Conv + BN

MaxPooling

MultiStep LIF

Conv + BN

⊕

MultiStep LIF

Conv + BN

MaxPooling

MultiStep LIF

Conv + BN

MaxPooling

MultiStep LIF

Conv + BN

d

W

MultiStep LIF

Spike encoder

⊕

MultiStep LIF

Conv + BN

MaxPooling

Conv + BN

d

W

⊕

MultiStep LIF

SPEDS-2 & SPEDS-3

SPEDS-2 & SPEDS-3 in

Pre-activation

d

W

MultiStep LIF

MultiStep LIF

Conv + BN

MaxPooling

MultiStep LIF

Conv + BN

MultiStep LIF

Conv + BN

MaxPooling

SPS in Spikformer

(a)

(b)

...

7.5 Experimental Details

Datasets. We evaluate QKFormer on static image classification and neuromorphic classification. The former includes ImageNet-1K [39], CIFAR10/100 [40]. The latter contains CIFAR10-DVS [41] and DVS128 Gesture [42].

ImageNet-1K is the most typical static image dataset for classification. It contains 1 . 28 million images for training and 50k images for validation, with a total of 1,000 categories. CIFAR10/CIFAR100 provides 50, 000 train and 10, 000 test images with 32 × 32 resolution. The difference is that CIFAR10 contains 10 categories for classification. While CIFAR100 contains 100 categories, owning better distinguishing ability for the classification algorithm.

CIFAR10-DVS is an event-based neuromorphic dataset converted from the static image dataset by capturing shifting image samples through the Dynamic Vision Sensor (DVS) camera, which provides 9,000 training samples and 1,000 test samples. DVS128 Gesture is an event-based gesture

recognition dataset that contains 1342 samples of 11 hand gesture categories from 29 individuals under 3 illumination conditions, each gesture has an average duration of 6 seconds.

Training Details. In our experiments, we use 8 NVIDIA Tesla V100 SXM2 32GB GPUs when training models on ImageNet, while 1 GPU is used to train other datasets (CIFAR10, CIFAR100, DVS128 Gesture, CIFAR10-DVS). In direct training SNN models with surrogate function,

we select the Sigmoid function σ ( x ) as the surrogate function with α = 4 during the backpropagation of direct training in all experiments.

Experimental Details on CIFAR and Neuromorphic Classification. We evaluate our QKFormer on small-scale datasets, including CIFAR10, CIFAR100 [40] and temporal neuromorphic datasets (CIFAR10-DVS and DVS128 Gesture [42]). The detailed results on the four small-scale datasets are presented in Table 8.

Training and Testing Curve on ImageNet. We show the training loss, test loss, top-1, and top-5 test accuracy of QKFormer (64.96M, 29.08M, 16.47M) on ImageNet-1K in Figure 6.

0

25

50

75

100

125

150

175

200

2

3

4

5

6

training loss

QKFormer (64.96M)

QKFormer (29.08M)

QKFormer (16.47M)

(a) Training loss

0

25

50

75

100

125

150

175

200

1

2

3

4

5

test loss

QKFormer (64.96M)

QKFormer (29.08M)

QKFormer (16.47M)

(b) Testing loss

0

25

50

75

100

125

150

175

200

0

10

20

30

40

50

60

70

80

top-1 accuracy (%)

QKFormer (64.96M)

QKFormer (29.08M)

QKFormer (16.47M)

(c) Top-1 accuracy

0

25

50

75

100

125

150

175

200

20

40

60

80

100

top-5 accuracy (%)

QKFormer (64.96M)

QKFormer (29.08M)

QKFormer (16.47M)

(d) Top-5 accuracy

7.6 Energy Consumption Calculation of QKFormer and ANNs

The homogeneity of convolution allows the following BN and linear scaling transformation to be equivalently fused into the convolutional layer with an added bias when deployment [45, 46, 47, 48]. Therefore, when calculating the theoretical energy consumption, the consumption of BN layers could be ignored. We calculate the number of Synaptic Operations (SOPs) of spike before calculating theoretical energy consumption for QKFormer.

where l is a block/layer in QKFormer, fr is the firing rate of the block/layer and T is the simulation time step of spiking neuron. FLOPs l refers to floating point operations of block/layer l , which is the number of multiply-and-accumulate (MAC) operations. And SOP l is the number of spike-based accumulate (AC) operations. Refer to previous works[49, 31, 50, 11, 12, 51, 52]. we assume that the MAC and AC operations are implemented on the 45nm hardware [50], where E MAC = 4 . 6 pJ and E AC = 0 . 9 pJ . The theoretical energy consumption of QKFormer can be calculated as follows:

Eq.23 shows the energy consumption of QKFormer. FLOP 1 Conv is the first layer encoding the non-spike input into spike-form. Then the SOPs of N SNN Conv layers, M QKTA layers, and Z SSA layers are added together and multiplied by E AC . For ANNs, the theoretical energy consumption can be calculated:

7.7 Supplementary for Memory Consumption in Experiment 4.3

Table 9 shows the detailed values of Figure 4 in the main body of this paper (Experiment 4.3). We compare the memory consumption between QKTA (Formula.6) and SSA (Formula.4) under different token numbers, which is calculated on a GPU by forwarding the input tensor ( T, B, C, N ) . To facilitate the statistics of the impact of #tokens N on memory consumption, the #channels C are set to 256, and the time step T and batch size B are set to 1. The experiment result is shown in Figure 3(b). With the increment of #Tokens, SSA consumes much more GPU memory than QKTA, of which the complexity is linear to #Tokens. For example, SSA consumes about 10 × GPU memory than QKTA when √ N = 50 .

7.8 The Training and Inference Time Comparison.

We organized the experiment to test the training and inference time of QKFormer compared with Spikformer. We carried out this experiment on ImageNet with an input size of 224*224. This

experiment is carried out on a Ubuntu 18.04.6 LTS server with the Intel(R) Xeon(R) W-2125 CPU @ 4.00GHz, and the GeForce RTX 2080 (8G) GPU. "BS" means Batch Size. The experimental results are as follows:

In terms of inference time, QKFormer and Spikformer are very close. In terms of training time, QKFormer is about 1.35 times the training time of Spikformer in one batch, caused by hierarchical architecture. The training epochs of QKFormer on ImageNet are 200, while the training epochs of Spikformer are 300 [11], thus, the total training time cost of QKFormer on ImageNet is close to Spikformer's.

7.9 Discussion

Prospect. The human brain has powerful intelligence that runs with low power consumption, so how to develop novel artificial intelligence algorithms to achieve high performance with the low power consumption of the human brain level is one of the AI's ultimate goals. SNN is an attractive potential way to achieve it. QKFormer directly trained on ImageNet-1K has a groundbreaking leap forward with 10.84% accuracy improvement compared to the previous SNN model while maintaining the energy-efficient feature, which marks an important step towards this goal. Combined with pre-training in the future, the performance of QKFormer is expected to be further improved.

Reproducibility. The experimental results in this paper are reproducible. All experiments are implemented based on Pytorch [53], SpikingJelly [54] and Timm [55]. We explain the details of model training and configuration in the main text and Appendix. Our codes and models of QKFormer will be available on GitHub after review.

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

Justification: See the Abstract and Section.1.

Guidelines:

The answer NA means that the abstract and introduction do not include the claims made in the paper.

The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.

The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.

It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes]

Justification: See the Appendix. 7.9.

Guidelines:

The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.

The authors are encouraged to create a separate "Limitations" section in their paper.

The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.

The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.

The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.

The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.

If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.

While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [Yes]

Justification: See Section. 3 and Appendix. 7.2.

Guidelines:

The answer NA means that the paper does not include theoretical results.

All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.

All assumptions should be clearly stated or referenced in the statement of any theorems.

The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.

Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.

Theorems and Lemmas that the proof relies upon should be properly referenced.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: See Section. 4 and Appendix. 7.5.

Guidelines:

The answer NA means that the paper does not include experiments.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [No]

Justification: Our codes and models of QKFormer will be available on GitHub after review. Guidelines:

The answer NA means that paper does not include experiments requiring code.

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

Justification: See Section. 4 and Appendix. 7.5.

Guidelines:

The answer NA means that the paper does not include experiments.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

The full details can be provided either with the code, in appendix, or as supplemental material.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [No]

Justification: Error bars are not reported because it would be too computationally expensive.

Guidelines:

The answer NA means that the paper does not include experiments.

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

The assumptions made should be given (e.g., Normally distributed errors).

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: See Appendix. 7.5.

Guidelines:

The answer NA means that the paper does not include experiments.

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes]

Justification: This research is in every respect with the NeurIPS Code of Ethics.

Guidelines:

The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.

If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.

The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [NA]

Justification: This research belongs to foundational research and is not tied to particular applications.

Guidelines:

The answer NA means that there is no societal impact of the work performed.

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.

Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.

The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.

The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.

If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA]

Justification: This paper poses no such risks

Guidelines:

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

Justification: See Appendix. 7.5.

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should cite the original paper that produced the code package or dataset.

The authors should state which version of the asset is used and, if possible, include a URL.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA]

Justification: This paper does not release new assets.

Guidelines:

The answer NA means that the paper does not release new assets.

Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.

The paper should discuss whether and how consent was obtained from people whose asset is used.

At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA]

Justification: This paper does not involve crowdsourcing nor research with human subjects.

Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.

According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: [NA]

Justification: This paper does not involve crowdsourcing nor research with human subjects.

Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.

For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe authors introduce a novel spiking transformer, QKFormer, which incorporates several innovative features: a spike-form Q-K attention mechanism with linear complexity and enhanced energy efficiency, a hierarchical structure that facilitates multi-scale spiking representation, and a spiking patch embedding with a deformed shortcut designed to optimize spiking information transmission and integration. Notably, this model achieves a remarkable top-1 accuracy of 85.65% on the ImageNet-1k dataset, marking the first instance where directly trained spiking neural networks have surpassed the 85% accuracy threshold on this benchmark.\n\nSTRENGTHS:\n1) The authors' introduction of a novel spike-form Q-K attention module with linear complexity represents a significant advancement in mitigating the quadratic computational complexity of spiking self-attention, a core component of traditional spiking transformers. This innovation demonstrates a substantial degree of originality and contributes to the optimization of spiking neural network architectures.\n2) The authors' design of a powerful spiking patch embedding with deformed shortcut (SPEDS) is a notable achievement, as it effectively enhances spiking information transmission and integration. This enhancement contributes to the overall performance of the proposed QKFormer model and underscores the authors' creative approach to improving SNN performance.\n3) The proposed QKFormer model, leveraging the innovative Q-K attention and SPEDS, represents a substantial leap forward in SNN performance. Its ability to outperform state-of-the-art SNNs on various static and neuromorphic datasets, particularly the ImageNet-1K dataset, where it achieves over 85% accuracy for the first time with directly trained SNNs, underscores its significance and potential impact on real-world applications of SNNs. This achievement not only demonstrates the model's quality but also highlights its potential to revolutionize the field of SNN research.\n\nWEAKNESSES:\n1) The authors' assertion that SPEDS can facilitate spiking information transmission and integration lacks sufficient elaboration on the underlying mechanisms. \n2) Clarifying the rationale behind the assertion that the low variance of Q-K attention negates the necessity for scaling operations would significantly enhance the paper's rigor and credibility. \n3) To improve the overall writing quality and grammar of the paper, several revisions are recommended. Firstly, in the caption of Figure 1, the phrase \"The input is\" should be revised to \"The inputs are\" to ensure consistency with the plural form of \"inputs.\" Secondly, the expression in line 246 appears unusual and requires refinement to enhance clarity. Lastly, the abbreviation \"LF\" should be corrected to \"IF\" in line 316, assuming it is a typographical error and should stand for \"if.\" Additionally, a comprehensive review and refinement of the entire paper's language, grammar, and structure would further elevate its academic style and readability.\n\nQUESTIONS:\n1) Could the summation operation in the QK attention mechanism potentially result in an excessively high firing rate within the attention vector? \n2) Could you elaborate on the relationship between Figure 3a and the original input image? \n3) As noted in the weaknesses section.\n\nLIMITATIONS:\nThe authors briefly mention limitations in the Appendix, but discussing them in the main text would enhance clarity. Another limitation is that the model was only evaluated on image classification, limiting its generalizability.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-11"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis model introduces a spike-form Q-K attention mechanism that efficiently models the importance of token or channel dimensions using binary values, significantly reducing computational complexity .The model is evaluated on the ImageNet-1K dataset, achieving an impressive top-1 accuracy of 85.65%, surpassing existing benchmarks for spiking transformers.\n\nSTRENGTHS:\n1.\tThe proposed spike-form Q-K attention mechanism provides an efficient way to handle token or channel dimensions with binary spikes.\n2.\tThe model achieves over 85% accuracy on ImageNet-1K, which is a very impressive result.\n\nWEAKNESSES:\n1、The Q-K attention module discussed in the paper has already been introduced in Spike-Driven Transformer V2[1] (SDSA-2 in Figure 3). Additionally, the overall architecture of the QKFormer model closely resembles that in [2].\n2、 In Section 4.1, the authors incorrectly compare the full-precision results of their work with Binary Neural Networks. Upon reviewing the original texts, it was found that PokeBNN (20.7MB) [2] and MeliusNet59 (17.4MB) [3] report model sizes, not parameter counts (20.7M, 17.4M). Comparisons should use consistent metrics.\n3、The baseline for the Q-K attention ablation study (QKCA + SSA) is not reasonable. There is no information on the model with only SSA or without the attention module.\n4、The effectiveness of the SPEDS module with only Q-K attention and without SPEDS remains unclear. It appears that the architecture of Spikformer differs from QKFormer, with QKFormer’s architecture being more similar to that in Spike-Driven Transformer V2\n\n[1] Man Yao, JiaKui Hu, Tianxiang Hu, Yifan Xu, Zhaokun Zhou, Yonghong Tian, XU Bo, and Guoqi Li. Spike-driven transformer v2: Meta spiking neural network architecture inspiring the design of next-generation neuromorphic chips. In The Twelfth International Conference on Learning Representations, 2023.\n[2] Zhang Y, Zhang Z, Lew L. Pokebnn: A binary pursuit of lightweight accuracy[C]//Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. 2022: 12475-12485.\n[3] Bethge J, Bartz C, Yang H, et al. Meliusnet: An improved network architecture for binary neural networks[C]//Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision. 2021: 1439-1448.\n\nQUESTIONS:\n1.\tThe paper suggests that Q-K attention proposed here is simpler compared to SDSA-3 in Spike-Driven Transformer V2, and ablation experiments show performance degradation with Q-K Attention. The QKFormer architecture closely resembles [1] yet achieves a 5.65% improvement on ImageNet. Could this improvement be attributed to superior data augmentation or training strategies rather than the effectiveness of the attention methods and model architecture?\n2.\tSince the accuracy on ImageNet-1K significantly exceeds those of existing comparable models, it is challenging to evaluate the results without access to the corresponding code. Could you please make the code open source?\n\nLIMITATIONS:\nN/A", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-11"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe author has thoughtfully considered the attention structure of the existing Spiking Transformer (SSA) as well as issues present in other parts. Spiking neural networks are characterized by their high efficiency and energy-saving features. For this purpose, the author has proposed a more efficient attention mechanism. To better enhance performance, the author has also made modifications to the embedding part. From the experimental results, the new model achieved better performance on several typical datasets with lower energy consumption and fewer parameters. Additionally, the ablation experiments designed by the author demonstrated the rationality of the attention mechanism and embedding modifications. Overall, the method proposed in the article is highly feasible and logically coherent.\n\nSTRENGTHS:\n1. The article analyzes the issue of computational redundancy in existing Spiking Transformer attention mechanisms.\n2. The Q-K Attention offers an almost perfect solution, being simple in design (not a bad thing), yet reducing computational complexity while enhancing performance.\n3. A better embedding method has been designed.\n4. Ablation experiments have demonstrated the rationality of these approaches.\n\nWEAKNESSES:\n1. Lack of an overview of pipeline. Some charts, such as Figure 3, seem to be of little significance. In contrast, SPEDS might require a more intuitive representation, given that you have made significant modifications to the previous embedding.\n2. Could the ablation study include additional experiments? We have seen experiments on SPEDS and Q-K Attention using CIFAR-100. Could we conduct a similar set of experiments on neuromorphic datasets? Given the unique nature of events, we hope to see SPEDS achieve performance improvements on neuromorphic datasets as well.\n\nQUESTIONS:\nI ampleased to see that such a simplified attention mechanism can improve performance while saving energy. But I still have the following questions:\n1. The capability of SPEDS on event datasets needs to be demonstrated.\n2. As shown Eq.6, row and column-wise summation is performed when computing Q-K attention. Attention mechanisms are designed to integrate global attention. Would Q-K attention cause the loss of features that do not align with the row and column directions?\n3. After summation in Eq.6,, Q undergoes neuron processing, is this to ensure the model is spike-driven? Representations in SNNs are inherently sparse; would this lead to feature loss?\n\nLIMITATIONS:\nSee weaknesses and Questions", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-16"}

comments: SUMMARY:
The authors proposed QKFormer, which pushes SNN to 85% accuracy in ImageNet, becoming a new sota and contributing to the SNN community.

STRENGTHS:
1. The authors propose a model accuracy of Sota, which is 10% higher than the previous spikformer, and the number of parameters is lower than spikformer, which is undoubtedly the leader of the SNN-Transformer series.
2. The description is clear and the comparison is complete. The working mechanism of Q-K Attention is clearly expressed. The visualization results are rich. Comparison experiments are complete, comparing the time complexity and space complexity of different attentions in SNN domain in recent years, comparing with the Transformer architecture in ANN domain, covering the commonly used static datasets CIFAR10, CIFAR100, ImageNet, and DVS datasets DVS128, CIFAR10-DVS.

WEAKNESSES:
1. The current accuracy is high, but it still requires a large time step and a large amount of computation.

QUESTIONS:
1. In Table2 the authors list a comparison of multiple metrics for different models, but there is a large time step for SNN, how does QKFormer's time during training or inference compare to other models?
2. The authors could add an explanation of Table1 to the supplemental material to visually analyze the complexity of other attention mechanisms.
3. Q-K token attention Sum each column and then use LIF on the column vectors, as shown in Fig. 1(a), 4 to 1,2 to 0. How is the threshold set?

LIMITATIONS:
See Questions and Weaknesses.
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2024-07-17