Title: PROXQUANT: QUANTIZED NEURAL NETWORKS VIA PROXIMAL OPERATORS

Abstract: To make deep neural networks feasible in resource-constrained environments (such as mobile devices), it is beneficial to quantize models by using low-precision weights. One common technique for quantizing neural networks is the straightthrough gradient method, which enables back-propagation through the quantization mapping. Despite its empirical success, little is understood about why the straight-through gradient method works. Building upon a novel observation that the straight-through gradient method is in fact identical to Nesterov's dual-averaging algorithm on a quantization constrained optimization problem, we propose a more principled alternative approach, called PROXQUANT, that formulates quantized network training as a regularized learning problem instead and optimizes it via the prox-gradient method. PROX-QUANT does back-propagation on the underlying full-precision vector and applies an efficient prox-operator in between stochastic gradient steps to encourage quantizedness. For quantizing ResNets and LSTMs, PROXQUANT outperforms state-of-the-art results on binary quantization and is on par with state-of-the-art on multi-bit quantization. We further perform theoretical analyses showing that PROXQUANT converges to stationary points under mild smoothness assumptions, whereas variants such as lazy prox-gradient method can fail to converge in the same setting.

1. INTRODUCTION:

Deep neural networks (DNNs) have achieved impressive results in various machine learning tasks (Goodfellow et al., 2016) . High-performance DNNs typically have over tens of layers and millions of parameters, resulting in a high memory usage and a high computational cost at inference time. However, these networks are often desired in environments with limited memory and computational power (such as mobile devices), in which case we would like to compress the network into a smaller, faster network with comparable performance.

A popular way of achieving such compression is through quantization -training networks with lowprecision weights and/or activation functions. In a quantized neural network, each weight and/or activation can be representable in k bits, with a possible codebook of negligible additional size compared to the network itself. For example, in a binary neural network (k = 1), the weights are restricted to be in {±1}. Compared with a 32-bit single precision float, a quantized net reduces the memory usage to k/32 of a full-precision net with the same architecture (Han et al., 2015; Courbariaux et al., 2015; Rastegari et al., 2016; Hubara et al., 2017; Zhou et al., 2016; Zhu et al., 2016) . In addition, the structuredness of the quantized weight matrix can often enable faster matrixvector product, thereby also accelerating inference (Hubara et al., 2017; Han et al., 2016) .

Typically, training a quantized network involves (1) the design of a quantizer q that maps a full-precision parameter to a k-bit quantized parameter, and (2) the straight-through gradient method (Courbariaux et al., 2015) that enables back-propagation from the quantized parameter back onto the original full-precision parameter, which is critical to the success of quantized network training. With quantizer q, an iterate of the straight-through gradient method (see Figure 1a ) proceeds BinaryConnect has a very stringent condition to converge to any fixed point (Section 5.3), which we verify through a sign change experiment (Appendix C).

1.1. PRIOR WORK:

Methodologies Han et al. (2015) propose Deep Compression, which compresses a DNN via sparsification, nearest-neighbor clustering, and Huffman coding. This architecture is then made into a specially designed hardware for efficient inference (Han et al., 2016) . In a parallel line of work, Courbariaux et al. (2015) propose BinaryConnect that enables the training of binary neural networks, and Li & Liu (2016) ; Zhu et al. (2016) extend this method into ternary quantization. Training and inference on quantized nets can be made more efficient by also quantizing the activation (Hubara et al., 2017; Rastegari et al., 2016; Zhou et al., 2016) , and such networks have achieved impressive performance on large-scale tasks such as ImageNet classification (Rastegari et al., 2016; Zhu et al., 2016) and object detection (Yin et al., 2016) . In the NLP land, quantized language models have been successfully trained using alternating multi-bit quantization (Xu et al., 2018) .

Theories Li et al. (2017) prove the convergence rate of stochastic rounding and BinaryConnect on convex problems and demonstrate the advantage of BinaryConnect over stochastic rounding on non-convex problems. Anderson & Berg (2017) demonstrate the effectiveness of binary networks through the observation that the angles between high-dimensional vectors are approximately preserved when binarized, and thus high-quality feature extraction with binary weights is possible. Ding et al. (2018) show a universal approximation theorem for quantized ReLU networks.

Principled methods Sun & Sun (2018) perform model quantization through a Wasserstein regularization term and minimize via the adversarial representation, similar as in Wasserstein GANs (Arjovsky et al., 2017) . Their method has the potential of generalizing to other generic requirements on the parameter, but might be hard to tune due to the instability of the inner maximization problem.

