DOUBLE VITERBI: WEIGHT ENCODING FOR HIGH COMPRESSION RATIO AND FAST ON-CHIP RECON-
Year: 2019

Abstract:
Weight pruning has been introduced as an efficient model compression technique. Even though pruning removes significant amount of weights in a network, memory requirement reduction was limited since conventional sparse matrix formats require significant amount of memory to store index-related information. Moreover, computations associated with such sparse matrix formats are slow because sequential sparse matrix decoding process does not utilize highly parallel computing systems efficiently. As an attempt to compress index information while keeping the decoding process parallelizable, Viterbi-based pruning was suggested. Decoding non-zero weights, however, is still sequential in Viterbi-based pruning. In this paper, we propose a new sparse matrix format in order to enable a highly parallel decoding process of the entire sparse matrix. The proposed sparse matrix is constructed by combining pruning and weight quantization. For the latest RNN models on PTB and WikiText-2 corpus, LSTM parameter storage requirement is compressed 19× using the proposed sparse matrix format compared to the baseline model. Compressed weight and indices can be reconstructed into a dense matrix fast using Viterbi encoders. Simulation results show that the proposed scheme can feed parameters to processing elements 20 % to 106 % faster than the case where the dense matrix values directly come from DRAM.

text: Weight pruning has been introduced as an efficient model compression technique. Even though pruning removes significant amount of weights in a network, memory requirement reduction was limited since conventional sparse matrix formats require significant amount of memory to store index-related information. Moreover, computations associated with such sparse matrix formats are slow because sequential sparse matrix decoding process does not utilize highly parallel computing systems efficiently. As an attempt to compress index information while keeping the decoding process parallelizable, Viterbi-based pruning was suggested. Decoding non-zero weights, however, is still sequential in Viterbi-based pruning. In this paper, we propose a new sparse matrix format in order to enable a highly parallel decoding process of the entire sparse matrix. The proposed sparse matrix is constructed by combining pruning and weight quantization. For the latest RNN models on PTB and WikiText-2 corpus, LSTM parameter storage requirement is compressed 19× using the proposed sparse matrix format compared to the baseline model. Compressed weight and indices can be reconstructed into a dense matrix fast using Viterbi encoders. Simulation results show that the proposed scheme can feed parameters to processing elements 20 % to 106 % faster than the case where the dense matrix values directly come from DRAM.

heading: 1 INTRODUCTION
text: Deep neural networks (DNNs) require significant amounts of memory and computation as the number of training data and the complexity of task increases (Bengio & Lecun, 2007). To reduce the memory burden, pruning and quantization have been actively studied. Pruning removes redundant connections of DNNs without accuracy degradation (Han et al., 2015). The pruned results are usually stored in a sparse matrix format such as compressed sparse row (CSR) format or compressed sparse column (CSC) format, which consists of non-zero values and indices that represent the location of non-zeros. In the sparse matrix formats, the memory requirement for the indices is not negligible.
Viterbi-based pruning (Lee et al., 2018) significantly reduces the memory footprint of sparse matrix format by compressing the indices of sparse matrices using the Viterbi algorithm (Forney, 1973). Although Viterbi-based pruning compresses the index component considerably, weight compression can be further improved in two directions. First, the non-zero values in the sparse matrix can be compressed with quantization. Second, sparse-to-dense matrix conversion in Viterbi-based pruning is relatively slow because assigning non-zero values to the corresponding indices requires sequential processes while indices can be reconstructed in parallel using a Viterbi Decompressor (VD).
Various quantization techniques can be applied to compress the non-zero values, but they still cannot reconstruct the dense weight matrix quickly because it takes time to locate non-zero values to the corresponding locations in the dense matrix. These open questions motivate us to find a non-zero value compression method, which also allows parallel sparse-to-dense matrix construction. The contribution of this paper is as follows.
(a) To reduce the memory footprint of neural networks further, we propose to combine the Viterbibased pruning (Lee et al., 2018) with a novel weight-encoding scheme, which also uses the Viterbi-based approach to encode the quantized non-zero values.
(b) We suggest two main properties of the weight matrix that increase the probability of finding "good" Viterbi encoded weights. First, the weight matrix with equal composition ratio of ‘0’ and ‘1’ for each bit is desired. Second, using the pruned parameters as "Don’t Care" terms increases the probability of finding desired Viterbi weight encoding.
(c) We demonstrate that the proposed method can be applied to Recurrent Neural Networks (RNNs) and Convolutional Neural Networks (CNNs) with various sizes and depths.
(d) We show that using the same Viterbi-based approach to compress both indices and non-zero values allows us to build a highly parallel sparse-to-dense reconstruction architecture. Using a custom cycle-simulator, we demonstrate that the reconstruction can be done fast.

