arxiv: v1 [cs.ne] 31 Oct 2018

Similar documents
TYPES OF MODEL COMPRESSION. Soham Saha, MS by Research in CSE, CVIT, IIIT Hyderabad

Deep Learning with Low Precision by Half-wave Gaussian Quantization

arxiv: v3 [cs.lg] 2 Jun 2016

arxiv: v1 [cs.cv] 11 May 2015 Abstract

arxiv: v1 [cs.cv] 3 Aug 2017

DNN FEATURE MAP COMPRESSION USING LEARNED REPRESENTATION OVER GF(2)

Layer 1. Layer L. difference between the two precisions (B A and B W ) is chosen to balance the sum in (1), as follows: B A B W = round log 2 (2)

LOGNET: ENERGY-EFFICIENT NEURAL NETWORKS USING LOGARITHMIC COMPUTATION. Stanford University 1, Toshiba 2

TRAINING LONG SHORT-TERM MEMORY WITH SPAR-

arxiv: v1 [cs.cv] 25 May 2018

LARGE BATCH TRAINING OF CONVOLUTIONAL NET-

arxiv: v1 [cs.cv] 3 Feb 2017

Differentiable Fine-grained Quantization for Deep Neural Network Compression

Introduction to Deep Neural Networks

Weighted-Entropy-based Quantization for Deep Neural Networks

HIGHLY EFFICIENT 8-BIT LOW PRECISION INFERENCE

Deep Neural Network Compression with Single and Multiple Level Quantization

Designing Energy-Efficient Convolutional Neural Networks using Energy-Aware Pruning

Towards Accurate Binary Convolutional Neural Network

arxiv: v1 [cs.lg] 4 Dec 2017

arxiv: v1 [cs.cv] 1 Oct 2015

arxiv: v1 [cs.cv] 4 Jul 2017

arxiv: v2 [cs.ne] 23 Nov 2017

Efficient DNN Neuron Pruning by Minimizing Layer-wise Nonlinear Reconstruction Error

Accelerating Convolutional Neural Networks by Group-wise 2D-filter Pruning

σ(x) = clip( x m + α 2, 0, α) = min(max( x m + α 2, 0), α) (1)

arxiv: v2 [cs.cv] 7 Dec 2017

<Special Topics in VLSI> Learning for Deep Neural Networks (Back-propagation)

Introduction to Convolutional Neural Networks (CNNs)

EnergyNet: Energy-Efficient Dynamic Inference

Frequency-Domain Dynamic Pruning for Convolutional Neural Networks

Multi-Precision Quantized Neural Networks via Encoding Decomposition of { 1, +1}

LQ-Nets: Learned Quantization for Highly Accurate and Compact Deep Neural Networks. Microsoft Research

arxiv: v2 [cs.cv] 20 Aug 2018

Improved Bayesian Compression

Exploring the Granularity of Sparsity in Convolutional Neural Networks

Deep Learning Year in Review 2016: Computer Vision Perspective

Neural Network Approximation. Low rank, Sparsity, and Quantization Oct. 2017

Analytical Guarantees on Numerical Precision of Deep Neural Networks

Sajid Anwar, Kyuyeon Hwang and Wonyong Sung

Exploring the Granularity of Sparsity in Convolutional Neural Networks

GENERATIVE MODELING OF CONVOLUTIONAL NEU-

Scalable Methods for 8-bit Training of Neural Networks

Two-Step Quantization for Low-bit Neural Networks

Compressing deep neural networks

An Analytical Method to Determine Minimum Per-Layer Precision of Deep Neural Networks

OBJECT DETECTION FROM MMS IMAGERY USING DEEP LEARNING FOR GENERATION OF ROAD ORTHOPHOTOS

Two at Once: Enhancing Learning and Generalization Capacities via IBN-Net

arxiv: v2 [cs.cv] 17 Nov 2017

COMPARING FIXED AND ADAPTIVE COMPUTATION TIME FOR RE-

arxiv: v6 [stat.ml] 18 Jan 2016

Binary Deep Learning. Presented by Roey Nagar and Kostya Berestizshevsky

arxiv: v1 [cs.cv] 31 Jan 2018

arxiv: v1 [cs.lg] 18 Dec 2017

Toward Correlating and Solving Abstract Tasks Using Convolutional Neural Networks Supplementary Material

Analytical Guarantees on Numerical Precision of Deep Neural Networks

Auto-balanced Filter Pruning for Efficient Convolutional Neural Networks

Convolutional Neural Networks for Electron Neutrino and Electron Shower Energy Reconstruction in the NOvA Detectors

arxiv: v1 [cs.cv] 21 Oct 2016

ECE G: Special Topics in Signal Processing: Sparsity, Structure, and Inference

Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference

On Modern Deep Learning and Variational Inference

arxiv: v1 [stat.ml] 15 Dec 2017

arxiv: v3 [cs.cv] 20 Nov 2015

Very Deep Residual Networks with Maxout for Plant Identification in the Wild Milan Šulc, Dmytro Mishkin, Jiří Matas

arxiv: v3 [cs.lg] 5 Jun 2017

Binary Convolutional Neural Network on RRAM

Convolutional Neural Networks II. Slides from Dr. Vlad Morariu

Efficient Deep Learning Inference based on Model Compression

DEEP neural networks have become indispensable tools