Prior to our work, a couple of proximal or regularization based quantization algorithms were proposed as alternatives to the straight-through gradient method, which we now briefly review and compare with. (Yin et al., 2018) propose BinaryRelax, which corresponds to a lazy proximal gradient descent. (Hou et al., 2017; Hou & Kwok, 2018) propose a proximal Newton method with a diagonal approximate Hessian. Carreira-Perpinán (2017); Carreira-Perpinán & Idelbayev (2017) formulate quantized network training as a constrained optimization problem and propose to solve them via augmented Lagrangian methods. Our algorithm is different with all the aformentioned work in using the non-lazy and "soft" proximal gradient descent with a choice of either 1 or 2 regularization, whose advantage over lazy prox-gradient methods is demonstrated both theoretically (Section 5) and experimentally (Section 4.1 and Appendix C).

2. PRELIMINARIES:

The optimization difficulty of training quantized models is that they involve a discrete parameter space and hence efficient local-search methods are often prohibitive. For example, the problem of training a binary neural network is to minimize L(θ) for θ ∈ {±1}

d . Projected SGD on this set will not move unless with an unreasonably large stepsize (Li et al., 2017) , whereas greedy nearestneighbor search requires d forward passes which is intractable for neural networks where d is on the order of millions. Alternatively, quantized training can also be cast as minimizing L(q(θ)) for θ ∈ R d and an appropriate quantizer q that maps a real vector to a nearby quantized vector, but θ → q(θ) is often non-differentiable and piecewise constant (such as the binary case q(•) = sign(•)), and thus back-propagation through q does not work.

2.1. THE STRAIGHT-THROUGH GRADIENT METHOD:

The pioneering work of BinaryConnect (Courbariaux et al., 2015) proposes to solve this problem via the straight-through gradient method, that is, propagate the gradient with respect to q(θ) unaltered to θ, i.e. to let ∂L ∂θ := ∂L ∂q(θ) . One iterate of the straight-through gradient method (with the SGD optimizer) is

θ t+1 = θ t -η t ∇L(θ)| θ=q(θt) .

Algorithm 1 PROXQUANT: Prox-gradient method for quantized net training

Require: Regularizer R that induces desired quantizedness, initialization θ 0 , learning rates {η t } t≥0 , regularization strengths {λ t } t≥0 while not converged do Perform the prox-gradient step

EQUATION

The inner SGD step in eq. ( 4) can be replaced by any preferred stochastic optimization method such as Momentum SGD or Adam (Kingma & Ba, 2014) . end while Compared to usual full-precision training, PROXQUANT only adds a prox step after each stochastic gradient step, hence can be implemented straightforwardly upon existing full-precision training. As the prox step does not need to know how the gradient step is performed, our method adapts to other stochastic optimizers as well such as Adam.

In the remainder of this section, we define a flexible class of quantization-inducing regularizers through "distance to the quantized set", derive efficient algorithms of their corresponding prox operator, and propose a homotopy method for choosing the regularization strengths. Our regularization perspective subsumes most existing algorithms for model-quantization (e.g., (Courbariaux et al., 2015; Han et al., 2015; Xu et al., 2018) ) as limits of certain regularizers with strength λ → ∞. Our proposed method can be viewed as a principled generalization of these methods to λ < ∞ with a non-lazy prox operator.

3.1. REGULARIZATION FOR MODEL QUANTIZATION:

Let Q ⊂ R d be a set of quantized parameter vectors. An ideal regularizer for quantization would be to vanish on Q and reflect some type of distance to Q when θ / ∈ Q. To achieve this, we propose L 1 and L 2 regularizers of the form

R(θ) = inf θ0∈Q θ -θ 0 1 or R(θ) = inf θ0∈Q θ -θ 0 2 2 .

(5) This is a highly flexible framework for designing regularizers, as one could specify any Q and choose between L 1 and L 2 . Specifically, Q encodes certain desired quantization structure. By appropriately choosing Q, we can specify which part of the parameter vector to quantize1 , the number of bits to quantize to, whether we allow adaptively-chosen quantization levels and so on. The choice between {L 1 , L 2 } will encourage {"hard","soft"} quantization respectively, similar as in standard regularized learning (Tibshirani, 1996) .

In the following, we present a few examples of regularizers under our framework eq. ( 5) which induce binary weights, ternary weights and multi-bit quantization. We will also derive efficient algorithms (or approximation heuristics) for solving the prox operators corresponding to these regularizers, which generalize the projection operators used in the straight-through gradient algorithms.

Binary neural nets In a binary neural net, the entries of θ are in {±1}. A natural choice would be taking

EQUATION

This is exactly the binary regularizer R bin that we discussed earlier in eq. ( 3). Figure 2 plots the W-shaped one-dimensional component of R bin from which we see its effect for inducing {±1} quantization in analog to L 1 regularization for inducing exact sparsity. The prox operator with respect to R bin , despite being a non-convex optimization problem, admits a simple analytical solution:

prox λR bin (θ) = SoftThreshold(θ, sign(θ), λ) = sign(θ) + sign(θ -sign(θ)) [|θ -sign(θ)| -λ] + .

(7) We note that the choice of the L 1 version is not unique: the squared L 2 version works as well, whose prox operator is given by (θ + λ sign(θ))/(1 + λ). See Appendix A.1 for the derivation of these prox operators and the definition of the soft thresholding operator.

Multi-bit quantization with adaptive levels. Following (Xu et al., 2018) , we consider k-bit quantized parameters with a structured adaptively-chosen set of quantization levels, which translates into

Q = k i=1 α i b i : {α 1 , . . . , α k } ⊂ R, b i ∈ {±1} d = θ 0 = Bα : α ∈ R k , B ∈ {±1}

d×k .

(8) The squared L 2 regularizer for this structure is

EQUATION

which is also the alternating minimization objective in (Xu et al., 2018) .

We now derive the prox operator for the regularizer eq. ( 9). For any θ, we have

EQUATION

)

This is a joint minimization problem in ( θ, B, α), and we adopt an alternating minimization schedule to solve it:

(1) Minimize over θ given (B, α), which has a closed-form solution θ = θ+2λBα 1+2λ .

(2) Minimize over (B, α) given θ, which does not depend on θ 0 , and can be done via calling the alternating quantizer of (Xu et al., 2018) : Bα = q alt ( θ).

Together, the prox operator generalizes the alternating minimization procedure in (Xu et al., 2018) , as λ governs a trade-off between quantization and closeness to θ. To see that this is a strict generalization, note that for any λ the solution of eq. ( 10) will be an interpolation between the input θ and its Euclidean projection to Q. As λ → +∞, the prox operator collapses to the projection.

Ternary quantization Ternary quantization is a variant of 2-bit quantization, in which weights are constrained to be in {-α, 0, β} for real values α, β > 0. We defer the derivation of the ternary prox operator into Appendix A.2.

3.2. HOMOTOPY METHOD FOR REGULARIZATION STRENGTH:

Recall that the larger λ t is, the more aggressive θ t+1 will move towards the quantized set. An ideal choice would be to (1) force the net to be exactly quantized upon convergence, and (2) not be too aggressive such that the quantized net at convergence is sub-optimal.

We let λ t be a linearly increasing sequence, i.e. λ t := λ • t for some hyper-parameter λ > 0 which we term as the regularization rate. With this choice, the stochastic gradient steps will start off close to full-precision training and gradually move towards exact quantizedness, hence the name "homotopy method". The parameter λ can be tuned by minimizing the validation loss, and controls the aggressiveness of falling onto the quantization constraint. There is nothing special about the linear increasing scheme, but it is simple enough and works well as we shall see in the experiments.

4. EXPERIMENTS:

We evaluate the performance of PROXQUANT on two tasks: image classification with ResNets, and language modeling with LSTMs. On both tasks, we show that the default straight-through gradient method is not the only choice, and our PROXQUANT can achieve the same and often better results.

4.1. IMAGE CLASSIFICATION ON CIFAR-10:

Problem setup We perform image classification on the CIFAR-10 dataset, which contains 50000 training images and 10000 test images of size 32x32. We apply a commonly used data augmentation strategy (pad by 4 pixels on each side, randomly crop to 32x32, do a horizontal flip with probability 0.5, and normalize). Our models are ResNets (He et al., 2016) of depth 20, 32, 44, and 56 with weights quantized to binary or ternary.

Method We use PROXQUANT with regularizer eq. ( 3) in the binary case and eqs. ( 15) and ( 16) in the ternary case, which we respectively denote as PQ-B and PQ-T. We use the homotopy method λ t = λ • t with λ = 10 -4 as the regularization strength and Adam with constant learning rate 0.01 as the optimizer.

We compare with BinaryConnect (BC) for binary nets and Trained Ternary Quantization (TTQ) (Zhu et al., 2016) for ternary nets. For BinaryConnect, we train with the recommended Adam optimizer with learning rate decay (Courbariaux et al., 2015) (initial learning rate 0.01, multiply by 0.1 at epoch 81 and 122), which we find leads to the best result for BinaryConnect. For TTQ we compare with the reported results in (Zhu et al., 2016) .

For binary quantization, both BC and our PROXQUANT are initialized at the same pre-trained fullprecision nets (warm-start) and trained for 300 epochs for fair comparison. For both methods, we perform a hard quantization θ → q(θ) at epoch 200 and keeps training till the 300-th epoch to stabilize the BatchNorm layers. We compare in addition the performance drop relative to full precision nets of BinaryConnect, BinaryRelax (Yin et al., 2018) , and our PROXQUANT.

