TL;DR
This paper introduces a novel 4-bit quantization technique for Shampoo, a powerful but memory-hungry optimizer for deep learning. By quantizing Cholesky factors of Shampoo's preconditioners and incorporating error feedback, they significantly reduce memory usage while maintaining competitive performance, enabling larger models to be trained on existing hardware.
What Problem Does This Paper Address?
Training increasingly large deep learning models has led to a demand for more efficient optimization algorithms. While methods like Shampoo offer theoretical and practical advantages in convergence speed due to their full-matrix preconditioning, they come with a substantial memory overhead. This makes them impractical for many large-scale applications. Existing attempts to reduce this memory footprint through quantization often lead to significant performance degradation due to information loss. This paper aims to bridge this gap by developing a memory-efficient 4-bit Shampoo that preserves optimization quality.
Methods
The core of this work lies in two key innovations for compressing Shampoo's preconditioners:
- Cholesky Quantization (CQ): Instead of directly quantizing the full preconditioner matrices (L and R), the authors first apply a Cholesky decomposition to obtain their lower triangular factors. These factors require roughly half the storage of the original matrices. They then quantize these Cholesky factors to 4-bit precision. This approach is novel, as prior work has not applied quantization to Cholesky factors of preconditioners.
- Error Feedback (EF): To further mitigate the information loss from quantization, an error feedback mechanism is introduced. This mechanism captures quantization errors from previous steps and uses them to compensate for current errors, improving the accuracy of the reconstructed preconditioners. The triangular structure of the Cholesky factors allows for efficient joint storage of the factor and its error state.
The paper also provides theoretical convergence guarantees for their quantized Shampoo in both smooth and non-smooth nonconvex settings.
Datasets
The paper evaluates their proposed method on several standard image classification datasets:
- CIFAR-100
- Tiny-ImageNet
- ImageNet
They also conduct experiments on large language model (LLM) pre-training using the:
- C4 dataset
Key Insights and Ideas
- Cholesky factors are a better target for quantization: Decomposing preconditioners into Cholesky factors and quantizing these factors is more effective than directly quantizing the full matrices. This is because Cholesky factors are lower triangular, reducing the number of parameters, and their structure better preserves the spectral properties crucial for optimization stability.
- Error feedback is crucial for maintaining performance: Quantization inherently introduces information loss. The proposed error feedback mechanism effectively compensates for this loss, leading to significant performance improvements compared to vanilla 4-bit quantization.
- Memory savings enable larger models: The substantial reduction in memory footprint allows for training larger models that would otherwise exceed GPU memory limits, as demonstrated with LLaMA-1B.
- Theoretical guarantees are essential: Providing convergence proofs for the quantized optimizer in both smooth and non-smooth settings adds significant credibility and theoretical grounding to the practical improvements observed.
Key Results
- Significant Memory Reduction: The 4-bit Shampoo with Cholesky quantization and error feedback (CQ+EF) reduces peak memory usage substantially compared to 32-bit Shampoo. For example, on ResNet-34 with SGDM, it reduces memory by over 540MB (more than 28%).
- Competitive Test Accuracy: The proposed method achieves test accuracy comparable to, and often better than, vanilla 4-bit Shampoo and closely matches 32-bit Shampoo. For instance, on ResNet-34 (CIFAR-100) with SGDM, CQ+EF achieves 80.52% accuracy, outperforming vanilla 4-bit Shampoo (79.45%) and nearing 32-bit Shampoo (80.69%).
- Improved Performance over Vanilla Quantization: CQ+EF consistently outperforms vanilla 4-bit quantization (VQ) across various models and datasets. For example, on ViT-Small (Tiny-ImageNet) with AdamW, CQ+EF achieves 62.81% accuracy compared to 61.28% for VQ.
- Enabling Larger Models: The memory efficiency allows training of models like LLaMA-1B, which would exceed 80GB GPU memory with 32-bit Shampoo.
- Theoretical Convergence: The paper proves optimal convergence rates for smooth nonconvex losses and global convergence to stationary points for non-smooth nonconvex losses.
Limitations and Future Work
- Shampoo-Specific: The current work focuses on Shampoo. The authors suggest that their CQ and EF techniques could be applicable to other preconditioned methods, which is a promising direction for future research.
- Limited Domains: Experiments were primarily conducted on image classification and LLM pre-training. Future work could explore the application of these techniques to other domains like detection, video generation, and large-scale fine-tuning.
Summary updated