Two-Step Quantization for Low-Bit Neural Networks

Peisong Wang, Qinghao Hu, Yifan Zhang, Chunjie Zhang, Yang Liu, Jian Cheng

Introduction

Deep Neural Networks (DNNs) have achieved remarkable success in computer vision, but their high computational and memory requirements hinder deployment on resource-constrained edge devices. Quantization, which reduces weight and activation precision to low-bit representations (e.g., 1 or 2 bits), offers a solution by replacing floating-point multiplications with efficient bitwise operations. However, quantizing below 4 bits typically results in a significant "accuracy gap."

This paper identifies the "tight coupling" of weight and activation quantization during training as a primary cause of this performance degradation. To address this, we propose Two-Step Quantization (TSQ), a framework that decouples activation quantization from weight quantization, enabling low-bit models to achieve near-full-precision accuracy.

Methodology

The TSQ framework splits the quantization process into two sequential stages to simplify the optimization landscape.

Step 1: Code Learning via Sparse Quantization

In the first stage, weights are maintained in full precision while activations are quantized. This stage introduces Sparse Quantization (SQ), motivated by the observation that large activations in ReLU-based networks carry the most critical information. By applying a threshold, small activations are zeroed out, and only the most significant signals are quantized. This process generates high-quality "codes" (quantized activations) that serve as targets for the subsequent step.

Table 1: Impact of activation sparsity on AlexNet performance during the Code Learning stage.

As shown in Table 1, increasing sparsity up to approximately 62.5% (SQ-2) actually improves the Top-1 accuracy of the quantized codes, demonstrating that sparsity can enhance the resolution of low-bit representations by focusing on high-value signals.

Step 2: Transformation Function Learning

Once the optimal codes are established, the second stage fixes these targets and optimizes low-bit weights to reconstruct them. This is treated as a non-linear least-squares regression problem.

  • Optimal Ternary Weights Approximation (OTWA): A specialized algorithm used to initialize ternary weights efficiently.
  • Asymmetric Learning: To mitigate error accumulation across layers, each layer is trained to map from the already quantized output of the previous layer to the optimal code of the current layer. This acts as an inherent error-correction mechanism.

Experimental Results

The TSQ framework was evaluated on ImageNet (ILSVRC-12) and CIFAR-10 using AlexNet and VGG-16 architectures.

ImageNet Performance

On ImageNet, AlexNet with ternary weights and 2-bit activations achieved 58.0% Top-1 accuracy. This represents a mere 0.5% drop from the full-precision baseline (58.5%) and a substantial improvement over prior methods like HWGQ (55.8%). Similarly, VGG-16 showed a narrow gap of only 2.0% compared to its full-precision counterpart.

CIFAR-10 Performance

On the CIFAR-10 dataset using a VGG-Small architecture, TSQ demonstrated exceptional performance, even surpassing the full-precision model.

Table 2: Comparison of error rates on CIFAR-10. TSQ achieves lower error than the full-precision baseline.

As seen in Table 2, TSQ with 2-bit activations and ternary weights achieved a 6.51% error rate, compared to 6.82% for the full-precision model. This suggests that low-bit quantization in the TSQ framework can provide a regularizing effect that improves generalization on smaller datasets.

Conclusion

Two-Step Quantization (TSQ) effectively bridges the accuracy gap for low-bit neural networks by decoupling activation and weight optimization. By leveraging sparse quantization and asymmetric learning, TSQ allows models with ternary weights and 2-bit activations to maintain, and sometimes exceed, the performance of full-precision baselines. Future work includes extending this approach to modern architectures like ResNets and exploring hardware-specific implementations to measure real-world power savings.

Summary updated

BibTeX
@inproceedings{wang2018two,
  author = {Peisong Wang and Qinghao Hu and Yifan Zhang and Chunjie Zhang and Yang Liu and Jian Cheng},
  title = {{Two-Step Quantization for Low-Bit Neural Networks}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  doi = {10.1109/cvpr.2018.00460},
}
Figure