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

XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks

Binary weights and inputs let convolutional networks run on cheap hardware

  • Problem Standard convolutional networks need large memory and many high precision operations, so they are hard to run on cell phones and embedded devices. Earlier binarization methods lost too much accuracy on ImageNet.
  • Method XNOR-Net replaces each filter with its sign pattern and a scale, and also binarizes the inputs. Convolutions then run on XNOR and bitcount operations instead of multiplications.
  • Results Binary-Weight-Network reached 56.8 top-1 and 79.4 top-5 on ImageNet with AlexNet, against 56.6 and 80.2 for full precision.

Why compress CNNs for small devices

Convolutional networks have reached strong results in object recognition and detection, but the authors want those models on hardware far smaller than a GPU server. AlexNet alone has 61M parameters, which occupy 249MB of memory, and it needs 1.5B high precision operations to classify one image. Deeper networks such as VGG push both figures higher, which is why cost matters on cell phones and embedded electronics.

The approach therefore targets two limits at once: the memory a model occupies and the arithmetic cost of each convolution.

Where this sits among compression and binarization work

Pruning, hashed weight sharing and low-rank factorization shrink or reshape a trained network. Compact layer designs reduce cost by restructuring the architecture, whereas the authors keep the standard deep architectures and change only the numerical form of the parameters. Quantization work is the closest neighbour, and the authors' quantization is the extreme case in which values are +1 or -1.

Among binarization methods, BinaryConnect keeps real-valued weights for the updates and BinaryNet binarizes activations as well, and the authors compare directly against both on ImageNet. The networks here are trained from scratch rather than starting from a pretrained network.

Binarizing weights with a closed-form scale

Each real-valued filter W is approximated by a binary filter B with entries in \( \{+1,-1\} \) and a positive scalar \( \alpha \), so that \( W \approx \alpha B \). The pair is chosen to minimize the squared error \( \lVert W-\alpha B\rVert^{2} \) over B and \( \alpha \). Expanding the error leaves a term in B that depends only on \( W^{T}B \), and because \( B^{T}B = n \) for any binary B, the best B maximizes \( W^{T}B \) under the sign constraint, which gives \( B^{*} = \mathrm{sign}(W) \).

Setting the derivative with respect to \( \alpha \) to zero gives \( \alpha^{*} = \frac{1}{n}\lVert W\rVert_{\ell_1} \) with \( n = c\times w\times h \), so the scale is the mean absolute weight of the filter. Storing the binary filter cuts filter memory by about 32× relative to single precision, and a convolution with binary weights needs only additions and subtractions, which the authors estimate gives about 2× speed-up.

Binarizing inputs for XNOR operations

XNOR-Net extends binarization to the inputs, so every operand of a convolution is binary. A convolution is a repeated shift followed by a dot product, so the dot product is the piece that must be made binary; for binary vectors it can be computed with XNOR and bitcounting. For vectors X and W in \( \mathbb{R}^{n} \), the method approximates \( X^{T}W \approx \beta\alpha H^{T}B \) with H and B in \( \{+1,-1\}^{n} \), and merges the two scales into \( \gamma = \beta\alpha \).

The sign vector of the product is \( C^{*} = \mathrm{sign}(Y) = \mathrm{sign}(X)\odot\mathrm{sign}(W) \), where \( Y_i = X_i W_i \). The best \( \gamma \) is the mean of \( |Y_i| \), and treating \( |X_i| \) and \( |W_i| \) as independent turns it into the product of the two mean absolute values, \( \gamma^{*} \approx \frac{1}{n}\lVert X\rVert_{\ell_1}\cdot\frac{1}{n}\lVert W\rVert_{\ell_1} \).

Computing this scale for every overlapping input window would repeat work, so the method averages absolute input values across channels into one map A and convolves A with a two-dimensional filter whose entries are all equal, which yields a scale K for each window position. The full operation is \( I * W \approx (\mathrm{sign}(I)\circledast\mathrm{sign}(W))\odot K\alpha \), where the circled convolution uses XNOR and bitcount, and K and \( \alpha \) rescale the output elementwise; only this scaling step uses non-binary arithmetic.

Training, block order and binary gradients

A typical block runs convolution, batch normalization, activation and pooling in that order. That order fits binary inputs poorly, because pooling binary values, such as taking a maximum, returns mostly +1 entries and loses information, so pooling moves after the convolution. The input is normalized before binarization, which gives it zero mean so that thresholding at zero adds less quantization error.

The resulting ordering, B-A-C-P, places batch normalization and binary activation before the binary convolution, with pooling last; a non-binary activation such as ReLU may follow the convolution, which the authors say helps with AlexNet or VGG-type networks. Training uses the same procedure as Algorithm 1, with the real-valued weights updated and the binary forward and backward passes computed from them.

The backward convolution between weight filters and input gradients can be binarized in the same way. Taking the mean-absolute scale from equation 6 for these gradients would weaken the direction of largest change for SGD, so the authors scale by the maximum absolute gradient instead. With a binary gradient, XNOR-Net loses 1.4% top-1 accuracy in the reported experiment.

The k-bit extension replaces the sign function with a rounding function defined on inputs in [-1, 1], which allows more than one bit per value. All reported results use the 1-bit binarization, so the k-bit form is introduced without an evaluation in the text.

ImageNet setup and baselines

