DeepCABAC: Context-adaptive binary arithmetic coding for deep neural network compression

Simon Wiedemann, Heiner Kirchhoffer, Stefan Matlage, Paul Haase, Arturo Marbán, Talmaj Marinc, David Neumann, Ahmed Osman, Detlev Marpe, Heiko Schwarz, Thomas Wiegand, Wojciech SamekarXiv 2019

Abstract

Deep neural networks (DNNs) are often too large for deployment on resource-constrained devices. This paper introduces DeepCABAC, a compression framework that applies Context-Adaptive Binary Arithmetic Coding (CABAC)—a cornerstone of modern video standards—to DNN weights. By combining a novel binarization scheme, context modeling, and rate-distortion optimization based on weight robustness, DeepCABAC achieves state-of-the-art compression ratios without requiring expensive fine-tuning. For instance, it compresses VGG16 by 63.6x with no loss in accuracy.

Introduction

The massive memory and storage requirements of deep learning models present significant hurdles for mobile deployment, energy efficiency, and low-bandwidth transmission in federated learning. While sparsification (pruning) is a common research focus, the subsequent stages of quantization and entropy coding are frequently treated as independent, suboptimal steps. DeepCABAC bridges this gap by creating a unified compression pipeline that leverages the sophisticated entropy coding techniques perfected in the video compression community.

Methodology

DeepCABAC is built upon three primary pillars designed to maximize coding efficiency for neural network parameters.

Binarization and Context Modeling

The algorithm first converts weights into a series of binary decisions, or "bins." This custom binarization scheme sequentially checks for zero-valued weights, sign, and magnitude relative to specific thresholds. Unlike static coding schemes like Huffman coding, DeepCABAC employs context modeling to estimate the probability of each bit based on local data statistics. As the coder processes more weights, it dynamically adapts its internal probability models, leading to higher compression efficiency.

The binarization scheme used in DeepCABAC to convert weights into binary bins.

Weighted Rate-Distortion Optimization

A key innovation is the coupling of quantization with the actual coding process. DeepCABAC minimizes a cost function that balances distortion and bit-rate:

$$ \text{cost} = \eta_i(\text{distortion}) + \lambda(\text{bit-rate}) $$

The bit-rate ($R$) is determined by the CABAC coder itself, ensuring the quantization is optimized for the specific entropy coder. Furthermore, the algorithm uses a Bayesian approach to estimate the "robustness" ($\eta_i$) of each weight. Sensitive weights are quantized with high precision, while more robust weights are compressed more aggressively.

Experimental Results

The researchers evaluated DeepCABAC across standard benchmarks including ImageNet, CIFAR10, and MNIST, using architectures ranging from LeNet to ResNet50.

Summary of compression results across different models and datasets.

As shown in the results table, DeepCABAC achieves remarkable performance:

  • VGG16 on ImageNet: The model was compressed by 63.6x (from 553.43 MB to 8.7 MB) with 0.0% loss in top-1 accuracy, outperforming previous state-of-the-art methods.
  • ResNet50: Achieved a compression ratio of approximately 17x (5.95% of original size) while maintaining high accuracy.
  • Efficiency: On average, DeepCABAC improved the compression of pre-sparsified networks by 74% compared to existing post-sparsity algorithms.

Key Insights and Discussion

The success of DeepCABAC highlights several critical points:

  1. Cross-Domain Application: Sophisticated entropy coding from video standards is directly applicable to neural weight distributions.
  2. Coupling Quantization and Coding: Measuring the actual bit-rate during quantization, rather than using proxies like entropy, leads to superior trade-offs.
  3. Weight Sensitivity: Implicitly understanding network "brittleness" through Bayesian robustness metrics allows for smarter bit allocation.
  4. No Fine-Tuning: DeepCABAC achieves these results without the costly re-training steps required by many competing methods.

Conclusion

DeepCABAC represents a significant step forward in making deep learning models portable. While it currently relies on pre-processing sparsification, its ability to significantly shrink models without accuracy loss is a powerful tool for edge deployment. Future work may explore its integration into non-sparsified networks or its application in reducing communication overhead for federated learning.

Summary updated

BibTeX
@misc{wiedemann2019deepcabac,
  author = {Simon Wiedemann and Heiner Kirchhoffer and Stefan Matlage and Paul Haase and Arturo Marbán and Talmaj Marinc and David Neumann and Ahmed Osman and Detlev Marpe and Heiko Schwarz and Thomas Wiegand and Wojciech Samek},
  title = {{DeepCABAC: Context-adaptive binary arithmetic coding for deep neural network compression}},
  year = {2019},
  eprint = {1905.08318},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1905.08318},
}
Figure