Machine Learning for Large-Scale Data Analysis and Decision Making A. Neural Networks Week #6

P-TELU : Parametric Tan Hyperbolic Linear Unit Activation for Deep Neural Networks

Towards Effective Low-bitwidth Convolutional Neural Networks

Lipschitz Properties of General Convolutional Neural Networks

arxiv: v2 [cs.lg] 3 Dec 2018

CondenseNet: An Efficient DenseNet using Learned Group Convolutions

On the Complexity of Neural-Network-Learned Functions

Lower bounds on the robustness to adversarial perturbations

CS 229 Project Final Report: Reinforcement Learning for Neural Network Architecture Category : Theory & Reinforcement Learning

Fixed-point Factorized Networks

SHAKE-SHAKE REGULARIZATION OF 3-BRANCH

Classification goals: Make 1 guess about the label (Top-1 error) Make 5 guesses about the label (Top-5 error) No Bounding Box

Multiscale methods for neural image processing. Sohil Shah, Pallabi Ghosh, Larry S. Davis and Tom Goldstein Hao Li, Soham De, Zheng Xu, Hanan Samet

Speaker Representation and Verification Part II. by Vasileios Vasilakakis

WHY ARE DEEP NETS REVERSIBLE: A SIMPLE THEORY,

THE HIGH-DIMENSIONAL GEOMETRY OF BINARY NEURAL NETWORKS

arxiv: v1 [cs.cv] 16 Mar 2016

ANALYSIS ON GRADIENT PROPAGATION IN BATCH NORMALIZED RESIDUAL NETWORKS

arxiv: v1 [cs.ne] 20 Apr 2018

arxiv: v1 [cs.lg] 19 May 2017

arxiv: v1 [cs.lg] 27 Feb 2017

Convolutional Neural Network Architecture

arxiv: v2 [cs.cv] 19 Sep 2017

arxiv: v1 [cs.cv] 21 Nov 2016

Providing theoretical learning guarantees to Deep Learning Networks arxiv: v1 [cs.lg] 28 Nov 2017

Asaf Bar Zvi Adi Hayat. Semantic Segmentation

Lecture 7 Convolutional Neural Networks

Attention Based Pruning for Shift Networks

RAGAV VENKATESAN VIJETHA GATUPALLI BAOXIN LI NEURAL DATASET GENERALITY

arxiv: v4 [cs.cv] 2 Aug 2016

Transcription:

Convolutional Neural Network Quantization using Generalized Gamma Distribution Doyun Kim 1 Han Young Yim 1 Sanghyuck Ha 1 Changgwun Lee 1 Inyup Kang 1 arxiv:181.13329v1 [cs.ne] 31 Oct 218 Abstract As edge applications using convolutional neural networks (CNN) models grow, it is becoming necessary to introduce dedicated hardware accelerators in which network parameters and featuremap data are represented with limited precision. In this paper we propose a novel algorithm for energy-efficient deployment of the hardware accelerators. For weights and biases, the optimal bit length of the fractional part is determined so that the error is minimized over their distribution. For feature-map data, meanwhile, their sample distribution is well approximated with the generalized gamma distribution (GGD), and accordingly the optimal step size can be obtained through the asymptotical closed form solution of GGD. The proposed algorithm has a higher signal-to--noise ratio (SQNR) than other schemes previously proposed for CNNs, and even can be more improved by tuning the parameters, resulting in efficient implementation of the hardware accelerators for CNNs in terms of power consumption and memory bandwidth. 1. Introduction Recent achievements in image processing tasks such as image recognition, object detection, and scene segmentation have been coupled with the application of deep convolutional networks (Szegedy et al., 215; Ren et al., 215; Long et al., 215). As the need for more complex networks increases, we get faced with several implementation issues, i.e. real time processing, limited power budget, and memory bandwidth. For the issues to get resolved, various approaches have been investigated; low-precision (Courbariaux et al., 214; 215; Hubara et al., 216; Gupta et al., 215; Gysel et al., 216; Judd et al., 215; Lin et al., 216), 1 System LSI Business, Samsung Electronics, Gyeonggi-do, South Korea. Correspondence to: {dyun.kim@samsung.com}. network compression (Han et al., 215), (Han et al., 216), small network design (Iandola et al., 216), (Howard et al., 217), and so on. In this paper, meanwhile, we focus on low precision for a power-efficient implementation of hardware accelerators (Horowitz, 214). Related works are divided into two categories depending on whether the low precision method supports training or not. Firstly, lots of low precision works including training, have been investigated. Through (Courbariaux et al., 214), it has been observed that the precision of the multiplication affects the final error after training, and very low precision is sufficient enough not only for inference but also for training. A method to train a network with binary weights is introduced in (Courbariaux et al., 215) through the forward and backward propagations. Moreover, the authors of (Hubara et al., 216) have investigated a method to train quantized neural networks (QNNs) with different bit-widths between inference and training. (Gupta et al., 215) deals with a rounding scheme called stochastic rounding, which plays a crucial role in determining network behavior during training. But those works are focused on training under a lower precision, and do not directly support of pre-trained models without re-training. Next, the other groups have studied low precision schemes only for inference. In (Gysel et al., 216), a fast and automated framework named Ristretto has been presented for of convolutional neural networks (CNN). The algorithm finds the maximum values of weights and activations to determine the fractional length. In (Judd et al., 215), the authors have shown how the reduced precision affects the accuracy during inference, and proposed a method to find a low precision configuration, maintaining high accuracy. An optimization problem has been formulated and solved in (Lin et al., 216) for fixed-point bit-width allocation across layers. Also there has been proposed a scheme for inference by optimal uniform quantizer in well-known distributions such as Uniform, Gaussian, Laplace, and gamma. In this paper, we propose a novel algorithm to obtain low-precision representations of weights, biases, and feature-maps for CNNs. The algorithm applies different methods to weights/biases and feature-maps,

