# BinaryConnect: Training Deep Neural Networks with binary weights during propagations

Courbariaux, Matthieu, Bengio, Yoshua, David, Jean-Pierre · arXiv · 2015-11-2

- **Problem** Deep networks are costly because their multiply-accumulate operations use real-valued weights, and multipliers dominate power on specialized hardware. Training with binary weights was unclear, since SGD seemed to need high precision in its accumulated updates.
- **Method** BinaryConnect binarizes weights to plus or minus one during forward and backward propagation. Instead of storing binary weights, it updates a real-valued copy with SGD and clips it to minus one through one.
- **Results** Stochastic BinaryConnect reached 1.18 ± 0.04% test error on permutation-invariant MNIST, against 1.30 ± 0.04% for the baseline with no regularizer. On CIFAR-10 it reached 8.27%, against 10.64% for that baseline.

## Why multiplications limit deep network hardware

Most of the arithmetic in a deep network is a real-valued weight multiplied by a real-valued activation in the forward pass, or by a gradient in the backward pass. On specialized digital hardware the multipliers take the most area and power, so this arithmetic is where a hardware designer gains the most. The pressure to run learning on low-power devices, where GPUs are a poor fit, has increased the interest in dedicated hardware for deep networks.

With such weights, a multiply-accumulate becomes an addition or a subtraction, and fixed-point adders are much cheaper than fixed-point multiply-accumulators. Low-bit weights alone do not settle the matter, because training with SGD appeared to need high precision in the accumulated updates.

The problem therefore has two parts: whether discretized weights can drive SGD at all, and whether the noise that discretization adds helps or harms the trained network. The experiments on MNIST, CIFAR-10 and SVHN address the second part through the error rates reported for each variant.

## Keeping precise weights for the updates

SGD moves parameters through many small, noisy steps, and the noise in individual minibatch gradients tends to cancel when these steps are summed. The accumulator that collects these steps therefore needs fine resolution, even if the value used during propagation is coarse. The authors argue that a precision of the stored weights is required, while the propagated value only has to be a noisy view of it.

Earlier studies give some numerical grounding: SGD was reported to need weights with at least 6 to 8 bits, and DNNs were trained with 12 bits of dynamic fixed-point computation. The authors also cite an estimate that brain synapses hold between 6 and 12 bits. Randomized or stochastic rounding is cited as a way to make the discretization unbiased.

Noise on weights or activations is a second ingredient, since it can improve generalization in methods such as variational weight noise, Dropout and DropConnect. DropConnect is the closest of these methods: it randomly sets about half of the weights to zero during propagation. From these earlier results the authors take that only the expected value of a weight needs high precision, and that the noise itself can help.

BinaryConnect follows this split: the real-valued weights are the stored parameters, and only the copy used in propagation is binarized. Each minibatch the SGD update is written to the real-valued variable, so the binary copy is refreshed from it on the next step.

## Deterministic and stochastic binarization

The simplest map takes the sign of the real-valued weight, with a weight of exactly zero mapped to +1. \\\[ w\_b=\\begin{cases}+1 & \\text{if } w\\ge 0\\\\ -1 & \\text{otherwise}\\end{cases} \\\] Here \\(w\_b\\) is the binarized weight and \\(w\\) the real-valued weight, and this is the deterministic form of BinaryConnect.

The authors argue that a sign map loses information, but averaging over the many inputs of a hidden unit can compensate for that loss. Their alternative samples the binary value: \\(w\_b=+1\\) with probability \\(p=\\sigma(w)\\) and \\(w\_b=-1\\) with probability \\(1-p\\). This stochastic form lets the sampled weights average to the real-valued weight, which the authors describe as preserving its expected value.

The probability uses the hard sigmoid rather than the soft sigmoid: \\\[ \\sigma(x)=\\mathrm{clip}\\left(x+\\tfrac{1}{2},0,1\\right)=\\max\\left(0,\\min\\left(1,x+\\tfrac{1}{2}\\right)\\right) \\\] The authors chose it because it is much cheaper to compute in software and in specialized hardware, and it gave good results in their experiments. It is piecewise linear, resembles the hard tanh nonlinearity, and is a bounded form of the rectifier.

