When Compression Meets Model Compression: Memory-Efficient Double Compression for Large Language Models

Weilan Wang, Yu Mao, Dongdong Tang, Hongchao Du, Nan Guan, Chun Jason Xue

Introduction

Large Language Models (LLMs) have revolutionized artificial intelligence but present significant deployment challenges due to their massive memory requirements. Standard model compression techniques, such as 8-bit quantization, reduce a 7-billion parameter model to approximately 7GB of VRAM, which still exceeds the capacity of many edge devices and consumer-grade hardware. To bridge this "memory gap," researchers from the City University of Hong Kong and MBZUAI introduced Double Compression (DC) at EMNLP 2024. This framework combines neural network quantization and pruning with lossless data compression algorithms, achieving a 40% reduction in memory usage beyond standard quantization with minimal impact on performance.

Methodology

The Double Compression (DC) framework operates through a two-stage pipeline designed to maximize compressibility without sacrificing inference speed.

1. Compression-Aware Quantization & Pruning

The first stage involves preparing the model weights for secondary compression. Unlike traditional methods that aim for uniform weight distributions to minimize quantization error, DC intentionally introduces "unevenness."

  • Scaling: Weight channels are scaled based on activation magnitudes. This process increases the presence of outliers, creating a distribution that is more difficult for standard quantization but highly efficient for lossless algorithms.
  • Pruning: By utilizing the $l$-infinite norm of activations, the researchers identify and zero out less significant weights. This increases the sparsity and the frequency of "near-zero" values, further lowering the data's entropy.
Distribution of activations, weights, and scaled weights across model layers.

2. Lossless "Double" Compression

The prepared weights are then processed using a lossless compression algorithm. After evaluating several options including LZ4 and Zstd, the authors selected Asymmetric Numeral Systems (ANS) for its optimal balance between high compression ratios and rapid GPU-based decompression.

3. Speed-Adaptive Partial Compression

To mitigate the latency overhead typically associated with on-the-fly decompression, the authors implemented a speed-adaptive approach. Weights are divided into blocks, and only the final segments of these blocks are compressed. This allows the system to overlap the loading of uncompressed data with the decompression of the remaining chunks, effectively hiding the computational cost.

Experimental Results

The team evaluated the DC framework across multiple architectures, including OPT (up to 13B), Llama2-7b, Falcon-7b, and Mistral-7b, using benchmarks such as HellaSwag, MMLU, and WikiText.

  • Compression Efficiency: The DC-W8A8 (8-bit weight/activation) models achieved an average 2.2x total compression ratio relative to the original FP16 models.
  • Memory and Performance: Actual GPU memory consumption was reduced by 40% compared to standard INT8 quantization. Crucially, the accuracy drop remained under 1% across all tested models.
  • Inference Latency: Due to the speed-adaptive framework and efficient ANS implementation, inference speeds remained comparable to uncompressed quantized models.

Discussion and Future Work

The primary insight of this research is that "unevenness" in weight distribution, often viewed as a hurdle for quantization, is actually a beneficial feature for secondary lossless compression. By pushing more values toward zero and creating predictable patterns, the entropy of the model parameters is significantly reduced.

Future research directions include extending the DC framework to 4-bit (INT4) quantization and exploring finer-grained scaling techniques to further enhance compression ratios. Additionally, optimizing the implementation for diverse hardware architectures remains a key goal for broader deployment.

Citation: Wang, W., Mao, Y., Tang, D., Du, H., Guan, N., & Xue, C. J. (2024). When Compression Meets Model Compression: Memory-Efficient Double Compression for Large Language Models. Findings of the Association for Computational Linguistics: EMNLP 2024.

Summary updated

BibTeX
@inproceedings{wang2024when,
  author = {Weilan Wang and Yu Mao and Dongdong Tang and Hongchao Du and Nan Guan and Chun Jason Xue},
  title = {{When Compression Meets Model Compression: Memory-Efficient Double Compression for Large Language Models}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.988},
}
Figure