TL;DR
Bayesian Bits introduces a unified, gradient-based framework for joint mixed-precision quantization and pruning in neural networks. By recursively decomposing the quantization operation into power-of-two residual additions controlled by stochastic gates, the method learns hardware-friendly bit-widths and structural sparsity end-to-end using variational inference.
What Problem Does This Paper Address?
Deploying deep neural networks to edge devices requires compression techniques like quantization (reducing operand bit-widths) and pruning (removing redundant weights or channels). While mixed-precision quantization—assigning different bit-widths to different layers—delivers better accuracy-efficiency trade-offs than static uniform quantization, it presents significant hurdles:
- Hardware compatibility: Most commercial hardware accelerators exclusively accelerate power-of-two bit-widths (e.g., 2, 4, 8, or 16 bits). Existing gradient-based search methods often learn continuous bit-widths that must be rounded up, losing efficiency gains.
- Exponential search space: Reinforcement learning or architecture search approaches can find discrete bit assignments, but they are computationally expensive.
- Disjoint pipelines: Quantization and pruning are traditionally treated as separate optimization problems rather than unified operations.
Methods
Bayesian Bits tackles these challenges with a mathematical formulation of quantization and variational gate optimization:
- Residual Quantization Decomposition: A uniform quantizer is decomposed into a base 2-bit quantizer followed by a sequence of residual quantizers that double the effective precision at each step (e.g., $2 \to 4 \to 8 \to 16 \to 32$ bits). Each level quantizes the residual error of the previous level using step sizes derived such that adding the quantized residual exactly produces the next power-of-two fixed-point grid.
- Unified Pruning and Quantization via Gating: Binary stochastic gates ($z_b \in \{0, 1\}$) control whether higher-order residuals are added. Crucially, a gate $z_2$ controls the initial 2-bit allocation: switching off $z_2$ zeroes out the output, treating pruning as "0-bit quantization." Gating groups of weights enables structured channel pruning.
- Bayesian Gate Learning: Gate configurations are formulated as an autoregressive variational inference problem. An inactive lower-order bit automatically forces higher-order bits off. A sparsity-inducing prior assigns penalties proportional to each gate's marginal Bit Operations (BOPs) cost.
- Continuous Optimization: The discrete gates are relaxed during training using the Hard-Concrete distribution, permitting backpropagation via the reparameterization trick. Model weights are trained using the Straight-Through Estimator (STE), and clipping ranges are parameterized using PACT.
Datasets
The authors evaluate Bayesian Bits on standard computer vision benchmarks across multiple architectures:
- MNIST with LeNet-5.
- CIFAR-10 with VGG-7.
- ImageNet (ILSVRC 2012) with ResNet-18 and MobileNetV2.
No new datasets were introduced. All layers (including first and last layers, which prior works often keep in high precision) were subjected to learned bit-widths and pruning.
Key Insights and Ideas
- Exact fixed-point equivalence: Unlike generic residual vector quantization, the specific choice of grid step sizes ($s_b = \frac{s_{b/2}}{2^{b/2} + 1}$) guarantees that summing gated residuals yields valid standard fixed-point representations at power-of-two precisions.
- Hierarchical conditioning avoids over-regularization: Conditioning higher-bit gates on lower-bit gates matches their multiplicative dependencies in the forward pass, ensuring high-precision bits are not penalized when the underlying layer is already pruned.
- Synergy of joint pruning and quantization: Ablation studies show that searching across mixed precisions and channel pruning jointly yields a significantly superior Pareto front compared to performing either mixed-precision quantization or pruning in isolation.
Key Results
- CIFAR-10: Bayesian Bits achieved 93.23% accuracy at only 0.51% of full-precision (FP32) Bit Operations (GBOPs), outperforming Differentiable Quantization baselines (91.59% accuracy at 0.54% GBOPs).
- MNIST: Bayesian Bits compressed LeNet-5 to 0.36% of baseline GBOPs while maintaining 99.30% accuracy.
- ImageNet (ResNet-18 & MobileNetV2): Bayesian Bits dominated static quantization baselines (such as fixed 4-bit and 8-bit networks from LSQ, PACT, and TQT) across the accuracy-vs-BOPs curve.
- Post-Training Mixed Precision: When freezing pre-trained weights and optimizing only gates and clipping parameters on a small calibration set, Bayesian Bits matched or outperformed iterative greedy sensitivity-based baselines.
Limitations and Future Work
- Training memory and compute footprint: Evaluating multiple residual stages requires computing multiple intermediate error tensors per layer. Mitigating memory overhead with gradient checkpointing led to an approximate 2× training slowdown (~70 hours for ResNet-18 on an Nvidia Tesla V100).
- Proxy metric limitations: The paper optimizes for Bit Operations (BOPs). While BOP count is a standard hardware-agnostic theoretical proxy, it does not guarantee proportional latency or energy reductions on specific off-the-shelf accelerators.
- Model behavior and fairness: The authors note that aggressively compressed networks can alter performance non-uniformly across individual output classes, an issue requiring further fairness auditing.
Summary updated