Weight Q W W q Feature-map Q Y W, B Y q q q Bias Q B B q BFT algorithm for feature-maps: FM-BFT BFT algorithm for weight and bias: W-BFT Re-training (option) Figure 1. A proposed procedure for network. respectively, since the former has deterministic values while the latter can be assumed to have random values. In the algorithm, the of weights and biases precedes the of feature-maps, and re-training the network is considered just optional, as shown in Figure 1. For weights and biases, the optimal fractional length is determined in order for the error to be minimized over their distribution. For feature-maps, on the other hand, the generalized gamma distribution (GGD) is used to approximate their sample distribution in each layer. From the asymptotic closed-form equation of GGD (Hui & Neuhoff, 21), the optimal step size is obtained in terms of signal-to-noise ratio (SQNR). To further enhance fixedpoint performance, we can tune the obtained parameters by an algorithm which we name backward-forward tuning (BFT). Adopting the BFT algorithm on top of the GGD-based, we can effectively deal with the critical issues arising from the discrepancy between SQNR maximization and fixed-point performance optimization in neural networks. 2. Proposed algorithm For both methods for weights/biases and feature-maps in common, we firstly try to determine parameters so that error is minimized. As is already known, however, minimizing error does not necessarily give the optimal quantized network for the classification accuracy. To overcome such a limitation, we introduce an additional step to tune the parameters, following the step to do for minimum error. Note that the tuning step is distinguished from re-training since it does not require training the network. 2.1. Quantization for SQNR maximization 2.1.1. QUANTIZATION OF WEIGHTS AND BIASES Weights and biases should be quantized independently over a pre-trained model of floating-point values, since those have different dynamic ranges each other. The proposed method for weights (W i ) for i th layer is shown in Algorithm 1. S F LW i denotes the set including candidates of F L for i th layer as (1): S F LW i = {m i, m i + 1,, m i + K w 1}, (1) where m i = bw i 1 log 2 max( W i ), x is the least integer that is greater than or equal to x, bw i means a bitwidth for the i th layer, minus one is to remove a sign bit, and K w is the length of S F LW i. In addition, len(v) is a length of a vector v, D is a error for k th F L value, F L min is the F L value with the minimum error D min, and Q(w i,j, F L) is quantized weight of w i,j by F L. Finally, Algorithm 1 is to determine F L W i to minimize overall error as follows: F L W i = arg min F L D(F L). For bias, all you have to do is to replace W i with b i. As described in Algorithm 1, a simple method is used for weight/bias in order to minimize the error separately for each layer. It is sufficient to consider K w = 2 in S F LW i, since an overload distortion rapidly increases as a F L increases. 2.1.2. QUANTIZATION OF FEATURE-MAPS To give a rough view of the output feature-map distribution, take a look at GoogLeNet (Szegedy et al., 215) as an example. GoogLeNet consists of 57 convolutional layers with Rectified Linear Unit (ReLU) and a fully connected layer in inference. Figure 2 includes four graphs, each of which is derived from a convolutional layer of GoogLeNet and represents two distributions on the same graph: 1) the sample distribution of pre-activation values and 2) the Gaussian distribution with unit variance. In the upper left graph, which shows the distribution of pre-activation values in the first convolutional layer of GoogLeNet, conv1/7 7-layer, it is observed that the distribution has a near zero mean and an almost symmetric density shape since subtracting the mean from data is included in the data layer. Except the conv1/7 7-layer, meanwhile, the others have a non-zero mean and are even not symmetric about the non-zero mean. The most conventional way for feature-map Algorithm 1 Weight Quantization for i th layer Input: Weights W i, F L set S F LW i for k = 1 to K w do Initialize D = : for j = 1 to len(w i ) do D + = w i,j Q(w i,j, F L) 2 if k = 1 then D min = D, F L min = F L else if D < D min then D min = D, F L min = F L end if Determine F L W i = F L min

