Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

DoReFa-Net: Training Low Bitwidth Convolutional Neural Networks with Low Bitwidth Gradients

Low bitwidth gradients enable bit convolution training

  • Problem Binarized networks keep gradients in full precision, so their backward pass cannot use fast bit convolution kernels. Most of their training time therefore stays in slow arithmetic.
  • Method DoReFa-Net quantizes weights, activations and gradients to low bitwidth, with gradients quantized stochastically. Instead of keeping gradients in full precision, it runs both passes on bit convolution kernels.
  • Results DoReFa-Net reached 46.1% single-crop top-1 on ImageNet with 1-bit weights, 2-bit activations and 6-bit gradients, trained from scratch.

Why the backward pass limits binarized training

Binarized networks such as BNN and XNOR-Net binarize both the weights and the input activations of convolutional layers, so the forward pass can be computed with bitwise operations. The backward pass is different, because the gradients stay in full precision. The convolution between those gradients and the 1-bit weights therefore multiplies 1-bit numbers by 32-bit floating-point values.

The authors argue that this leaves the backward pass unable to exploit bit convolution, so most training time of these networks falls there.

Earlier reduced-precision training work, such as the schemes of Gupta et al. and Courbariaux et al., still performs convolutions on numbers of at least 10 bits. The authors state that no earlier work had quantized backward-pass gradients below 8 bits while keeping comparable prediction accuracy. DoReFa-Net targets this gap by making weights, activations and gradients all low bitwidth, so that convolutions in both passes can run on bit convolution kernels.

Bit convolution as the computational core

For 1-bit vectors, a dot product equals the bit count of the bitwise AND of the two vectors. For fixed-point integers, each value is written as a sum of its bits weighted by powers of two, so the dot product becomes a double sum over the bit positions m of x and k of y, with each partial bit count weighted by \(2^{m+k}\). \[ x\cdot y=\sum_{m=0}^{M-1}\sum_{k=0}^{K-1}2^{m+k}\,\mathrm{bitcount}[\mathrm{and}(c_m(x),c_k(y))] \] Here \(c_m(x)\) and \(c_k(y)\) are bit vectors, so the cost is O(MK), proportional to the product of the two bitwidths.

When both vectors take values in {-1, 1}, an XNOR form replaces the AND form, and the dot product is N minus twice the bit count of the XNOR of the two vectors. Every low bitwidth tensor in the method is an affine image of fixed-point integers, so the same kernel serves the forward, backward-input and backward-weight products.

Training through rounding with a straight-through estimator

A function with a small finite range has zero gradient with respect to its input almost everywhere, so ordinary backpropagation would not update anything behind such a quantizer. The straight-through estimator avoids this by choosing an operator with its own forward and backward rules, independent of the true derivative. For Bernoulli sampling with probability p, the backward rule passes the gradient with respect to the sample q to p, which is justified because q equals p in expectation.

The quantizer quantizek takes a real input r_i in [0, 1] and, in the forward pass, returns the nearest k-bit level. \[ r_o=\frac{1}{2^k-1}\,\mathrm{round}\big((2^k-1)\,r_i\big) \] In the backward pass the gradient with respect to r_o is passed unchanged to r_i. Because the output is a k-bit fixed-point value, dot products of such outputs can use the integer dot product followed by a scaling step.

Quantizing weights to one or k bits

BNN binarizes weights with a sign function, and its backward rule passes the gradient only where the latent weight magnitude is at most 1. XNOR-Net also scales each binarized filter by a factor equal to the mean absolute value of each output channel. DoReFa-Net instead multiplies the binarized weights by one constant scalar for all filters, because channel-wise scaling would prevent bit kernels from being used when gradients are convolved with weights in the backward pass.

For k greater than 1, the weights are first squashed with tanh, divided by twice their largest absolute tanh value in the layer, shifted by one half, quantized and then mapped back to [-1, 1]. The authors find that the 1-bit form of this mapping, which differs from the constant-scalar form, makes no meaningful difference in their experiments.

Deterministic activations and stochastic gradients

The authors could not reproduce XNOR-Net results with its activation binarization, and they cite Rastegari et al. for the claim that binarizing activations as in BNN severely degrades AlexNet accuracy on ImageNet. DoReFa-Net assumes the previous layer's output passes through a bounded function h, so the input activations lie in [0, 1], and then applies quantizek directly to them.

The scaling maximum runs over every axis of the gradient except the mini-batch axis, so each instance keeps its own scale. The gradient quantizer acts only in the backward pass: each convolution output is passed forward unchanged, and its gradient is replaced by the quantized version. The authors find stochastic quantization necessary for low bitwidth gradients, in line with Gupta et al.

on 16-bit weights and gradients.

Training loop and what stays at full precision

In the forward pass of Algorithm 1, each layer uses a quantized copy of its weights and quantizes its output activation when the layer is not the last one. In the backward pass, each layer's gradient goes through the activation function, the gradient quantizer, and then the backward input and backward weight products, which all operate on low bitwidth numbers.

The parameter update acts on the unquantized weights W_k with the accumulated gradient, so the full-precision copy is kept for updates.

The first layer receives an image, which may hold 8-bit features, and the output layer produces nearly one-hot vectors, which the authors note are close to bit vectors. Most experiments therefore leave the first convolutional layer's weights unquantized while its outputs are quantized, and leave the last fully connected layer intact, with its gradients still quantized.

Storing h(a_k) in full precision would consume run-time memory, so the authors fuse the nonlinearity with the rounding step. When h is monotonic, the few possible values of the quantized activation correspond to non-overlapping ranges of a_k, so the quantized value can be obtained by comparisons between fixed-point numbers. For max-pooling, quantizek commutes with the max, so the quantized gradient can also be produced from the stored gradient by comparisons.

