Toward Compact Parameter Representations for Architecture-Agnostic Neural Network Compression

Yuezhou Sun, Wenlong Zhao, Lijun Zhang, Xiao Liu, Hui Guan, Matei ZahariaarXiv 2021

TL;DR

This paper introduces AQCompress, a novel method for compressing deep neural networks (DNNs) by treating their parameters as unstructured data and learning architecture-agnostic, shared representations. This approach achieves significant compression ratios with minimal or no accuracy loss, outperforming traditional pruning methods and opening new avenues for efficient on-device AI.

What Problem Does This Paper Address?

Deploying powerful deep neural networks (DNNs) on resource-constrained devices like mobile phones and IoT devices is a major challenge due to their large model sizes. While existing compression techniques like pruning and quantization exist, they often preserve the one-to-one mapping between parameters and network architectures. This paper tackles the problem of efficiently representing and storing DNN parameters by exploring the largely overlooked opportunity of cross-layer architecture-agnostic representation sharing. The core idea is to decouple parameters from their specific network structure and find common patterns across different layers, enabling more compact storage.

Methods

The proposed method, AQCompress, employs a four-step pipeline:

  1. Parameter Matrix Composition: DNN parameters are first decoupled from their architectures and reshaped into a single, large parameter matrix. This treats the parameters as unstructured data, making them amenable to general compression techniques.
  2. Learning Compositional Representations: Additive Quantization (AQ), a lossy compression method originally for image descriptors, is used to learn compact code representations. These representations consist of discrete codes and shared codebooks. An encoder learns to project parameter "pages" (rows of the matrix) into activations, which are then converted into probability distributions. A decoder uses these distributions and shared codebooks to reconstruct the parameter pages.
  3. Code Representations and Space-Efficiency: The discrete codes are further compressed using Huffman coding. To enhance Huffman coding's effectiveness, the basis vectors within each codebook are sorted by frequency, creating a more skewed distribution of codes that leads to higher compression.
  4. Codebook Finetuning: The codebook parameters (the trainable parts of the decoder) are finetuned on the specific task objective. This is achieved by backpropagating gradients from the task loss through the reconstructed DNN parameters and into the codebook computational graph, allowing the representations to adapt to the task.

Datasets

The paper evaluates AQCompress on several standard datasets:

  • Image Classification: CIFAR-10, CIFAR-100, and ImageNet (ILSVRC-2012).
  • Object Detection, Keypoint Detection, and Panoptic Segmentation: COCO dataset.

The authors use pre-trained models and standard training procedures for these tasks.

Key Insights and Ideas

  • Architecture-Agnostic Compression: The most significant insight is that DNN parameters can be compressed effectively by treating them as unstructured data, independent of their original network architecture. This opens up a new paradigm for compression.
  • Cross-Layer Representation Sharing: The paper demonstrates that representation sharing is not limited to within a layer but frequently occurs across different network layers. This is a novel observation that challenges the traditional view of layer-wise compression.
  • Global vs. Local Compression: Learning shared representations for the entire DNN leads to better size-accuracy trade-offs compared to compressing the model as multiple separate parts. This suggests that a more global approach to parameter representation is beneficial.
  • Complementary to Pruning: AQCompress can effectively compress parameters from already pruned networks, indicating it can complement existing pruning techniques.

Key Results

  • ResNet-50 on ImageNet: Achieved a 7.2x compression ratio with no accuracy loss and a 15.3x compression ratio with only a minor accuracy drop (from 76.1% to 74.79%).
  • MobileNet-v2 on CIFAR-10: Achieved a 14x compression ratio with no accuracy loss.
  • MobileNet-v2 on CIFAR-100: Achieved an 11x compression ratio with only a 1.31% accuracy loss.
  • Detectron2 Models (Object Detection, etc.): Outperformed unstructured pruning baselines significantly, achieving up to 18x compression with comparable performance loss, while pruning achieved only up to 12x.
  • Basis Vector Sharing: Analysis showed pair-wise sharing factors above 0.6 among different network blocks in ResNet-50, supporting the cross-layer sharing hypothesis.

Limitations and Future Work

  • Limitations: The paper acknowledges that the compression ratios for pruning baselines are likely over-estimated as they don't account for the overhead of storing sparse indices. The current implementation of AQCompress focuses on feedforward parameters.
  • Future Work:
    • Co-design of compression algorithms with hardware-specific system scheduling for real-time inference.
  • Parallelizing the decoding process to accelerate model inference.
  • Exploring how to best learn compact representations, potentially by combining lossy compression with DNN-specific techniques or investigating other lossy compression methods.
  • Extending the approach to other types of parameters (e.g., recurrent connections) or network components.

Summary updated

BibTeX
@misc{sun2021toward,
  author = {Yuezhou Sun and Wenlong Zhao and Lijun Zhang and Xiao Liu and Hui Guan and Matei Zaharia},
  title = {{Toward Compact Parameter Representations for Architecture-Agnostic Neural Network Compression}},
  year = {2021},
  eprint = {2111.10320},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2111.10320},
}
Figure