heading: 2 RELATED WORKS
text: DNNs have been growing bigger and deeper to solve complex nonlinear tasks. However, Denil et al. (2013) showed that most of the parameters in neural networks are redundant. To reduce the redundancy and minimize memory and computation overhead, several weight reduction methods have been suggested. Recently, magnitude-based pruning methods became popular due to its computational efficiency (Han et al., 2015). Magnitude-based pruning methods remove weights according to weight magnitude only and retrain the pruned network to recover from accuracy loss. The method is scalable to large and deep neural networks because of its low computation overhead. Han et al. (2015) showed 9×-13× pruning rate on AlexNet and VGG-16 networks without accuracy loss on ImageNet dataset. Although the compression rate was high, reduction of actual memory requirement was not as high as the compression rate because conventional sparse matrix formats, such as CSR and CSC, must use large portion of memory to store the indices of surviving weights. Lee et al. (2018) succeeded in reducing the amount of index-related information using a Viterbi-algorithm based pruning method and corresponding custom sparse matrix format. Lee et al. (2018) demonstrated 38.1% memory reduction compared to Han et al. (2015) with no accuracy loss. The memory reduction was limited, however, due to uncompressed non-zero values.
Several weight quantization methods were also suggested to compress the parameters of neural networks. Courbariaux et al. (2016); Li et al. (2016); Rastegari et al. (2016) demonstrated that reducing the weights to binary or ternary was possible, but the accuracy loss of the binary neural networks was significant. Zhou et al. (2016) reduced the bit resolution of weights to binary, activations to 2 bits and gradients to 6 bits with 9.8 % top-1 accuracy loss on AlexNet for ImageNet task. Guo et al. (2017) demonstrated a binary-weight AlexNet with 2.0% top-1 accuracy loss, achieving ∼10× compression rate. Xu et al. (2018) showed that RNNs can also be quantized to reduce the memory footprint. By quantizing the weight values to 3 bits with proposed method, the memory footprint of RNN models were reduced ∼10.5× with negligible performance degradation. Han et al. (2016b) suggested to combine pruning with weight quantization to achieve higher compression rate. The results showed 35× increase in compression rate on AlexNet. However, the reduction was limited since the memory requirement of index-related information was only slightly improved with Huffman coding.
Although several magnitude-based pruning methods showed high compression rate, computation time did not improve much, because it takes time to decode the sparse matrix formats that describe irregular weight indices of pruned networks. Han et al. (2016a; 2017) suggested to use dedicated hardware, custom sparse matrix formats, and dedicated pruning methods to accelerate the computation even after pruning. Hanson & Pratt (1989); Yu et al. (2017) tried to accelerate the computation by limiting the irregularity of weight indices. By pruning neurons or feature maps, pruned weight matrices could maintain the dense format. These approaches successfully reduced the number of computation of neural networks, but the compression rate was limited due to additional pruning conditions. Although Lee et al. (2018) could use the Viterbi encoder to construct the index matrix fast, the process of pairing the non-zero weight values with the corresponding indices is still sequential, and thus relatively slow.

heading: 3 WEIGHT PRUNING AND QUANTIZATION USING DOUBLE-VITERBI APPROACH
text: Figure 1 illustrates the flowchart of the proposed compression method. Viterbi-based pruning (Lee et al., 2018) is applied first, and the pruned matrix is quantized using alternating multi-bit quantization method (Xu et al., 2018). Quantized binary code matrices are then encoded using the Viterbi-based approach, which is similar to the one used in pruning.