SVHN bitwidth sweep

The SVHN cropped format has 73257 training digits, 26032 testing digits and 531131 less difficult samples that can serve as extra training data, with images resized to 40x40. Training uses ADAM with a learning rate of 0.001, and the reported number is the maximum test-set accuracy over 200 epochs.

With 1-bit weights, 1-bit activations and 2-bit gradients, Model A reaches 0.934 in the table, and the text rounds this configuration to 93% accuracy. Some rows are not monotone in bitwidth: 1-4-2 gives 0.815 for Model A, while 1-4-4 gives 0.975.

The authors find that weights, activations and gradients become progressively more sensitive to low bitwidth, and that gradients with G of 4 or fewer bits significantly degrade accuracy on SVHN. Gradient accuracy saturates at about 8 bits in most cases, and the authors find the best gradient bitwidth less tied to channel count. The authors attribute the smaller loss for Model A than for Model C to models with more channels being less sensitive to bitwidth, and suggest raising activation bitwidth for models with fewer channels as a compensation.

ImageNet results for AlexNet variants

The evaluation uses ILSVRC12, with about 1.2 million training images, 50k validation images and 1000 categories, reported as single-crop top-1 accuracy with inputs at 224x224. The 32-bit baseline AlexNet reaches 55.9% single-crop top-1. It replicates the original model with the second, fourth and fifth convolutions split into two parallel blocks and batch normalization in place of local contrast renormalization, trained with ADAM at 10−4 and then lowered to 10−5 and 10−6.

With 1-bit weights and 6-bit gradients, raising activations from 1 bit to 2, 3 and 4 bits gives 0.395, 0.461, 0.471 and 0.482 top-1 in the table. The 1-2-6 setting reaches 46.1% top-1, the figure given as the headline result of the paper. At each activation bitwidth the 6-bit gradient rows are close to the 32-bit gradient rows: 0.395 against 0.401 for 1-1, 0.461 against 0.477 for 1-2, and 0.471 against 0.484 for 1-3.

The authors describe 6-bit gradients as producing similar accuracy to 32-bit gradients.

The BNN row, 0.279, is taken from Rastegari et al., and the XNOR-Net row, 0.442, is also a reported figure, so these two are not controlled runs under the authors' setup. The 1-1-32 row at 0.401 is the authors' own run.

Models initialized from a 32-bit model score higher than models trained from scratch: 0.498 against 0.477 for 1-2-32, and 0.530 against 0.503 for 1-4-32. The authors describe the gap between trained-from-scratch and initialized models as considerable and leave closing it to future work.

Training curves for 6-bit gradients do not differ clearly from the unquantized curves, while 4-bit gradients as in the 1-2-4 setting show a clear drop in accuracy. The histograms show weights that remain roughly symmetric as their scale changes, and activations whose distribution stays stable across epochs 5, 15 and 35.

Effect of quantizing the first and last layers

The baseline (1, 2, 4) scores 0.975 for Model A, 0.969 for Model B and 0.939 for Model C. Adding quantization of the first convolutional layer gives 0.972, 0.963 and 0.932, and adding quantization of the last fully connected layer gives 0.973, 0.969 and 0.927. Quantizing both gives 0.971, 0.961 and 0.928.

The authors describe quantizing the first and last layers as causing significant accuracy degradation, larger for models with fewer channels. For Model C, the drop is from 0.939 to 0.927 when the last layer is quantized, while the changes for Model A are smaller. The authors read this as some justification for the practice of BNN and XNOR-Net of leaving these two layers unquantized.

How gradient quantization differs from earlier work

Lin et al. make a step toward low bitwidth gradients by turning some multiplications into bit shifts, but additions between high bitwidth numbers remain at the same order of magnitude. Seide et al. quantize gradients before communication in distributed training, but they keep full precision gradients in the backward pass and quantize only before sending them.

To the authors' knowledge, this is the first work to reduce gradient bitwidth to 6 bits or lower while keeping comparable accuracy on AlexNet and ImageNet, without increasing channel count.

Limitations

Trained-from-scratch models stay below initialized models, for example 0.477 against 0.498 for 1-2-32, and the authors leave closing that gap to future work. The ImageNet experiments use the combination (W, A) = (1, 2) with gradients of G of at least 4, chosen from the SVHN sweep, and most ImageNet runs leave the first and last layers unquantized.

The SVHN numbers are maxima of test-set accuracy over 200 epochs, not held-out selections. The complexity columns of Table 1 are computed from the bit-level dot product in Eqn. 3, and the text reports no measured run time on hardware. The authors list training on FPGA as future work because of the resource scaling of B-bit arithmetic.

Paper info

Authors
Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, Yuheng Zou
Venue
arXiv · Preprint
First published
2016-6-20
Added
2026-11-12
Updated
2018-2-2
Version
v3
arXiv
1606.06160
Category
cs.NE · cs.LG
Original paper terms
arXiv non-exclusive 1.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, Yuheng Zou (2016). DoReFa-Net: Training Low Bitwidth Convolutional Neural Networks with Low Bitwidth Gradients. arXiv:1606.06160v3. https://arxiv.org/abs/1606.06160v3

BibTeX
@misc{zhou2016dorefa,
  title = {{DoReFa-Net: Training Low Bitwidth Convolutional Neural Networks with Low Bitwidth Gradients}},
  author = {Shuchang Zhou and Yuxin Wu and Zekun Ni and Xinyu Zhou and He Wen and Yuheng Zou},
  year = {2016},
  eprint = {1606.06160},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1606.06160v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up