VQ4ALL: Efficient Neural Network Representation via a Universal Codebook

Juncan Deng, Shuaiting Li, Zeyu Wang, Hong Gu, Kedong Xu, Kejie HuangarXiv 2024

Abstract

The rapid growth of large neural network models necessitates lightweight representation methods. Traditional Vector Quantization (VQ) achieves high compression by sharing codewords but typically requires a unique codebook for every layer, leading to memory bottlenecks and complex hardware requirements. We propose VQ4ALL, a bottom-up approach that shares a single universal codebook across multiple neural networks. By utilizing Kernel Density Estimation (KDE) to extract global weight patterns and a Progressive Network Construction (PNC) strategy to update differentiable assignments, VQ4ALL achieves compression rates exceeding 16× while preserving high accuracy. This method significantly reduces memory I/O and enables efficient hardware implementation by storing static code tables in built-in ROM.

Introduction

Deploying modern neural networks on resource-constrained edge devices, such as smartphones and IoT sensors, is hindered by their massive size. While traditional VQ techniques compress models by representing weight sub-vectors with indices from a codebook, the "top-down" nature of per-layer codebook generation creates two major issues: high latency from frequent memory access and hardware incompatibility due to varying weight "alphabets" across models. VQ4ALL addresses these by identifying a common weight representation that works across diverse architectures.

Methods: The VQ4ALL Framework

The VQ4ALL framework shifts the paradigm from per-layer optimization to a global, bottom-up construction process.

The VQ4ALL framework: From universal codebook extraction via KDE to progressive network construction across various tasks.

Universal Codebook via KDE

Instead of per-model K-means clustering, VQ4ALL samples weight sub-vectors from various architectures (e.g., ResNet, MobileNet, Stable Diffusion). Kernel Density Estimation (KDE) models the global distribution of these weights, allowing for the creation of a single, frozen "Universal Codebook." This static codebook can be permanently stored in a chip's ROM, eliminating the need for per-layer loading.

Differentiable Assignments and PNC

To map original weights to the universal codebook, the framework uses a soft-assignment approach during fine-tuning. To prevent the "network collapse" typically associated with moving from soft to hard (one-hot) assignments, the authors introduced Progressive Network Construction (PNC). PNC gradually freezes assignments to their optimal codewords once they exceed a confidence threshold, allowing the remaining network parameters to adapt incrementally.

Experimental Evaluation

VQ4ALL was evaluated across several standard benchmarks, including ImageNet for classification (ResNet, MobileNet), MS COCO 2017 for object detection (Mask R-CNN), and COCO Prompts for image generation (Stable Diffusion v1-4).

Key Results

Experimental results demonstrate that VQ4ALL maintains high accuracy even at extreme compression levels.

Performance comparison of VQ4ALL against state-of-the-art compression methods on ImageNet for ResNet-18 and ResNet-50.
  • Extreme Compression: The method achieves over 16× compression with minimal accuracy loss. In challenging 1-bit and 2-bit scenarios, VQ4ALL significantly outperforms state-of-the-art methods like DKM, particularly on compact models like MobileNet-V2.
  • I/O Efficiency: By utilizing a universal codebook, the system reduces codebook-related memory access by over 500× compared to traditional per-layer VQ methods.
  • Generative Quality: In Stable Diffusion tests, 2-bit VQ4ALL produced images visually indistinguishable from the floating-point baseline, whereas competing methods often produced significant artifacts.

Conclusion

VQ4ALL demonstrates that weights across vastly different architectures share enough commonality to be represented by a single, universal "alphabet." By combining KDE-based codebook generation with a stable progressive construction strategy, VQ4ALL offers a hardware-friendly path toward extreme model compression. Future work will focus on integrating activation quantization to achieve a fully low-bit inference pipeline.

Summary updated

BibTeX
@misc{deng2024vq,
  author = {Juncan Deng and Shuaiting Li and Zeyu Wang and Hong Gu and Kedong Xu and Kejie Huang},
  title = {{VQ4ALL: Efficient Neural Network Representation via a Universal Codebook}},
  year = {2024},
  eprint = {2412.06875},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.06875},
}
Figure