heading: 3.1 VITERBI-BASED PRUNING FOR SPARSE MATRIX INDEX COMPRESSION
text: As the first step of the proposed weight encoding scheme, we compress the indices of the non-zero values in sparse weight matrix using the Viterbi-based pruning (Figure 1) (Lee et al., 2018). In this scheme, Viterbi algorithm is used to select a pruned index matrix which minimizes the accuracy degradation among many candidates which a Viterbi decompressor can generate. While the memory footprint of the index portion is significantly reduced by the Viterbi-based pruning, the remaining non-zero values after pruning still require non-negligible memory when high-precision bits are used. Hence, quantization of the non-zero values is required for further reduction of the memory requirement. Appendix A.1 explains the Viterbi-based pruning in detail.

heading: 3.2 MULTI-BIT QUANTIZATION AFTER VITERBI-BASED PRUNING
text: After Viterbi-based pruning is finished, the alternating multi-bit quantization (Xu et al., 2018) is applied to the sparse matrix (Figure 1). As suggested in Xu et al. (2018), real-valued non-zero weights are quantized into multiple binary codes {bi}ki=1 ∈ {−1,+1}. Detailed algorithm is explained in Appendix A.2.
In addition to the high compression capabilities, another important reason we chose the alternating quantization is that the output distribution of the method is well suited to the Viterbi algorithm, which is used to encode the quantized non-zero values. Detailed explanation is given in Section 3.3.

