<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>Stochastic Spiking Neural Networks with First-to-Spike Coding</title></titleStmt>
			<publicationStmt>
				<publisher>IEEE</publisher>
				<date>07/30/2024</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10560014</idno>
					<idno type="doi">10.1109/ICONS62911.2024.00012</idno>
					
					<author>Yi Jiang</author><author>Sen Lu</author><author>Abhronil Sengupta</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[Spiking Neural Networks (SNNs), recognized as the third generation of neural networks, are known for their bioplausibility and energy efficiency, especially when implemented on neuromorphic hardware. However, the majority of existing studies on SNNs have concentrated on deterministic neurons with rate coding, a method that incurs substantial computational overhead due to lengthy information integration times and fails to fully harness the brain's probabilistic inference capabilities and temporal dynamics. In this work, we explore the merger of novel computing and information encoding schemes in SNN architectures where we integrate stochastic spiking neuron models with temporal coding techniques. Through extensive benchmarking with other deterministic SNNs and rate-based coding, we investigate the tradeoffs of our proposal in terms of accuracy, inference latency, spiking sparsity, energy consumption, and robustness. Our work is the first to extend the scalability of direct training approaches of stochastic SNNs with temporal encoding to VGG architectures and beyond-MNIST datasets.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head>I. INTRODUCTION</head><p>Spiking neural networks (SNNs) bridge the gap between artificial and biological neural networks (ANNs), offering insights into neurological processes. In the human neuronal system, most of the information is propagated between neurons using spike-based activation signals over time. Inspired by this property, SNNs use binary spike signals to transmit, encode, and process information. Compared with analog neural networks where neuron and synaptic states are represented by non-binary multi-bit representations, SNNs have demonstrated significant energy and computational power savings, especially when deployed on neuromorphic hardware <ref type="bibr">[1]</ref>.</p><p>In SNNs, rate coding is one of the most popular coding methods. Under such a scheme, the information is represented by the rate or frequency of spikes over a defined period of time. However, such coding methods overlook the information of precise spike timings <ref type="bibr">[2]</ref> and are constrained by slow information transmission and large processing latency. On the other hand, temporal coding represents information by the precise timing of individual spikes but often lacks scalability and robustness <ref type="bibr">[3]</ref>. Compared to rate coding, which requires high firing rates to represent the same information, temporal coding can represent complex temporal patterns with relatively few spikes. In particular, First-to-Spike coding is a temporal coding scheme inspired by the rapid information processing observed in certain biological neural systems such as the retina <ref type="bibr">[4]</ref> and auditory system <ref type="bibr">[5]</ref>. In First-to-Spike coding, prediction is made when the first spike is observed on any one of the output neurons, thereby saving the need to operate over a redundant period of time as in rate coding. Therefore, it is often claimed that temporal coding is more computationally efficient than rate coding <ref type="bibr">[3]</ref>.</p><p>Nevertheless, it is a challenging task to train an SNN due to the disruptive nature of information representation and processing, especially for frameworks based on temporal coding. Most existing works on scalable SNN training with temporal encoding convert pre-trained ANN to SNN <ref type="bibr">[6]</ref>, <ref type="bibr">[7]</ref>. The conversion process typically involves mapping the analog activation values of the ANN's neurons to the timing of spikes of the SNN's neurons. SNN training algorithms with conventional architectures and rate encoding <ref type="bibr">[8]</ref> have witnessed rapid development <ref type="bibr">[9]</ref>, <ref type="bibr">[10]</ref> in recent years ranging from global spike-driven backpropagation techniques <ref type="bibr">[11]</ref> to more local approaches like Deep Continuous Local Learning (DECOLLE) <ref type="bibr">[12]</ref>, Equilibrium Propagation (EP) <ref type="bibr">[13]</ref>, <ref type="bibr">[14]</ref>, Deep Spike Timing Dependent Plasticity <ref type="bibr">[15]</ref>, among others. In stark contrast, literature on direct training of SNNs with temporal encoding remains extremely sparse with demonstrations primarily on toy datasets like MNIST.</p><p>Although the vast majority of algorithm development and applications in SNNs employ deterministic neuron models such as the deterministic Spike Response Model (SRM) <ref type="bibr">[16]</ref>, Integrate and Fire (IF), and Leaky Integrate and Fire (LIF) models <ref type="bibr">[17]</ref>, it is important to recognize that biological neurons generate spikes in a stochastic fashion <ref type="bibr">[18]</ref>. Furthermore, deterministic neuron models are discontinuous and non-differentiable, which presents substantial challenges in the application of gradient-based optimization methods. On the other hand, stochastic neuron models smoothen the network model to be continuously differentiable <ref type="bibr">[19]</ref> and therefore have the potential to offer enhanced efficiency and robustness. Additionally, stochasticity can enhance generalization performance by improving fault tolerance <ref type="bibr">[20]</ref> and by preventing overfitting <ref type="bibr">[21]</ref>.</p><p>Recently, there has been growing interest in exploiting stochastic devices in the neuromorphic hardware community <ref type="bibr">[22]</ref>, <ref type="bibr">[23]</ref>. With the scaling of device dimensions, memristive devices lose their programming resolution and are character-ized by increased cycle-to-cycle variation. Work has started in earnest to design stochastic state-compressed SNNs using such scaled neuromorphic devices that exhibit iso-accuracies in comparison to their multi-bit deterministic counterparts enabled by the alternate encoding of information in the probability domain <ref type="bibr">[24]</ref>, <ref type="bibr">[25]</ref>. Ref. <ref type="bibr">[26]</ref> proposes noisy spiking neural network (NSNN) which leverages stochastic noise as a resource for training SNNs using rate-based coding. While there is significant progress in the domain of stochastic SNN training algorithms, there remains a noticeable gap in the design of SNN architectures that integrate the benefits of both stochastic neuronal computing and temporal information coding. Most of the current efforts on directly training stochastic SNNs with temporal coding have primarily demonstrated success on simple datasets and shallow network structures <ref type="bibr">[27]</ref>- <ref type="bibr">[29]</ref>. Scaling these networks to deeper architectures and more complex datasets presents significant challenges. Further, as we demonstrate in this work, many of the supposed benefits of temporal encoding, like enhanced spiking sparsity, may not necessarily hold true for deep architectures. This necessitates a co-design approach to identify the relative tradeoffs of stochastic temporally encoded SNNs in terms of accuracy, latency, sparsity, energy cost, and robustness. The specific contributions of this work are summarized below: (i) Algorithm Development: We present a simple and structured algorithm framework to train stochastic SNNs directly with First-to-Spike coding. We also present training frameworks to train deterministic SNNs with temporal encoding that serve as a comparison baseline for our work to identify the relative merits/demerits of the computing and encoding scheme. We present empirical results to substantiate the scalability of our approach by demonstrating state-of-the-art accuracies on MNIST <ref type="bibr">[30]</ref> and CIFAR-10 [31] datasets for 2-layer MLP, LeNet5, and VGG15 architectures. Notably, this is the first work to demonstrate direct SNN training employing First-to-Spike coding for VGG architectures on the CIFAR dataset. (ii) Co-Design Analysis: We present a comprehensive quantitative analysis of previously unexplored trade-offs for stochastic SNNs with temporal encoding in terms of neuromorphic compute specific metrics like accuracy, latency, sparsity, energy efficiency, and robustness.</p><p>The rest of the paper is organized as follows. Section II describes related works. Section III introduces the training frameworks of SNNs with First-to-Spike coding for both deterministic and stochastic computing architectures. Section IV presents the experimental results and Section V provides conclusions and future outlook.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>II. RELATED WORKS</head><p>Temporal Coding: Temporal coding is characterized by its emphasis on the timing of spikes rather than the frequency in rate coding. Time-to-First-Spike (TTFS) coding <ref type="bibr">[32]</ref> is a popular temporal coding scheme that is demonstrated to have rapid and low power processing <ref type="bibr">[33]</ref>- <ref type="bibr">[36]</ref> since it typically imposes a limitation that each neuron should only generate at most one spike. This limitation lacks biological plausibility and it cannot handle the complex temporal structure of sequences of real-world events <ref type="bibr">[37]</ref>. Although latency is significantly reduced compared to rate coding, it still suffers from high latency, particularly when processing complex datasets <ref type="bibr">[35]</ref>, <ref type="bibr">[38]</ref>, <ref type="bibr">[39]</ref>. Therefore, we focus on First-to-Spike coding based temporal coding strategy that can further reduce the latency in comparison to TTFS coding. First-to-Spike coding is distinct from other approaches since it does not primarily rely on the precise timing of each spike. Instead, this coding strategy focuses on the order of the first spike of all the output neurons. The efficacy and potential applications of the First-to-Spike coding mechanism have been extensively explored in recent literature <ref type="bibr">[37]</ref>, <ref type="bibr">[40]</ref>. Nevertheless, the process of generating a spike in SNNs is non-differentiable. To tackle this problem, there are several common methods for developing and training SNNs with temporal coding, which will be introduced next.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>ANN-SNN Conversion Approaches for Temporal Coding:</head><p>ANN-SNN Conversion is a widely adopted method for converting pre-trained ANNs to SNNs <ref type="bibr">[41]</ref>- <ref type="bibr">[43]</ref>. The neurons with continuous activation functions, such as sigmoid or ReLU, need to be mapped to spiking neurons like IF/LIF neurons. Algorithmic approaches usually aim to reduce information loss caused during the conversion process. Proposal by <ref type="bibr">[6]</ref> designed an exact mapping from an ANN with ReLUs to a corresponding SNN with TTFS coding. The key achievement of this mapping is that it maintains the network accuracy after conversion with minimal drop. However, the conversion process involves complex steps which can make the process difficult to implement and optimize. Additionally, the necessity to use different conversion strategies for different types of layers further adds to the complexity. Also, it is important to note that the ANNs are trained without any temporal information, which typically results in high latency when converted to SNNs <ref type="bibr">[11]</ref>. Hence, it is critical to explore direct training strategies for SNNs with temporal encoding.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>Direct SNN Training Approaches for Temporal Coding:</head><p>In the domain of TTFS coding, a convolutional-like coding method <ref type="bibr">[44]</ref>, <ref type="bibr">[45]</ref> was proposed to directly train an SNN, which uses a temporal kernel to integrate temporal and spatial information. It can significantly reduce the model size and transform the spatial localities into temporal localities which can improve efficiency and accuracy. Some recent works use the surrogate gradient <ref type="bibr">[37]</ref>, <ref type="bibr">[46]</ref> or surrogate model <ref type="bibr">[39]</ref> to solve the non-differentiable backpropagation issue in deterministic neurons with temporal coding. Another technique is to directly train SNNs with stochastic neurons. The smoothing effect of stochastic neurons is crucial for enabling gradientbased optimization methods in SNNs <ref type="bibr">[19]</ref> by solving the nonlinear, non-differentiable aspects of the spiking mechanism.</p><p>Research by <ref type="bibr">[27]</ref>, <ref type="bibr">[28]</ref> introduced a stochastic neuron model for directly training SNNs. This model uses the generalized linear model (GLM) <ref type="bibr">[47]</ref> and first-to-spike coding. The GLM consists of a set of linear filters to process the incoming spikes, followed by a nonlinear function that computes the neuron's firing probability based on the filtered inputs. Subsequently, this model employs a stochastic process such as the Poisson process to generate spike trains. However, the computational complexity of adapting a GLM for large-scale SNN training can be quite high. Other recent works have also explored stochastic SNNs with TTFS coding where the stochastic neuron is implemented by the intrinsic physics of spin devices <ref type="bibr">[29]</ref>. However, existing research primarily focuses on shallow networks and MNIST-level datasets and lacks quantification of benefits offered by stochastic computing and temporal encoding in SNNs at scale.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>III. METHODS</head><p>In this section, we introduce the methodology to train deterministic and stochastic SNNs with First-to-Spike coding where the key idea is to find the neuron that generates the first spike signal, thereby terminating the inference process. Associated loss function design and weight gradient calculations are also elaborated considering discontinuity issues observed in spiking neurons.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Deterministic SNN</head><p>The Leaky Integrate-and-Fire (LIF) neuron model is one of the most recognized spiking neuron models in SNNs, primarily chosen for its balance between simplicity and biological plausibility <ref type="bibr">[48]</ref>. The LIF model simulates the behavior of neurons by accumulating input signals (voltage) until they reach the threshold. During this period, the accumulated voltage decays over time, which simulates the electrical resistance seen in real neuronal membranes. However, the process to generate a spike in LIF models is non-differentiable which makes it challenging for traditional gradient-based methods. Defining a surrogate gradient (SG) as a continuous relaxation of the real gradients is one of the common ways to tackle the discontinuous spiking nonlinearity <ref type="bibr">[19]</ref>. The deterministic LIF neuron model used in our network can be summarized as:</p><p>where, V t i is the membrane potential of neuron i at time t, w i,j is the weight connecting the pre-synapse neuron j and postsynapse neuron i, X t j is the input signal of pre-synapse neuron j at time t, V th is the threshold, and &#955; is the leak scaling factor. When neuron i's membrane potential at time t -1 is larger than the threshold, it generates a spike and resets its membrane potential. Soft reset is used to reduce the membrane potential by the threshold instead of hard reset which resets the membrane potential to a certain value. This reset method ensures that the residual potential that exceeds the threshold is carried over to subsequent timesteps, thereby minimizing potential information loss <ref type="bibr">[11]</ref>.</p><p>The output spike train o t i is generated by following this equation:</p><p>The temporal cross-entropy loss function <ref type="bibr">[49]</ref>, which integrates the principles of First-to-Spike coding, is formalized as follows: For each neuron i, the estimated activation probability is computed using the equation:</p><p>where, t i is the time of the first spike of neuron i and n is the number of output neurons. The loss function is given by the following equation:</p><p>where, y i &#8712; {0, 1} is a one-hot target vector and n is the number of output neurons. In the context of First-to-Spike coding, the goal is to minimize the time of the first spike of the correct neuron, which leads to maximizing its corresponding probability, as indicated by the cross-entropy loss function.</p><p>The gradient of the weights corresponding to the deterministic LIF neuron model is given by the following equation:</p><p>Surrogate gradients provide a solution by approximating the gradient of the spike generation process, enabling gradient descent through these non-differentiable neurons. In the deterministic LIF neuron model, the process of extracting the first spike time from the output spike train is non-differentiable. Therefore, we use the sign estimator by replacing the gradient &#8706;t i /&#8706;o t i with -1 only at the time of the first spike <ref type="bibr">[49]</ref>. Since Eqn. 2 is also non-differentiable, in order to compute &#8706;o t i /&#8706;V t i , we need a surrogate gradient to solve the discontinuous spiking nonlinearity. In this paper, the Arctan surrogate <ref type="bibr">[50]</ref> is used. After employing the Arctan surrogate, Eqn. 2 can be written as:</p><p>By using the surrogate gradient function, the discrete event is approximated as a differentiable function. The gradient &#8706;t i /&#8706;o t i can be expressed as:</p><p>This allows the network to be trained using variants of backpropagation. In this paper, Backpropagation through time (BPTT) <ref type="bibr">[51]</ref> is used where the network is unrolled across timesteps for backpropagation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Stochastic SNN</head><p>On the other hand, the introduction of stochasticity can efficiently smoothen out discontinuous spiking nonlinearities. Inspired by <ref type="bibr">[27]</ref>, we integrate stochastic LIF neurons with First-to-Spike coding. The membrane potential is computed by using the following equation:</p><p>where, k i is a scaling factor of the membrane potential of the neuron. Subsequently, the sigmoid activation function is used to calculate p t i , which is the probability of neuron i generating a spike at time t. The probability p t i is used to generate an independent and identically distributed (i.i.d.) Bernoulli value, which represents the discrete spike train generated by the neuron. Due to the non-differentiable nature of the Bernoulli function, it poses a problem for backpropagation techniques which rely on gradient-based optimization. To address this issue, we use the Straight-Through (ST) estimator <ref type="bibr">[52]</ref>, which passes the gradient received from the deeper layer directly to the preceding layer without any modification in the backward phase. In the output layer, we compute the probability P t of the correct neuron to generate the earliest spike at time t by the following equation:</p><p>where, p t c is the probability of correct neuron c generating a spike at time t. This equation represents the probability that no wrong neurons generate a spike before the correct neuron produces a spike at time t. We use the same ML (Maximum Likelihood) criterion used in <ref type="bibr">[27]</ref> by maximizing the sum of all P t s through the following equation:</p><p>As the timestep increases, P t reduces, and the contributions to the overall losses diminish progressively which encourages neurons to fire earlier but not before the correct neuron, resulting in reduced latency. Furthermore, the BPTT algorithm is employed in a similar fashion as the deterministic SNN model, unfolding the network across timesteps and calculating the gradients of Eqn. 10 with respect to the weights at each timestep.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>IV. RESULTS</head><p>In this section, we evaluate the accuracy, latency, sparsity, energy cost, and noise sensitivity of different types of models to evaluate the influence of information encoding, computing scheme, and training methods independently: ANN-SNN conversion utilizing deterministic neurons and rate coding (D-R-CONV) <ref type="bibr">[41]</ref>, BPTT trained models with deterministic neurons utilizing rate coding (D-R-BPTT) <ref type="bibr">[11]</ref>, deterministic neural networks trained by BPTT utilizing First-to-Spike coding (D-F-BPTT) and the stochastic neural networks trained by BPTT utilizing First-to-Spike coding (S-F-BPTT). It is worth noting that First-to-Spike coding is only applied in the final output layer to leverage the spike timing at which a neuron first spikes to encode information. Acronyms are used to simplify the naming that reflects its key features: The first part indicates the type of neurons: deterministic (D) and stochastic (S), the second part denotes the coding method: rate coding (R) and First-to-Spike coding (F), and the third part represents the training method: ANN-SNN conversion (CONV) and Backpropagation Through Time (BPTT). We will use these acronyms throughout the remainder of the paper for brevity. We conduct experiments for three neural network architectures, ranging from shallow to deep: 2-layer MLP, LeNet5, and VGG15.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Datasets</head><p>In this paper, we use the MNIST <ref type="bibr">[30]</ref> and CIFAR-10 <ref type="bibr">[31]</ref> datasets for our experiments. In the preprocessing stage for the MNIST dataset, we adjust the pixel intensities from their original range of 0-255 to a normalized range of 0-1. For the CIFAR-10 dataset, we use data augmentation to effectively increase the diversity of the training data and reduce overfitting. In our case, the random horizontal flipping is applied with a probability of 0.5, and the image is rotated at an angle randomly selected from a range of -15 to 15 degrees <ref type="bibr">[53]</ref>. Our preprocessing also includes random cropping of images, with a padding of 4 pixels <ref type="bibr">[54]</ref>. To further augment the dataset, a random affine transformation is applied to the image. This includes shear-based transformations, where the degree of shear is precisely set to 10, effectively introducing a specific level of distortion to the images. Additionally, scaling adjustments are applied, altering the image size to fluctuate between 80% and 120% of the original size. The image attributes such as brightness, contrast, and saturation are adjusted <ref type="bibr">[55]</ref>, each by a factor of 0.2, to enhance model robustness against varying lighting and color conditions. Furthermore, normalization of the input image data is employed based on the mean and standard deviation for each color channel in the CIFAR-10 dataset.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Model Training</head><p>TABLE I TRAINING HYPERPARAMETERS Dataset MNIST CIFAR-10 Model S-F-BPTT D-F-BPTT S-F-BPTT D-F-BPTT Leakage Factors 0.7 0.9 0.7 0.9 Epoch 150 150 1000 1000 Batch Size 512 512 64 64 Learning Rate 5e-2 1e-3 1e-2 5e-5 Weight Decay 1e-6 1e-4 1e-6 1e-2 Scheduler Step-Size 50 50 200 120 Scheduler Gamma 0.8 0.5 0.5 0.5</p><p>In the training of all architectures, the Adam optimizer <ref type="bibr">[56]</ref> is utilized, accompanied by a learning rate scheduler. For deterministic LIF neurons, the parameter &#945; is set to 2 in Eqn 7. The detailed hyperparameter settings are listed in Table <ref type="table">I</ref>. Additionally, a critical aspect of SNN-specific optimization involves layerwise tuning of the neuron's firing threshold V th in the D-F-BPTT model and the scaling factor k i in the S-F-BPTT model (see Section III). For this purpose, we used a Neuroevolutionary optimized hybrid SNN training approach <ref type="bibr">[57]</ref> where the trained model was subsequently optimized using the gradient-free differential evolution (DE)</p><p>TABLE II PERFORMANCE COMPARISON OF DIFFERENT TYPES OF SNNS Dataset Architecture Model Accuracy Timesteps Energy Cost MNIST 2-Layer MLP D-R-CONV [41] 97.74% 15 1.38 D-R-BPTT [11] 98.57% 15 0.87 S-F-BPTT 98.62% 2.03 0.11 D-F-BPTT 98.76% 3.10 0.07 MNIST LeNet5 D-R-CONV [41] 97.74% 25 1.44 D-R-BPTT [11] 98.59% 35 4.95 S-F-BPTT 98.69% 2.07 0.76 D-F-BPTT 99.12% 3.23 0.28 CIFAR-10 VGG15 D-R-CONV [41] 90.12% 110 3.77 D-R-BPTT [11] 89.61% 100 12.26 S-F-BPTT 90.03% 5.43 0.81 D-F-BPTT 89.55% 10.95 0.75 Other Temporal Coding Models MNIST 2-Layer MLP Sakemi et al. 2023 [60] 98.34% --5Conv-1FC Kim et al. 2024 [36] 98.50% --2Conv-1FC T2FSNN [35] 99.33% 40 -CIFAR-10 VGG16 T2FSNN [35] 91.43% 680 -Park et al. 2021 <ref type="bibr">[39]</ref> 91.90% 544 -DTA-TTFS <ref type="bibr">[38]</ref> 93.05% 160 algorithm <ref type="bibr">[58]</ref>, <ref type="bibr">[59]</ref> to achieve the best accuracy-latency tradeoff. Prior work has demonstrated that such a hybrid framework significantly outperforms approaches that combine such hyperparameter tuning during the BPTT training process itself <ref type="bibr">[57]</ref>.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>C. Quantitative Analysis</head><p>Accuracy: The performance of each network is summarized in Table <ref type="table">II</ref>. The accuracy is determined by calculating the mean value across ten independent runs. Transitioning rate coding to temporal coding actually does not the accuracy and even increases the accuracy in some cases. However, the introduction of stochasticity to the model causes a consistent increase in the network accuracy on the more complex CIFAR-10 dataset. For complex datasets, the variability introduced by stochasticity could act as a form of data augmentation, presenting the network with a wider range of data during the training. This can prevent the model from overfitting, leading to better generalization.</p><p>Inference Latency: In SNNs, reducing latency without sacrificing accuracy can be a critical goal, allowing for faster and more energy-efficient computation. In particular, for the D-R-CONV and D-R-BPTT models, the optimal number of timesteps is determined by identifying the saturation point on a plot of timesteps versus accuracy, where further increase in timesteps no longer significantly improves model accuracy.</p><p>For the S-F-BPTT and D-F-BPTT models, the inference latency is determined by averaging the number of timesteps at which the first spike is detected in the output layer across all input data. The differences in SNN inference latency in terms of timesteps are noted in Table <ref type="table">II</ref>. Compared to other temporal coding models, First-to-Spike coding models show a significantly lower latency. The First-to-Spike coding scheme requires only a single spike in the output layer to ascertain the result, reducing the number of timesteps significantly.</p><p>On the other hand, rate coding relies on the frequency of spikes over time, and therefore the network needs a longer observation window to establish an accurate spike rate. This phenomenon is magnified when the dataset becomes complex.</p><p>On the CIFAR-10 dataset, the rate coding approaches require a substantially higher number of timesteps to achieve the same level of accuracy compared to the models employing First-to-Spike coding. Interestingly, we find that the S-F-BPTT model reduces the latency even further in comparison to the D-F-BPTT model. The stochastic nature of spike generation in S-F-BPTT models may cause an output spike generation even when the input stimulus is not too strong or the membrane potential is low, allowing for a faster response to the input.</p><p>Sparsity: Spiking sparsity in SNNs is an important metric for evaluating the efficiency and functionality of models. The average spiking rate of a particular layer, defined as the average number of spikes that a neuron generates over a fixed time interval, is utilized to quantitatively represent sparsity. In this context, a higher average spike rate indicates lower sparsity, and vice versa. The average spiking rate of each model across various layers for the LeNet5 architecture trained on the MNIST dataset and VGG15 architecture trained on the CIFAR-10 dataset is shown in Fig. <ref type="figure">1</ref>. Contrary to the common assumption of higher sparsity in temporal coding models than in rate coding models, the figure shows that firstto-spike models do show higher sparsity in the final layer, with the hidden layers presenting a contrary trend, especially for the stochastic model, as shown in the results. The main reason is the necessity to encode the same information with reduced latency for temporally encoded models, which demands an increased spike count. It also explains why the S-F-BPTT model has the highest spiking rate with the lowest latency. Moreover, to achieve a reliable and consistent output in the presence of stochasticity, the stochastic SNN model needs to increase its spiking rate. This compensates for the unpredictability of individual spikes, ensuring that the overall signal transmission between neurons remains stable and correct. Energy Cost: The total number of SNN computations, that serves as a proxy metric for the resultant energy consumption of the model when deployed on neuromorphic hardware <ref type="bibr">[41]</ref>, is also a crucial factor in designing SNN models. The total "energy cost" E of each model, defined as the ratio of the number of computations performed in the SNN relative to that of an iso-architecture ANN, can be estimated as:</p><p>where, L is the total number of layers, S i-1 is the average spiking rate of the (i-1) th layer, T is the number of timesteps used for inference, and OP i is the number of operations in the i th layer. Following <ref type="bibr">[41]</ref>, OP i of convolutional layers and linear layers can be summarized as:</p><p>where, l i is the i th  Noise Sensitivity: A key aspect of ML model design is to ensure robustness to noise. A model's noise sensitivity can be measured by adding different levels of noise to the input and observing the impact on the network's accuracy. In this paper, Gaussian noise is used to assess how well the model can maintain its performance under noisy conditions. The variance of Gaussian noise is adjusted from 0 to 1. Fig. <ref type="figure">2</ref> shows the relationship between accuracy degradation and the magnitude of applied noise. It can be observed that the D-R-BPTT model demonstrates a higher tolerance to noise, maintaining higher accuracy as the noise intensity increases. Since it uses rate coding, which encodes information by the frequency of multiple spikes over time, individual perturbations caused by noise have less impact on the overall information conveyed.</p><p>Temporal coding models (D-F-BPTT and S-F-BPTT) are more sensitive to noise because they rely on the precise timing of spikes to encode information. However, the stochastic model has better performance than the deterministic model at high noise levels. This can be attributed to the stochasticity which is incorporated during the training process itself and therefore can provide more resilience to noise (through more tolerance towards the precision of individual spikes).</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>V. CONCLUSIONS</head><p>In summary, our research explores the interplay of deterministic/stochastic computing with First-to-Spike information coding in SNNs. This integration bridges a gap in current research, demonstrating scalable direct training of SNNs with temporal encoding on large-scale datasets and deep architectures. We showcase that First-to-Spike coding has significant performance benefits for SNN architectures in contrast to traditional rate-based models with regard to various metrics, including latency, sparsity, and energy efficiency. We also underscore notable trade-offs between the stochastic and deterministic SNN models in temporal encoding scenarios. Stochastic models reduce latency and provide enhanced noise robustness, which is important for real-time confidence-critical applications. However, this advantage is offered at the expense of a slight decrement in sparsity, which consequentially results in higher energy costs compared to deterministic SNNs employing First-to-Spike coding. In terms of accuracy, stochastic SNNs have the potential to aid in better generalization, especially for complex datasets. Although our results are promising, scaling this method to ImageNet level vision tasks as well as beyond vision applications could be a future research direction. Energy and sparsity aware training techniques can be also considered for stochastic SNN models with temporal encoding to further enhance its applicability for resource-constrained edge devices.</p></div></body>
		</text>
</TEI>
