Cross-filter compression for CNN inference acceleration

Fuyuan Lyu, Shien Zhu, Weichen LiuarXiv 2020

Abstract

Convolution neural network demonstrates great capability for multiple tasks, such as image classification and many others. However, much resource is required to train a network. Hence much effort has been made to accelerate neural network by reducing precision of weights, activation, and gradient. However, these filter-wise quantification methods exist a natural upper limit, caused by the size of the kernel. Meanwhile, with the popularity of small kernel, the natural limit further decrease. To address this issue, we propose a new cross-filter compression method that can provide $\sim32\times$ memory savings and $122\times$ speed up in convolution operations. In our method, all convolution filters are quantized to given bits and spatially adjacent filters share the same scaling factor. Our compression method, based on Binary-Weight and XNOR-Net separately, is evaluated on CIFAR-10 and ImageNet dataset with widely used network structures, such as ResNet and VGG, and witness tolerable accuracy loss compared to state-of-the-art quantification methods.

Introduction: The Compact Network Paradox

To deploy Deep Learning on resource-constrained edge devices, researchers typically employ two strategies: Uniform Quantization (reducing bit-precision) and Compact Network Design (using small 1x1 or 3x3 kernels). However, a "Compact Network Paradox" emerges when these methods are combined.

In standard quantization schemes like XNOR-Net, every filter maintains its own floating-point scaling factor to restore dynamic range. As networks become more compact with smaller kernels and higher channel counts, the number of these scaling factors grows linearly. Since multiplying by these factors requires full-precision floating-point math, they eventually become a computational bottleneck, potentially making a "compact" quantized network slower than a "classic" one.

Cross-filter Compression (CFC)

The proposed Cross-filter Compression (CFC) breaks this filter-wise limitation by allowing multiple filters to share a single scaling factor.

Comparison of filter structures: Full precision, standard Binary-Weight (BW), and the proposed BW-CF where scaling factors are shared across groups of filters.

Shared Scaling Factors

Instead of one scaling factor per filter, CFC shares one factor ($\alpha$) across $\beta$ spatially-adjunct filters. This reduces the frequency of full-precision multiplications during inference by a factor of $\beta$. The optimal shared scaling factor ($\alpha^*$) is derived as the mean of the absolute values of all weights across the grouped filters, while binary weights ($B^*$) retain the sign of the original weights.

Example of a quantized filter using cross-filter compression with $\beta=2$ and a shared scaling factor $\alpha=0.75$.

Implementation and Training

CFC can be implemented by training from scratch or by fine-tuning pre-existing binary models. This flexibility makes it highly practical for existing deployment pipelines. The method was integrated into both Binary Weight Networks (BWN) and XNOR-Net architectures for evaluation.

Experimental Evaluation

The researchers evaluated CFC on standard benchmarks including CIFAR-10 (using NIN and VGG-7) and ImageNet (using AlexNet and ResNet-18).

Key Results

  • Acceleration and Compression: Theoretical convolution speedups reached 122× when integrated with XNOR-Net. Model size was reduced by approximately 32×.
  • Accuracy Preservation: On CIFAR-10, accuracy loss was negligible (between -0.3% and 0.4%). On ImageNet with ResNet-18, the BW-CF2 configuration actually improved accuracy by 0.4% over the baseline binary weight network while using fewer scaling factors.
  • Scaling Efficiency: CFC-16 (sharing a factor across 16 filters) maintained competitive accuracy while achieving a 16× reduction in scaling-related multiplications.

Conclusion

Cross-filter Compression addresses the overhead bottleneck in quantized compact networks. By exploiting the numerical similarity of scaling factors within layers, CFC achieves significant speedups and memory savings with minimal impact on accuracy. Future work may explore automated grouping strategies to fully realize these theoretical gains on diverse hardware.

Summary updated

BibTeX
@misc{lyu2020cross,
  author = {Fuyuan Lyu and Shien Zhu and Weichen Liu},
  title = {{Cross-filter compression for CNN inference acceleration}},
  year = {2020},
  eprint = {2005.09034},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.09034},
}
Figure