heading: 3.3 ENCODING BINARY WEIGHT CODES USING THE VITERBI ALGORITHM
text: A sparse matrix that is generated by Viterbi-based pruning and quantization can be represented using the Viterbi Compression Matrix (VCM) format (Lee et al., 2018). A sparse matrix stored in VCM format requires much smaller amount of memory than the original dense weight matrix does. However, it is difficult to parallelize the process of reconstructing sparse matrix from the representation in VCM format, because assigning each non-zero value to its corresponding index requires a sequential process of counting ones in indices generated by the Viterbi encoder. To address this issue, we encode binary weight codes {bi}ki=1 as {b̂i}ki=1 in addition to the indices, based on the same Viterbi algorithm (Forney, 1973). By using similar VD structures (Figure 2) to generate both {b̂i}ki=1 and indices, we can generate both {b̂i}ki=1 and corresponding indices at the same time; thereby parallel sparse-to-dense matrix conversion becomes possible as shown in Figure 3.
While using VD structures to generate binary weight codes allows parallel sparse-to-dense matrix conversion, it requires the quantization method to satisfy a specific condition to minimize accuracy
loss after Viterbi-based encoding. It is known that the VD structure acts as a random number generator (Lee & Roy, 2012), which produces ‘0’ and ‘1’ with 50 % probability each. Thus, generated binary weight codes will be closer to the target binary weight codes if the target binary weight code matrix also consists of equal number of ‘0’ and ‘1’. Interestingly, the composition ratio of ‘-1’ and ‘+1’ in each bi, which was generated by the alternating quantization method, is 50 % each.
It is because the weights in DNNs are generally initialized symmetrically with respect to ‘0’ (Glorot & Bengio, 2010; He et al., 2015) and the distribution is maintained even after training (Lin et al., 2016). The preferable output distribution of the alternating quantization implies that the probability of finding an output matrix b̂i close to bi with the Viterbi algorithm is high. For comparison, we measured the accuracy differences before and after Viterbi encoding for several quantization methods such as linear quantization (Lin et al., 2016), logarithmic quantization (Miyashita et al., 2016), and alternating quantization (Xu et al., 2018). When the Viterbi encoding is applied to the weight quantized by alternating quantization (Xu et al., 2018), the validation accuracy degrades by only 2 %. However, accuracy degrades by 71 % when the Viterbi encoding is applied to the weight quantized using other methods (Lin et al., 2016; Miyashita et al., 2016). The accuracy difference mainly comes from the uneven weight distribution. Because weights of neural networks usually have normal distribution, the composition ratio of ’0’ and ’1’ is not equal when the linear or logarithmic quantization is applied to the weights unlike alternating quantization.
Another important idea to increase the probability of finding "good" Viterbi encoded weight is to consider the pruned parameters in bi as "Don’t Care" terms (Figure 4). The "Don’t Care" elements can have any values when finding b̂i, because they will be masked by the zero values in the index matrix generated by the Viterbi pruning.
Next, let us describe how we use the Viterbi algorithm for weight encoding. We select the b̂i that best matches with bi among all possible b̂i cases that the VD can generate, as follows. We first construct a trellis diagram as shown in Figure 5. The trellis diagram is a state diagram represented
with time index T . A state number is represented with Flip-Flop (FF) values, where the rightmost FF value is the most significant bit (MSB).1 Each transition with a 1-bit input from a state generates the corresponding multiple output bits.
A cost function for each transition using path and branch metrics is set and computed in the next step. The branch metric λi,jt is the cost of traveling along a transition from a state i to the successor state j at the time index t. The path metric is expressed as
Γjt+1 = max ( Γi1t + λ i1,j t ,Γ i2 t + λ i2,j t ) , (1)
where i1 and i2 are two predecessor states of j. Equation 1 denotes that one of the two possible transitions is selected to maximize the accumulated value of branch metrics.2 The branch metric is defined as
βi,j,mt =
{ 1, if bi,j,mt = 2o i,j,m t − 1
0, otherwise , λi,jt = No∑ m=1 βi,j,mt , (2)
where bi,j,mt is the value of binary codes according to the m th VD output at time index t, oi,j,mt is the value of the mth VD output at time index t, and No is the number of outputs generated by the VD at each time step. {−1,+1} in the binary codes corresponds to {0, 1} in the VD output in equation 2. Equation 2 maximizes the number of VD outputs that exactly match with corresponding binary codes while ignoring the pruned parameters (Figure 4). When the last time index is reached, the state with the maximum path metric is selected. Previous states connected by surviving branches are traced while corresponding oi,j,mt of each branch is recorded as b̂ i,j,m t . Each binary weight code bi is encoded as b̂i with a compression ratio of 1/No using this scheme.
1If the VD has N FFs, then the number of states is 2N . 2max function is used instead of min function because the metric value is considered as a degree of ‘reward’
rather than ‘cost’ (Lee et al., 2018).

heading: 3.4 RETRAINING
text: To maintain the accuracy, the number of incorrect bits in the encoded binary code b̂i compared to the original binary code bi needs to be minimized. Thus, we retrain the network with ŴPQ =(∑k
i=1 αib̂i
) M (M is the index matrix of non-zeros in W), apply the alternating quantization,
and then perform the Viterbi encoding repeatedly (Figure 1). By repeating the retraining, quantization, and Viterbi encoding, the number of incorrect bits between b̂i and bi can be reduced because the parameters in the network are fine-tuned close to parameters in ŴPQ. During the retraining period, we apply the straight-through estimate (Rastegari et al., 2016), i.e. ∂C
∂ŴPQ = ∂C∂W as adopted in Xu
et al. (2018). After the last Viterbi encoding is finished, small amount of components in b̂i can be still different from the corresponding values in bi. To maintain the accuracy, location data for the incorrect components are stored separately and are used to flip the corresponding VD encoded bits during on-chip weight reconstruction period. In our experiments, the memory requirement for the correction data was negligible. After the retraining is finished, we can obtain a compressed parameter in Viterbi Weight Matrix (VWM) format, which includes {αi}ki=1, compressed input to generate {b̂i}ki=1, compressed index in VCM format, and indices where {b̂i}ki=1 6= {bi}ki=1. Note that entire training process used the training dataset and the validation dataset only to decide the best compressed weight data. The accuracy measurement for the test dataset was done only after training is finished so that any hyperparameter was not tuned on the test dataset. All the experiments in this paper followed the above training principle.

heading: 4 EXPERIMENTAL RESULTS

heading: 4.1 RECURRENT NEURAL NETWORKS (RNN) FOR LANGUAGE MODELING
text: We first conduct experiments on Penn Tree Bank (PTB) corpus (Marcus et al., 1993). We use the standard split version of PTB corpus with 10K vocabulary (Mikolov, 2012), and evaluate the performance using perplexity per word (PPW). We pretrain the RNN model3 which contains 1 layer of LSTM with 600 memory units, then prune the parameters of LSTMs with 80 % pruning rate using the Viterbi-based pruning technique4 and retrain the model. Then, we quantize the parameters of LSTMs using alternating quantization technique, encode the binary weight codes by using the Viterbi algorithm, and retrain the model. We repeat the quantization, binary code encoding, and retraining process 5 times.
Number of quantization bits: We quantize the LSTM model with different numbers of quantization bits k with the fixed No = 5. As k increases, PPW is improved, but the memory requirement for parameters is also increased (Table 1). Note that k = 3 is the minimum number of bits that minimizes the model size without PPW degradation. Compared to Lee et al. (2018), further quantization and Viterbi-based compression reduce the parameter size by 78 % to 90 % (Table 1).
Number of VD outputs: We compress the binary weight codes with different number of VD outputs No in case of k = 3. As No increases, PPW degrades while the memory requirement for parameters is increased (Table 1). Large No implies that the binary weight codes are compressed with high compression ratio 1/No, but the similarity between b̂i and bi decreases. The optimal No is 100/(100- pruning rate (%)) , where the average number of survived parameters per No serial parameters is 1 statistically, which results in no model performance degradation.
Effectiveness of "Don’t Care": To verify the effectiveness of using the "Don’t Care" elements, we apply our proposed method on the original network and pruned one. While the pruned network maintains the original PPW after applying our proposed compression method, applying our method to the dense network degrades PPW to 102.6. This is because the ratio of incorrect bits between b̂i and bi decreases from 28.3 % to 1.7 % when we use the sparse bi. Therefore, combination of the Viterbi pruning and alternating quantization increases the probability of finding b̂i close to bi using the VD for weight encoding, which results in no PPW degradation.
3https://github.com/tensorflow/models/blob/master/tutorials/rnn/ptb/ptb_word_lm.py 4We use the VD which consists of a 50-bit VD output and a 5-bit comparator input. 1 skip state is applied to
the Viterbi algorithm (Lee et al., 2018).
The latest RNN for language modeling: We further test our proposed method on the latest RNN model (Yang et al., 2018), which shows the best perplexity on both PTB and WikiText-2 (WT2) corpus. We prune 75 % of the parameters in three LSTMs with the same condition as we prune the above 1-layer LSTM model, and quantize them to 3 bits (k = 3). Note that we do not apply fine-tuning and dynamic evaluation (Krause et al., 2017) in this experiment. The compression result in Table 2 shows that the memory requirements for the models are reduced by 94.7 % with our VWM format on both PTB and WT2 corpus without PPW degradation. This result implies that our proposed compression method can be applied regardless of the depth and size of the network. Detailed experiment settings and compression results are described in Appendix A.3. In addition, we extend our proposed method to the RNN models for machine translation (Wu et al., 2016), and its experimental results are presented in Appendix A.4.

heading: 4.2 CONVOLUTIONAL NEURAL NETWORKS (CNN) FOR IMAGE CLASSIFICATION
text: Experimental results on VGG-9 is found in Table 3. Compared to Han et al. (2016b), the VWM format generated by the proposed scheme has 39 % smaller memory footprint due to the compressed indices, smaller number of bits for quantization, and encoded binary weight codes. This experiment on CIFAR-10 shows that our proposed method can be applied to DNNs with various types and sizes. Meanwhile, it can be seen that the combination of the Viterbi-pruning (Lee et al. (2018)) with the alternating quantization (Xu et al. (2018)) requires 10% smaller memory requirement than the VWM
5nCm means a convolution layer where the number of output channel is n with mxm size of kernel. MP2 means a max-pooling layer with 2x2 size of kernel. nFC is a fully-connected layer with n output neurons, and 10SM is a softmax layer with 10 labels.
format because the VWM format requires additional memory for indices where {b̂i}ki=1 6= {bi}ki=1. However, additional "Viterbi-based binary code encoding" process for the VWM format allows parallel sparse-to-dense matrix conversion, which increases the parameter feeding rate up to 40.5 % compared to Lee et al. (2018). In Section 4.3, we analyze the speed of sparse-to-dense matrix conversion in detail.
a) Non-zero values are represented as 32-bit floating point numbers. b) Convolution filters are quantized to 8-bit, and weights of fully-connected layers and indices of sparse matrices are quantized to 5-bit, which is the same quantization condition as the condition used in Han et al. (2016b). c) For the Conv1 layer, pruning is not applied and only the alternating quantization is applied.