Result The top-1 classification errors for binary quantization are reported in Table 1 . Our PROX-QUANT consistently yields better results than BinaryConnect. The performance drop of PROX-QUANT relative to full-precision nets is about 1%, better than BinaryConnect by 0.2% on average and significantly better than the reported result of BinaryRelax.

Results and additional details for ternary quantization are deferred to Appendix B.1. et al., 1993) , which contains 929K training tokens, 73K validation tokens, and 82K test tokens. Our model is a standard one-hidden-layer LSTM with embedding dimension 300 and hidden dimension 300. We train quantized LSTMs with the encoder, transition matrix, and the decoder quantized to k-bits for k ∈ {1, 2, 3}. The quantization is performed in a row-wise fashion, so that each row of the matrix has its own codebook {α 1 , . . . , α k }.

Method We compare our multi-bit PROXQUANT (eq. ( 10)) to the state-of-the-art alternating minimization algorithm with straight-through gradients (Xu et al., 2018) . Training is initialized at a pre-trained full-precision LSTM. We use the SGD optimizer with initial learning rate 20.0 and decay by a factor of 1.2 when the validation error does not improve over an epoch. We train for 80 epochs with batch size 20, BPTT 30, dropout with probability 0.5, and clip the gradient norms to 0.25. The regularization rate λ is tuned by finding the best performance on the validation set. In addition to multi-bit quantization, we also report the results for binary LSTMs (weights in {±1}), comparing BinaryConnect and our PROXQUANT-Binary, where both learning rates are tuned on an exponential grid {2.5, 5, 10, 20, 40}.

Result We report the perplexity-per-word (PPW, lower is better) in Table 2 . The performance of PROXQUANT is comparable with the Straight-through gradient method. On Binary LSTMs, PROXQUANT-Binary beats BinaryConnect by a large margin. These results demonstrate that PROX-QUANT offers a powerful alternative for training recurrent networks. 

5. THEORETICAL ANALYSIS:

In this section, we perform a theoretical study on the convergence of quantization algorithms. We show in Section 5.1 that our PROXQUANT algorithm (i.e. non-lazy prox-gradient method) converges under mild smoothness assumptions on the problem. In Section 5.2, we provide a simple example showing that the lazy prox-gradient method fails to converge under the same set of assumptions. In Section 5.3, we show that BinaryConnect has a very stringent condition for converging to a fixed point. Our theory demonstrates the superiority of our proposed PROXQUANT over lazy proxgradient type algorithms such as BinaryConnect and BinaryRelax (Yin et al., 2018) . All missing proofs are deferred to Appendix D.

Prox-gradient algorithms (both lazy and non-lazy) with a fixed λ aim to solve the problem minimize

EQUATION

and BinaryConnect can be seen as the limiting case of the above with λ = ∞ (cf. Section 2.2).

5.1. A CONVERGENCE THEOREM FOR PROXQUANT:

We consider PROXQUANT with batch gradient and constant regularization strength λ t ≡ λ:

θ t+1 = prox ηtλR (θ t -η t ∇L(θ t )).

Theorem 5.1 (Convergence of ProxQuant). Assume that the loss L is β-smooth (i.e. has β-Lipschitz gradients) and the regularizer R is differentiable. Let F λ (θ) = L(θ) + λR(θ) be the composite objective and assume that it is bounded below by F . Running ProxQuant with batch gradient ∇L, constant stepsize η t ≡ η = 1 2β and λ t ≡ λ for T steps, we have the convergence guarantee

EQUATION

)

where C > 0 is a universal constant.

A ADDITIONAL RESULTS ON REGULARIZATION A.1 PROX OPERATORS FOR BINARY NETS:

Here we derive the prox operators for the binary regularizer eq. ( 6) and its squared L 2 variant. Recall that

R bin (θ) = d j=1 min {|θ j -1|, |θ j + 1|}.

By definition of the prox operator, we have for any θ ∈ R d that prox λR bin (θ) = arg min

θ∈R d    1 2 θ -θ 2 2 + λ d j=1 min | θ j -1|, | θ j + 1|    = arg min θ∈R d    d j=1 1 2 ( θ j -θ j ) 2 + λ min | θ j -1|, | θ j + 1|    .

This minimization problem is coordinate-wise separable. For each θ j , the penalty term remains the same upon flipping the sign, but the quadratic term is smaller when sign( θ j ) = sign(θ j ). Hence, the solution θ to the prox satisfies that sign(θ j ) = sign(θ j ), and the absolute value satisfies

|θ j | = arg min t≥0 1 2 (t -|θ j |) 2 + λ|t -1| = SoftThreshold(|θ j |, 1, λ) = 1+sign(|θ j |-1)[||θ j |-1|-λ] + .

Multiplying by sign(θ j ) = sign(θ j ), we have

θ j = SoftThreshold(θ j , sign(θ j ), λ),

which gives eq. ( 7).

