FBM: Fast-Bit Allocation for Mixed-Precision Quantization

Moshe Kimhi, Tal Rozen, Tal Kopetz, Olya Sirkin, Avi Mendelson, Chaim BaskinarXiv 2022

Abstract

Quantized neural networks are well known for reducing the latency, power consumption, and model size without significant harm to the performance. This makes them highly appropriate for systems with limited resources and low power capacity. Mixed-precision quantization offers better utilization of customized hardware that supports arithmetic operations at different bitwidths. Quantization methods either aim to minimize the compression loss given a desired reduction or optimize a dependent variable for a specified property of the model (such as FLOPs or model size); both make the performance inefficient when deployed on specific hardware, but more importantly, quantization methods assume that the loss manifold holds a global minimum for a quantized model that copes with the global minimum of the full precision counterpart. Challenging this assumption, we argue that the optimal minimum changes as the precision changes, and thus, it is better to look at quantization as a random process, placing the foundation for a different approach to quantize neural networks, which, during the training procedure, quantizes the model to a different precision, looks at the bit allocation as a Markov Decision Process, and then, finds an optimal bitwidth allocation for measuring specified behaviors on a specific device via direct signals from the particular hardware architecture. By doing so, we avoid the basic assumption that the loss behaves the same way for a quantized model. Automatic Mixed-Precision Quantization for Edge Devices (dubbed AMED) demonstrates its superiority over current state-of-the-art schemes in terms of the trade-off between neural network accuracy and hardware efficiency, backed by a comprehensive evaluation.

Introduction

Deep Neural Networks (DNNs) are increasingly deployed on resource-constrained "edge" devices, such as drones and medical sensors. To meet strict power and memory requirements, quantization—reducing weight and activation precision from 32-bit floats to lower-bit integers—has become a standard optimization. However, traditional uniform quantization, which applies the same bit-width to every layer, is often suboptimal. Some layers are inherently more sensitive to noise than others, suggesting that mixed-precision (MP) quantization is a more efficient path.

The challenge lies in the search space: a 50-layer network with four precision options presents $4^{50}$ possible configurations. Furthermore, existing MP methods often rely on "proxy" metrics like FLOPs or model size. This paper argues that these proxies are misleading; actual hardware latency is influenced by complex factors like memory bandwidth and cache behavior that FLOPs fail to capture. We introduce AMED (Automatic Mixed-Precision Quantization for Edge Devices), a framework that rethinks quantization as a stochastic process rather than a static optimization of a full-precision manifold.

Methodology: The AMED Framework

AMED moves away from the assumption that the "loss manifold" of a quantized model mirrors its full-precision counterpart. Instead, it treats bit allocation as a dynamic process where the optimal weights shift as precision changes.

Markovian Bit Allocation and Sampling

The framework models the transition between precision states as a multivariate Markov Chain. To navigate the massive search space, AMED employs a Random Walk Metropolis-Hastings algorithm. This MCMC approach samples and evaluates bit-width configurations based on a quality score, allowing the system to explore the search space efficiently without exhaustive computation.

Hardware-in-the-Loop Optimization

Rather than estimating performance, AMED uses a cycle-accurate hardware simulator (SCALE-Sim) to provide direct feedback. The optimization objective is a non-differentiable function that balances cross-entropy loss (accuracy) against actual simulated latency. This ensures the discovered bit-allocations are tailored to the specific bottlenecks of the target hardware, such as memory-bounded depthwise convolutions.

Typical CNN architecture optimized by AMED, showing varying layer types including Convolution, Pooling, and MLP.

Experimental Results

The framework was evaluated on ImageNet and CIFAR100 using ResNet-18, ResNet-50, and MobileNetV2 architectures. AMED consistently outperformed state-of-the-art methods like HAWQ, LSQ, and HAQ in the accuracy-latency trade-off.

  • ResNet-18: Achieved a 2.6x latency improvement with a negligible 0.23% accuracy drop compared to benchmarks.
  • ResNet-50: Outperformed 4-bit uniform models by 0.2–0.93% in accuracy while simultaneously reducing latency.
  • MobileNetV2: Demonstrated a 1ms latency reduction over the HAQ (Hardware-Aware Quantization) method while maintaining higher accuracy.
Comparison of Top-1 Accuracy vs. Latency (msec) across different quantization methods. AMED (purple) consistently defines the superior Pareto frontier.

Key Insights and Discussion

A primary finding of this work is that hardware specificity matters. AMED produces distinct bit-allocations for the same model depending on the target hardware architecture. This proves that "one size fits all" mixed-precision is a myth. By adjusting a single hyperparameter ($\beta$), users can navigate the trade-off between speed and precision, finding solutions that are both faster and more accurate than previous methods.

Limitations and Future Work

While AMED shows significant promise, current hardware simulators assume optimal data flow and simplified memory hierarchies. Real-world factors like OS overhead or thermal throttling are not yet captured. Future work will focus on integrating AMED with Neural Architecture Search (NAS) to simultaneously optimize network topology and bit-widths for truly "hardware-native" models.

Summary updated

BibTeX
@misc{kimhi2022fbm,
  author = {Moshe Kimhi and Tal Rozen and Tal Kopetz and Olya Sirkin and Avi Mendelson and Chaim Baskin},
  title = {{FBM: Fast-Bit Allocation for Mixed-Precision Quantization}},
  year = {2022},
  eprint = {2205.15437},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2205.15437},
}
Figure