Deep Convolutional Neural Network Inference with Floating-point Weights and Fixed-point Activations

Liangzhen Lai, Naveen Suda, Vikas ChandraarXiv 2017

Abstract

Deep convolutional neural network (CNN) inference requires significant amount of memory and computation, which limits its deployment on embedded devices. To alleviate these problems to some extent, prior research utilize low precision fixed-point numbers to represent the CNN weights and activations. However, the minimum required data precision of fixed-point weights varies across different networks and also across different layers of the same network. In this work, we propose using floating-point numbers for representing the weights and fixed-point numbers for representing the activations. We show that using floating-point representation for weights is more efficient than fixed-point representation for the same bit-width and demonstrate it on popular large-scale CNNs such as AlexNet, SqueezeNet, GoogLeNet and VGG-16. We also show that such a representation scheme enables compact hardware multiply-and-accumulate (MAC) unit design. Experimental results show that the proposed scheme reduces the weight storage by up to 36% and power consumption of the hardware multiplier by up to 50%.

Introduction

Deploying Deep Convolutional Neural Networks (CNNs) on embedded devices like smartphones or IoT sensors is a massive challenge due to their heavy memory and computational requirements. To save space and power, engineers typically "quantize" these networks, converting 32-bit floating-point numbers into shorter fixed-point integers (e.g., 8-bit).

However, fixed-point representation has a major flaw: inconsistency. A bit-width that works perfectly for one network might cause another to fail completely. This phenomenon, often called the "Accuracy Cliff," is illustrated in Figure 5, where different models exhibit sharp drop-offs in accuracy at different bit-widths. Even within the same network, different layers often require different levels of precision. This forces hardware designers to over-provision their chips for the "worst-case" bit-width, leading to wasted area and power.

Normalized accuracy vs. fixed-point bit-width, showing the "accuracy cliff" for different CNN architectures.

Proposed Hybrid Representation

The authors propose a hybrid representation scheme for inference:

  1. Weights: Represented using a custom floating-point format (sign, mantissa, and exponent).
  2. Activations: Represented using standard fixed-point format.

The primary reason fixed-point fails at low bit-widths isn't a lack of precision, but a lack of dynamic range. Some layers have weight distributions concentrated around very small values that fixed-point simply rounds to zero. Floating-point’s exponent allows it to "zoom in" on these small values, providing the necessary range.

Hardware Implementation

Usually, floating-point math is expensive. However, when multiplying a floating-point weight by a fixed-point activation, a full-blown floating-point unit is unnecessary. Instead, a small fixed-point multiplier handles the weight's mantissa and the activation, followed by a barrel shifter to apply the weight's exponent. This architecture, shown in Figure 1, is significantly more efficient than a standard fixed-point multiplier of equivalent range.

Hybrid MAC unit architecture for floating-point weights and fixed-point activations.

The study also explores the "implicit bit" trick from IEEE 754. Interestingly, for very low bit-widths, removing the implicit bit actually improves accuracy because it allows the network to represent much smaller numbers.

Experimental Evaluation

The researchers evaluated their approach using four popular large-scale CNN models: AlexNet, SqueezeNet, GoogLeNet, and VGG-16. These pre-trained models were quantized using the proposed scheme to measure accuracy degradation without any retraining.

Key Results

  • Weight Storage: The proposed scheme achieves the same accuracy as an 11-bit fixed-point representation using only 7 or 8 bits of floating-point data, resulting in a 36% reduction in storage.
  • Power Efficiency: The hybrid multiplier/shifter hardware design reduces power consumption by up to 50% compared to a standard 8x8 fixed-point multiplier.
  • Zero Retraining: Unlike many quantization techniques that require fine-tuning, this method works directly on pre-trained models.
  • Hardware Consistency: Because floating-point naturally adapts to different weight distributions, a single hardware design can support a wide variety of CNNs, solving the "future-proofing" problem for chip designers.

Conclusion and Future Work

This hybrid approach offers a "best of both worlds" strategy for efficient CNN inference. While this study focused on weight representation with 16-bit fixed-point activations, future work could explore reducing activation bit-width. Additionally, investigating how different network topologies influence optimal number representation remains an open area for research. This work demonstrates that focusing on dynamic range through floating-point weights can significantly improve the efficiency of embedded AI deployments.

Summary updated

BibTeX
@misc{lai2017deep,
  author = {Liangzhen Lai and Naveen Suda and Vikas Chandra},
  title = {{Deep Convolutional Neural Network Inference with Floating-point Weights and Fixed-point Activations}},
  year = {2017},
  eprint = {1703.03073},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1703.03073},
}
Figure