## One training step with binary weights

A training step has three parts: a forward propagation that computes activations layer by layer, a backward propagation that passes gradients with respect to activations down to the first hidden layer, and a parameter update. BinaryConnect binarizes the weights only in the first two parts.

At the start of a step the binary weights are computed from the previous real-valued weights, and the forward pass uses those binary weights together with the previous biases. The backward pass also uses the binary weights to propagate the gradient with respect to the activations. The update then computes the gradient with respect to the binary weights and applies it to the real-valued weights, which are clipped afterwards, while the biases are updated without binarization.

They write this as \\\[ w^{\*}=\\operatorname{sign}\\Big(\\sum\_t g\_t\\Big) \\\] where \\(g\_t\\) is a noisy estimate of the gradient of the objective with respect to the weights at step \\(t\\), and \\(w^{\*}\\) is the final discretized weight. On this view the discretization acts as a form of corruption and therefore as a regularizer, which the authors say their experiments support.

DropConnect is the analogy the authors draw: it also injects noise only into the weights during propagation. DropConnect uses Bernoulli noise, while BinaryConnect uses binary sampling, and in both cases the corrupted value has the clean value as its expectation.

## Clipping and training choices

Once the magnitude of a real-valued weight passes ±1, the binarization no longer responds to small changes in it. Clipping the real-valued weights to the interval \[-1, 1\] right after each update keeps them from growing without any effect on the binary weights. The clip acts like a bound on the weight vector, which the authors note is a common way to regularize weights.

Batch Normalization is used in all experiments, because it speeds training by reducing internal covariate shift and lowers the influence of the weight scale. The CNN experiments use the ADAM learning rule, and the MLP on MNIST uses SGD without momentum. Learning rates are scaled by the weight initialization coefficients for ADAM, and by the squares of those coefficients for SGD or Nesterov momentum.

In the small CNN on CIFAR-10, scaling the learning rates lowered the test error of Nesterov momentum from 15.65% to 11.30%. With ADAM it lowered the test error from 12.81% to 10.47%. These are the only optimizer comparisons reported for this scaling, and they come from the small CNN rather than the full CIFAR-10 network.

## Choosing weights at test time

The paper considers three options at test time: use the binary weights, use the real-valued weights, or sample many binary networks and average their outputs. The deterministic form pairs naturally with the first option, since its binary weights are fixed for a given real-valued weight.

For the stochastic form the authors focus on the training advantage, so they evaluate with the real-valued weights. This follows Dropout practice, where the noise is removed at test time. The sampled-ensemble option is described but is not evaluated in the reported experiments.

## Permutation-invariant MNIST results

MNIST has 60000 training images and 10000 test images of size 28 × 28, and the model must ignore the two-dimensional image structure. The network is an MLP with three hidden layers of 1024 ReLU units and an L2-SVM output, trained with SGD and no momentum on the square hinge loss. The last 10000 training samples serve as validation for early stopping, and the test error is taken at the best validation error after 1000 epochs, over six runs with different initializations.

The no-regularizer baseline reached 1.30 ± 0.04% test error. Deterministic BinaryConnect reached 1.29 ± 0.08%, which is essentially the same as the baseline. Stochastic BinaryConnect reached 1.18 ± 0.04%, lower than the baseline.

Dropout at 50% reached 1.01 ± 0.04%, below the stochastic variant. The authors therefore regard the stochastic version as a regularizer that is slightly less powerful than Dropout in this setting. In the first-layer weight histograms, the weights of both binary variants move toward deterministic values, and some deterministic BinaryConnect weights stay near zero.

## CIFAR-10 results

CIFAR-10 has 50000 training images and 10000 test images of 32 × 32 color pixels, preprocessed with global contrast normalization and ZCA whitening and without data augmentation. The CNN uses six 3 × 3 ReLU convolution layers in three pairs, each pair followed by 2 × 2 max-pooling, then two fully connected layers of 1024 units and an L2-SVM output.

The no-regularizer CNN reached 10.64% test error. Deterministic BinaryConnect reached 9.90%, and stochastic BinaryConnect reached 8.27%. Both binary variants lower the error relative to the baseline in this setting.