For the squared L 2 version, by a similar argument, the corresponding regularizer is

R bin (θ) = d j=1 min (θ j -1) 2 , (θ j + 1) 2 .

For this regularizer we have

prox λR bin (θ) = arg min θ∈R d    d j=1 1 2 ( θ j -θ j ) 2 + λ min ( θ j -1) 2 , ( θ j + 1) 2    .

Using the same argument as in the L 1 case, the solution θ satisfies sign(θ j ) = sign(θ j ), and

|θ j | = arg min t≥0 1 2 (t -|θ j |) 2 + λ(t -1) 2 = |θ j | + λ 1 + λ .

Multiplying by sign(θ j ) = sign(θ j ) gives

θ j = θ j + λ sign(θ j ) 1 + λ ,

or, in vector form, θ = (θ + λ sign(θ))/(1 + λ).

A.2 PROX OPERATOR FOR TERNARY QUANTIZATION:

For ternary quantization, we use an approximate version of the alternating prox operator eq. ( 10): compute θ = prox λR (θ) by initializing at θ = θ and repeating

EQUATION

)

where q is the ternary quantizer defined as

EQUATION

)

This is a straightforward extension of the TWN quantizer (Li & Liu, 2016 ) that allows different levels for positives and negatives. We find that two rounds of alternating computation in eq. ( 15) achieves a good performance, which we use in our experiments.

B ADDITIONAL EXPERIMENTAL RESULTS:



B.1 TERNARY QUANTIZATION FOR CIFAR-10:

Our models are ResNets of depth 20, 32, and 44. Ternarized training is initialized at pre-trained full-precision nets. We perform a hard quantization θ → q(θ) at epoch 400 and keeps training till the600-th epoch to stabilize the BatchNorm layers. Result The top-1 classification errors for ternary quantization are reported in Table 3 . Our results are comparable with the reported results of TTQ,3 and the best performance of our method over 4 runs (from the same initialization) is slightly better than TTQ.

C SIGN CHANGE EXPERIMENT:

We experimentally compare the training dynamics of PROXQUANT-Binary and BinaryConnect through the sign change metric. The sign change metric between any θ 1 and θ 2 is the proportion of their different signs, i.e. the (rescaled) Hamming distance:

SignChange(θ 1 , θ 2 ) = sign(θ 1 ) -sign(θ 2 ) 1 2d ∈ [0, 1].

In R d , the space of all full-precision parameters, the sign change is a natural distance metric that represents the closeness of the binarization of two parameters. Recall in our CIFAR-10 experiments (Section 4.1), for both BinaryConnect and PROXQUANT, we initialize at a good full-precision net θ 0 and stop at a converged binary network θ ∈ {±1} d . We are interested in SignChange(θ 0 , θ t ) along the training path, as well as SignChange(θ 0 , θ), i.e. the distance of the final output model to the initialization.