Evaluation uses ImageNet (ILSVRC2012), with about 1.2M training images from 1K categories and 50K validation images, reported as Top-1 and Top-5 accuracy. Three base architectures are binarized: AlexNet, ResNet and a GoogLenet variant. The baselines are BinaryConnect, used with deterministic binarization because the authors found stochastic binarization inefficient, and BinaryNet, evaluated under the settings discussed in its source.

AlexNet has five convolutional layers and two fully connected layers, and the authors train it with batch normalization but without local response normalization. Training images are resized so the smaller side is 256 pixels and then cropped at random to 224×224, and the test uses a 224×224 center crop. Training runs for 16 epochs at batch size 512 with negative log-likelihood over the softmax outputs.

Binary-Weight-Network and BinaryConnect are updated with SGD using momentum 0.9, while XNOR-Net and BinaryNet use ADAM, which the authors say converges faster for binary inputs. The learning rate starts at 0.1 and has a learning-rate decay of 0.01 applied every 4 epochs.

ResNet-18 uses short-cut type B, and its images are resized between 256 and 480 pixels on the smaller side before a 224×224 crop; it trains for 58 epochs at batch size 256 with the learning-rate decay of 0.01 applied at epochs 30 and 40. The GoogLenet variant has 21 convolutional layers with filter sizes alternating between 1×1 and 3×3 and no branching, trains for 80 epochs at batch size 128, and uses a polynomial rate decay written with β = 4.

AlexNet accuracy and ablations

Table 1 gives Binary-Weight-Network 56.8 top-1 and 79.4 top-5, while full-precision AlexNet reached 56.6 and 80.2. XNOR-Net reached 44.2 and 69.2, BinaryConnect 35.4 and 61.0, and BinaryNet 27.9 and 50.42 under the same AlexNet setup. The binary-weight version therefore matches full precision on top-1 and sits slightly below it on top-5.

The introduction states a margin of more than 16% top-1 over BinaryConnect and BinaryNet, and the body gives 16.3% over BinaryNet on ILSVRC2012. The epoch curves show Binary-Weight-Network and XNOR-Net about 17% above BinaryConnect and BinaryNet at every epoch. The authors' experiments indicate that BinaryConnect is not very successful on a large-scale dataset such as ImageNet.

Removing the input scale β lowers AlexNet top-1 accuracy by less than 1%, so the authors find the weight scale α matters much more than the input scale. Computing α through a separate learned layer instead of equation 6 gives Binary-Weight-Network 46.2 top-1 and 69.5 top-5, against 56.8 and 79.4 with the closed-form scale. Ordering the XNOR-Network block as C-B-A-P gives 30.3 top-1 and 57.5 top-5, against 44.2 and 69.2 for B-A-C-P.

ResNet-18 and GoogLenet results

On ResNet-18, Binary-Weight-Network reached 60.8 top-1 and 83.0 top-5, XNOR-Network reached 51.2 and 73.2, and full precision reached 69.3 and 89.2. Figure 6 plots these ResNet-18 accuracies over the epochs for training and validation.

On the GoogLenet variant only Binary-Weight-Network is reported, at 65.5 top-1 and 86.1 top-5, against 71.3 and 90.0 for full precision. The XNOR-Network entries for this variant are marked N/A, so no XNOR-Net result is given for it.

Speed and memory estimates

A standard convolution needs c N_W N_I operations, with \( N_W = wh \) and \( N_I = w_{in}h_{in} \), while the binary approximation needs c N_W N_I binary operations and only N_I non-binary operations. Assuming a CPU performs 64 binary operations per clock, the speedup works out to \( S = \frac{64\,cN_W}{cN_W+64} \), which depends on channel count and filter size but not on input size.

For the reference setting with c = 256 and 3×3 filters, the theoretical speedup is 62.27×. The authors' CPU implementation reached 58× for one convolution, excluding memory allocation and memory access. The introduction states the 58× as a CPU speedup in number of high precision operations, and the body measures it on one convolution.

With a channel size of 3 or a 1×1 filter the speedup is not high, so the first and last layers are kept without binarization. The weight-only speed-up of about 2× assumes that multiplication and addition take separate cycles; on CPUs that fuse them into one cycle, Binary-Weight-Networks give no speedup. Binary-weight networks are small enough to fit portable devices, while the full-precision AlexNet occupies 249MB.

Limitations

The evaluation covers ImageNet with AlexNet, ResNet-18 and one GoogLenet variant. The CIFAR-10 comparison is given only as error rates for the same architecture as BinaryConnect and BinaryNet, 9.88% for Binary-Weight-Network and 10.17% for XNOR-Network. Accuracies are single final values per setting, and the text gives no seeds or intervals.

Stochastic binarization for BinaryConnect was not used in the comparisons. The speed figures are per-convolution CPU measurements under the 64-operations-per-clock assumption and exclude memory allocation and access. XNOR-Network trails full precision on ResNet-18 by a wide margin, and the text does not analyze its cause. k-bit quantization is introduced without evaluation.

Paper info

Authors
Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, Ali Farhadi
Venue
arXiv · Preprint
First published
2016-3-16
Added
2026-11-12
Updated
2016-8-2
Version
v4
arXiv
1603.05279
Category
cs.CV
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

Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, Ali Farhadi (2016). XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks. arXiv:1603.05279v4. https://arxiv.org/abs/1603.05279v4

BibTeX
@misc{rastegari2016xnor,
  title = {{XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks}},
  author = {Mohammad Rastegari and Vicente Ordonez and Joseph Redmon and Ali Farhadi},
  year = {2016},
  eprint = {1603.05279},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1603.05279v4}
}

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