Training curves show that both binary variants raise the training cost, slow training, and lower the validation error, which the authors describe as the behaviour expected of a Dropout-type scheme.

## SVHN results

SVHN has a training set of 604K images and a test set of 26K images, each 32 × 32 in color. The procedure follows CIFAR-10, with half the number of hidden units and 200 epochs instead of 500, because SVHN is a large dataset.

The no-regularizer model reached 2.44% test error on SVHN. Deterministic BinaryConnect reached 2.30%, and stochastic BinaryConnect reached 2.15%.

## Relation to earlier binary and ternary training

Expectation Backpropagation trains binary-weight networks without backpropagation, using Expectation Propagation as a variational Bayes method. Its posterior over the weights is not binary, which the authors note is close to keeping a real-valued version of the weights as BinaryConnect does.

The ternary approaches train a network in high precision first, then ternarize the weights to three values, and finally retrain with ternary weights during propagation and high-precision weights during updates. BinaryConnect trains with binary weights during propagation from the start, so the training procedure avoids the full-precision phase.

## What the savings estimates rest on

The authors estimate that the forward and backward propagations account for about 2/3 of the multiplications, so removing them from training would remove about that share.

With the deterministic form at test time, the authors estimate a memory reduction by a factor of at least 16, going from 16-bit single-float weights to single-bit weights. The estimate concerns the memory of the weights, and it is an estimate rather than a measurement.

## Limits of the evidence

The reported experiments cover one MLP on permutation-invariant MNIST, one CNN on CIFAR-10 without data augmentation, and one SVHN setting. The authors state that extending the results to other models and datasets is future work.

The authors do not measure the training speed-up or the memory reduction; both are estimates. The sampled-ensemble test option is not evaluated.

The MNIST MLP is trained with SGD and the CNNs with ADAM, so the optimizers differ across the reported comparisons. The comparison table also lists values from prior methods, which were not all trained under this paper's protocol, so those rows are not a controlled comparison. Training ran for 1000, 500 and 200 epochs across the three benchmarks, and the authors note that the binary variants slow training on CIFAR-10.

## Paper info

