Towards Accurate Post-training Network Quantization via Bit-Split and Stitching

Peisong Wang, Qiang Chen, Xiangyu He, Jian Cheng

This paper, presented at ICML 2020, introduces a novel framework for Post-training Quantization (PTQ) that pushes the boundaries of how low we can go with bit-widths without needing to retrain a model from scratch.

TL;DR

The authors propose a Bit-Split and Stitching framework that enables accurate 3-bit and 4-bit network quantization without the need for full-dataset fine-tuning. By treating quantization as a bit-level optimization problem and compensating for activation errors within the weights, they achieve near-original model performance on complex tasks like ImageNet classification and COCO object detection.

The Challenge of Low-Bit Quantization

To run deep learning models efficiently on edge devices (like smartphones or IoT sensors), developers typically "quantize" them—converting 32-bit floating-point (FP32) weights and activations into low-bit integers (like INT8).

There are two primary approaches to quantization:

  1. Quantization-Aware Training (QAT): Highly accurate but requires the full training dataset, massive GPU resources, and significant time.
  2. Post-training Quantization (PTQ): Fast and requires very little data (just a small calibration set), but accuracy usually falls off a cliff once bit-widths drop below 8 bits.

The core challenge addressed by this paper is: How can we achieve the efficiency of PTQ (no retraining) while reaching the low-bit accuracy (3-bit or 4-bit) typically reserved for QAT?

Core Methods

The authors introduce two primary techniques to solve this problem:

1. Bit-Split and Stitching

Instead of simply rounding a floating-point number to the nearest integer, the authors treat quantization as an optimization problem.

The Bit-Split and Stitching Process
  • Bit-Split: They decompose an $M$-bit integer into $(M-1)$ ternary bits (values of $-1, 0, 1$).
  • Bit-Optimization: They iteratively optimize each of these ternary bits alongside a global scaling factor to minimize the squared error between the original FP32 output and the quantized output.
  • Bit-Stitching: Finally, they "stitch" these optimized bits back together into a single integer. This allows the quantized values to represent the original distribution much more accurately than standard rounding.

2. Error Compensated Activation Quantization (ECAQ)

Activations are notoriously harder to quantize than weights because they change dynamically with every input. Standard PTQ often uses a single scale for an entire layer of activations, which can be highly inaccurate since different channels often have wildly different ranges.

Error Compensated Activation Quantization
  • The Trick: The authors use per-channel scaling for activations to reduce error, but then mathematically "absorb" or move those scaling factors into the static weights.
  • The Result: At inference time, the hardware executes a simple per-layer quantization (which is fast and hardware-friendly), but the weights have been pre-adjusted to compensate for the activation quantization error.

Key Insights

  • Quantization as Mapping, Not Just Clipping: Most PTQ methods focus on finding the best "clipping" threshold. This paper argues that quantization is actually a mapping problem from input to output. By optimizing the bits to preserve the output of a convolution, you retain more functional information.
  • The Power of Ternary Decompositions: Splitting bits into ternary values ($-1, 0, 1$) provides a flexible search space that can be solved efficiently using iterative solvers. This is much easier than trying to optimize a discrete $M$-bit integer directly.
  • Zero-Overhead Compensation: The idea of using per-channel activation scaling but mathematically moving that complexity into the static weights is a "free lunch" for inference speed. It provides the accuracy of complex quantization with the hardware efficiency of simple quantization.

Experimental Results

The framework was validated on standard, high-bar benchmarks including ImageNet (classification) and MS COCO (object detection and instance segmentation). The results are particularly impressive for the 3-bit and 4-bit regimes:

  • 3-bit Weights: On ResNet-18, the standard baseline (TF-Lite) collapses to 0.85% accuracy. The Bit-Split method maintains 66.76% (only a ~3% drop from the FP32 original).
  • 4-bit Weights & Activations (A4W4): For ResNet-50, Bit-Split achieves 74.2% top-1 accuracy, significantly outperforming previous state-of-the-art PTQ methods like ACIQ-Mix (73.8%) and far surpassing TF-Lite (10.4%).
  • Generalization: The method works across different architectures (e.g., VGG vs. ResNet) and tasks (Classification vs. Detection) without needing task-specific tweaks.

Limitations and Future Work

  • Calibration Data: While it doesn't need the full dataset, it still requires a small amount of calibration data (e.g., 1024 images). In strictly "data-free" scenarios where no images are available due to privacy, this method would need to be combined with synthetic data generation.
  • Offline Computation: The iterative optimization process (Bit-Optimization) is more computationally expensive than simple rounding during the quantization phase. However, this is a one-time offline cost that doesn't affect the final model's inference speed.
  • Hardware Support: While the paper targets standard integer operations, the "stitched" integers might result in distributions that could benefit from specialized hardware kernels to fully realize the power savings of 3-bit math.

Summary updated

BibTeX
@inproceedings{wang2020towards,
  author = {Peisong Wang and Qiang Chen and Xiangyu He and Jian Cheng},
  title = {{Towards Accurate Post-training Network Quantization via Bit-Split and Stitching}},
  booktitle = {International Conference on Machine Learning},
  year = {2020},
}
Figure