Conv1/7x7 layer Inception_3b/1x1 layer Conv2/3x3 layer Inception_5b/3x3 layer Figure 2. Comparisons between distribution of pre-activations (green colored histogram) and Gaussian distribution (red line) for four convolutional layers. Conv1/7x7 layer Inception_3b/1x1 layer Conv2/3x3 layer Inception_5b/3x3 layer Figure 3. Comparisons between distribution of activation values (green colored histogram) and gamma distribution (red line) for four convolutional layers when all zeroes are excluded in the evaluations and in the plots. is to approximate the sample distribution of pre-activations with a symmetric distribution like the Gaussian distribution or the Laplace distribution. Unfortunately, however, such a method is sometimes not optimal in terms of SQNR observed at the input of the next layer for the following reasons: 1) The mismatch between asymmetric sample distributions and symmetric model distributions causes critical overload distortion, resulting in difficulty finding the optimal step size in. 2) When assuming that the mean of pre-activations is none-zero and ReLU is used as an activation function, the efficient is to consider only the pre-activations of a positive value since all the pre-activations of a negative value is supposed to be mapped to zero after passing through ReLU activation. To overcome the problems of the feature-map based on a symmetric distribution, we tried to search for an alternative approach immune to non-zero mean and asymmetric distribution. We focused on the distribution of activations instead of pre-activations. Assuming ReLU is used as an activation function, the distribution of activations of a positive value is single-sided. For, we don t need to include the activations of zero value in the distribution. The resultant sample distribution has a good match in the positive part for a symmetric distribution such as the Gaussian distribution and the Laplace distribution, and a better match for a distribution with heavy tails such as the gamma distribution, as shown in Figure 3. Generalized gamma distribution: The probability density function of the gamma distribution is represented as follows: 1 Γ(κ)θ κ xκ 1 e x θ (2) where Γ(τ) = x τ 1 e x dx (gamma function), κ and θ denote a shape and a scale parameters in the gamma distribution, respectively. And there are simple relationships between mean, variance, κ and θ as E[X] = κθ and V ar[x] = κθ 2 (3) We calculated κ and θ with sample mean and variance, while all zeroes being excluded. Then, we plot the sample distribution and the gamma distribution with calculated κ and θ in Figure 3. Through the results, the gamma distribution and sample distribution are found well-matched, especially for the tails of those. Therefore, if the optimal step size is found based on the gamma distribution parameterized through our calculation, we have an optimal solution to the feature-map in terms of SQNR. In (Hui & Neuhoff, 21), minimum mean-square error (MSE)-optimal N-level uniform scalar quantizers are designed numerically and their asymptotic characteristics tabulated in a closed form. The distribution of a GGD is represented by (4): p(x) = µ x β e λ x α (4) where α >, β > 1 is the exponential decay parameter, µ and λ are in (Hui & Neuhoff, 21). When α=1, such densities reduce to the gamma density. The asymptotic equations of the support length ˆL N and the overall distortion ˆD N have been derived as follows: ˆL N = 2 ln N λ ( 2 1 + β ) ln ln N α λ 1 λ ln ( 2 1 (1+β)/α α 2 λ (1+β)/α 3µ ) + ɛ N 1/α (5) where ɛ N is the correction term of closed form as (6) (Hui & Neuhoff, 21). ˆL N closely approximates the actual L N

even at N = 4 or 8. And by using a ˆL N, we also calculate the overall distortion ˆD N (ˆL N ) in (7). ɛ N = 1 λ ln ( ) ( ) 2α ln N 3 3α + 2β 1 + 1 + N 2α ln N ( 1 + 1 2 1 + β ) ln ln N+ α 2 ln N ln (Φ) where Φ = 21 (1+β)/α α 2 λ (1+β)/α 3µ. ( ˆD N (ˆL N ) = 1 12 2ˆL N N ) 2 + 4µ (αλ) 3 e λ α ˆL N ˆL 3α β 3 N 2 (1+β)/α Finally, these equations for optimal step size and distortion extend to densities with one-sided infinite support such as single-sided gamma of (2). Specifically, the optimal N-level uniform scalar quantizer with support interval [, N N ] for a density with support [, ] has step size, N = 2N, and distortion, D N = D 2N, where 2N and D 2N are the step size and distortion for the optimal 2N-level symmetric quantizer for the symmetric density, p(x) = (p(x) + p( x))/2. Single-sided distribution: By using the GGD mentioned in previous section, we propose a method for the activations with single-sided sample distribution in Algorithm 2. Here, m x and σ 2 x are mean and variance to be estimated from samples after activation function of i th layer, where zeroes have to be excluded. Additionally, Γ( ) is the gamma function, v is the greatest integer that is less than or equal to v, x i,j is the j th sample of i th layer, x i is the sample set of i th layer, and Q(x i,j, F L) means the quantized value of x i,j with fractional length F L. We can optionally extend the algorithm to GGD by estimating parameters (α, β, λ, µ) with various approaches (Stacy & Mihram, 1965), (Gomès et al., 28). It is important that zeroes have to be excluded when estimating the stochastic characteristics. We recommend to use the default mode for higher SQNRs and the fast mode for shorter simulation time. Double-sided distribution: We also propose a method for the activations with double-sided sample distribution. In CNNs, a double-sided distribution can be generated from pre-activation samples or from the output of sigmoid, hyper-tangent, or p-relu activation functions. In GoogLeNet, the loss3/classifier-layer has a double-sided distribution because its output is connected to the soft-maxlayer. To quantize the samples with a double-sided distribution, we first divide the samples into two groups, as shown in Figure 4. Next, we estimate parameters (α, β, λ, µ) (6) (7) Algorithm 2 FM Quantization for a single-sided distribution for i th layer Input: Single-sided sample set x i, m x, σ 2 x, N Begin: Estimate parameters (α, β, λ, µ) of a GGD: α = 1, β = m 2 x/σx 2 1, λ = m x /σx, 2 µ = λm2 x /σ2 x 2Γ(m 2 x /σ2 x ) Calculate ˆL N by (5) and (6) with (α, β, λ, µ) Calculate the optimal step size, ˆ N = 2ˆL N /N Determine the F L set, S F Lxi : S F Lxi = { log 2 ˆ N, log 2 ˆ N }. for k=1 to len(s F Lxi ) do F L = S F Lxi (k) if mode = default then ˆD N = x i,j x i x i,j Q(x i,j, F L) 2 else if mode = fast then ˆ N = 2 F L ˆL N = N ˆ N /2 ˆD N = ˆD N (ˆL N ) in (7) end if if k = 1 then D min = ˆD N, F L min = F L else if ˆD N < D min then D min = ˆD N, F L min = F L end if Determine F L xi = F L min of the GGD for each group and find the optimal fractional length. Algorithm details are described in Algorithm 3. Here, N is a number of levels, ρ = (number of negative samples)/(number of total samples). 2.2. Tuning parameters The BFT algorithm tunes the parameters which have already been set for SQNR maximization since the maximization does not always come with the highest performance in quantized networks. For example, assume that the loss3/classifier layer of GoogLeNet has been quantized resulting in a saturation threshold with which the maximum SQNR is achieved. But, if the ratio of the layer outputs whose value is exceeding the threshold is much greater than 1/1, Top-1 accuracy will be dropped since a plural output samples of the loss3/classifier layer have the same highest probability. As explained in Algorithm 4, the BFT algorithm finds the fractional length in each layer to maximize the network performance, i.e. Top-1 or Top-5 accuracy for GoogLeNet. Also, the algorithm is applicable to weights, biases, and feature-maps, independently. The reason why the algorithm is performed in a backward direction and then in a forward direction is that the network performance is more affected

