NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Post-training quantization for re-parameterization via coarse & fine weight splitting

Dawei Yang, Ning He, Xing Hu, Zhihang Yuan, Jiangyong Yu, Chen Xu, Zhe Jiang

TL;DR

This paper introduces the first effective Post-Training Quantization (PTQ) method specifically designed for re-parameterized networks like RepVGG. By using a novel "Coarse & Fine Weight Splitting" (CFWS) technique and an optimized KL-divergence metric for activations, the authors reduce the accuracy loss of a quantized RepVGG-A1 model to a mere 0.3%, enabling efficient deployment without the need for expensive retraining.

What Problem Does This Paper Address?

Structural re-parameterization has become a "cheat code" for computer vision. It allows researchers to train complex, multi-branch models (which converge better) and then fuse them into simple, lightning-fast single-branch structures (like a plain 3x3 convolution) for inference.

However, there is a major catch: these fused models are notoriously difficult to quantize. While a standard RepVGG-A1 model achieves 74.5% accuracy in floating-point (FP32), its accuracy plummets to 61.7% when converted to 8-bit integers (INT8) using standard post-training quantization. Previously, the only way to fix this was through Quantization-Aware Training (QAT), which requires the original training pipeline, full datasets, and significant GPU time. This paper aims to bridge that gap, providing a "push-button" PTQ solution that works on already-trained re-parameterized models.

Methods

The authors identify two primary culprits for the accuracy drop: "spiky" weight distributions and outlier-heavy activations. They propose two main solutions:

  1. Coarse & Fine Weight Splitting (CFWS): In a fused 3x3 kernel, the weights from the original 1x1 and identity branches only affect the center pixel. This creates a massive disparity: the center weight has a huge dynamic range, while the surrounding eight weights are much smaller. Standard quantization "stretches" its range to accommodate the center, effectively "squashing" the precision of the surrounding weights to zero.

  2. The Fix: They split the weights. First, they perform a "coarse" quantization on just the center weights. Then, they calculate the residual (the error) of that quantization and add it to the surrounding weights. Finally, they perform a "fine" quantization on this combined "union" weight. This two-step approach preserves the importance of the center while maintaining the precision of the surroundings.

  3. Improved KL Metric for Activations: The authors observed that many large activation values are actually "outliers" that don't contribute much to accuracy. They developed an improved calibration metric based on Kullback-Leibler (KL) divergence. To avoid numerical instability common in standard KL implementations, they transformed the formula into a log-difference space and fused the ReLU activation into the distribution analysis to better determine the optimal clipping range.

Datasets

The researchers evaluated their approach on two industry-standard benchmarks:

  • ImageNet: Used for image classification, specifically testing various sizes of the RepVGG architecture (A0, A1, and B1).
  • MS COCO: Used for object detection to demonstrate the generalization of the method, specifically testing YOLOv6-tiny and YOLOv6-small.
  • Calibration: Notably, the method only requires 32 unlabeled images for calibration, making it highly practical for scenarios where data is scarce or private.

Key Insights and Ideas

  • The "Center Weight" Bottleneck: The most significant "aha moment" is the realization that the structural fusion process inherently creates a weight distribution that is hostile to uniform quantization. The identity branch is essentially a "1" in the center of a sea of "0s," which wreaks havoc on Min-Max scaling.
  • Clipping is a Virtue: In activation quantization, the paper shows that "more data" isn't always better. By aggressively clipping outliers that are insensitive to the network's final output, they can narrow the quantization range and significantly reduce rounding errors for the majority of the data.
  • Decoupling Research from Deployment: By enabling PTQ for these models, the authors allow AI researchers to focus on building the best FP32 models possible without worrying about how the quantization team will handle the deployment later.

Key Results

The results are a massive leap over "vanilla" PTQ:

  • RepVGG-A1: Jumped from 61.7% (standard PTQ) to 74.2% (Ours), nearly matching the FP32 baseline of 74.5%.
  • RepVGG-B1: Improved from a broken 54.6% to a robust 75.7%.
  • Efficiency: Compared to 16-bit quantization (which is often used when 8-bit fails), the proposed 8-bit method achieved higher accuracy while using roughly 3.6x fewer Bit Operations (BOPs).
  • Object Detection: On YOLOv6s, the method achieved 43.0% mAP, losing only 0.8% compared to the floating-point version, significantly outperforming standard TensorRT quantization.

Limitations and Future Work

While the paper provides a robust solution for 3x3 convolutional kernels (the bread and butter of RepVGG and YOLO), it focuses primarily on these structures.

  • Kernel Geometry: The CFWS method is specifically tailored to the way 1x1 and identity branches map onto 3x3 kernels. Extending this to more exotic re-parameterization shapes (like those used in some Large Kernel designs) might require further adjustments.
  • Hardware-Specific Implementation: While the authors use "BOPs" as a hardware-agnostic metric, the actual speedup on specific edge NPU (Neural Processing Unit) architectures would depend on how those chips handle the split-weight arithmetic.

The authors suggest that their work opens the door for PTQ to be applied to an even wider variety of complex, structurally-fused architectures in the future.

Summary updated

BibTeX
@article{yang2024post,
  author = {Dawei Yang and Ning He and Xing Hu and Zhihang Yuan and Jiangyong Yu and Chen Xu and Zhe Jiang},
  title = {{Post-training quantization for re-parameterization via coarse \& fine weight splitting}},
  journal = {J. Syst. Archit.},
  year = {2024},
  url = {https://openreview.net/forum?id=HYNSwxOZKv},
}
Figure