MVQ:Towards Efficient DNN Compression and Acceleration with Masked Vector Quantization

Shuaiting Li, Chengxuan Wang, Juncan Deng, Zeyu Wang, Zewen Ye, Zongsheng Wang, Haibin Shen, Kejie Huang · DOI

TL;DR

This paper introduces Masked Vector Quantization (MVQ), a novel DNN compression technique that significantly improves accuracy by prioritizing the quantization of important weights. They also present a hardware accelerator that leverages MVQ to achieve substantial gains in energy efficiency and reduced hardware footprint.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are becoming increasingly powerful but also larger, making them challenging to deploy on resource-constrained edge devices. Traditional compression methods like Vector Quantization (VQ) reduce model size and memory bandwidth but often lead to significant accuracy degradation because they treat all weights equally. This means crucial weights can be poorly approximated, impacting overall model performance. The paper aims to bridge this gap by developing a VQ method that preserves the accuracy of important weights while still achieving high compression ratios.

Methods

The core of the paper is the Masked Vector Quantization (MVQ) approach, which has two main components:

  • Algorithm Level:
    • N:M Pruning: Initially, less important weights are removed using N:M pruning. This creates a sparse model and a mask indicating which weights remain.
  • Masked k-means Clustering: A modified k-means algorithm is used for vector clustering. Crucially, this "masked" version only considers the unpruned weights when calculating distances to codewords and updating them. This prevents unimportant (pruned) weights from negatively influencing the approximation of important ones.
  • Codebook Quantization & Fine-tuning: The resulting codebook is quantized (to 8-bit) for hardware efficiency. The model is then fine-tuned using masked gradients to recover any lost accuracy.
  • Architecture Level:
    • EWS (Enhanced Weight Stationary) CNN Accelerator: The MVQ algorithm is implemented on a custom hardware accelerator based on the EWS dataflow.
  • Sparse Systolic Array Design: The accelerator features a sparse systolic array designed to efficiently handle the sparsity introduced by MVQ, maximizing the benefits of the compression.
  • Assignment-Aware Weight Loading: A specialized unit optimizes the loading of compressed weights (indices and masks) to minimize memory access costs.

Datasets

The paper validates its approach on various standard datasets for different tasks:

  • Image Classification: ImageNet
  • Object Detection: MS COCO 2017
  • Segmentation: Pascal VOC

Key Insights and Ideas

  • Importance of "Important" Weights: The most critical insight is that simply minimizing overall clustering error is suboptimal. Prioritizing the accurate approximation of important weights is paramount for maintaining DNN accuracy during compression.
  • Pruning as a Precursor to VQ: Using N:M pruning before vector quantization is not just for sparsity but also to create a "mask" that guides the VQ process, preventing irrelevant weights from corrupting the codebook.
  • Masked k-means is Key: The "masked" aspect of the k-means algorithm is what allows MVQ to effectively isolate and better approximate important weights by ignoring the pruned ones during clustering.
  • Hardware-Software Co-design Pays Off: The paper demonstrates that a well-designed hardware architecture (EWS with sparse systolic arrays) is essential to fully exploit the benefits of the MVQ compression algorithm, leading to significant efficiency gains.

Key Results

  • Algorithm Performance: MVQ outperforms conventional VQ methods in terms of accuracy at comparable compression ratios and also reduces FLOPs.
  • Hardware Performance (ASIC Evaluation):
    • Boosts energy efficiency by 2.3x compared to the base EWS accelerator.
  • Reduces the size of the systolic array by 55%.
  • Achieves 1.73x higher energy efficiency compared to previous sparse accelerators.
  • Accuracy: Achieves higher accuracy than state-of-the-art methods on models like ResNet-18 and ResNet-50, even with higher compression ratios. For example, on ResNet-50, it achieves 75.2% accuracy at a ~22x compression ratio, a 1.0% improvement over prior work.
  • FLOPs Reduction: Significantly reduces FLOPs, by about 70% for object detection and segmentation tasks.

Limitations and Future Work

  • Pruning Strategy Trade-offs: The paper notes that selecting the optimal pruning strategy involves complex trade-offs between accuracy, mask storage cost, and compression ratio. While they explore different strategies, finding the absolute best for every scenario might require further investigation.
  • Depthwise Convolution Bottleneck: For depthwise convolutions, the benefits of MVQ are less pronounced because the weight-loading process is not the primary bottleneck, and the number of parameters is limited.
  • Future Work: The paper doesn't explicitly detail future work, but the success of MVQ suggests potential for applying it to a wider range of network architectures and tasks, as well as exploring more advanced pruning and quantization techniques in conjunction with MVQ. The hardware-software co-design aspect also opens avenues for further architectural optimizations.

Summary updated

BibTeX
@inproceedings{li2024mvq,
  author = {Shuaiting Li and Chengxuan Wang and Juncan Deng and Zeyu Wang and Zewen Ye and Zongsheng Wang and Haibin Shen and Kejie Huang},
  title = {{MVQ:Towards Efficient DNN Compression and Acceleration with Masked Vector Quantization}},
  booktitle = {Asplos},
  year = {2024},
  doi = {10.1145/3669940.3707268},
}
Figure