GGD approximation for negative sample distribution neg, neg, neg, neg Double-sided distribution of samples GGD approximation for zero & positive sample distribution pos, pos, pos, pos Figure 4. Concept of feature-map for sample set with double-sided distribution. Algorithm 3 FM Quantization for a double-sided distribution for i th layer Input: Double-sided sample set x i, N, ρ, empty set C Begin: Divide x i into two groups: a negative sample group (neg) and a zero&positive sample group (pos). for g in [neg, pos] do Input: m x and σ 2 x for each group Estimate parameters (α, β, λ, µ) of a GGD: α = 1, β = m 2 x/σ 2 x 1, λ = m x /σ 2 x, µ = λ m2 x /σ2 x 2Γ(m 2 x /σ2 x ) Calculate ˆL N by (5) and (6) with (α, β, λ, µ) Calculate the optimal step size, ˆ N = 2ˆL N /N C [C, log 2 ˆ N, log 2 ˆ N ] (α g, β g, λ g, µ g ) (α, β, λ, µ) Determine the F L set, S F Lxi : S F Lxi = {x min(c) x max(c)} for k=1 to len(s F Lxi ) do F L = S F Lxi (k) if mode = default then ˆD D,N = x i,j x i x i,j Q(x i,j, F L) 2 else if mode = fast then ˆ N = 2 F L ˆL N = N ˆ N /2 Calculate overall distortion ˆD D,N by using (7): ˆD neg = ˆD N (ˆL N ) with α neg, β neg, λ neg, µ neg ˆD pos = ˆD N (ˆL N ) with α pos, β pos, λ pos, µ pos ˆD D,N = ρ ˆD neg + (1 ρ) ˆD pos end if if k = 1 then D min = ˆD D,N, F L min = F L else if ˆD D,N < D min then D min = ˆD D,N, F L min = F L end if Determine F L xi = F L min Algorithm 4 Backward-Forward Tuning (BFT) Input: layer index set S BF T, K BF T Begin: Start the BFT procedure: for l = 1 to len(s BF T ) do i S BF T (l) F L i F L W i (or F L xi ) S F L,i = {x F L i K BF T x F L i + K BF T } for k = 1 to len(s F L,i ) do Run the network with S F L,i (k) Get performance set {P,, P T 1 } Compute P overall (k) = T 1 n= c np n m = arg max m P overall (m) F L W i (or F L xi ) S F L,i (m ) by the change of the fractional length in the layers close to the output, and accordingly it is efficient to find the best fractional length in a backward direction first, i.e. from the loss layer to the input layer. To reflect the change of layer output distribution due to the updated fractional lengths, it is necessary to find the fractional length again for each layer in a forward direction, i.e. from the input layer to the loss layer. In Algorithm 4, S BF T denotes a set of layer indices according to the tuning order and T is the number of performance metrics in a network. In case of GoogLeNet, T = 2 since GoogLeNet has two performance metrics, Top-1 accuracy and Top-5 accuracy. P n and c n denote the n th performance metric and the weight of the metric, respectively. K BF T is a positive integer number indicating the size of a searching window for tuning, and its default value is 1. 3. Performance evaluation We evaluate the fixed-point performance of GoogLeNet (Szegedy et al., 215) with the proposed algorithm on the ImageNet (Deng et al., 29) (ILSVRC 212) validation dataset, which has 5, images for inference, in the Caffe framework (Jia et al., 214). The inference step is operated with 57 convolutional layers, one fully connected layer, and two local response normalization (LRN) layers in GoogLeNet to get Top-1 and Top-5 accuracies. We apply the proposed algorithm to two types of layers, convolutional layer and fully connected layer. The parameter α is set to be 1 for feature-map and K BF T to be 1 in the BFT algorithm for low computing complexity. We set c =1 and c 1 = in the BFT algorithm for focusing on the Top-1 accuracy. We estimate samples mean (m x ) and variance (σ 2 x) of all layers using 64 training images on inference operations with the mini-batch size of 32.