heading: 4.3 ANALYSIS ON RECONSTRUCTION SPEED
text: We built a cycle-level simulator for the weight matrix reconstruction process of the proposed format to show that the sparse matrix-matrix multiplications with the proposed method can be done fast with parallel reconstruction of dense matrix. In the simulator, baseline structure feeds two dense input matrices to processing elements (PEs) using raw data fed by DRAM (Figure 6a), while the proposed structure reconstructs both index masks and binary codes using the highly compressed data fed by DRAM and sends the reconstructed values to PEs (Figure 6b). Both index masks and binary codes are reconstructed by several Viterbi encoders in parallel, and bit errors in binary codes are corrected in a serial manner using the small number of flip-bit related data, which are received from DRAM. Simulation results show that the feeding rate of the proposed scheme is 20.0-106.4 % higher than the baseline case and 10.3-40.5 % higher than Lee et al. (2018), depending on the pruning rate (Figure 6c). The gain mainly comes from the high compression rate and parallel reconstruction process of the proposed method. As shown in Figure 6c, higher sparsity leads to higher feeding rate. Higher sparsity allows using many VD outputs for the index Nind, and increasing Nind leads to faster reconstruction. Also, the reconstruction rate of binary codes becomes higher with reduced number of non-zero values and corresponding bit corrections.

