{'fraction_non_alphanumeric': 0.028115820394460762, 'fraction_numerical': 0.01062211498111624, 'mean_word_length': 4.941873149446782, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Tandem Learning Rule for Efficient and Rapid Inference on Deep Spiking Neural Networks

Emerging neuromorphic computing (NC) architectures have shown compelling energy efficiency in machine learning tasks using spiking neural networks (SNNs). However, due to the non-differentiable nature of spiking neuronal functions, the standard error back-propagation algorithm is not directly applicable to SNNs. In this work, we propose a tandem learning framework, that consists of a SNN and an Artificial Neural Network (ANN) that share weights. The ANN is an auxiliary structure that facilitates the error back-propagation for the training of the SNN. To this end, we consider the spike count as the discrete neural representation and design ANN neuronal activation function that can effectively approximate the spike count of the coupled SNN. The SNNs that are trained with the proposed tandem learning rule show competitive classification accuracies on the CIFAR-10 and ImageNet-2012 datasets with significantly reduced inference time and total synaptic operations over other state-of-the-art SNN implementations. The proposed tandem learning rule offers a novel solution to training efficient, low latency and high accuracy deep SNNs with low computing resources.


I. INTRODUCTION
Deep learning has greatly improved pattern classification performance by leaps and bounds in computer vision [1], [2], speech processing [3], [4], language understanding [5] and robotics [6]. However, deep neural networks are computationally intensive and memory inefficient, thereby, limiting their deployments in mobile and wearable devices that have limited computational budgets. This prompts us to look into energyefficient solutions.
The human brain, with millions of years of evolution, is incredibly efficient at performing complex perceptual and cognitive tasks [7]. Although hierarchically organized deep neural network models are brain-inspired, they differ significantly from the biological brain in many ways. Fundamentally, the information is represented and communicated through asynchronous action potentials or spikes in the brain. To efficiently and rapidly process the information carried by these spike trains, biological neural systems adopt the event-driven computation strategy, whereby energy is mostly consumed only when spike generation and communication take place.
Neuromorphic computing (NC), as an emerging non-von Neumann computing paradigm, aims to mimic such asynchronous event-driven information processing with spiking neural networks (SNNs) in silicon [8]. The novel neuromorphic computing architectures, for instances TrueNorth [9] and Loihi [10], leverage on the low-power, densely-connected parallel computing units to support spike-based computation. Furthermore, the co-located memory and computation can effectively mitigate the problem of low bandwidth between the CPU and memory (i.e., von Neumann bottleneck) [11]. When implemented on these neuromorphic architectures, deep SNNs benefit from the best of two worlds: superior classification accuracies and compelling energy efficiency [12]. Such promising prospects motivate the study in this paper.
While neuromorphic computing architectures offer attractive energy-saving, how to train large-scale SNNs that can operate efficiently and effectively on these NC architectures remains as a challenging research problem. The biological plausible Hebbian learning rules [13] and spike-timing-dependent plasticity (STDP) [14], [15] are intriguing local learning rules for computational neuroscience studies and also attractive for hardware implementation with emerging non-volatile memory device [16]- [18]. However, they are not straightforward to use for large-scale machine learning tasks due to the ineffective task-specific credit assignment.
Due to the asynchronous and discontinuous nature of synaptic operations within the SNN, the error back-propagation algorithm that is commonly used for ANN training is not directly applicable to the SNN. Recent research works [19]- [23] have suggested that it is viable to convert pre-trained ANNs to SNNs with little adverse impacts on the classification accuracy. This indirect training approach assumes that the graded activation of analog neurons is equivalent to the average firing rate of spiking neurons, and simply requires parsing and normalizing the weights after training the ANNs.
Rueckauer et al. [21] provide a theoretical analysis of the performance deviation of such an approach as well as a systematic study of the Convolutional Neural Network (CNN) models for a large-scale image classification task. This conversion approach achieves the best-reported results for SNNs on many benchmark datasets including the challenging ImageNet-2012 dataset [24]. However, this approach comes with a tradeoff that has an impact on the inference speed and classification accuracy and requires at least several hundred of inference time steps to reach an optimal classification accuracy [21], [22].
Additional research efforts are also devoted to training constrained ANNs that can approximate the properties of specific spiking neuron [12], [25]- [28], which can seamlessly transfer to the target hardware platform and perform better than the aforementioned generic conversion approach. Grounded on the rate-based spiking neuron model, this constrain-then-train approach transforms the steady-state firing rate of spiking neuron into a continuous and hence differentiable form that  Fig. 1: A hand-crafted example for illustration of the approximation error, spike count discrepancy, between the SNN and the approximated ANN when encoding time window is short and neuronal firing rate is low. Although the aggregate membrane potential of the post-synaptic IF neuron stays below the firing threshold in the end (a useful intermediate quantity that is applied to approximate the output spike count), an output spike is generated due to the early arrival of spikes from positive synapses.
can be optimized with the conventional error back-propagation algorithm. While competitive classification accuracies are shown with both the generic ANN-to-SNN conversion and constrain-then-train approaches, the underlying assumption of a rate-based spiking neuron model requires a long inference time window or a high firing rate to reach the steady neuronal firing state [20], [26]. This steady-state requirement limits the computational benefits that can be acquired from the NC architectures.
To improve the overall energy efficiency as well as inference speed, an ideal SNN learning rule should support a short encoding time window with sparse synaptic activities. To exploit this desirable property, temporal coding has been investigated whereby the spike timing of the first spike was employed as a differentiable proxy to enable the error backpropagation algorithm [29], [30]. Although competitive classification accuracies were reported on the MNIST dataset with such a temporal learning rule, maintaining the stability of neuronal firing and scaling it up to the size of state-ofthe-art deep ANNs remain elusive. In view of the steadystate requirement of rate-based SNNs and scalability issue of temporal-based SNNs, we are interested in developing a new learning rule that can effectively and efficiently train deep SNNs to operate under short encoding time window with sparse synaptic activities.
The spiking neuronal function is designed to describe the temporal dynamics, such as leak and reset mechanisms of the membrane potential, and refractory period, that is very different from a continuous and differentiable ANN neuronal function. Furthermore, the size of the encoding time window also plays a role in capturing the sparse synaptic activities. It is not straightforward to approximate the exact behavior of a SNN with an ANN, especially if there are multiple hidden layers in the network.
To demonstrate such an approximation error happens during information forward-propagation, namely neural representa-tion error, we prepared a hand-crafted example as shown in Fig. 1. Although the free aggregate membrane potential, at the end of the simulation time window, of an integrate-andfire (IF) neuron stays below the firing threshold (a useful intermediate quantity that can be applied to approximate the output spike count as will be explained in Section II-C), an output spike is generated due to early arrival of spikes from the positive synapses. Even worse, such a neural representation error (spike count discrepancy) will accumulate across layers and significantly affects the classification accuracy of the SNN when transferring the trained weights from the ANN. Therefore, to effectively train a deep SNN under short encoding time window with sparse synaptic activities, it is necessary to derive an exact neural representation with SNN in the training loop.
One way to overcome the approximation error is to formulate SNNs as recurrent neural networks [31], and apply error Back-propagation Through Time (BPTT) algorithm to train deep SNNs with pseudo derivatives [32]- [35]. While competitive accuracies were reported on the MNIST and CIFAR-10 [36] datasets, it is both memory and computationally inefficient to train deep SNNs using BPTT. Furthermore, the vanishing gradient problem [37] that is well-known for RNNs may affect learning when the firing rate is low. Readers may refer to the recent overviews on deep learning with spiking neural networks [38], [39] for more details.
In this paper, to effectively and efficiently train deep SNNs to classify inputs that are encoded in spikes within a short time window, we propose a novel learning rule with the tandem neural network. As illustrated in Fig.2, the tandem network architecture consists of a SNN and an ANN that is coupled layer-wise with weights sharing. The ANN is an auxiliary structure that facilitates the error back-propagation for the training of the SNN, while the SNN is used to derive the exact spiking neural representation.
The rest of this paper is organized as follows: in Section II, we present the details of the tandem learning framework. In Section III, we evaluate the proposed tandem network and learning rule on the CIFAR-10 and ImageNet-2012 datasets by comparing classification accuracies, inference speed and energy efficiency to other SNN implementations. Furthermore, we investigate why the proposed tandem learning rule can learn effectively by comparing the high dimensional geometry of activation values and weight-activation dot products between the coupled ANN and SNN network layers. Finally, we conclude the paper in Section IV.

II. LEARNING THROUGH A TANDEM NETWORK
In this section, we first introduce the neuron model and the neural coding scheme that is used in this work. We then present a discrete neural representation scheme using spike count as the information carrier across network layers, and we design ANN neuronal activation function to effectively approximate the spike count of the coupled SNN for error back-propagation. Finally, we introduce the tandem network and its learning rule, that is called tandem learning rule, for deep SNN training.  The spike counts are considered as the main information carrier in this framework, and ANN neuronal function is designed to approximate the spike counts of the coupled SNN. During training, in the forward pass, the spike counts and spike trains derived from a SNN layer are taken as the inputs to the subsequent SNN and ANN layers respectively; the error gradients are passed backward through the ANN layers during error back-propagation, to update the weights so as to minimize the objective function.

A. Neuron Model
In this work, we use the integrate-and-fire (IF) neuron model with reset by subtraction scheme [21] in the SNN layers. This simplified spiking neuron model drops the membrane potential leak and refractory period terms present in other more realistic spiking neuron models, for instance, the spike response model [40] and leaky integrate-and-fire model [41]. In this way, it retains the efficacy of input spikes that receive across time (until reset). While the IF neuron does not emulate the rich temporal dynamics of biological neurons, it is however ideal for working with sensory input where spike timing does not play a significant role and for hardware implementation.
At time step t, under a discrete-time setting with encoding window size T e . The input spikes to neuron j at layer l are transduced as follows where θ l−1 i (t) indicates the occurrence of an input spike from the afferent neuron i at time step t, and w l−1 ji denotes the strength of the synaptic connection from afferent neuron i of layer l − 1. Here, b l j /T e can be interpreted as a constant input current to the IF neuron. Mathematically, this term is related to the bias term b l j of the corresponding ReLU neuron j in the coupled ANN layer l. It is important to distribute the effect of b l j evenly throughout the encoding time window, thereby effectively preventing IF neurons from over-firing at early time steps.
The neuron j then integrates the input current z l j (t) into its membrane potential V l j (t) as per Eq. 2 (without loss of generality, a unitary membrane resistance is assumed here). V l j (0) is reset and initialized to zero for each input sample. An output spike is generated whenever V l j (t) crosses the firing threshold ϑ (Eq. 3).
According to Eq. 1, the free aggregated membrane potential (no spiking) of neuron j in layer l at end of encoding time window T can be expressed as where c l−1 i is the input spike count from pre-synaptic neuron i at layer l − 1 as per Eq. 5.
For ANN layers, we use bounded ReLU neurons that linearly integrate inputs and deliver only positive, integervalue 'spike count' to the subsequent layer. As explained in the ANN-to-SNN conversion work [21], the firing rate of IF neurons linearly correlates with the activation value of ReLU neurons. In this work, we extend this property further and approximate the spike count of IF neurons with bounded ReLU neurons as will be presented in Section II-C.

B. Encoding and Decoding Schemes
Just like how cochlear converts a received sound waves into nerve impulses, and the auditory cortex then perceives the sound encoded in the incoming nerve impulses; a SNN front-end is required to encode the sensory inputs into spike trains, and a neural network back-end will then decode the output spike trains into desired pattern classes. Two encoding schemes are commonly used: rate code and temporal code. Rate code [20], [21] converts real-valued inputs into spike trains at each sampling time step following a Poisson or Bernoulli distribution. However, it suffers from sampling errors, thereby requiring long encoding time window T e to compensate for such errors. Hence, it is not desirable to be applied to encode information into a short time window. On the other hand, temporal coding uses the timing of a single spike to encode information. Therefore, it enjoys superior coding efficiency and computational advantages. However, it is complex to decode and sensitive to noise [42].
Alternatively, we adopt the encoding scheme introduced in [21], [34] and directly input the input images or feature vectors into the neural encoding layer. The neural encoding layer performs a weighted transformation with bounded ReLU neurons as shown in Eq. 6.
where w 0 ji denotes the synaptic weight that connects input value i to the encoding neuron j and b 0 j is the bias term of the encoding neuron. We use f (·) to denote the activation function of the bounded ReLU neuron that is defined in Eq. 11. Here, the activation function a 0 j is analogous to the free aggregate membrane potential V 0,f j (0) at the end of encoding time window T e . The subsequent spike train is generated by distributing this free aggregate membrane potential into consecutive time steps, since the beginning of the encoding window, as follows Altogether, the spike train s 0 and spike count c 0 that output from the neural encoding layer can be represented as follows This neural encoding layer converts the input into spike trains, whereby the output spike count can be adjusted in a learnable fashion to match the size of the encoding window T e . Such an encoding scheme is beneficial for rapid inference since the input information can be effectively encoded within a short time window. Beginning from this neural encoding layer, spike trains and spike counts are used as input to the SNN and ANN layers, respectively.
For decoding, it is feasible to decode from the SNN output layer using either the discrete spike counts or the continuous free aggregate membrane potentials. In our preliminary study, as shown in Fig. 8, we observe that the free aggregate membrane potential provides a much smoother learning curve due to the continuous error gradients derived at the output layer.

C. Spike Count as a Discrete Neural Representation
Deep neural networks learn to describe the input data with compact feature representations. A typical feature representation is in the form of a continuous or discrete-valued vector. While most studies have focused on continuous feature representations, discrete representations have their unique advantages in solving some real-world problems [43]- [47]. For example, they are potentially a more natural fit for representing natural language which is inherently discrete, and also native for logical reasoning and predictive learning. Moreover, the idea of discretized neural representation has also been exploited in the binary neural network [48] for network quantization, wherein binarized activations (-1, +1) are used for feature representation.
In this work, we consider the spike count as a discrete feature representation in deep SNNs as shown in Fig. 3. To formulate a discrete neural representation in the coupled ANN  layer, if we are to ignore the temporal dynamics (membrane potential reset after spiking) of the IF neurons, we may then establish a one-to-one correspondence between the free aggregated membrane potential V l,f j of the spiking neuron and the discrete pseudo output spike count a l j of the ANN neuron: where a l j is lower bounded at value zero. Without loss of generality, we set ϑ to 1 in this work. As shown in Fig. 4, different from the commonly used continuous neuron activation function in ANNs, a l j are only non-negative integers. The surplus free membrane potential that is insufficient to induce an additional spike is rounded off, resulting in a quantization error q l j as expressed in Eq. 12.
In practice, however, we did not observe any obvious interference to the learning or inference that due to this quantization error. Moreover, a l j is upper bounded by the encoding time window size T e . As shown in Fig. 3, the proposed ANN activation function can effectively approximate the exact spike count information of the coupled SNN layer. As the ANN and SNN are coupled layer-by-layer, the ANN approximates the SNN layer-by-layer. This makes it possible to train the deep SNN in a similar way as a deep ANN.
Notably, as described in Fig. 1, the pseudo spike count a l that is derived in the ANN layer (Eq. 11) may deviate from the actual spike count c l of the SNN layer especially within a short time window, which may adversely affect the quality of the gradient derived in the error back-propagation. We will refer to this error as the gradient approximation error in the following sections. Our experimental results in Section III-E however suggest that the cosine angle between these two outputs are exceedingly small in a high dimensional space and this relationship maintains throughout learning. In addition, weight-activation dot products, a critical intermediate quantity, are approximately preserved despite the spike count discrepancy. Therefore, the learning dynamic in the ANN layer can effectively approximate that of the coupled SNN layer with spike count as the discrete neural representation.

D. Credit Assignment in the Tandem Network
Although the neural representation error is not significant at each layer alone as demonstrated in Fig. 3, they may cause severe impairments to the classification accuracy if inaccurate neural representation is propagated to the subsequent layers. To solve this problem, we propose a tandem learning framework. As shown in Fig. 1 and 5, an ANN with activation function defined in Eq. 11 is employed to enable error backpropagation in a rate-based network; while the SNN, sharing weights with the coupled ANN is employed to determine the exact neural representation (i.e., spike counts and spike trains). The spike count and spike trains are transmitted to the subsequent ANN and SNN layers, respectively. By incorporating the dynamics of the IF neuron into the training phase and propagating its output to the subsequent layers, this tandem learning framework effectively prevents the neural representation error from accumulating across layers. While a coupled ANN is used for error back-propagation, the forward inference is executed entirely on the SNN. The pseudo code of the proposed tandem learning rule is given in Algorithm.

1.
It is worth mentioning that, in the forward pass, the ANN layer takes the output of the previous SNN layer as the input. This aims at synchronizing the training of the SNN with ANN via the interlaced layers, rather than trying to optimize the classification performance of the ANN. The similar idea of interlaced network layers has also been explored in the binary neural networks [48], of which full-precision activation values are calculated at each layer, whereas binarized activation values are forward propagated to the subsequent layer.

III. EXPERIMENTAL EVALUATION AND DISCUSSION
In this section, we first present the neural representation errors that may arise and accumulate across layers when taking the constrain-then-train approach (introduced in Section I) in the scenarios of short encoding window. Then, we evaluate the learning capability of the proposed tandem learning rule on two standard image classification benchmarks. We further discuss why effective learning can be performed within the  Fig. 5: Illustration of the information flow across the convolution and fully-connected layers during the forward and backward pass. As the weights are shared between the ANN and SNN layers, the ANN is designed to approximate the discrete neural representation (spike count) of the SNN, so as to facilitate error backpropagation across the ANN layers.
tandem network. Finally, we discuss the properties of rapid inference and synaptic operation reduction that are achieved with the proposed tandem learning rule.

A. Datasets, Network Configurations and Implementation
To evaluate the learning capability, convergence property and energy efficiency of the proposed learning rule, we use two image classification benchmark datasets: CIFAR-10 [36] and ImageNet-2012 [24]. The CIFAR-10 consists of 60,000 color images of size 32×32 from 10 classes, with a standard split of 50,000 and 10,000 for train and test, respectively. The large-scale ImageNet-2012 dataset consists of over 1.2 million images from 1,000 object categories. Notably, the success of AlexNet [1] on this dataset represents a key milestone of deep learning research.
As shown in Fig. 6, we use a convolutional neural network (CNN) with 6 learnable layers for CIFAR-10 (namely CIFARNet) and AlexNet for ImageNet-2012. To reduce the dependency on weight initialization and to accelerate the training process, we add batch normalization [49] layer after each convolution and fully-connected layer. Given that batch normalization layer only performs an affine transformation, we follow the approach introduced in [21] and integrate their parameters into the preceding layer's weight vectors before copying them into the coupled SNN layer. We replace the average pooling operations that are commonly used in the ANN-to-SNN conversion approach with a stride of 2 convolution operations, which perform dimensionality reduction in a learnable fashion [50].
We perform all experiments with the Tensorpack toolbox [51], which is a high-level neural network training interface based on TensorFlow. Tensorpack optimizes the whole training pipeline, providing accelerated and memory-efficient training on multi-GPU machines. We follow the same data

B. Counting Synaptic Operations
The computational cost of neuromorphic architectures is typically benchmarked using the number of total synaptic operations [9], [21], [22], [35]. For SNN, as defined below, the total synaptic operations (SynOps) correlate with the neurons' firing rate, fan-out f out (number of outgoing connections to the subsequent layer) and encoding time window size T e .
where L is the total number of layers and N l denotes the total number of neurons in layer l. s l j (t) indicates whether a spike is generated by neuron j of layer l at time step t.
In contrast, the total synaptic operations that are required to classify one image in the ANN is given as follows where f l in denotes the number of incoming connections to each neuron in layer l. In our experiment, we calculate the average synaptic operations on a randomly chosen mini-batch (256 images) from the test set.

C. Accumulated Neural Representation Error
As discussed in Section I, one can train a constrained ANN that approximates the properties of spiking neurons (e.g., firing rate or spike count) using conventional error back-propagation algorithm, and subsequently, transfer the trained weights to the SNN as described in Fig. 7A, namely the constrain-then-train approach. Taking Eq. 11 as the neuron activation function, we reported competitive classification accuracy on the MNIST dataset [28]. However, when applying this approach to the more complex CIFAR-10 dataset with T e = 10, we noticed a large accuracy drop (approximately 11%) when transferring the trained ANN weights to the SNN. After carefully comparing the ANN output 'spike count' with the actual SNN spike count, we observe a growing spike count discrepancy between the ANN and SNN layers as shown in Fig. 7C. This is due to the fact that the neuronal activation function of the ANN has ignored the temporal dynamics of the IF neuron. While such spike count discrepancies could be negligible for a shallow network used for classifying the MNIST dataset [28] or with very high input firing rates, it has huge impacts in the face of sparse synaptic activities and short encoding time window. By incorporating the dynamics of IF neurons during the training of the tandem network, the exact output spike counts, instead of ANN predicted spike counts, are propagated forward to the subsequent ANN layer. The proposed tandem learning framework can effectively prevent this representation error from accumulating forward across layers.

D. Image Classification Results
For CIFAR-10, as shown in Table. I, the CIFARNet trained with the proposed learning rule achieves a competitive test error rate of 8.46% (spike count decoding) and 9.93% (aggregate membrane potential decoding), respectively. The CIFARNet, with spike count decoding, achieves by far the best-reported result on CIFAR-10 with a SNN. As shown in Fig. 8, we however note that its learning dynamics is unstable, which may be attributed to the discrete error gradients derived at the final output layer. Therefore, we use the aggregate membrane potential decoding for the rest of the experiments on ImageNet-2012 as well as a further study on the effect of encoding time window size on CIFAR-10. Although the learning converges slower than the plain CNN (with ReLU activation function) and bounded CNN (with bounded ReLU activation function as defined in Eq. 11), the error rate of the SNN eventually matches that of the bounded CNN. It also suggests that the representation error described in Sec. III-C can be effectively mitigated with the proposed tandem learning framework.  To train a model on ImageNet-2012 with a spike-based learning rule using BPTT for synaptic weight update, it requires a huge amount of computer memory to store the intermediate states of the spiking neurons as well as huge computational costs. Hence, only a few SNN implementations, without taking into consideration the dynamics of spiking neurons during training, have made some successful attempts on this challenging task, including ANN-to-SNN conversion [21], [22] and constrain-then-train [26] approaches. The tandem learning rule benefits from the best of two worlds: the dynamics of IF neurons are considered during the forward propagation, while only the rate-based ANN is used for error back-propagation. As a result, it reduces both the memory requirement and computational cost over other spike-based learning rules. Meanwhile, it also reduces the inference time and the total synaptic operations when compared to the ANNto-SNN conversion and constrain-then-train approaches.
As shown in Table. I While the ANN-to-SNN conversion approaches achieve better classification accuracies on the ImageNet-2012, their successes can largely be credited to the more advanced network models used. Furthermore, we note an error rate increase of around 7% from the baseline ANN implementation with full-precision activation (revised from the original AlexNet model [1] by replacing pooling layers with a stride of 2 convolution operations to match the AlexNet used in this work, and adding batch normalization layers). To investigate the effect of the discrete neural representation, whereby how much of the drop in accuracy is due to quantization, and how much of it is due to dynamics of the IF neuron, we modify the full-precision ANN by quantizing the activation function, using the bounded ReLU neuron as defined in Eq. 11. In a single trial, the resulting quantized ANN achieves the top-1 and top-5 error rate of 50.73% and 26.08%, respectively. This result is very close to that of our SNN implementation, which suggests that the quantization of the activation function alone may account for most of the accuracy drop.

E. Activation Direction Preservation and Weight-Activation Dot Product Proportionality within the Interlaced Layers
After showing how effective the proposed tandem learning rule performs on the CIFAR-10 and ImageNet-2012, we further investigate why learning can be performed effectively via the interlaced network layers. To answer this question, we borrow ideas from the recent theoretical work of binary neural network [53], wherein learning is also performed across the interlaced network layers (binarized activations are forward propagated to subsequent layers). In the proposed tandem network, as shown in Fig. 10, the ANN layer activation value a l−1 at layer l − 1 is replaced with the spike count c l−1 derived from the coupled SNN layer. Due to the dynamic nature of spike generation, it is not easy to find an analytical transformation function between a l−1 and c l−1 .
To circumvent this problem, we analyze the degree of mismatch between these two quantities and its effect on the activation forward propagation and error back-propagation. In our numerical experiments on CIFAR-10 with a randomly drawn mini-batch of 256 test samples, we calculate the cosine angle between vectorized c l−1 and a l−1 for all the convolution layers. As shown in Fig. 9, their cosine angles are below 24 degrees on average and such a relationship maintains consistently throughout learning. While these angles seem large in low dimensions, they are exceedingly small in a high dimensional space. According to the hyperdimensional computing theory [54] and the theoretical study of binary neural network [53], the cosine angle between any two high dimensional random vectors is approximately orthogonal. It also worth noting that the distortion of replacing a l−1 with c l−1 is less severe than binarizing a random high dimensional vector, which changes cosine angle by 37 degrees in theory. Given that the activation function and error gradients that backpropagated from the subsequent ANN layer remains equal, the distortions to the error back-propagation are bounded locally by the discrepancy between a l−1 and c l−1 .
Furthermore, we calculate the Pearson Correlation Coeffi-  Figure  2. The pseudo spike count a l−1 from ANN layer l − 1 is replaced with exact spike count c l−1 before passing through the activation function f (·) of ANN layer l. cient (PCC) between the weight-activation dot products c l · W and a l · W , which is an important intermediate quantity (input to the batch normalization layer) in our current network configurations. The PCC, ranging from -1 to 1, measures the linear correlation between two variables. A value of 1 implies a perfect positive linear relationship. As shown in Fig. 9, the PCC maintains consistently above 0.9 throughout learning for most of the samples, suggesting the linear relationship of weight-activation dot products are approximately preserved.

F. Rapid Inference with Reduced Synaptic Operations
As shown in Fig. 8, the proposed learning rule can deal with and utilize different encoding window sizes T e on CIFAR-10. In the most challenging case when T e = 1, we are able to achieve a satisfying error rate that is below 12%. This may be partially credited to the encoding strategy that we have employed, whereby important input information can be encoded at the first time step before passing into the SNN layer. In addition, the Batch Normalization layer that is added after each convolution and fully-connected layer ensures effective information transmission to the top layers. The error rate is reduced further by increasing T e , while the improvement vanishes beyond T e = 10. Hence, the SNN trained with the proposed learning rule can perform inference rapidly with at least an order of time-saving compared with other learning rules as shown in Table. I. While binary neural network also supports a rapid inference, they propagate information in a synchronized fashion and differ fundamentally from asynchronous information processing that is studied in other SNN works.
To study the energy efficiency of the proposed learning rule, we follow the evaluation metrics used in [22], [35]. As defined in Section III-B, we calculate the ratio of SNN SynOps to ANN SynOps on the CIFAR-10 and ImageNet-2012 datasets and compare them with other state-of-the-art learning rules. Given the short inference time required and sparse synaptic activities as summarized in Fig. 11, the AlexNet (shown in Table. II, with T e = 10) trained with the proposed learning rule achieves a ratio of only 0.40 and 0.68 for CIFAR-10 and ImageNet-2012 dataset, respectively. It is worth noting that the SNN is more energy-efficient than its ANN counterpart with a ratio below 1. The saving is even more significant compared to ANNs if we consider the fact that for SNNs, only an accumulate (AC) operation is performed for each synaptic operation; while for ANNs, a more costly multiplyand-accumulate (MAC) operation is performed. This results in an order of magnitude chip area as well as energy saving per synaptic operation [21], [22]. In contrast, the existing SNN implementations [22], [35] achieve a ratio of at least 3.61 and 1.975, which is at least 9 and 3 times more costly than the proposed tandem learning rule, on the CIFAR-10 and ImageNet-2012 datasets, respectively.

IV. CONCLUSION
In this work, we introduce a novel tandem neural network and its learning rule to effectively train SNNs for efficient and rapid inference for pattern classification tasks. Within the tandem neural network, a SNN is employed to determine spike counts as a discrete neural representation and spike trains for the activation forward propagation; while an ANN, sharing the weight with the coupled SNN, is used to approximate gradients of the coupled SNN. Given that error back-propagation is performed on the rate-based ANN, the proposed learning rule is both memory and computationally more efficient than the error back-propagation through time algorithm that is used in many spike-based learning rules [32]- [34].
To understand why the learning can be effectively performed within the tandem learning framework, we study the learning dynamics of the tandem network and compare it with an intact ANN. The empirical study on the CIFAR-10 reveals that the cosine distances between the vectorized ANN output a l and the coupled SNN output spike count c l are exceedingly small in a high dimensional space and such a relationship maintains throughout the training. Furthermore, strongly positive Pearson Correlation Coefficients are exhibited between weightactivation dot product c l ·W and a l ·W , an important intermediate quantity in the activation forward propagation, suggesting a linear relationship of weight-activation dot products are well preserved.
The SNNs trained with the proposed tandem learning rule have demonstrated competitive classification accuracies on the CIFAR-10 and ImageNet-2012 datasets. By encoding sensory stimuli within the available encoding time window through a learnable transformation layer, and adding batch normalization layers to ensure effective information flow; rapid inferences, with at least an order of magnitude time-saving compared to state-of-the-art ANN-to-SNN conversion and constrainthen-train approaches [22], are demonstrated on a large-scale ImageNet-2012 image classification task. Furthermore, the total synaptic operations are also significantly reduced compared to the baseline ANNs and other SNN implementations.
By integrating the algorithmic power of the proposed tandem learning rule with the unprecedented energy efficiency of emerging neuromorphic computing architectures, we expect to enable low-power on-chip computing on pervasive mobile and embedded devices. For future work, we will explore strategies to close the accuracy gap between the baseline ANN and SNN implementations as well as to evaluate more advanced network architectures.