Weight Bias W-BFT Feature-map FM-BFT.7 weight steps feature-map steps WQ WQ + WQ_FQ WQ_FQ + WQ + _FQ + Figure 5. Explanation about five schemes and two steps used in evaluations: A circle and a cross on lines mean whether the corresponding step is operated or not, respectively. SQNR for bw=6 [db] SQNR for bw=8 [db] 5 4 3 2 1 WQ Ristretto-based scheme WQ - Ristretto -1 1 2 3 4 5 6 Index of layer 5 4 3 2 1-1 1 2 3 4 5 6 Index of layer Figure 6. SQNRs for all layers after weight/bias. To explain the proposed algorithm clearly, we use five different names, 1) W Q, 2) W Q +, 3) W Q F Q, 4) W Q F Q +, and 5) W Q + F Q +, according to the processing steps included for, as shown in Figure 5. W Q includes only weight/bias steps, while feature-map having floating values. W Q + means W Q followed by W-BFT. W Q F Q, W Q F Q +, and W Q + F Q + denote three types of whole consecutive procedure including weight and feature-map steps, where + means the use of BFT algorithm at the end of each step. As a reference we use the Ristretto-based scheme, where the criteria to find fractional lengths for weight/bias and feature-map in the i th layer have been experimentally determined given a bit width bw, as shown in (8). Note that we use the Ristretto-based approach only for without re-training (Gysel et al., 216). fl W i = bw 1 log 2 max( W i ) fl xi = bw log 2 max(x i ) (8).6.5.4.3.2.1 4 6 8 Floating Performance, 68.9 [%] WQ WQ+ Ristretto-based scheme 1 Bit width Figure 7. Top-1 accuracy of GoogLeNet after weight/bias. 3.1. Evaluation of weight steps To evaluate the weight/bias scheme, we define weight steps in Figure 5. In the steps, we can concentrate on the performance comparison of weight/bias under floating-valued feature-maps. Figure 6 shows SQNR of each scheme and SQNR difference between them for all layers. It is observed that most layers have SQNR gain through the proposed scheme for both bw = 6 and bw = 8. How much gain can be achieved in terms of Top-1 accuracy owing to better SQNR? The answer is shown in Figure 7, where Top-1 accuracy is 68.9 % in a floating network with pre-trained BVLC GoogLeNet model 1. All three schemes can almost achieve floating-level performance when bw 8. When bw < 8, however, floating-level accuracy cannot be achieved even with W Q and W Q +, which show lots of performance gain over the Ristrettobased scheme though. Three observations in the results are as follows: 1) W Q is effective to reduce performance loss in a quantized neural network, 2) W Q + provides an excellent performance gain for a small bw, and 3) there may exist a required SQNR level of a weight step to achieve the floating-level performance in a deep neural network. Unfortunately, the relationship between accuracy and SQNR has not yet been clarified. 3.2. Evaluation of feature-map steps In this section, we evaluate the performance in terms of SQNR and Top-1 accuracy after feature-map steps. Figure 8 shows SQNR for W Q F Q and the Ristrettobased scheme, and SQNR difference between them for each layer. W Q F Q has SQNR gain in many layers after featuremap steps for bw = 6. Figure 9 shows Top- 12 14 16 1 Reference model is from Caffe model zoo