- **Authors**: Courbariaux, Matthieu, Bengio, Yoshua, David, Jean-Pierre
- **Venue**: arXiv · Preprint
- **First published**: 2015-11-2
- **Added**: 2026-11-12
- **Updated**: 2016-4-18
- **Version**: v3
- **arXiv**: 1511.00363
- **Category**: cs.LG · cs.CV · cs.NE
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1511.00363v3) · [PDF ↗](https://arxiv.org/pdf/1511.00363v3)

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

Courbariaux, Matthieu, Bengio, Yoshua, David, Jean-Pierre (2015). BinaryConnect: Training Deep Neural Networks with binary weights during propagations. arXiv:1511.00363v3. https://arxiv.org/abs/1511.00363v3

**BibTeX**

```
@misc{matthieu2015binaryconnect,
  title = {{BinaryConnect: Training Deep Neural Networks with binary weights during propagations}},
  author = {Courbariaux, Matthieu and Bengio, Yoshua and David, Jean-Pierre},
  year = {2015},
  eprint = {1511.00363},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1511.00363v3}
}
```

## Related papers

- [XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks](https://refivu.com/en/papers/a24ab4a0-5bb0-49ce-a4e8-1e280720a977-xnor-net-imagenet-classification-using-binary-convolutional.md)
- [Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift](https://refivu.com/en/papers/bd3e1105-da91-407a-8b28-4217cd2afedf-batch-normalization-accelerating-deep-network-training-by.md)
- [ProxylessNAS: Direct Neural Architecture Search on Target Task and Hardware](https://refivu.com/en/papers/40299bf6-79d4-4e50-829c-39acb400238f-proxylessnas-direct-neural-architecture-search-on-target.md)
- [The One Hundred Layers Tiramisu: Fully Convolutional DenseNets for Semantic Segmentation](https://refivu.com/en/papers/3c8829cf-0ddd-4bc8-9b7c-cfba6d667b61-the-one-hundred-layers-tiramisu-fully-convolutional.md)
- [Network In Network](https://refivu.com/en/papers/27c629ee-aa61-4496-8fca-b1dbef86d705-network-in-network.md)
- [Improved Techniques for Training GANs](https://refivu.com/en/papers/fa2b409d-90c8-47af-916c-aa43ebfdf357-improved-techniques-for-training-gans.md)

## Other paper commentary

- [Deep Networks with Stochastic Depth](https://refivu.com/en/papers/a740a8af-8c09-4c4a-92ca-ab98a84c56cf-deep-networks-with-stochastic-depth.md)
- [Deep Transfer Learning with Joint Adaptation Networks](https://refivu.com/en/papers/a47a8c83-de4b-469b-a9c2-9df2e72bbd27-deep-transfer-learning-with-joint-adaptation-networks.md)
- [A Structured Self-attentive Sentence Embedding](https://refivu.com/en/papers/a8cbdabb-c63d-415b-8edf-e85be94428b8-a-structured-self-attentive-sentence-embedding.md)
- [Meta-Learning in Neural Networks: A Survey](https://refivu.com/en/papers/c729f50c-a819-4d71-934d-d46e25ac8859-meta-learning-in-neural-networks-a-survey.md)
- [YOLOv12: Attention-Centric Real-Time Object Detectors](https://refivu.com/en/papers/1b328616-dcc0-4c66-b27e-453b2482a00d-yolov12-attention-centric-real-time-object-detectors.md)
- [Self-Normalizing Neural Networks](https://refivu.com/en/papers/a058a6ec-aa7c-4607-896a-7c88369c2618-self-normalizing-neural-networks.md)
- [Self-critical Sequence Training for Image Captioning](https://refivu.com/en/papers/04b028af-36f0-4ffd-b470-072e66a024c9-self-critical-sequence-training-for-image-captioning.md)
- [Bilinear CNNs for Fine-grained Visual Recognition](https://refivu.com/en/papers/6ca2f2f1-4711-4b74-898b-dcb3662ffa1f-bilinear-cnns-for-fine-grained-visual-recognition.md)
- [Time Series Forecasting With Deep Learning: A Survey](https://refivu.com/en/papers/780d7359-7e46-4268-a1a4-b0f1171c7abd-time-series-forecasting-with-deep-learning-a-survey.md)
- [Scaling Up Visual and Vision-Language Representation Learning With Noisy Text Supervision](https://refivu.com/en/papers/fe9f3871-e0e0-4933-a807-febf612d4db8-scaling-up-visual-and-vision-language-representation.md)
- [EuroSAT: A Novel Dataset and Deep Learning Benchmark for Land Use and Land Cover Classification](https://refivu.com/en/papers/6d2c7153-052d-419e-be70-b7562167c83a-eurosat-a-novel-dataset-and-deep-learning-benchmark.md)
- [Tacotron: Towards End-to-End Speech Synthesis](https://refivu.com/en/papers/6c1ac20e-aefe-488b-af41-213ae484f317-tacotron-towards-end-to-end-speech-synthesis.md)

## Terms in this paper

- [MNIST](https://refivu.com/en/terms/28b9bb66d1c6-mnist)
- [dropout](https://refivu.com/en/terms/db73f75bbdd3-dropout)
- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [Batch Normalization](https://refivu.com/en/terms/2b3e5f8509f6-batch-normalization)
- [CNN](https://refivu.com/en/terms/06880f5198e6-cnn)
- [deep neural networks](https://refivu.com/en/terms/c5e1efb0ea81-deep-neural-networks)
- [MLP](https://refivu.com/en/terms/80d2a9115406-mlp)
- [test error rate](https://refivu.com/en/terms/e48f5abd37a3-test-error-rate)
- [BinaryConnect](https://refivu.com/en/terms/eb1bfe3fbdad-binaryconnect)
- [hard sigmoid](https://refivu.com/en/terms/c2959486b5a3-hard-sigmoid)
- [L2-SVM](https://refivu.com/en/terms/c59e31f65384-l2-svm)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/50c59bf6-7b51-443a-b99a-d2bbc087f3e9-binaryconnect-training-deep-neural-networks-with-binary)