Our finding is that PROXQUANT produces binary nets with both lower sign changes and higher performances, compared with BinaryConnect. Put differently, around the warm start, there is a good binary net nearby which can be found by PROXQUANT but not BinaryConnect, suggesting that Bi-naryConnect, and in general the straight-through gradient method, suffers from higher optimization instability than PROXQUANT. This finding is consistent in all layers, across different warm starts, and across differnent runs from each same warm start (see Figure 3 and For any β-smooth function, it satisfies the bound

f (y) ≤ f (x) + ∇f (x), y -x + β 2 x -y 2 2 for all x, y ∈ R d .

Convergence results like Theorem 5.1 are standard in the literature of proximal algorithms, where we have convergence to stataionarity without convexity on either L or R but assuming smoothness.

For completeness we provide a proof below. Note that though the convergence is ergodic, the best index T best can be obtained in practice via monitoring the proximity θ t -θ t-1 2 .

Proof of Theorem 5.1 Recall the ProxQuant iterate

θ t+1 = arg min θ∈R d L(θ t ) + θ -θ t , ∇L(θ t ) + 1 2η θ -θ t 2 2 + λR(θ) .

By the fact that θ t+1 minimizes the above objective and applying the smoothness of L, we get that

F λ (θ t ) = L(θ t ) + λR(θ t ) ≥ L(θ t ) + θ t+1 -θ t , ∇L(θ t ) + 1 2η θ t+1 -θ t 2 2 + λR(θ t+1 ) ≥ L(θ t+1 ) + 1 2η - β 2 θ t+1 -θ t 2 2 + λR(θ t+1 ) = F λ (θ t+1 ) + β 2 θ t+1 -θ t 2 2 .

Telescoping the above bound for t = 0, . . . , T -1, we get that

T -1 t=0 θ t+1 -θ t 2 2 ≤ 2(F λ (θ 0 ) -F λ (θ T )) β ≤ 2(F λ (θ 0 ) -F ) β .

Therefore we have the proximity guarantee

EQUATION

We now turn this into a stationarity guarantee. The first-order optimality condition for θ t+1 gives ∇L(θ t ) + 1 η (θ t+1 -θ t ) + λ∇R(θ t+1 ) = 0.

Combining the above equality and the smoothness of L, we get

∇F λ (θ t+1 ) 2 = ∇L(θ t+1 ) + λ∇R(θ t+1 ) 2 = 1 η (θ t -θ t+1 ) + ∇L(θ t+1 ) -∇L(θ t ) 2 ≤ 1 η + β θ t+1 -θ t 2 = 3β θ t+1 -θ t 2 .

Choosing t = T best -1 and applying the proximity guarantee eq. ( 17), we get

∇F λ (θ T best ) 2 2 ≤ 9β 2 θ T best -θ T best -1 2 2 = 9β 2 min 0≤t≤T -1 θ t+1 -θ t 2 2 ≤ 18β(F λ (θ 0 ) -F ) T .

This is the desired bound.

D.2 PROOF OF THEOREM 5.2

As both R and L are even functions, a symmetric argument holds for θ 1 from which we get θ 2 = -θ 1 = θ 0 . Therefore the lazy prox-gradient method ends up oscillating between two points: θ t = (-1) t θ 0 .

On the other hand, it is straightforward to check that the only stationary points of L(θ) + λR(θ) are 0 and ± λ +λ , all not equal to ±θ 0 . Therefore the sequence {θ t } t≥0 does not have a subsequence with vanishing gradient and thus does not approach stationarity in the ergodic sense.

D.3 PROOF OF THEOREM 5.3:

We start with the "⇒" direction. If s is a fixed point, then by definition there exists θ 0 ∈ R d such that θ t = θ for all t = 0, 1, 2, .... By the iterates eq. ( 14)

θ T = θ 0 - T t=0 η t ∇L(s t ).

Take signs on both sides and apply s t = s for all t on both sides, we get that s = s T = sign(θ T ) = sign θ 0 -∇L(s) T t=0 η t Take the limit T → ∞ and apply the assumption that t η t = ∞, we get that for all i ∈ Now we prove the "⇐" direction. If θ obeys that sign(∇L(s)[i]) = -s[i] for all i ∈ [d] such that ∇L(s)[i] = 0, then if we take any θ 0 such that sign(θ 0 ) = s, θ t will move in a straight line towards the direction of -∇L(s), which does not change the sign of h 0 . In other words, s t = sign(θ t ) = sign(θ 0 ) = s for all t = 0, 1, 2, .... Therefore, by definition, s is a fixed point.

:

Empirically, it is advantageous to keep the biases of each layers and the BatchNorm layers at full-precision, which is often a negligible fraction, say 1/

We thankXu et al. (2018) for sharing the implementation of this method through a personal communication. There is a very clever trick not mentioned in their paper: after computing the alternating quantization q alt (θ), they multiply by a constant 0.3 before taking the gradient; in other words, their quantizer is a rescaled alternating quantizer: θ → 0.3q alt (θ). This scaling step gives a significant gain in performance -without scaling the PPW is {116.7, 94.3, 87.3} for {1,

2, 3} bits. In contrast, our PROXQUANT does not involve a scaling step and achieves better PPW than this unscaled ALT straight-through method.

We note that our PROXQUANT-Ternary and TTQ are not strictly comparable: we have the advantage of using better initializations; TTQ has the advantage of a stronger quantizer: they train the quantization levels (θ + , θ -) whereas our quantizer eq. (16) pre-computes them from the current full-precision parameter.

Figures and Tables:

Figure 2: W-shaped regularizer for binary quantization.

Figure 3: SignChange(θ0, θt) against t (epoch) for BinaryConnect and PROXQUANT, over 4 runs starting from the same full-precision ResNet-20. PROXQUANT has significantly lower sign changes than BinaryConnect while converging to better models. (a) The first conv layer of size 16 × 3 × 3 × 3; (b) The last conv layer of size 64 × 64 × 3 × 3; (c) The fully connected layer of size 64 × 10; (d) The validation top-1 error of the binarized nets (with moving average smoothing).

[d]  such that [∇L(θ)] i = 0,s[i] = lim T →∞ sign θ 0 -∇L(s) T t=0 η t [i] = -sign(∇L(s))[i].



Table content: <table><tr><td/><td/><td colspan="2">Classification error</td><td colspan="3">Performance drop over FP net</td></tr><tr><td>Model</td><td>FP</td><td>BC</td><td>PQ-B (ours)</td><td>BC</td><td colspan="2">BinaryRelax PQ-B (ours)</td></tr><tr><td>(Bits)</td><td>(32)</td><td>(1)</td><td>(1)</td><td>(1)</td><td>(1)</td><td>(1)</td></tr><tr><td colspan="4">ResNet-20 8.06 9.54 (0.03) 9.35 (0.13)</td><td>+1.48</td><td>+4.84</td><td>+1.29</td></tr><tr><td colspan="4">ResNet-32 7.25 8.61 (0.27) 8.53 (0.15)</td><td>+1.36</td><td>+2.75</td><td>+1.28</td></tr><tr><td colspan="4">ResNet-44 6.96 8.23 (0.23) 7.95 (0.05)</td><td>+1.27</td><td>-</td><td>+0.99</td></tr><tr><td colspan="4">ResNet-56 6.54 7.97 (0.22) 7.70 (0.06)</td><td>+1.43</td><td>-</td><td>+1.16</td></tr><tr><td colspan="4">4.2 LANGUAGE MODELING WITH LSTMS</td><td/><td/><td/></tr></table>

PPW of quantized LSTM on Penn Treebank.

Table content: <table><tr><td>Method / Number of Bits</td><td>1</td><td>2</td><td>3</td><td>FP (32)</td></tr><tr><td>BinaryConnect</td><td>372.2</td><td>-</td><td>-</td><td/></tr><tr><td colspan="4">PROXQUANT-Binary (ours) 288.5 ALT Straight-through 2 104.7 90.2 86.1 --</td><td>88.5</td></tr><tr><td>ALT-PROXQUANT (ours)</td><td colspan="3">106.2 90.0 87.2</td><td/></tr></table>

Top-1 classification error of ternarized ResNets on CIFAR-10. Performance is reported in mean(std) over 4 runs, where for PQ-T we report in addition the best of 4 (Bo4).

Table content: <table><tr><td>Model</td><td>FP</td><td colspan="3">TTQ PQ-T (ours) PQ-T (ours, Bo4)</td></tr><tr><td>(Bits)</td><td>(32)</td><td>(2)</td><td>(2)</td><td>(2)</td></tr><tr><td colspan="3">ResNet-20 8.06 8.87</td><td>8.40 (0.13)</td><td>8.22</td></tr><tr><td colspan="3">ResNet-32 7.25 7.63</td><td>7.65 (0.15)</td><td>7.53</td></tr><tr><td colspan="3">ResNet-44 6.96 7.02</td><td>7.05 (0.08)</td><td>6.98</td></tr></table>

Table 4 in Appendix C.1).This result here is also consistent with Theorem 5.3: the signs in BinaryConnect never stop changing until we manually freeze the signs at epoch 400.