SQNR for bw=6 [db] SQNR for bw=8 [db] 5 4 3 2 1 WQ_FQ Ristretto-based scheme WQ_FQ - Ristretto -1 1 2 3 4 5 6 Index of layer 5 4 3 2 1-1 1 2 3 4 5 6 Index of layer Figure 8. SQNRs for all layers after feature-map. Floating Performance Ristretto-based scheme (floating FM) Ristretto-based scheme 68.9 4 bit 6 bit 8 bit 1 bit 16 bit.1 66.4 68.8 68.9 68.9.1 57.4 68.6 68.9 68.9 W Q 38.8 67.4 68.6 68.9 68.9 W Q + 54.8 68. 68.8 68.9 68.9 W Q F Q 5.4 57.9 68.4 68.9 68.9 W Q F Q + 25.7 66.2 68.5 69.1 69.1 W Q + F Q + 41. 66.7 68.6 69.1 69.1.7 Table 1. Summary of Top-1 accuracies for several bit-widths.6.5.4.3.2.1 4 6 8 Floating Performance, 68.9 [%] WQ_FQ WQ_FQ+ WQ+_FQ+ Ristretto-based scheme 1 Bit width Figure 9. Top-1 accuracy of GoogLeNet after feature-map. 1 accuracy for five representations, that is, floating-point, W Q F Q, W Q F Q +, W Q + F Q +, and a Ristretto-based scheme. All the schemes can almost achieve the floatinglevel performance when bw 8. W Q + F Q + has the performance gain about 4.9 % for bw = 4 and 9.3 % for bw = 6, over the Ristretto-based scheme. In Table 1, Top-1 accuracies are summarized for all the schemes. W Q F Q + and W Q + F Q + seem to be competitive as one of the powerful CNN schemes when bw 6. 3.3. Analysis on 4 bit Our proposed scheme (W Q + F Q + in Table 1) has 27.9 % performance degradation for 4 bit weight and 4 bit featuremap. Therefore, it seems not acceptable to apply 4 bit to GoogLeNet. We try to find the dominant factor of performance degradation in the case. For the layers with a lower SQNR in weight 12 14 16 than a given threshold, 4 bit weights are replaced with 8 bit weights. We can find that Top-1 accuracy proportionally increases from 54.8 % to 68.8 % as the ratio of the number of layers of 8 bit quantized weights to the number of total layers increases, as shown in Table 2. It is found that securing a high SQNR in weight is requisite for achieving target performance, and the required SQNR should be at least 12 db in order for performance loss to be less than 5 % in the case of W Q +. Table 3 shows how Top-1 accuracy changes after feature-map as the SQNR threshold of feature-maps increases. For the layers with a lower SQNR in feature-map than a given threshold, 4 bit feature-maps are replaced with 8 bit feature-maps, while weight/bias being kept to 8 bit. A very sharp drop in Top-1 accuracy is observed as the threshold changes 14dB to 13dB. We find that the first convolutional layer ( conv1/7 7 ) and the classifier ( loss3/classifier ) are two critical layers to cause performance degradation in 4 bit feature-map. From the analysis, we evaluate the alternative approach with 4 bit feature-map and with 8 bit weight for GoogLeNet. With W Q + F Q +, we finally achieve 65.5 % Top-1 accuracy with only 4.4 % degradation as seen in Table 4. 3.4. Comparison with the previous works Table 5 shows a comparison in GoogLeNet accuracy among previous algorithms proposed for CNN. In the table Ours denotes W Q + F Q + which has the best performance among our schemes. For performance comparison, there are given two metrics, Top-1 accuracy (acc.) and performance loss (loss). Since there is not an identical floatingpoint accuracy for GoogLeNet as a reference, it seems better