heading: 5 CONCLUSIONS
text: We proposed a DNN model compression technique with high compression rate and fast dense matrix reconstruction process. We adopted the Viterbi-based pruning and alternating multi-bit quantization technique to reduce the memory requirement for both non-zeros and indices of sparse matrices. Then, we encoded the quantized binary weight codes using Viterbi algorithm once more. As the non-zero values and the corresponding indices are generated in parallel by multiple Viterbi encoders, the sparse-to-dense matrix conversion can be done very fast. We also demonstrated that the proposed scheme significantly reduces the memory requirements of the parameters for both RNN and CNN.

heading: ACKNOWLEDGMENTS
text: This research was in part supported by Samsung Research Funding Center of Samsung Electronics under Project Number SRFC-TC1603-04 and the MSIT(Ministry of Science and ICT), Korea, under the ICT Consilience Creative program(IITP-2018-2011-1-00783) supervised by the IITP(Institute for Information & Communications Technology Promotion).

heading: A APPENDIX
text: A.1 PRUNING USING THE VITERBI ALGORITHM
In Viterbi-based pruning scheme, the binary outputs generated by a Viterbi Decompressor (VD) are used as the index matrix that indicates whether a weight element is pruned (‘0’) or not (‘1’). Suppose the number of elements in a target weight matrix is q, and the number of outputs generated by a VD at each time step is Nind, then only 2q/Nind binary matrices can be generated by the VD among all 2q binary matrices. The index matrix which minimizes the accuracy loss should be selected among binary matrix candidates which VD can generate in this pruning scheme, and the Viterbi algorithm is used for this purpose.
The overall pruning process is similar to the binary weight encoding process using the Viterbi algorithm in Section 3.3. First, Trellis diagram (Figure 5) of the VD which is used for pruning is constructed, and then the cost function is computed by using the path metric and the branch metric. The same path metric shown in Equation 1 in Section 3.3 is used to select the branch which maximizes the path metric between two connected branches from the previous states. On the other hand, a different branch metric λi,jt is used for pruning, which is expressed as:
Di,j,mt = ( W i,j,mt − THp ) /S1, 0 ≤W i,j,mt ,THp ≤ 1
βi,j,mt = tanh ( Di,jt ) × S2,when survived − tanh ( Di,jt ) × S2,when pruned , λi,jt = R∑ m=1 βi,j,mt , (3)
where W i,j,mt is the magnitude of a parameter at the m th VD output and time index t, normalized by the maximum absolute value of all elements in target weight matrix, and THp is the pruning threshold value determined heuristically. As βi,j,mt gives additional points (penalties) to the parameters with large magnitude to survive (be pruned), the possibility to prune small-magnitude parameters is maximized. S1 and S2 are the scaling factors which is empirically determined. (Lee et al. (2018) uses 5.0 and 104 each). After computing the cost function through the whole time steps, the state with the maximum path metric is chosen, and we trace the previous state by selecting the surviving branch and corresponding indices backward until the first state is reached.
The ideal pruning rate of the Viterbi-based pruning is 50 %, because the VD structures act like random number generator and the probability to generate ‘0’ or ‘1’ is 50 % each. For various pruning rates, comparators and comparator threshold value, THc, are used. A NC -bit comparator receives Nc VD outputs and generates 1-bit result whether the value made by the combination of the received VD outputs (e.g. {out1, out2, · · · , outNind} where outi indicates the ith VD output) is greater than THc or not. For example, suppose a 4-bit comparator is used to the VD in Figure 1 and THc = 3, then the probability for the comparator to generate ‘1’ is 25%(= (3 + 1)/24) and this percentage is the target pruning rate. Comparators and THc control the value of pruning rates and the index compression ratio decreases by 1/Nc times.
It is reported that a low Nind is desired to prune weights of convolutional layers while high Nind can be used to prune the weights of fully-connected layers because of the trade-off between the index compression ratio and the accuracy (Lee et al., 2018). Thus, in our paper, we use Nind = 50 and Nc = 5 to prune weights of LSTMs and fully-connected layers in VGG-6 on CIFAR-10. On the other hand, we use Nind = 10 and Nc = 5 to prune weights of convolutional layers in VGG-6 on CIFAR-10.
A.2 ALTERNATING MULTI-BIT QUANTIZATION ON SPARSE MATRIX
Algorithm 1: Alternating multi-bit quantization for sparse weight input :Sparse weight w ∈ Rn , the number of quantization bits k, the number of iterations T output :{αi,bi}ki=1 , with αi ∈ R, bi ∈ {−1,+1}n r0 = w, m = sign (|w|) . Step 1. Initialization for i← 1 to k do
αi ← ∑ |ri−1|∑
m ; . Average norm-1 of non-zeros bi ← sign (ri) ; ri−1 ← w − ∑i j=1 αjbj ;
end B← [b1, · · · ,bk] ; . Step 2. Alternating quantization if det ( BTB ) 6= 0 then
for t← 1 to T do [α1, α2, ..., αk]← (( BTB )−1 BTw )T ;
Construct v in ascending order ; Update {bi}ki=1 according to v ; . Pruned components in {bi}ki=1 are set to ‘0’ B← [b1, · · · ,bk] ;
end end B← [b1 + (¬m) , · · · ,bk + (¬m)] ; . Pruned components in {bi}ki=1 are set to ‘+1’ because bi ∈ {−1,+1}n.
Algorithm 1 explains the multi-bit quantization process applied to a sparse matrix. Given {αi}ki=1 with α1 ≥ α2 · · · ≥ αk−1 ≥ αk ≥ 0 and the number of quantization bits k, each non-zero value in a sparse weight matrix w is quantized to a value v ∈ v = {− ∑k i=1 αi,− ∑k−1 i−1 αi + αk, · · · , ∑k−1 i−1 αi −
αk, ∑k
i=1 αi}. Algorithm 1 is a derivative of the alternating multi-bit quantization algorithm (Xu et al., 2018) with some consideration for sparse matrix. First, {αi}ki=1 is initialized with the average norm-1 value of non-zeros in w instead of the average norm-1 value of entire elements in a dense matrix, which was the case in Xu et al. (2018). Also, if the inverse matrix of BTB does not exist due to high pruning rate, Algorithm 1 does not proceed to the second alternating quantization step. Note that the model performance was not degraded much without running the second quantization step. Pruned components are represented with ‘0’ during the quantization. After the quantization, {bi}ki=1 for the pruned components are set to ‘+1’ because bi ∈ {−1,+1}n. It does not matter whether pruned components are represented as ‘-1’ or ‘+1’, because they will be eventually masked by the binary index matrix indicating the location of non-zeros.
A.3 DETAILED COMPRESSION RESULTS OF THE LATEST RNN FOR LANGUAGE MODELING
The RNN model in Yang et al. (2018) is composed of three LSTM layers, and use various learning techniques such as mixture-of-softmaxes (MoS) to achieve better perplexity. As shown in Table A1 and Table A2, the parameters in the first layer have high sparsity, so we use No = 6. In the remaining layers, however, we use No = 3 because the parameters are pruned with only about 70 % pruning rate. We repeat the process of quantization, binary code encoding, and retraining only once.
Table A1: Compression result of the lastest LSTM model for PTB corpus.
Layer LSTM Parameter Pruning Compression rate (%)
Size (KB) Rate (%) Lee et al. (2018) VWM (ours)
LSTM1 18600.0 86.7 13.9 3.7 LSTM2 28800.0 70.1 30.5 5.9 LSTM3 15306.3 70.2 30.4 6.0
Total 62706.3 75.0 25.6 5.3(4×) (19×) Validation PPW 58.7 59.4 58.7
Test PPW 56.3 56.6 56.2
Table A2: Compression result of the lastest LSTM model for WT2 corpus.
Layer LSTM Parameter Pruning Compression rate (%)
Size (KB) Rate (%) Lee et al. (2018) VWM (ours)
LSTM1 26054.7 86.1 14.5 3.7 LSTM2 41328.1 69.4 31.3 6.0 LSTM3 18281.3 71.2 29.4 5.9
Total 85664.1 74.9 25.8 5.3(4×) (19×) Validation PPW 67.0 67.6 67.5
Test PPW 64.0 64.6 64.4
A.4 RECURRENT NEURAL NETWORKS (RNN) FOR MACHINE TRANSLATION
We also extend our experiments on the RNN models for machine translation (Wu et al., 2016) 6. We use the model which consists of an encoder, a decoder and an attention layer. 4-layer LSTMs with 1024 units compose each encoder and decoder. A bidirectional LSTM (BiLSTM) is used for the first layer of the encoder. The weights of LSTM models are pruned with 75 % pruning rate by the Viterbi-based pruning techinque, then k = 4 is used for quantization. Optimal No values are used according to the sparsity of each LSTM layer (i.e. 3 ≤ No ≤ 6 is enough to encode binary weight codes with 70 - 83% of sparsity). The process of quantization, binary code encoding, and retraining is repeated only once in this case, too. As shown in Table A3 and Table A4, we reduce the memory requirement of each baseline model by 93.5 % using our proposed technique. This experiment results show that our proposed scheme can be extended to RNNs for other complex tasks.
6https://github.com/tensorflow/nmt
Table A3: Compression result of the GNMT model for WMT En→ De.
Network Layer LSTM Parameter Pruning Compression rate (%)
Type Size (KB) Rate (%) Lee et al. (2018) VWM (ours)
Encoder
BiLSTM (FW) 32768.0 83.3 17.3 4.8 BiLSTM (BW) 32768.0 76.7 23.9 5.8
LSTM1 49152.0 74.1 26.5 6.2 LSTM2 32768.0 70.9 29.8 7.3 LSTM3 32768.0 74.2 26.4 6.3
Decoder
LSTM4 49152.0 76.1 24.6 6.0 LSTM5 49152.0 79.3 21.3 5.7 LSTM6 49152.0 73.4 27.2 6.6 LSTM7 49152.0 69.3 31.3 7.8
Total 376832.0 75.1 25.6 6.3(4×) (16×) Validation BLEU (WMT 15) 25.6 25.8 25.2
Test BLEU (WMT 16) 30.1 29.9 29.0
Table A4: Compression result of the GNMT model for WMT De→ En.
Network Layer LSTM Parameter Pruning Compression rate (%)
Type Size (KB) Rate (%) Lee et al. (2018) VWM (ours)
Encoder
BiLSTM (FW) 32768.0 81.6 19.0 5.0 BiLSTM (BW) 32768.0 75.5 25.1 6.0
LSTM1 49152.0 73.9 26.7 6.3 LSTM2 32768.0 71.3 29.4 6.8 LSTM3 32768.0 73.4 27.2 6.5
Decoder
LSTM4 49152.0 76.5 24.1 6.0 LSTM5 49152.0 80.3 20.3 5.5 LSTM6 49152.0 73.2 27.5 6.6 LSTM7 49152.0 68.9 31.8 7.8
Total 376832.0 74.9 25.8 6.3(4×) (16×) Validation BLEU (WMT 15) 28.0 28.4 28.0
Test BLEU (WMT 16) 33.2 33.3 33.0

Review summaries:
This paper presents a new way to represent a dense matrix in a compact format. First, the method prunes a dense matrix based on the Viterbi-based pruning. Then, the pruned matrix is quantized with alternating multi-bit quantization. Finally, the binary vectors produced by the quantization algorithm are further compressed with the Viterbi-based algorithm. It spots the problem of each existing approach and solve the problems by combining each method. The combination is new and the result is encouraging.