{'fraction_non_alphanumeric': 0.02865647545532516, 'fraction_numerical': 0.00956056707532415, 'mean_word_length': 4.608006790210779, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Training Multilayer Spiking Neural Networks using NormAD based Spatio-Temporal Error Backpropagation

Spiking neural networks (SNNs) have garnered a great amount of interest for supervised and unsupervised learning applications. This paper deals with the problem of training multilayer feedforward SNNs. The non-linear integrate-and-fire dynamics employed by spiking neurons make it difficult to train SNNs to output desired spike train in response to a given input. To tackle this, first the problem of training a multilayer SNN is formulated as an optimization problem such that its objective function is based on the deviation in membrane potential rather than the spike arrival instants. Then, an optimization method named Normalized Approximate Descent (NormAD), hand-crafted for such non-convex optimization problems, is employed to derive the iterative synaptic weight update rule. Next it is reformulated for a more efficient implementation, which can also be interpreted to be spatio-temporal error backpropagation. The learning rule is validated by employing it to solve generic spike based training problem as well as a spike based formulation of the XOR problem. Thus, the new algorithm is a key step towards building deep spiking neural networks capable of event-triggered learning.


Introduction
The human brain assimilates multi-modal sensory data and uses it to learn and perform complex cognitive tasks such as pattern detection, recognition and completion. This ability is attributed to the dynamics of approximately 10 11 neurons interconnected through a network of 10 15 synapses in the human brain. This has motivated the study of neural networks in the brain and attempts to mimic their learning and information processing capabilities to create smart learning machines. Neurons, the fundamental information processing units in brain, communicate with each other by transmitting action potentials or spikes through their synapses. The process of learning in the brain emerges from synaptic plasticity viz., modification of strength of synapses triggered by spiking activity of corresponding neurons.
Spiking neurons are the third generation of artificial neuron models which closely mimic the dynamics of biological neurons. Unlike previous generations, both inputs and the output of a spiking neuron are signals in time. Specifically, these signals are point processes of spikes in the membrane potential of the neuron, also called a spike train. Spiking neural networks (SNNs) are computationally more powerful than previous generations of artificial neural networks as they incorporate temporal dimension to the information representation and processing capabilities of neural networks [1,2,3]. Owing to the incorporation of temporal dimension, SNNs naturally lend themselves for processing of signals The present success of deep learning based methods can be traced back to the breakthroughs in learning algorithms for second generation artificial neural networks (ANNs) [11]. As we will discuss in section 2, there has been work on learning algorithms for SNNs in the recent past, but those methods have not found wide acceptance as they suffer from computational inefficiencies and/or lack of reliable and fast convergence. One of the main reasons for unsatisfactory performance of algorithms developed so far is that those efforts have been centered around adapting high-level concepts from learning algorithms for ANNs or from neuroscience and porting them to SNNs. In this work, we utilize properties specific to spiking neurons in order to develop a supervised learning algorithm for temporal encoding applications with spike-induced weight updates.
A supervised learning algorithm named NormAD, for single layer SNNs was proposed in [12]. For a spike domain training problem, it was demonstrated to converge at least an order of magnitude faster than the previous state-ofthe-art. Recognizing the importance of multilayer SNNs for supervised learning, in this paper we extend the idea to derive NormAD based supervised learning rule for multilayer feedforward spiking neural networks. It is a spikedomain analogue of the error backpropagation rule commonly used for ANNs and can be interpreted to be a realization of spatio-temporal error backpropagation. The derivation comprises of first formulating the training problem for a multilayer feedforward SNN as a non-convex optimization problem. Next, the Normalized Approximate Descent based optimization, introduced in [12], is employed to obtain an iterative weight adaptation rule for multilayer SNNs. The new learning rule, is successfully validated by applying it to a general spike domain training problem and also to a spike domain formulation of the XOR problem. Note that a single layer SNN can not solve the XOR problem and a multilayer network is necessary. This paper is organized as follows. We begin with a summary of learning methods for SNNs documented in literature in section 2. Section 3 provides a brief introduction to spiking neurons and the mathematical model of Leaky Integrate-and-Fire (LIF) neuron, also setting the notations we use later in the paper. Supervised learning problem for feedforward spiking neural networks is discussed in section 4, starting with description of a generic training problem for SNNs. Next we present a brief mathematical description of a feedforward SNN with one hidden layer and formulate the corresponding training problem as an optimization problem. Then Normalized Approximate Descent based optimization is employed to derive spatio-temporal error backpropagation in section. 5. Simulation experiments to demonstrate performance of the new learning rule for some exemplary supervised training problems are discussed in section. 6. Section 7 concludes the development with discussion on directions for future research that can leverage the algorithm developed here towards the goal of realizing event-triggered deep spiking neural networks.

Related Work
One of the earliest attempts to demonstrate supervised learning with spiking neurons is the SpikeProp algorithm [13]. However, it is restricted to single spike learning, thereby limiting its information representation capacity. SpikeProp was then extended in [14] to neurons firing multiple spikes. In these studies, the training problem was formulated as an optimization problem with the objective function in terms of the difference between desired and observed spike arrival instants and gradient descent was used to adjust the weights. However, since spike arrival time is a discontinuous function of the synaptic strengths, the optimization problem is non-convex and gradient descent is prone to local minima.
The biologically observed spike time dependent plasticity (STDP) has been used to derive weight update rules for SNNs in [15,16,17]. ReSuMe and DL-ReSuMe took cues from both STDP as well as the Widrow-Hoff rule to formulate a supervised learning algorithm [15,16]. Though these algorithms are biologically inspired, the training time necessary to converge is a concern, especially for real-world applications in large networks. The ReSuMe algorithm has been extended to multilayer feedforward SNNs using backpropagation in [18].
Another notable spike-domain learning rule is PBSNLR [19], which is an offline learning rule for the spiking perceptron neuron (SPN) model using the perceptron learning rule. The PSD algorithm [20] uses Widrow-Hoff rule to empirically determine an equivalent learning rule for spiking neurons. The SPAN rule [21] converts input and output spike signals into analog signals and then applies the Widrow-Hoff rule to derive a learning algorithm. Further, it is applicable to the training of SNNs with only one layer. The SWAT algorithm [22] uses STDP and BCM rule to derive a weight adaptation strategy for SNNs. The Normalized Spiking Error Back-Propagation (NSEBP) method proposed in [23] is based on approximations of the simplified Spike Response Model for the neuron. The multi-STIP algorithm proposed in [24] defines an inner product for spike trains to approximate a learning cost function. As opposed to the above approaches which attempt to develop weight update rules for fixed network topologies, there are also some efforts in developing feed-forward networks based on evolutionary algorithms where new neuronal connections are progressively added and their weights and firing thresholds updated for every class label in the database [25,26].
Recently, an algorithm to learn precisely timed spikes using a leaky integrate-and-fire neuron was presented in [27]. The algorithm converges only when a synaptic weight configuration to the given training problem exists, and can not provide a close approximation, if the exact solution does not exist. To overcome this limitation, another algorithm to learn spike sequences with finite precision is also presented in the same paper. It allows a window of width around the desired spike instant within which the output spike could arrive and performs training only on the first deviation from such desired behavior. While it mitigates the non-linear accumulation of error due to interaction between output spikes, it also restricts the training to just one discrepancy per iteration. Backpropagation for training deep networks of LIF neurons has been presented in [28], derived assuming an impulse-shaped post-synaptic current kernel and treating the discontinuities at spike events as noise. It presents remarkable results on MNIST and N-MNIST benchmarks using rate coded outputs, while in the present work we are interested in training multilayer SNNs with temporally encoded outputs i.e., representing information in the timing of spikes.
Many previous attempts to formulate supervised learning as an optimization problem employ an objective function formulated in terms of the difference between desired and observed spike arrival time [13,14,29,30]. We will see in section 3 that a leaky integrate-and-fire (LIF) neuron can be described as a non-linear spatio-temporal filter, spatial filtering being the weighted summation of the synaptic inputs to obtain the total incoming synaptic current and temporal filtering being the leaky integration of the synaptic current to obtain the membrane potential. Thus one can argue that in order to train multilayer SNNs we would need to backpropagate error in space as well as in time, and as we will see in section 5, it is indeed the case for proposed algorithm. Note that while the membrane potential can directly control the output spike timings, it is also relatively more tractable through synaptic inputs and weights compared to spike timing. This observation is leveraged to derive spaio-temporal error backpropagation by treating supervised learning as an optimization problem, with the objective function formulated in terms of the membrane potential.

Spiking Neurons
Spiking neurons are simplified models of biological neurons e.g., the Hodgkin-Huxley equations describing the dependence of membrane potential of a neuron on its membrane current and conductivity of ion channels [31]. A spiking neuron is modeled as a multi-input system that receives inputs in the form of sequences of spikes which are then transformed to analog current signals at its input synapses. The synaptic currents are superposed inside the neuron and the result is then transformed by its non-linear integrate-and-fire dynamics to a membrane potential signal with a sequence of stereotyped events in it, called action potentials or spikes. Despite the continuous-time variations in the membrane potential of a neuron, it communicates with other neurons through the synaptic connections by chemically inducing a particular current signal in the post-synaptic neuron each time it spikes. Hence, the output of a neuron can be completely described by the time sequence of spikes issued by it. This is called spike based information representation and is illustrated in Fig. 1. The output, also called a spike train, is modeled as a point process of spike events. Though the internal dynamics of an individual neuron are straightforward, a network of neurons can exhibit complex dynamical behaviors. The processing power of neural networks is attributed to the massively parallel synaptic connections among neurons.

Synapse
The communication between any two neurons is spike induced and is accomplished through a directed connection between them known as a synapse. In the cortex, each neuron can receive spike-based inputs from thousands of other neurons. If we model an incoming spike at a synapse as a unit impulse, then the behavior of the synapse to translate it to an analog current signal in the post-synaptic neuron can be modeled by a linear time invariant system with transfer function wα(t). Thus, if a pre-synaptic neuron issues a spike at time t f , the post-synaptic neuron receives a current Figure 1: Illustration of spike based information representation: a spiking neuron assimilates multiple input spike trains to generate an output spike train. Figure adapted from [12].
Here the waveform α(t) is known as the post-synaptic current kernel and the scaling factor w is called weight of the synapse. The weight varies from synapse-to-synapse and is representative of its conductance, whereas α(t) is independent of synapse and is commonly modeled as where u(t) is the Heaviside step function and τ 1 > τ 2 . Note that the synaptic weight w can be positive or negative, depending on which the synapse is said to be excitatory or inhibitory respectively. Further, we assume that the synaptic currents do not depend on the membrane potential or reversal potential of the post-synaptic neuron.
Let us assume that a neuron receives inputs from n synapses and spikes arrive at the i th synapse at instants t i 1 , t i 2 , . . .. Then, the input signal at the i th synapse (before scaling by synaptic weight w i ) is given by the expression The synaptic weights of all input synapses to a neuron are usually represented in a compact form as a weight vector w = [w 1 w 2 · · · w n ] T , where w i is the weight of the i th synapse. The synaptic weights perform spatial filtering over the input signals resulting in an aggregate synaptic current received by the neuron: where A simplified illustration of the role of synaptic transmission in overall spike based information processing by a neuron is shown in Fig. 2, where an incoming spike train at a synaptic input is translated to an analog current with an amplitude depending on weight of the synapse. The resultant current at the neuron from all its upstream synapses is transformed non-linearly to generate its membrane potential with instances of spikes viz., sudden surge in membrane potential followed by an immediate drop.

Synaptic Plasticity
The response of a neuron to stimuli greatly depends on the conductance of its input synapses. Conductance of a synapse (the synaptic weight) changes based on the spiking activity of the corresponding pre-and post-synaptic neurons. A neural network's ability to learn is attributed to this activity dependent synaptic plasticity. Taking cues from biology, we will also constrain the learning algorithm we develop to have spike induced synaptic weight updates.

Leaky Integrate-and-Fire (LIF) Neuron
In leaky integrate-and-fire (LIF) model of spiking neurons, the transformation from aggregate input synaptic current I(t) to the resultant membrane potential V (t) is governed by following differential equation and the reset condition [32]: Here C m is the membrane capacitance, E L is the leak reversal potential and g L is the leak conductance. If V (t) exceeds the threshold potential V T , a spike is said to have been issued at time t. The expression V (t) −→ E L when Assuming that the neuron issued its latest spike at time t l , Eq. (4) can be solved for any time instant t > t l , until the issue of the next spike, with the initial condition where ' * ' denotes linear convolution and with τ L = C m /g L is the neuron's leakage time constant. Note from Eq. (5) that the aggregate synaptic current I(t) obtained by spatial filtering of all the input signals is first gated with a unit step located at t = t l and then fed to a leaky integrator with impulse response h(t), which performs temporal filtering. So the LIF neuron acts as a non-linear spatio-temporal filter and the non-linearity is a result of the reset at every spike.
Using Eq. (3) and (5) the membrane potential can be represented in a compact form as where (7) it is evident that d(t) carries all the information about the input necessary to determine the membrane potential. It should be noted that d(t) depends on weight vector w, since d i (t) for each i depends on last spiking instant t l which in turn is dependent on the weight vector w.
The neuron is said to have spiked only when the membrane potential V (t) reaches the threshold V T . So minor changes in the weight vector w may eliminate an already existing spike or introduce new spikes. Thus, spike arrival time t l is a discontinuous function of w. Therefore, Eq. (7) implies that V (t) is also discontinuous in weight space. Supervised learning problem for SNNs is generally framed as an optimization problem with the cost function described in terms of the spike arrival time or membrane potential. However, discontinuity of spike arrival time as well as V (t) in weight space renders the cost function discontinuous and hence the optimization problem non-convex. Commonly used steepest descent methods can not be applied to solve such non-convex optimization problems. In this paper, we extend the optimization method named Normalized Approximate Descent, introduced in [12] for single layer SNNs to multilayer SNNs.

Refractory Period
After issuing a spike, biological neurons can not immediately issue another spike for a short period of time. This short duration of inactivity is called the absolute refractory period (∆ abs ). This aspect of spiking neurons has been omitted in the above discussion for simplicity, but can be easily incorporated in our model by replacing t l with (t l + ∆ abs ) in the equations above.
Armed with a compact representation of membrane potential in Eq. (7), we are now set to derive a synaptic weight update rule to accomplish supervised learning with spiking neurons.

Supervised Learning using Feedforward SNNs
Supervised learning is the process of obtaining an approximate model of an unknown system based on available training data, where the training data comprises of a set of inputs to the system and corresponding outputs. So, the learned model should not only fit to the training data well but in addition it should also generalize well. That is, it should fit sufficiently well to any other input-output pair which was derived from the same system but was not a part of the training data. The first requirement viz. to obtain a model so that it best fits the given training data is called training problem. Next we discuss the training problem in spike domain, solving which is a stepping stone towards solving the more constrained supervised learning problem.

Training Problem
A canonical training problem for a spiking neural network is illustrated in Fig. 3. There are n inputs to the network such that s in,i (t) is the spike train fed at the i th input. Let the desired output spike train corresponding to this set of input spike trains be given in the form of an impulse train as Here δ(t) is the Dirac delta function and t 1 d , t 2 d , ..., t f d are the desired spike arrival instants over a duration T , also called an epoch. The aim is to determine the weights of the synaptic connections constituting the SNN so that its output s o (t) in response to the given input is as close as possible to the desired spike train s d (t).
NormAD based iterative synaptic weight adaptation rule was proposed in [12] for training single layer feedforward SNNs. However there are many systems which can not be modeled by any possible configuration of single layer SNN and necessarily require a multilayer SNN. Hence, now we aim to obtain supervised learning rule for multilayer spiking neural networks. The change in weights in a particular iteration of training can be based on the given set of input spike trains, desired output spike train and the corresponding observed output spike train. Also the weight adaptation rule should be constrained to have spike induced weight updates for computational efficiency. For simplicity, we will first derive the weight adaptation rule for training a feedforward SNN with one hidden layer and then state the general weight adaptation rule for feedforward SNN with an arbitrary number of layers. Figure 3: Spike domain training problem: Given a set of n input spike trains fed to the SNN through its n inputs, determine the weights of synaptic connections constituting the SNN so that the observed output spike train is as close as possible to the given desired spike train.

Performance Metrics
Training performance can be assessed by correlation between desired and observed outputs. It can be quantified in terms of cross-correlation between low-pass filtered versions of the two spike trains. The correlation metric which was introduced in [33] and is commonly used in characterizing the spike based learning efficiency [12,34] is defined as .

Feedforward SNN with One Hidden Layer
A fully connected feedforward SNN with one hidden layer is shown in Fig. 4. It has n neurons in the input layer, m neurons in the hidden layer and 1 in the output layer. We denote this network as a n → m → 1 feedforward SNN. This basic framework can be extended to the case where there are multiple neurons in the output layer or the case where there are multiple hidden layers. The weight of the synapse from the j th neuron in the input layer to the i th neuron in the hidden layer is denoted by w h,ij and that of the synapse from the i th neuron in the hidden layer to the neuron in output layer is denoted by w o,i . All input synapses to the i th neuron in the hidden layer can be represented compactly as an n-dimensional vector  Let s in,j (t) denote the spike train fed by the j th neuron in input layer to neurons in hidden layer. Hence, from Eq. (2), the signal fed to the neurons in the hidden layer from the j th input (before scaling by synaptic weight) c h,j (t) is given as c h,j (t) = s in,j (t) * α (t) .
Assuming t last h,i as the latest spiking instant of the i th neuron in the hidden layer, define d h,i (t) as where c h (t) = [c h,1 c h,2 · · · c h,n ] T . From Eq. (7), membrane potential of the i th neuron in hidden layer is given as Accordingly, let s h,i (t) be the spike train produced at the i th neuron in the hidden layer. The corresponding signal fed to the output neuron is given as Defining Hence, from Eq. (7), the membrane potential of the output neuron is given as and the corresponding output spike train is denoted s o (t).

Mathematical Formulation of the Training Problem
To solve the training problem employing an n → m → 1 feedforward SNN, effectively we need to determine synaptic weights W h = [w h,1 w h,2 · · · w h,m ] T and w o constituting its synaptic connections, so that the output spike train s o (t) is as close as possible to the desired spike train s d (t) when the SNN is excited with the given set of input spike trains s in,i (t), i ∈ {1, 2, ..., n}. Let V d (t) be the corresponding ideally desired membrane potential of the output neuron, such that the respective output spike train is s d (t). Also, for a particular configuration W h and w o of synaptic weights of the SNN, let V o (t) be the observed membrane potential of the output neuron in response to the given input and s o (t) be the respective output spike train. We define the cost function for training as where and That is, the cost function is determined by the difference ∆V d,o (t), only at the instants in time where there is a discrepancy between the desired and observed spike trains of the output neuron. Thus, the training problem can be expressed as following optimization problem: Note that optimization with respect to w o is same as training a single layer SNN provided the spike trains from neurons in the hidden layer are known. In addition, we need to derive the weight adaptation rule for synapses feeding the hidden layer viz., the weight matrix W h , such that spikes in the hidden layer are most suitable to generate the desired spikes at the output. The cost function is dependent on the membrane potential V o (t) which is discontinuous with respect to w o as well as W h . Hence the optimization problem (20) is non-convex and susceptible to local minima when solved with steepest descent algorithm.

NormAD based Spatio-Temporal Error Backpropagation
In this section we apply Normalized Approximate Descent to the optimization problem (20) to derive a spike domain analogue of error backpropagation, which also has backpropagation along time dimension and hence called spatiotemporal error backpropagation. First we derive the training algorithm for SNNs with single hidden layer, and then we provide its generalized form to train feedforward SNNs with arbitrary number of hidden layers.

NormAD -Normalized Approximate Descent
Following the approach introduced in [12], we use three steps viz., (i) Stochastic Gradient Descent, (ii) Normalization and (iii) Gradient Approximation, as elaborated below to solve the optimization problem (20).

Stochastic Gradient Descent
Instead of trying to minimize the aggregate cost over the epoch, we try to minimize the instantaneous contribution to the cost at each instant t for which e(t) = 0, independent of that at any other instant and expect that it minimizes the total cost J (W h , w o ). The instantaneous contribution to the cost at time t is denoted J (W h , w o , t) and is obtained by restricting the limits of integral in Eq. (17) to an infinitesimally small interval around time t: Thus, using stochastic gradient descent, the prescribed change in any weight vector w at time t is given as: Here k(t) is a time dependent learning rate. The change aggregated over the epoch is, therefore Minimizing the instantaneous cost only for time instants when e(t) = 0 also renders the weight updates spike induced i.e., it is non-zero only when there is either an observed or a desired spike in the output neuron.

Normalization
Observe in Eq. (22) that the gradient of membrane potential ∇ w V o (t) is scaled with error term ∆V d,o (t), which serves two purposes. First, it determines the sign of the weight update at time t and second, it gives more importance to weight updates corresponding to the instants with higher magnitude of error. But V d (t) and hence error ∆V d,o (t) is not known. Also, dependence of the error on w h,i is non-linear, so we avoid the error term ∆V d,o (t) for neurons in hidden layer by choosing k (t) such that where r h is a constant. From Eq. (22), we obtain the weight update for the i th neuron in the hidden layer as since sgn (∆V d,o (t)) = sgn (e(t)). For the output neuron, we avoid the error term by choosing k (t) such that where r o is a constant. From Eq. (22), we get the weight update for the output neuron as Now, we proceed to determine the gradients ∇ w h,i V o (t) and ∇ wo V o (t).

Gradient Approximation
We use an approximation of V o (t) which is affine in w o and given as where Here, τ L is a hyper-parameter of learning rule that needs to be determined empirically. Similarly V h,i (t) can be approximated as Note that V h,i (t) and V o (t) are linear in weight vectors w h,i and w o respectively of corresponding input synapses.
Similarly ∇ w h,i V o (t) can be approximated as since only d o,i (t) depends on w h,i . Thus, from Eq. (26), we get We know that c o,i (t) = s α t − t s h,i , where t s h,i denotes the s th spiking instant of i th neuron in the hidden layer. Using the chain rule of differentiation, we get Refer to the appendix for a step-by-step derivation of Eq. (33). Using Eq. (32) and (33), we obtain an approximation Note that the key enabling idea in the derivation of the above learning rule is the use of the inverse of the time rate of change of the neuronal membrane potential to capture the dependency of its spike time on its membrane potential, as shown in the appendix in detail.

Spatio-Temporal Error Backpropagation
Incorporating the approximation from Eq. (30) into Eq. (25), we get the weight adaptation rule for w o as Similarly incorporating the approximation made in Eq. (34) into Eq. (24), we obtain the weight adaptation rule for w h,i as Thus the adaptation rule for the weight matrix W h is given as where U h (t) is a m × m diagonal matrix with i th diagonal entry given as Equation (37) can be equivalently written in following form, which lends itself to relatively more efficient implementation.
In addition Eq. (39) also brings forth the intuition that NormAD based training of multilayer SNNs is actually spatiotemporal error backpropagation, where spatial backpropagation is done through the weight vector w o and temporal backpropagation using time reversed kernels α (t) and h(t). This will be more evident when we generalize it to SNNs with arbitrarily many hidden layers.
From Eq. (36), note that the weight update for synapses of a neuron in hidden layer depends on its own spiking activity thus suggesting the spike-induced nature of weight update. However, in case all the spikes of the hidden layer vanish in a particular training iteration, there will be no spiking activity in the output layer and as per Eq. (36) the weight update ∆w h,i = 0 for all subsequent iterations. To avoid this, regularization techniques such as constraining the average spike rate of neurons in the hidden layer to a certain range can be used, though it has not been used in the present work. Figure 5: Fully connected feedforward SNN with L layers (N 0 → N 1 → N 2 · · · N L−1 → 1)

Generalization to Deep SNNs
For the case of feedforward SNNs with two or more hidden layers, the weight update rule for output layer remains same as in Eq. (35). Here we provide the general weight update rule for any particular hidden layer of an arbitrary fully connected feedforward SNN N 0 → N 1 → N 2 · · · N L−1 → 1 with L layers and shown in Fig. 5.2. It can be obtained by simple extension of the derivation for the case with single hidden layer discussed above. For this discussion, the subscript h or o in the notations above, indicating layer of corresponding neuron, is replaced by corresponding layer index to accommodate arbitrary number of layers. The iterative weight update rule for synapses connecting neurons in layer l − 1 to neurons in layer l viz., W l (0 < l < L) is given as follows: where e spat l (t) = W T l+1 e temp l+1 (t) for 1 < l < L, performs temporal backpropagation. Here U l (t) is an N l × N l diagonal matrix with n th diagonal entry given as where V l,n (t) is the membrane potential of n th neuron in layer l and t s l,n is the time of its s th spike.

Validation
In this section we validate the applicability of NormAD based Spatio-Temporal Error Backpropagation to training of multilayer SNNs. The algorithm comprises of Eq. (40) -(43).

Training Multilayer SNN
To validate the algorithm for training multilayer SNNs, 100 → 50 → 25 → 1 feedforward SNN architecture was used with the weights of synapses feeding the outermost layer initialized to 0. The synapses feeding the hidden layers were initialized such that 80% of them were excitatory and the rest 20% were inhibitory. The initial values of these synapses were set according to a uniformly random distribution. A training problem comprised of n = 100 input spike trains and corresponding desired output spike train, all generated to have Poisson distributed spikes with arrival rate 20 s −1 for the input and 10 s −1 for output and over an epoch duration T = 500 ms. Figure 6 shows the progress of  training for an exemplary training problem by plotting output spike rasters for various training iterations overlaid on the vertical red lines denoting positions of the desired spikes.
To assess the impact of training hidden layers using NormAD based spatio-temporal error backpropagation, we ran a set of 3 experiments. For 100 different training problems for the same SNN architecture as described above, we studied the effect of (i) training only the output layer, (ii) training only the outer 2 layers and (iii) training all the 3 layers. Figure 7 plots the cumulative number of SNNs trained against number of training itertions for the 3 cases, where the criteria for completion of training is reaching the correlation metric of 0.98 or above. Figure 8 shows plots of the mean spike correlation metric with standard deviation error-bars over the 100 training problems for the 3 experiments.
As can be seen, in the third experiment when all 3 layers were trained, all 100 training problems converged within 6000 training iterations. In contrast, the first 2 experiments have non-zero standard deviation even until 10000 training iterations indicating non-convergence for some of the cases. In the first eperiment, where only synapses feeding the output layer were trained, convergence was achieved only for 71 out of 100 training problems after 10000 iterations. But when synapses feeding the top two layers were trained the number of cases reaching convergenvce rose to 98, thus proving effectiveness of proposed NormAD based training for multilayer SNNs. Figure 8: Plots of mean spike correlation metric with standard deviation errorbars while partially or completely training 3-layer 100 → 50 → 25 → 1 SNNs for 100 different training problems.

XOR Problem
XOR problem is a prominent example of non-linear classification problems which can not be solved using the single layer neural network architecture and hence compulsorily require a multilayer network. Here, we present how proposed NormAD based training was employed to solve a spike domain formulation of the XOR problem for a multilayer SNN. The XOR problem is similar to the one used in [13] and represented by Table 1. There are 3 input neurons and 4 different input spike patterns given in the 4 rows of the table, where temporal encoding is used to represent logical 0 and 1. The numbers in the table represent arrival time of spikes at the corresponding neurons. The bias input neuron always spikes at t = 0 ms. The other two inputs can have two types of spiking activity viz., presence or absence of a spike at t = 6 ms, representing logical 1 and 0 respectively. The desired output is coded such that an early spike (at t = 10 ms) represents a logical 1 and a late spike (at t = 16 ms) represents a logical 0.
In the network reported in [13], the three input neurons had 16 synapses with axonal delays of 0, 1, 2, ..., 15 ms respectively. Instead of having multiple synapses we use a set of 18 different input neurons for each of the three inputs such that when first neuron of the set spikes, second one spikes after 1 ms, third one after another 1 ms and so on. Thus there are 54 input neurons comprising of three sets with 18 neurons in each set. So, a 54 → 54 → 1 feedforward Table 1: XOR Problem set-up from [13], which uses arrival time of spike to encode logical 0 and 1.
Input spike time (ms) Output Bias Input 1 Input 2 spike time (ms)  0  --16  0  -6  10  0  6  -10  0  6  6  16 SNN is trained to perform the XOR operation in our implementation. Input spike rasters corresponding to the 4 input patterns are shown in Fig. 9 (on left). Weights of synapses from the input layer to the hidden layer were initialized randomly using Gaussian distribution, with 80% of the synapses having positive mean weight (excitatory) and rest 20% of the synapses having negative mean weight (inhibitory). Again NormAD based training was employed and Fig. 9 plots the output spike raster (on right) corresponding to each of the four input patterns (on left), for an exemplary initialization of the weights from the input to the hidden layer. As can be seen, convergence was achieved in under 120 iterations in this experiment.
The necessity of a multilayer SNN for solving an XOR problem is well known, but to demonstrate the effectiveness of NormAD based training to hidden layers as well, we conducted two experiments. For 100 independent random initializations of the synaptic weights to the hidden layer the SNN was trained with (i) non-plastic hidden layer and (ii) plastic hidden layer. The output layer was trained using Eq. (35) in both the experiments. Figure 10 shows the mean spike correlation metric with standard deviation error-bars for the 100 initializations of the SNN. For the case with non-plastic hidden layer, the mean correlation reached close to 1, but the non-zero standard deviation represents a sizable number of experiments which did not converge even after 800 training iterations. When the hidden layer synapses were also trained, convergence was obtained for all the initializations within 400 training iterations. Here the convergence criteria was to reach spike correlatin metric 1.0. Figure 10: Plots of mean spike correlation metric with standard deviation error-bars over 100 different initializations of 54 → 54 → 1 SNN, trained for the XOR problem with non-plastic hidden layer and plastic hidden layer respectively.

Conclusion
We developed NormAD based Spaio-Temporal Error Backpropagation to train multilayer feedforward spiking neural networks. It is the spike domain analogue of error backpropagation algorithm used in second generation neural networks. The derivation was accomplished by first formulating the corresponding training problem as a non-convex optimization problem and then employing Normalized Approximate Descent based optimization to get the weight adaptation rule for the SNN. The learning rule was validated by applying it to general spike domain training problems as well as to a spike domain formulation of the XOR problem.
The main contribution of this work is hence the development of learning rule for spiking neural networks with arbitrary number of hidden layers. One of the major hurdles in achieving this has been the problem of backpropagating error through non-linear leaky integrate-and-fire dynamics of a spiking neuron. We have tackled the same by introducing temporal error backpropagation and quantifying the dependence of time of a spike on the corresponding membrane potential by inverse time rate of change of the membrane potential. This together with pre-existent spatial backpropagation of error constitutes NormAD based training of multilayer SNNs.
The problem of local convergence while training second generation deep neural networks is tackled by unsupervised pretraining prior to application of error backpropagation [11,35]. Development of such unsupervised pretraining techniques for deep SNNs is a topic of future research, as NormAD could be applied in principle to develop SNN based autoencoders.

A Gradient Approximation
Derivation of Eq. 33 is presented below: To compute ∇ w h,i t s h,i , let us assume that a small change δw h,ij in w h,ij led to changes in V h,i (t) and t s h,i by δV h,i (t) and δt s h,i respectively i.e., From Eq. (29), δV h,i (t) can be approximated as Note that approximation in Eq. (47) is an important step towards obtaining weight adaptation rule for hidden layers, as it now allows us to approximately model the dependence of spiking instant of a neuron on its inputs using inverse of the time derivative of its membrane potential.