SQNR threshold [db] ( = ratio [%] # of layers of w8 # of all layers ) 8 1 12 21.9 42.2 6.9 1 W Q 38.8 57.4 61.7 63.8 68.6 W Q + 54.8 59.4 63.1 64.2 68.8 Table 2. Top-1 accuracy after weight according to SQNR thresholds of weights. Here w8 denotes weight of 8 bits. SQNR threshold [db] ( = ratio [%] # of layers of fm8 # of all layers ) Top-1 accuracy under w8 [%] 13 14 15 16 1.6 37.9 68.2 81.8 1 W Q F Q 5.1 65.7 67.5 68. 68.4 Table 3. Top-1 accuracy after feature-map according to SQNR thresholds of feature-maps. Here w8 is assumed and fm8 means feature-map of 8 bits. to compare each algorithm in terms of fixedpoint loss from floating-point. When bw 6, our proposed algorithm has the lowest performance degradation compared to (Hubara et al., 216) and (Gysel et al., 216). Our algorithm achieves both high SQNR and high accuracy for bw 6. Meanwhile, our algorithm is not the best when bw 4. Quantization algorithms that are operated with their own architecture and with training from scratch have much better accuracy for bw of small values. In actual commercial environments, however, datasets may not be sufficiently shared for due to security and privacy issues, and hardware accelerators may not support a dedicated structure for a specific algorithm, whereas our proposed algorithm does not re- models (w8, fm4) w/ fm8 in classifier (w8, fm4) w/ fm8 in classifier and fm8 in the 1 st layer W Q F Q 61. 64. W Q F Q + 62.9 64.9 W Q + F Q + 63. 65.5 (-4.4) Table 4. Top-1 accuracy after (w8, fm4). Here (w8, fm4) denotes weight of 8 bits and feature-map of 4 bits. float (ref.) 4 bit 6 bit 8 bit Ours 68.9 acc. 41. 66.7 68.6 loss 27.9 2.2.3 Ristretto 68.9 acc. - - 66.6 loss - - 2.3 QNN 71.6 acc. 66.5 66.4 - loss 5.1 5.2 - Table 5. Comparison with previous algorithms in GoogLeNet. All accuracies have been evaluated from references: Ristretto (Gysel et al., 216) and QNN (Hubara et al., 216) float W Q F Q W Q F Q + (ref.) 6 bit 8 bit 6 bit 8 bit AlexNet 56.8 43.2 56. 52.9 56.2 VGG-16 68.3 57.7 68.2 64.8 68.3 Table 6. Top-1 accuracies for AlexNet and VGG-16, quantized by the proposed algorithms. quire any special structure as well as a dataset for training. 3.5. Evaluation of various networks For generalization, we also evaluate top-1 accuracy in different networks such as AlexNet (Krizhevsky et al., 212) and VGG-16 (Simonyan & Zisserman, 214). In Table 6, a floating-level accuracy for both networks can be almost achieved by W Q F Q + of 8 bit and the performance degradation is less than 4% by W Q F Q + of 6 bit. 4. Conclusion In this paper, we proposed an algorithm for weight, bias, and feature-map in CNNs. The proposed algorithm has been designed to achieve the maximum SQNR in steps and to enhance performance in tuning steps, separately. In steps, we designed a simple SQNR-based for weights/biases and a powerful GGD-based for feature-maps. In tuning steps, moreover, we introduced the BFT algorithm to modify the fractional length to improve performance in a quantized network. By using the proposed algorithm, we achieved floating-level performance for AlexNet, VGG-16, and GoogLeNet with bw = 8. For GoogLeNet, Top-1 accuracies of 66.7 % and 65.5 % have been achieved with (w6, fm6) and with (w8, fm4), respectively. In conclusion, the proposed algorithm is the powerful approach to reduce power consumption and memory bandwidth for efficient implementation of hardware accelerators for inference.

References Courbariaux, Matthieu, Bengio, Yoshua, and David, Jean- Pierre. Training deep neural networks with low precision multiplications. arxiv preprint arxiv:1412.724, 214. Courbariaux, Matthieu, Bengio, Yoshua, and David, Jean- Pierre. Binaryconnect: Training deep neural networks with binary weights during propagations. In Advances in Neural Information Processing Systems, pp. 3123 3131, 215. Deng, Jia, Dong, Wei, Socher, Richard, Li, Li-Jia, Li, Kai, and Fei-Fei, Li. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 29. CVPR 29. IEEE Conference on, pp. 248 255. IEEE, 29. Gomès, Ophélie, Combes, Catherine, and Dussauchoy, Alain. Parameter estimation of the generalized gamma distribution. Mathematics and Computers in Simulation, 79(4):955 963, 28. Gupta, Suyog, Agrawal, Ankur, Gopalakrishnan, Kailash, and Narayanan, Pritish. Deep learning with limited numerical precision. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1737 1746, 215. Gysel, Philipp, Motamedi, Mohammad, and Ghiasi, Soheil. Hardware-oriented approximation of convolutional neural networks. arxiv preprint arxiv:164.3168, 216. Han, Song, Mao, Huizi, and Dally, William J. Deep compression: Compressing deep neural networks with pruning, trained and huffman coding. arxiv preprint arxiv:151.149, 215. Han, Song, Pool, Jeff, Narang, Sharan, Mao, Huizi, Tang, Shijian, Elsen, Erich, Catanzaro, Bryan, Tran, John, and Dally, William J. Dsd: Regularizing deep neural networks with dense-sparse-dense training flow. arxiv preprint arxiv:167.4381, 216. Horowitz, Mark. 1.1 computing s energy problem (and what we can do about it). In Solid-State Circuits Conference Digest of Technical Papers (ISSCC), 214 IEEE International, pp. 1 14. IEEE, 214. Howard, Andrew G, Zhu, Menglong, Chen, Bo, Kalenichenko, Dmitry, Wang, Weijun, Weyand, Tobias, Andreetto, Marco, and Adam, Hartwig. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arxiv preprint arxiv:174.4861, 217. Hubara, Itay, Courbariaux, Matthieu, Soudry, Daniel, El- Yaniv, Ran, and Bengio, Yoshua. Quantized neural networks: Training neural networks with low precision weights and activations. arxiv:169.761, 216. arxiv preprint Hui, Dennis and Neuhoff, David L. Asymptotic analysis of optimal fixed-rate uniform scalar. IEEE Transactions on Information Theory, 47(3):957 977, 21. Iandola, Forrest N, Han, Song, Moskewicz, Matthew W, Ashraf, Khalid, Dally, William J, and Keutzer, Kurt. Squeezenet: Alexnet-level accuracy with 5x fewer parameters and.5 mb model size. arxiv preprint arxiv:162.736, 216. Jia, Yangqing, Shelhamer, Evan, Donahue, Jeff, Karayev, Sergey, Long, Jonathan, Girshick, Ross, Guadarrama, Sergio, and Darrell, Trevor. Caffe: Convolutional architecture for fast feature embedding. In Proceedings of the 22nd ACM international conference on Multimedia, pp. 675 678. ACM, 214. Judd, Patrick, Albericio, Jorge, Hetherington, Tayler, Aamodt, Tor, Jerger, Natalie Enright, Urtasun, Raquel, and Moshovos, Andreas. Reduced-precision strategies for bounded memory in deep neural nets. arxiv preprint arxiv:1511.5236, 215. Krizhevsky, Alex, Sutskever, Ilya, and Hinton, Geoffrey E. Imagenet classification with deep convolutional neural networks. In Advances in neural information processing systems, pp. 197 115, 212. Lin, Darryl, Talathi, Sachin, and Annapureddy, Sreekanth. Fixed point of deep convolutional networks. In International Conference on Machine Learning, pp. 2849 2858, 216. Long, Jonathan, Shelhamer, Evan, and Darrell, Trevor. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3431 344, 215. Ren, Shaoqing, He, Kaiming, Girshick, Ross, and Sun, Jian. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pp. 91 99, 215. Simonyan, Karen and Zisserman, Andrew. Very deep convolutional networks for large-scale image recognition. arxiv preprint arxiv:149.1556, 214. Stacy, E Webb and Mihram, G Arthur. Parameter estimation for a generalized gamma distribution. Technometrics, 7 (3):349 358, 1965. Szegedy, Christian, Liu, Wei, Jia, Yangqing, Sermanet, Pierre, Reed, Scott, Anguelov, Dragomir, Erhan, Dumitru, Vanhoucke, Vincent, and Rabinovich, Andrew. Going

deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1 9, 215.