Table content: <table><tr><td>Published as a conference paper at ICLR 2019</td></tr><tr><td>C.1 RAW DATA FOR SIGN CHANGE EXPERIMENT</td></tr></table>

Performances and sign changes on ResNet-20 in mean(std) over 3 full-precision initializations and 4 runs per (initialization x method). Sign changes are computed over all quantized parameters in the net.

Table content: <table><tr><td colspan="4">Initialization Method Top-1 Error(%) Sign change</td></tr><tr><td>FP-Net 1</td><td>BC</td><td>9.489 (0.223)</td><td>0.383 (0.006)</td></tr><tr><td>(8.06)</td><td>PQ-B</td><td>9.146 (0.212)</td><td>0.276 (0.020)</td></tr><tr><td>FP-Net 2</td><td>BC</td><td>9.745 (0.422)</td><td>0.381 (0.004)</td></tr><tr><td>(8.31)</td><td>PQ-B</td><td>9.444 (0.067)</td><td>0.288 (0.002)</td></tr><tr><td>FP-Net 3</td><td>BC</td><td>9.383 (0.211)</td><td>0.359 (0.001)</td></tr><tr><td>(7.73)</td><td>PQ-B</td><td>9.084 (0.241)</td><td>0.275 (0.001)</td></tr></table>

Performances and sign changes on ResNet-20 in raw data over 3 full-precision initializations and 4 runs per (initialization x method). Sign changes are computed over all quantized parameters in the net.Recall that a function f : R d → R is said to be β-smooth if it is differentiable and ∇f is β-Lipschitz: for all x, y ∈ R d we have ∇f (x) -∇f (y) 2 ≤ β x -y 2 .

Table content: <table><tr><td colspan="2">Initialization Method</td><td>Top-1 Error(%)</td><td>Sign change</td></tr><tr><td>FP-Net 1</td><td>BC</td><td colspan="2">9.664, 9.430, 9.198, 9.663 0.386, 0.377, 0.390, 0.381</td></tr><tr><td>(8.06)</td><td>PQ-B</td><td colspan="2">9.058, 8.901, 9.388, 9.237 0.288, 0.247, 0.284, 0.285</td></tr><tr><td>FP-Net 2</td><td>BC</td><td colspan="2">9.456, 9.530, 9.623, 10.370 0.376, 0.379, 0.382, 0.386</td></tr><tr><td>(8.31)</td><td>PQ-B</td><td colspan="2">9.522, 9.474, 9.410, 9.370 0.291, 0.287, 0.289, 0.287</td></tr><tr><td>FP-Net 3</td><td>BC</td><td colspan="2">9.107, 9.558, 9.538, 9.328 0.360, 0.357, 0.359, 0.360</td></tr><tr><td>(7.73)</td><td>PQ-B</td><td colspan="2">9.284, 8.866, 9.301, 8.884 0.275, 0.276, 0.276, 0.275</td></tr></table>

