TL;DR
Researchers have developed Jointly Learnable Codebooks and Mappings (JLCM), a novel compression technique that shrinks massive deep neural networks (DNNs) by over 7x with minimal accuracy loss. By reimagining how weights are mapped to codebooks and introducing a "proximal" gradient update, they successfully compressed a Llama 7B model down to 2GB, allowing it to run on 5-year-old commodity smartphones.
The Memory Bottleneck in Modern AI
The explosive growth of Large Language Models (LLMs) and advanced computer vision models has a massive downside: their memory footprint. A Llama 7B model requires about 28GB of VRAM just to load in standard precision—far exceeding the capacity of even high-end consumer GPUs (typically 24GB), let alone mobile devices.
While quantization (mapping high-precision numbers to low-precision formats) is the standard solution, the most memory-efficient version—codebook-based quantization—faces two major hurdles:
- The Granularity Problem: Using one codebook per tensor is often too coarse to capture weight diversity, but using multiple codebooks usually requires extra "mapping" data that eats up the memory savings.
- The Optimization Problem: Standard gradient descent is "broken" for discrete mappings. It tends to make weights "jump" to extreme values in a codebook rather than searching for the closest, most logical neighbor.
Introducing JLCM
The authors introduce JLCM to tackle these issues through three key innovations:
- Neuron Re-ordering: Instead of treating a weight matrix as a random block, they group neurons with similar distributions together. This allows them to apply different scales or even different codebooks to different groups without needing extra indices to track which codebook belongs where.
- Joint Learning: Unlike previous methods that optimize codebooks and mappings separately, JLCM optimizes them simultaneously using a small "calibration" dataset (similar to Post-Training Quantization or PTQ).
- Proximal Gradient Update: This is the "secret sauce." In standard backpropagation, the gradient update for a weight index is proportional to the codebook value itself, which favors larger values. JLCM introduces a new gradient definition that favors proximal values (nearby neighbors in the codebook), making the optimization much more stable and effective.
Key Insights and Ideas
Weights are the Bottleneck: The authors demonstrate that weights account for over 94% of a model's memory footprint during inference. This justifies focusing almost exclusively on weight compression to enable on-device deployment.
"Free" Multi-Codebooks: By re-ordering the matrix so similar neurons are contiguous, the "which codebook do I use?" information is implicitly stored in the row index, resulting in zero memory overhead for higher granularity.
Rethinking the Gradient: The realization that standard Straight-Through Estimation (STE) is biased toward extreme values in codebooks led to the development of the proximal update, which is critical for making joint learning work.
Key Results
JLCM achieves state-of-the-art results in extreme compression scenarios across a diverse range of tasks, including ImageNet (ResNet18, ViT b16, MobileNet v2, EfficientNet B0), DiffusionDB, and common-sense reasoning benchmarks:
- Llama 7B: Compressed by a factor of ~7.2x (down to 2GB) while retaining 95% of its original performance. This allows the model to be loaded onto older devices like an iPhone 8 or Samsung Galaxy A10.
- Stable Diffusion: Preserved 99.8% of the original CLIP score while outperforming previous state-of-the-art methods like RED++.
- Superiority at Low Bit-rates: JLCM significantly outperforms popular methods like AdaRound and GPTQ when pushing for high compression ratios (e.g., 5.33x to 7.5x).
Limitations and Future Work
While JLCM is highly effective for memory compression, the authors note that codebook-based methods can sometimes introduce latency overhead on specific hardware that isn't optimized for lookups. Future work could involve hardware-aware optimization to ensure that the memory savings also translate into faster execution. Additionally, while the method uses a small calibration set, exploring a completely data-free version of the joint optimization could further simplify the deployment pipeline.
Summary updated