N OISY M ACHINES : U NDERSTANDING NOISY NEURAL NETWORKS AND ENHANCING ROBUSTNESS TO ANALOG HARDWARE ERRORS USING DISTILLATION
Anonymous authors
Paper under double-blind review
A BSTRACT
The success of deep learning has brought forth a wave of interest in computer hardware design to better meet the high demands of neural network inference.
In particular, analog computing hardware has been heavily motivated speciﬁcally for accelerating neural networks, based on either electronic, optical or photonic devices, which may well achieve lower power consumption than conventional digital electronics.
However, these proposed analog accelerators suffer from the intrinsic noise generated by their physical components, which makes it challenging to achieve high accuracy on deep neural networks.
Hence, for successful deployment on analog accelerators, it is essential to be able to train deep neural networks to be robust to random continuous noise in the network weights, which is a somewhat new challenge in machine learning.
In this paper, we advance the understanding of noisy neural networks.
We outline how a noisy neural network has reduced learning capacity as a result of loss of mutual information between its input and output.
To combat this, we propose using knowledge distillation combined with noise injection during training to achieve more noise robust networks, which is demonstrated experimentally across different networks and datasets, including ImageNet.
Our method achieves models with as much as ∼ 2 × greater noise tolerance compared with the previous best attempts, which is a signiﬁcant step towards making analog hardware practical for deep learning.
I NTRODUCTION
Deep neural networks (DNNs) have achieved unprecedented performance over a wide variety of tasks such as computer vision, speech recognition, and natural language processing.
However, DNN inference is typically very demanding in terms of compute and memory resources.
Consequently, larger models are often not well suited for large-scale deployment on edge devices, which typically have meagre performance and power budgets, especially battery powered mobile and IoT devices.
To address these issues, the design of specialized hardware for DNN inference has drawn great interest, and is an extremely active area of research.
To date, a plethora of techniques have been proposed for designing efﬁcient neural network hardware (Sze et al., 2017).
In contrast to the current status quo of predominantly digital hardware, there is signiﬁcant research interest in analog hardware for DNN inference.
In this approach, digital values are represented by analog quantities such as electrical voltages or light pulses, and the computation itself (e.g., multiplication and addition) proceeds in the analog domain, before eventually being converted back to digital.
Analog accelerators take advantage of particular efﬁciencies of analog computation in exchange for losing the bit-exact precision of digital.
In other words, analog compute is cheap but somewhat imprecise.
Analog computation has been demonstrated in the context of DNN inference in both electronic (Binas et al., 2016), photonic (Shen et al., 2017) and optical (Lin et al., 2018) systems.
Analog accelerators promise to deliver at least two orders of magnitude better performance over a conventional digital processor for deep learning workloads in both speed (Shen et al., 2017) and energy efﬁciency (Ni et al., 2017).
Electronic analog DNN accelerators are arguably the most mature technology and hence will be our focus in this work.
The most common approach to electronic analog DNN accelerator is in-memory computing , which typically uses non-volatile memory (NVM) crossbar arrays to encode the network weights as analog values.
The NVM itself can be implemented with memristive devices, such as metal-oxide resistive random-access memory (ReRAM) (Hu et al., 2018) or phase-change memory (PCM) (Le Gallo et al., 2018; Boybat et al., 2018; Ambrogio et al., 2018).
The matrix-vector operations computed during inference are then performed in parallel inside the crossbar array, operating on analog quantities for weights and activations.
For example, addition of two quantities encoded as electrical currents can be achieved by simply connecting the two wires together, whereby the currents will add linearly according to Kirchhoff’s current law.
In this case, there is almost zero latency or energy dissipation for this operation.
Similarly, multiplication with a weight can be achieved by programming the NVM cell conductance to the weight value, which is then used to convert an input activation encoded as a voltage into a scaled current, following Ohm’s law.
Therefore, the analog approach promises signiﬁcantly improved throughput and energy efﬁciency.
However, the analog nature of the weights makes the compute noisy, which can limit inference accuracy.
For example, a simple two-layer fully-connected network with a baseline accuracy of 91 .
7% on digital hardware, achieves only 76 .
7% when implemented on an analog photonic array (Shen et al., 2017).
This kind of accuracy degradation is not acceptable for most deep learning applications.
Therefore, the challenge of imprecise analog hardware motivates us to study and understand noisy neural networks , in order to maintain inference accuracy under noisy analog computation.
The question of how to effectively learn and compute with a noisy machine is a long-standing problem of interest in machine learning and computer science (Stevenson et al., 1990; Von Neumann, 1956).
In this paper, we study noisy neural networks to understand their inference performance.
We also demonstrate how to train a neural network with distillation and noise injection to make it more resilient to computation noise, enabling higher inference accuracy for models deployed on analog hardware.
We present empirical results that demonstrate state-of-the-art noise tolerance on multiple datasets, including ImageNet.
The remainder of the paper is organized as follows.
Section 2 gives an overview of related work.
Section 3 outlines the problem statement.
Section 4 presents a more formal analysis of noisy neural networks.
Section 5 gives a distillation methodology for training noisy neural networks, with experimental results.
Finally, Section 6 provides a brief discussion and Section 7 closes with concluding remarks.
R ELATED WORK
Previous work broadly falls under the following categories: studying the effect of analog computation noise, analysis of noise-injection for DNNs, and use of distillation in model training.
Analog Computation Noise Models In Rekhi et al.
(2019), the noise due to analog computation is modeled as additive parameter noise with zero-mean Gaussian distribution.
The variance of this Gaussian is a function of the effective number of bits of the output of an analog computation.
Similarly, the authors in Joshi et al.
(2019) also model analog computation noise as additive Gaussian noise on the parameters, where the variance is proportional to the range of values that their
PCM device can represent.
Some noise models presented have included a more detailed account of device-level interactions, such as voltage drop across the analog array (Jain et al., 2018; Feinberg et al., 2018), but are beyond the scope of this paper.
In this work, we consider an additive Gaussian noise model on the weights, similar to Rekhi et al.
; Joshi et al.
and present a novel training method that outperforms the previous work in model noise resilience.
Noise Injection for Neural Networks Several stochastic regularization techniques based on noise-injection and dropout (Srivastava et al., 2014; Noh et al., 2017; Li & Liu, 2016) have been demonstrated to be highly effective at reducing overﬁtting.
For generalized linear models, dropout and additive noise have been shown to be equivalent to adaptive L 2 regularization to a ﬁrst order (Wager et al., 2013).
Training networks with Gaussian noise added to the weights or activations can also increase robustness to variety of adversarial attacks (Rakin et al., 2018).
Bayesian neural networks replace deterministic weights with distributions in order to optimize over the posterior distribution of the weights (Kingma & Welling, 2013).
Many of these methods use noise injection at inference time to approximate weight distribution; in Gal & Ghahramani (2016) a link between
Gaussian processes and dropout is established in an effort to model the uncertainty of the output of a network.
A theoretical analysis by Stevenson et al.
(1990) has shown that for neural networks with adaptive linear neurons, the probability of error of a noisy neural network classiﬁer with weight noise increases with the number of layers, but largely independent of the number of weights per neuron or neurons per layer.
Distillation in Training Knowledge distillation (Hinton et al., 2015) is a well known technique in which the soft labels produced by a teacher model are used to train a student model which typically has reduced capacity.
Distillation has shown merit for improving model performance across a range of scenarios, including student models lacking access to portions of training data (Micaelli & Storkey, 2019), quantized low-precision networks (Polino et al., 2018;
Mishra & Marr, 2017), protection against adversarial attacks (Papernot et al., 2016; Goldblum et al., 2019), and in avoiding catastrophic forgetting for multi-task learning (Schwarz et al., 2018).
To the best of our knowledge, our work is the ﬁrst to combine distillation with noise injection in training to enhance model noise robustness.
P ROBLEM STATEMENT
[Figure]
analog in-memory crossbar involves ﬁrst ﬂattening the ﬁlters for a given layer into weight matrix W l , which is then programmed into an array of NVM devices which provide differential conductances G l for analog multiplication.
A random Gaussian ∆ W l is used to model the inherent imprecision in analog computation.
Without loss of generality, we model a general noisy machine after a simple memristive crossbar array, similar to Shaﬁee et al.
Figure 1 illustrates how an arbitrary neural network layer, l , such as a typical 3 × 3 convolution, can be mapped to this hardware substrate by ﬁrst ﬂattening the weights into a single large 2D matrix, W l , and then programming each element of this matrix into a memristive cell in the crossbar array, which provides the required conductances G l (the reciprocal of resistance) to perform analog multiplication following Ohm’s law, i out = v in G .
Note that a pair of differential pair of NVM devices are typically used to represent a signed quantity in G l .
Subsequently, input activations, x l converted into continuous voltages, v ( x l ) , are streamed into the array rows from the left-hand side.
The memristive devices connect row with columns, where the row voltages are converted into currents scaled by the programmed conductance, G , to generate the currents i ( y l ) , which are differential in order to represent both positive and negative quantites with unipolar signals.
The currents from each memristive device essentially add up for free where they are connected in the columns, according to Kirchhoff’s current law.
Finally, the differential currents are converted to bipolar voltages, v ( y l ) , which are they digitized before adding bias, and performing batch normalization and ReLU operations, which are not shown in Figure 1.
However, the analog inference hardware of Figure 1 is subject to real-world non-idealities, typically attributed to variations in: 1) manufacturing process, 2) supply voltage and 3) temperature, PVT variation collectively, all of which result in noise in the system.
Below we discuss the two key components in terms of analog noise modeling.
Data Converters.
Digital-to-analog converter (DAC) and analog-to-digital converter (ADC) circuits are designed to be robust to PVT variation, but in practice these effects do degrade the resolution (i.e. number of bits).
Therefore, we consider effective number of bits (ENOB), which is a lower bound on resolution in the presence of non-idealities.
Hence, we use activation and weight quantization with ENOB data converters and no additional converter noise modeling. NVM cells. Due to their analog nature, memristive NVM cells have limited precision, due to the read and write circuitry (Joshi et al., 2019). In between write and read operations, their stored value is prone to drift over time.
Long-term drift can be corrected with periodic refresh operations. At shorter timescales, time-varying noise may be encountered. For most of the experiments in this paper, we model generic NVM cell noise as an additive zero-mean i.i.d.
Gaussian error term on the weights of the model in each particular layer ∆ W l ∼ N (∆ W l ; 0 , σ 2 N,l I ) .
This simple model, described more concretely in Section 5, is similar to that used by Joshi et al.
(2019) which was veriﬁed on real hardware. In addition, we also investigate spatially-varying and time-varying noise models in Section 5.2 (Table 1).
A NALYSIS OF NOISY NEURAL NETWORKS 4. B IAS VARIANCE DECOMPOSITION FOR NOISY WEIGHTS
Naively deploying an off-the-shelf pretrained model on a noisy accelerator will yield poor accuracy for a fundamental reason.
Consider a neural network f
( W ; x ) with weights W that maps an input x ∈ R n to an output y ∈ R .
In the framework of statistical learning, x and y are considered to be randomly distributed following a joint probability distribution p ( x , y ) .
In a noisy neural network, the weights W are also randomly distributed, with distribution p ( W ) .
The expected Mean Squared
Error (MSE) of this noisy neural network can be decomposed as
[Equation]
y ) ∼ p ( x ,y ) , W ∼ p ( W )
[( f ( W
[Equation]
x ) − y ) 2 ] =
E ( x
[Equation]
y ) ∼ p
[Equation]
x ,y
[Equation]
W ∼ p
[Equation]
W
[Equation]
[Equation]
f
[Equation]
W
[Equation]
x
[Equation]
E W ∼ p
[Equation]
W
[Equation]
[ f ( W [Equation] x )] + E W ∼ p
[Equation]
W
[Equation]
[ f
[Equation]
W
[Equation]
x
[Equation]
] − y
[Equation]
] =
E x ∼ p
( x ) [ E W ∼ p ( W ) [( f ( W
[Equation]
x ) − E W ∼ p ( W ) [ f ( W
[Equation]
x )]) 2 ]] + E ( x ,y ) ∼ p ( x ,y )
[( E W ∼ p ( W )
[ f ( W
[Equation]
x
[Equation]
[Equation]
y ) 2 ] .
The ﬁrst term on the right hand side of Equation 1 is a variance loss term due to randomness in the weights and is denoted as l var .
The second term is a squared bias loss term which we call l bias .
However, typically a model is trained to minimize the empirical version of expected loss l pretrained =
E ( x ,y ) ∼ p ( x ,y )
[( f ( E [ W ]; x ) − y ) 2 ] .
We assume that the noise is centered such that pretrained weights are equal to E [ W ] .
A pretrained model is therefore optimized for the wrong loss function when deployed on a noisy accelerator.
To show this in a more concrete way, a baseline LeNet model (32 ﬁlters in the ﬁrst convolutional layer, 64 ﬁlters in the second convolutional layer and 1024 neurons in the fully-connected layer) (LeCun et al., 1998) is trained on MNIST dataset to 99 .
19% accuracy and then exposed to Gaussian noise in its weights, numerical values of these loss terms can be estimated.
The expected value of the network output E W [ f ( W ; x )] is estimated by averaging over outputs of different instances of the network for the same input x .
We perform inference on n = 100 different instances of the network and estimate the loss terms as
[Equation]
The above formulas are for a network with a scalar output.
They can be easily extended to the vector output case by averaging over all outputs.
In the LeNet example, we take the output of softmax layer to calculate squared losses.
The noise is assumed i.i.d.
Gaussian centered around zero with a ﬁxed SNR σ 2 W,l /σ 2 N,l in each layer l .
The numerical values of the above losses are estimated using the entire test dataset for different noise levels.
Results are shown in Figure 2(a).
ˆ l bias is initially equal to ˆ l pretrained and ˆ l var = 0 when there is no noise.
However, as noise level rises, they increase in magnitude and become much more important than ˆ l pretrained .
ˆ l var overtakes ˆ l bias to become the predominant loss term in a noisy LeNet at σ N /σ W (cid:39) 0 .
It is useful to note that l bias increases with noise entirely due to nonlinearity in the network, which is ReLU in the case of LeNet.
In a linear model, l bias should be equal to l pretrained as we would have f ( E [ W ]; x ) =
E [ f ( W ; x )] .
A model trained in a conventional manner is thus not optimized for the real loss it is going to encounter on a noisy accelerator.
Special retraining is required to improve its noise tolerance.
In Figure 2(a), we show how the model accuracy degrades with a rising noise level for the baseline LeNet and its deeper and wider variants.
The deeper network is obtained by stacking two more convolutional layers of width 16 in front of the baseline network and the wider network is obtained by increasing the widths of each layer in the baseline to 128, 256, 2048 respectively.
Performance degradation due to noise is worse for the deeper variant and less severe for the wider one.
A more detailed discussion of the network architecture effect on its performance under noise is offered in Section 4.
[Figure]
4. L OSS OF INFORMATION IN A NOISY NEURAL NETWORK
Information theory offers useful tools to study noise in neural networks.
Mutual information
I ( X ; Y ) characterizes the amount of information obtained on random variable X by observing another random variable Y .
The mutual information between X and Y can be related to Shannon entropy by
[Equation]
Mutual information has been used to understand DNNs (Tishby & Zaslavsky, 2015; Saxe et al., 2018).
Treating a noisy neural network as a noisy information channel, we can show how information about the input to the neural network diminishes as it propagates through the noisy computation.
In this subsection, X is the input to the neural network and Y is the output.
Mutual information is estimated for the baseline LeNet model and its variants using Equation 6.
When there is no noise, the term H ( Y | X ) is zero as Y is deterministic once the input to the network X is known, therefore I ( X ; Y ) is just H ( Y ) in this case.
Shannon entropy H ( Y ) can be estimated using a standard discrete binning approach (Saxe et al., 2018).
In our experiment, Y is the output of the softmax layer which is a vector of length 10 .
Entropy H ( Y ) is estimated using four bins per coordinate of Y by
[Equation]
where p i is the probability that an output falls in the bin i .
When noise is introduced to the weights, the conditional entropy H ( Y | X ) is estimated by ﬁxing the input X
= x and performing multiple noisy inferences to calculate ˆ H ( Y | X = x ) with the above binning approach.
ˆ H ( Y | X = x ) is then averaged over different input x to obtain ˆ H
( Y | X ) .
This estimate is performed for LeNet and its variants with different noise levels.
Results are shown in Figure 2(b).
The values are normalized to the estimate of I ( X ; Y ) at zero noise.
Mutual information between the input and the output decays towards zero with increasing noise in network weights.
Furthermore, mutual information in a deeper and narrower network decays faster than in a shallower and wider network.
Intuitively, information from the input undergoes more noisy compute when more layers are added to the network, while a wider network has more redundant paths for the information to ﬂow, thus better preserving it.
An information theoretic bound of mutual information decay as a function of network depth and width in a noisy neural network will be treated in our follow-up work.
Overall, noise is damaging the learning capacity of the network.
When the output of the model contains no information from its input, the network loses all ability to learn.
For a noise level that is not so extreme, a signiﬁcant amount of mutual information remains, which indicates that useful learning is possible even with a noisy model.
C OMBINING NOISE INJECTION AND KNOWLEDGE DISTILLATION 5. M ETHODOLOGY
Noise injection during training is one way of exposing network training to a more realistic loss as randomly perturbing weights simulates what happens in a real noisy analog device, and forces the network to adapt to noise during training.
Noise injection only happens in training during forward propagation, which can be considered as an approximation for calculating weight gradients with a straight-through-estimator (STE) (Bengio et al., 2013).
At each forward pass, the weight W l of layer l is drawn from an i.i.d.
Gaussian distribution N ( W l ; W l 0 , σ 2 N,l I ) .
The noise is referenced to the range of representable weights W l max − W l min in that particular layer
[Equation]
where η is a coefﬁcient characterizing the noise level.
During back propagation, gradients are calculated with clean weights W l 0 , and only W l 0 gets updated by applying the gradient.
W l max and W l min are hyperparameters which can be chosen with information on the weight distributions.
Knowledge distillation was introduced by Hinton et al.
(2015) as a way for training a smaller student model using a larger model as the teacher.
For an input to the neural network x , the teacher model generates logits z T i , which are then turned into a probability vector by the softmax layer
[Equation]
The temperature, T , controls the softness of the probabilities.
The teacher network can generate softer labels for the student network by raising the temperature T .
We propose to use a noise free clean model as the teacher to train a noisy student network.
The student network is trained with noise injection to match a mix of hard targets and soft targets generated by the teacher.
Logits generated by the student network are denoted as z S i .
A loss function with distillation for the student model can be written as
[Equation]
Here H is cross-entropy loss, y true is the one-hot encoding of the ground truth, and R is the L 2regularization term.
Parameter α balances relative strength between hard and soft targets.
We follow the original implementation in Hinton et al.
(2015), which includes a T 2 factor in front of the soft target loss to balance gradients generated from different targets.
The student model is then trained with Gaussian noise injection using this distillation loss function.
The vanilla noise injection training corresponds to the case where α = 0 .
If the range of weights is not constrained and the noise reference is ﬁxed, the network soon learns that the most effective way to decrease the loss is to increase the amplitude of the weights, which increases the effective SNR.
There are two possible ways to deal with this problem.
Firstly, the noise reference could be re-calculated after each weight update, thus updating the noise power.
Secondly, we can constrain the range of weights by clipping them to the range [ W l min , W l max ] , and use a ﬁxed noise model during training.
We found that in general the second method of ﬁxing the range of weights and training for a speciﬁc noise yields more stable training and better results.
Therefore, this is the training method that we adopt in this paper.
A schematic of our proposed method is shown in Figure 5 of the Appendix.
During training, a clean model is ﬁrst trained to its full accuracy and then weight clipping is applied to clip weights in the range [ W l min , W l max ] .
The speciﬁc range is chosen based on statistics of the weights.
Fine-tuning is then applied to bring the weight-clipped clean model back to full accuracy.
This model is then used as the teacher to generate soft targets.
The noisy student network is initialized with the same weights as the teacher.
This can be considered as a warm start to accelerate retraining.
As we discussed earlier, the range of weights is ﬁxed during training, and the noise injected into the student model is referenced to this range.
Our method also supports training for low precision noisy models.
Quantization reﬂects ﬁnite precision conversion between analog and digital domains in an analog accelerator.
Weights are uniformly quantized in the range [ W l min , W l max ] before being exposed to noise.
In a given layer, the input activations are quantized before being multiplied by noisy weights.
The output results of the matrix multiplication are also quantized before adding biases and performing batch normalization, which are considered to happen in digital domain.
When training with quantization, the straight-throughestimator is assumed when calculating gradients with back propagation.
5. E XPERIMENTAL RESULTS
In order to establish the effectiveness of our proposed method, experiments are performed for different networks and datasets.
In this section we mainly focus on bigger datasets and models, while results on LeNet and its variants with some discussion of network architecture effect can be found in Figure 6 of the Appendix.
ResNets are a family of convolutional neural networks proposed by He et al.
(2016), which have gained great popularity in computer vision applications.
In fact, many other deep neural networks also use ResNet-like cells as their building blocks.
ResNets are often used as industry standard benchmark models to test hardware performance.
The ﬁrst set of experiments we present consist of a ResNet-32 model trained on the CIFAR10 dataset.
In order to compare fairly with the previous work, we follow the implementation in Joshi et al.
and consider a ResNet32(v1) model on CIFAR10 with weight clipping in the range [ − 2 σ W,l , 2 σ W,l ] .
The teacher model is trained to an accuracy of 93 .
845% using stochastic gradient descent with cosine learning rate decay (Loshchilov & Hutter, 2016), and an initial learning rate of 0 .
1 (batch size is 128 ).
The network is then retrained with noise injection to make it robust against noise.
Retraining takes place forepochs, the initial learning rate is 0 .
01 and decays with the same cosine proﬁle.
We performed two sets of retraining, one without distillation in the loss ( α = 0 ), and another with distillation loss ( α = 1 ).
Everything else was kept equal in these retraining runs.
Five different noise levels are tested with ﬁve different values of η : { 0 . 02 , 0 . 04 , 0 .
Results are shown in Figure 3(a).
Every retraining run was performed twice and inference was performed 50 times on the test dataset for one model, to generate statistically signiﬁcant results.
Temperature was set to T = 6 for the runs with distillation.
We found that an intermediate temperature between 2 and 10 produces better results.
The pretrained model without any retraining performs very poorly at inference time when noise is present.
Retraining with Gaussian noise injection can effectively recover some accuracy, which we conﬁrm as reported in Joshi et al.
Our method of combining noise injection with knowledge distillation from the clean model further improves noise resilience by about 40% in terms of η , which is an improvement of almost 2 × in terms of noise power σ 2 N .
The actual noise level in a given device can only be estimated, and will vary from one device to another and even ﬂuctuate depending on the physical environment in which it operates (Section 3).
Therefore, it is important that any method to enhance noise robustness can tolerate a range of noise [Figure] levels.
Our method offers improved noise robustness, even when the actual noise at inference time is different from that injected at training time.
It is shown in Figure 3(b) that the model obtained from distillation is more accurate and less sensitive to noise level differences between training and inference time.
This holds for a range of different inference noise levels around the training level [Figure]
In the previous experiments [Figure] we assume a ﬁxed noise level parameterized by η .
On real analog hardware, there could be additional non-idealities such as variation in noise level due to temperature ﬂuctuation and nonuniform noise proﬁle on different NVM cells due to statistical variation in the manufacturing process.
We have conducted additional experiments to account for these effects.
Results from the experiments are shown in Table 1.
Temporal ﬂuctuation represents noise level variation over time. Noise η is randomly sampled from N ( η ; η 0 , σ 2 η ) for each inference batch. A noise temporal ﬂuctuation level of 10% means that σ η = 0 . 1 η 0 .
Spatial noise level ﬂuctuation introduces nonuniform diagonal terms in the noise covariance matrix.
More concretely, each weight noise in our previous model is multiplied by a scale factor λ w with λ w drawn from a Gaussian distribution N ( λ w ; 1 , σ 2 λ ) .
A noise spatial ﬂuctuation level of 10% means that σ λ = 0 . The scale factors are generated and then ﬁxed when the network is instantiated, therefore the noise during network inference is non i.i.d. in this case. Results from our experiments show that there is no signiﬁcant deviation when a combination of these non-ideal noise effects are taken into account.
[Table]
The performance of our training method is also validated with quantization.
A ResNet-18(v2) model is trained with quantization to 4-bit precision (ENOB) for both weights and activations.
This corresponds to 4-bit precision conversions between digital and analog domains.
A subset of training data is passed through the full precision model to calibrate the range for quantization – we choose the 0 .
1% and 99 .
9% percentiles as q min and q max for the quantizer.
This range of quantization is ﬁxed throughout training.
The quantized model achieves an accuracy of 92 .
91% on the test dataset when no noise is present.
The model is then re-trained for noise robustness.
The noise level is referenced to the range of quantization of weights in one particular layer, such that W l min =
q min , l and W l max = q max , l .
Results are shown for the same set of η values in Figure 4(a).
In the distillation retraining runs, the full-precision clean model with an accuracy of 93 .
87% is used as the teacher and temperature is set to T
= 6 .
Due to extra loss in precision imposed by aggressive quantization, accuracy of the pretrained quantized model drops sharply with noise.
At η = 0 .
057 , the model accuracy drops to 87 .
5% without retraining and further down to 80 .
9% at η = 0 .
Even retraining with noise injection struggles, and the model retrained with only noise injection achieves an accuracy of 90 .
34% at η = 0 .
Our method of combining noise injection and distillation stands out by keeping the accuracy loss within 1% from the baseline up to a noise level of η (cid:39) 0 .
[Figure]
One interesting aspect of using distillation loss during retraining with noise can be seen in Figure 4(b).
The evolution of model accuracy on the test dataset is shown.
When no distillation loss is used, the model suffers an accuracy drop (difference between blue and orange curves) around 2 .
08% when tested with noise.
The drop (difference between green and red curves) is signiﬁcantly reduced to around 0 .
6% when distillation loss is used.
This observation indicates that training with distillation favors solutions that are less sensitive to noise.
The ﬁnal model obtained with distillation is actually slightly worse when there is no noise at inference time but becomes superior when noise is present.
Results on the ImageNet dataset for a ResNet-50(v1) network are shown in Table 2 to demonstrate that our proposed approach scales to a large-scale dataset and a deep model.
A ResNet-50 model is ﬁrst trained to an accuracy of 74 . 942% with weight clipping in the range [ − 2 σ W,l , 2 σ W,l ] .
This range is ﬁxed as the reference for added noise.
For ResNet-50 on ImageNet, only three different noise levels are explored, and the accuracy degrades very quickly beyond the noise level η = 0 .
06 , as the model and the task are considerably more complex.
Retraining runs for 30 epochs with an initial learning rate of 0 .
001 and cosine learning rate decay with a batch size of 32 .
For distillation, we used α = 1 and T = 6 as in previous experiments.
Results are collected for two independent training runs in each setting and 50 inference runs over the entire test dataset.
The ﬁndings conﬁrm that training with distillation and noise injection consistently delivers more noise robust models.
The accuracy uplift beneﬁt also markedly increases with noise.
D ISCUSSION
Effects of distillation Knowledge distillation is a proven technique to transfer knowledge from a larger teacher model to a smaller, lower capacity student model.
This paper shows, for the ﬁrst time, that distillation is also an effective way to transfer knowledge between a clean model and its noisy
[Table]
counterpart, with the novel approach of combining distillation with noise injection during training. We give some intuition for understanding this effect with the help of Section 4.2: a noisy neural network can be viewed as a model with reduced learning capacity by the loss of mutual information argument.
Distillation is therefore acting to help reduce this capacity gap.
In our experiments, distillation shows great beneﬁt in helping the network to converge to a good solution, even with a high level of noise injected in the forward propagation step.
Here, we attempt to explain this effect by the reduced sensitivity of distillation loss.
An inﬂuential work by Papernot et al.
(2016) shows that distillation can be used to reduce the model sensitivity with respect to its input perturbations thus defending against some adversarial attacks.
We argue that distillation can achieve a similar effect for the weights of the network.
Taking the derivative of the i -th output of the student network q S i at temperature T with respect to a weight w yields
[Equation]
The 1 /T scaling makes the output less sensitive to weight perturbation at higher temperature, thus potentially stabilizing the training when noise is injected into weights during forward propagation.
We plan to work on a more formal analysis of this argument in our future work.
Hardware Performance Beneﬁts The improvements in noise tolerance of neural networks demonstrated in this work have a potential impact on the design of practical analog hardware accelerators for neural network inference.
Increased robustness to noisy computation at the model training level potentially means that the speciﬁcation of the analog hardware can be relaxed.
In turn, this can make it easier to achieve the hardware speciﬁcation, or even allow optimizations to further reduce the energy consumption.
An in-depth discussion of the trade-off between compute noise performance and hardware energy dissipation is beyond the scope of this paper, but we refer the interested reader to Rekhi et al.
for more details.
In summary, we believe that machine learning research will be a key enabler for practical analog hardware accelerators.
C ONCLUSION
Analog hardware holds the potential to signiﬁcantly reduce the latency and energy consumption of neural network inference.
However, analog hardware is imprecise and introduces noise during computation that limits accuracy in practice.
This paper explored the training of noisy neural networks, which suffer from reduced capacity leading to accuracy loss.
We propose a training methodology that trains neural networks via distillation and noise injection to increase the accuracy of models under noisy computation.
Experimental results across a range of models and datasets, including
ImageNet, demonstrate that this approach can almost double the network noise tolerance compared with the previous best reported values, without any changes to the model itself beyond the training method.
With these improvements in the accuracy of noisy neural networks, we hope to enable the implementation of analog inference hardware in the near future. A A PPENDIX 1 st 2 nd ……. l th 1 st 2 nd …….
l th
Teacher
Student
[Figure]
Hard
Labels
[Figure]
[Equation]
[Table]
[Equation]
[Table]
[Figure]
5l9aJNwxRwkzVbYDevAdyFaQgst4yhp
[Figure]
7TAglJqL1FUuZlTruYX4r9yo0tn7sWF5WWmak
[Figure]
uLsopjXeDFYvGESUo0nzsAIpmbFZMZSCDarb
[Figure]
hPiFaf
[Figure]
JdONnpRmE
[Figure]
vS2tX
[Figure]
w
[Figure]
I5N9AptozaK0Du0j3roCA0Q8Xpe7l14l
[Figure]
5HX
[Figure]
lX
[Figure]
rfrUt9bel6ilfC
[Figure]
/wYwwOO9<
[Figure]
[Figure]
[Figure]