Peer review (iclr2019):
 This paper proposed ProxQuant method to train neural networks with quantized weights. ProxQuant relax the quantization constraint to a continuous regularizer and then solve the optimization problem with proximal gradient method. The authors argues that previous solvers straight through estimator (STE) in BinaryConnect (Courbariaux et al. 2015) may not converge, and the proposed ProxQuant is better. I have concerns about both theoretical and experimental contributions 1. The proposed regularizer for relaxing quantized constraint looks similar to BinaryRelax (Yin et al. 2018 BinaryRelax: A Relaxation Approach For Training Deep Neural Networks With Quantized Weights.), which is not cited. I hope the authors can discuss this work and clarify the novelty of the proposed method. One difference I noticed is that BinaryRelax use lazy prox-graident, while the proposed ProxQuant use non-lazy update. It is unclear which one is better. 2. On page 5, the authors claim ‘’Our proposed method can be viewed as … generalization ...’’ in page 5. It seems inaccurate because unlike proposed method, BinaryConnect use lazy prox-gradient. 3. What’s the purpose of equation (4)? I am confused and did not find it explained in the content. 4. The proposed method introduced more hyper-parameters, like the regularizer parameter .lambda, and the epoch to perform hard quantization. In section 4.2, it is indicated that parameter .lambda is tuned on validation set. I have doubts about the fairness comparing with baseline BinaryConnect. Though BC does not have this parameter, we can still tune learning rate. 5. ProxQuant is fine-tuned based on the pre-trained real-value weights. Is BinaryConnect also fine-tuned? For a CIFAR-10 experiments, 600 epochs are a lot for fine-tuning. As a comparison, training real-value weights usually use less than 300 epochs. BinaryConnect can be trained from scratch using same number of epochs. What does it mean to hard-quantize BinaryConnect? The weights are already quantized after projection step in BinaryConnect. 6. The authors claim there are no reported results with ResNets on CIFAR-10 for BinaryConnect, which is not true. (Li et al. 2017 Training Quantized Nets: A Deeper Understanding) report results on ResNet-56, which I encourage authors to compare with. 7. What is the benefit of ProxQuant? Is it faster than BinaryConnect? If yes, please show convergence curves. Does it generate better results? Table 1 and 2 does not look convincing, especially considering the fairness of comparison. 8. How to interpret Theorem 5.1? For example, Li et al. 2017 show the real-value weights in BinaryConnect can converge for quadratic function, does it contradict with Theorem 5.1? 9. I would suggest authors to rephrase the last two paragraphs of section 5.2. It first states ‘’one needs to travel further to find a better net’’, and then state ProxQuant find good result nearby, which is confusing. 10. The theoretical benefit of ProxQuant is only intuitively explained, it looks to me there lacks a rigorous proof to show ProxQuant will converge to a solution of the original quantization constrained problem. 11. The draft is about 9 pages, which is longer than expected. Though the paper is well written and I generally enjoyed reading, I would appreciate it if the authors could shorten the content. My main concerns are novelty of the proposed method, and fairness of experiments. ======================= after rebuttal ======================= I appreciate the authors* efforts and am generally satisfied with the revision. I raised my score. The authors show advantage of the proposed ProxQuant over previous BinaryConnect and BinaryRelax in both theory and practice. The analysis bring insights into training quantized neural networks and should be welcomed by the community. However, I still have concerns about novelty and experiments. - The proposed ProxQuant is similar to BinaryRelax except for non-lazy vs. lazy updates. I personally like the theoretical analysis showing ProxQuant is better, although it is based on smooth assumptions. However, I am quite surprised BinaryRelax is so much worse than ProxQuant and BinaryConnect in practice (table 1). I would encourage the authors to give more unintuitive explanation. - The training time is still long, and the experimental setting seems uncommon. I appreciate the authors* efforts on shortening the finetuning time, and provide more parameter tuning. However, 200 epochs training full precision network and 300 epochs for finetuning is still a long time, consider previous works like BinaryConnect can train from scratch without a full precision warm start. In this long-training setting, the empirical advantage of ProxQuant over baselines is not much (less than 0.3% for cifar-10 in table 1, and comparable with Xu 2018 in table 2).