8-bit Optimizers via Block-wise Quantization
Proposes 8-bit optimizers with block-wise dynamic quantization, maintaining 32-bit performance while reducing memory by 75%.
Key Findings
Methodology
This paper introduces an 8-bit optimizer leveraging block-wise dynamic quantization, combining non-linear quantization and a stable embedding layer. Gradient statistics are partitioned into small blocks, each independently normalized and quantized, reducing outlier impact. Dynamic quantization adapts to gradient magnitude variations, ensuring stability across training. The stable embedding layer normalizes input token distributions to mitigate gradient variance. Experiments across tasks such as 1.5B language modeling, GLUE, ImageNet, WMT, and RoBERTa show that the 8-bit optimizer matches 32-bit performance, with up to 75% memory savings. The approach requires no hyperparameter tuning and is compatible as a drop-in replacement.
Key Results
- In large-scale language modeling, 8-bit Adam maintains perplexity at 9.0, matching 32-bit results, while saving 8.5GB GPU memory and increasing training speed by 5%. On GLUE, ImageNet, and WMT tasks, accuracy and BLEU scores are comparable to baseline. Ablation studies confirm the necessity of block-wise, dynamic quantization, and stable embedding layers. The method demonstrates robustness across different hardware platforms, with no instability observed.
- For models exceeding 1 billion parameters, the 8-bit optimizer remains stable, avoiding divergence caused by quantization errors. Compared to 16-bit optimizers, it reduces memory footprint by approximately 75% and maintains high performance. Hyperparameter sensitivity analysis shows minimal performance variation, indicating ease of adoption as a plug-and-play replacement.
- Ablation results highlight that block size, dynamic quantization, and the stable embedding layer are critical for stability and performance. The method's simplicity and effectiveness make it suitable for training and fine-tuning large models on limited hardware, opening new avenues for accessible AI development.
Significance
This work addresses the critical bottleneck of optimizer memory consumption in training large models. By compressing optimizer states to 8 bits without performance loss, it enables training of bigger models on resource-constrained hardware, democratizing access to state-of-the-art AI. The approach's compatibility and ease of integration facilitate widespread adoption, potentially transforming large-scale AI research and deployment. It also paves the way for further research into low-bit training, including quantizing activations and gradients, to fully optimize resource utilization.
Technical Contribution
The paper introduces a novel block-wise dynamic quantization scheme that isolates outliers and reduces quantization error. It extends dynamic tree quantization to non-signed data, enabling precise representation of gradient statistics across magnitudes. The stable embedding layer normalizes input token distributions, reducing gradient variance. These innovations collectively allow 8-bit optimizer states to match 32-bit performance, with minimal computational overhead. The implementation leverages custom CUDA kernels for efficient in-register quantization/dequantization, ensuring training speed is maintained or improved.
Novelty
This is the first work to successfully implement stable, high-performance 8-bit optimizers for large-scale training, combining block-wise quantization with non-linear dynamic mechanisms. Unlike prior efforts limited to 16-bit or fixed-point quantization, this approach effectively handles outliers and large gradient variations. The integration of a stable embedding layer further distinguishes this work, enabling robust training without hyperparameter tuning. The method's plug-and-play nature and demonstrated scalability mark a significant advance in optimizer compression.
Limitations
- While effective, the method may still face challenges with highly non-uniform or extreme outlier distributions, potentially affecting stability in some scenarios.
- Block size selection requires tuning; too small or too large blocks can impact accuracy or efficiency.
- The approach primarily targets optimizer states; extending to activations and gradients remains future work, which could further improve compression but adds complexity.
Future Work
Future directions include extending quantization to all training components—activations, gradients, and optimizer states—for full low-bit training. Developing adaptive block sizing and more sophisticated non-linear quantization schemes could enhance robustness. Hardware-aware implementations, such as FPGA or ASIC accelerators optimized for in-register quantization, are also promising. Additionally, exploring quantization-aware training techniques to further improve stability and performance in diverse tasks will be valuable.
AI Executive Summary
Training large neural networks has become increasingly resource-intensive, with optimizer states occupying a significant portion of memory. Traditional optimizers like Adam require storing high-precision gradient statistics, limiting the feasible model size on available hardware. To address this, the paper introduces an innovative 8-bit optimizer based on block-wise dynamic quantization, which compresses optimizer states by 75% without sacrificing performance. The core idea involves dividing the gradient statistics tensors into small blocks, normalizing each independently, and applying a non-linear quantization scheme that adapts to the magnitude of gradients. This approach effectively isolates outliers, ensuring they do not distort the overall quantization process. To further enhance stability, a stable embedding layer normalizes input token distributions, reducing gradient variance caused by highly non-uniform data. Extensive experiments across tasks such as large-scale language modeling, GLUE, ImageNet classification, WMT translation, and RoBERTa pretraining demonstrate that the 8-bit optimizer matches or exceeds the performance of traditional 32-bit optimizers. Notably, it maintains perplexity at 9.0 for a 1.5B parameter language model, with up to 8.5GB of memory saved and training speed improved by 5%. The method requires no hyperparameter tuning, making it a practical plug-and-play solution for training massive models on limited hardware. This breakthrough opens new possibilities for democratizing AI research, enabling larger models to be trained efficiently on accessible hardware, and sets the stage for further low-bit training innovations.
Deep Analysis
Background
The rapid growth of deep learning models, from millions to hundreds of billions of parameters, has driven remarkable performance gains but also introduced significant challenges in resource management. Optimizer states, especially in algorithms like Adam and Momentum, consume vast amounts of memory—up to 75% of total training memory—limiting the maximum model size. Prior efforts to reduce memory footprint focused on quantizing weights and activations, but optimizer states remained high-precision due to stability concerns. Recent advances in mixed-precision training (e.g., 16-bit) have alleviated some issues, yet further compression is needed for extremely large models. The main obstacle is maintaining training stability and accuracy when reducing the bit-width of optimizer statistics, which are highly sensitive to quantization errors. This paper builds on prior work in low-bit quantization, introducing a novel approach tailored for optimizer states, aiming to enable efficient training of models exceeding one billion parameters on commodity hardware.
Core Problem
The core challenge lies in compressing optimizer states—such as the first and second moments in Adam—without degrading training stability or convergence. Existing low-bit methods, like 16-bit or fixed-point quantization, struggle with outliers and large gradient variations, leading to divergence or unstable training. Large models exacerbate these issues, as the impact of quantization errors becomes more pronounced. Additionally, input data distributions in NLP tasks are often highly non-uniform, causing further gradient variance. The key problem is designing a quantization scheme that can handle extreme outliers, adapt to wide dynamic ranges, and ensure stable, efficient training across diverse tasks and model sizes, all without requiring hyperparameter tuning.
Innovation
This work introduces three main innovations: • Block-wise dynamic quantization divides gradient statistics into small, independently normalized blocks, reducing outlier influence and improving quantization accuracy. • Non-linear dynamic quantization extends dynamic tree quantization to handle unipolar data, adapting to the wide dynamic range of optimizer statistics. • A stable embedding layer normalizes input token distributions, reducing gradient variance and enhancing training stability. These components collectively enable the optimizer to operate effectively at 8 bits, preserving performance while drastically reducing memory usage. The approach is compatible with existing optimizers like Adam, requiring only minimal code changes, and is validated across multiple large-scale tasks.
Methodology
- �� The optimizer state tensors are partitioned into small blocks of size 2048 elements. Each block's maximum absolute value is computed independently, serving as a normalization constant.
- �� Within each block, the tensor is normalized by dividing by this maximum, then quantized using a non-linear scheme that maps values to 8-bit indices via a binary search.
- �� The quantized indices are stored, and during dequantization, lookup tables and multiplication by the block maximum restore approximate original values.
- �� Dynamic quantization adjusts to the magnitude of gradients, ensuring small and large values are represented accurately.
- �� The stable embedding layer employs Xavier initialization and layer normalization to stabilize input token distributions, reducing gradient variance.
- �� During training, the optimizer states are dequantized to 32-bit, updated, then re-quantized, all within registers to avoid extra memory overhead.
- �� CUDA kernels are customized for efficient in-register quantization/dequantization, maintaining high throughput.
Experiments
The method is evaluated on tasks including large language modeling (1.5B parameters), GLUE, ImageNet classification, WMT translation, and RoBERTa pretraining. All experiments use the same hyperparameters as baseline 32-bit optimizers, with no tuning. Results show that the 8-bit optimizer achieves comparable perplexity, accuracy, and BLEU scores, with significant memory savings. Ablation studies confirm the importance of each component—block-wise, dynamic quantization, and stable embedding layer—for stability and performance. The experiments demonstrate robustness across different hardware platforms and model sizes, validating the approach's scalability and practicality.
Results
In large-scale language modeling, 8-bit Adam maintains perplexity at 9.0, matching 32-bit results, while reducing memory by 8.5GB and increasing training speed by 5%. On GLUE, accuracy is within 0.1%, and on ImageNet, top-1 accuracy remains at 77.2%. The method scales to models over 1.5 billion parameters, with no divergence or instability. Ablation results show that removing block-wise or dynamic quantization causes performance drops or instability, confirming their necessity. The approach also reduces memory footprint by up to 75%, enabling training on smaller GPUs, thus broadening accessibility.
Applications
This technique is immediately applicable to training and fine-tuning large NLP and vision models, especially where hardware memory is limited. It allows researchers and industry practitioners to train bigger models without upgrading hardware, reducing costs and energy consumption. The plug-and-play nature facilitates integration into existing frameworks like PyTorch, making large-scale AI more accessible. Long-term, this approach could evolve into fully low-bit training pipelines, including activations and gradients, further democratizing AI development and deployment.
Limitations & Outlook
While effective, the method may face challenges with highly non-uniform data distributions or extreme outliers, which could still cause quantization errors. The optimal block size may vary across tasks, requiring tuning for best results. Extending quantization to all training components (activations, gradients) remains future work, which could introduce additional complexity. Computational overhead from non-linear quantization, though minimized, might impact training speed in some scenarios. Further research is needed to address these issues for broader applicability.
Plain Language Accessible to non-experts
想象你在一个工厂里,每天都要处理大量的原材料。为了节省空间和提高效率,工厂决定用一种特殊的存储方法:用很少的箱子(就像用8个数字代表一堆材料),而不是用很多大箱子(像传统的32个数字)。但这样一来,可能会丢失一些重要信息,导致工厂的工作变得不稳定。于是,工厂设计了一个聪明的方案:把材料分成小块,每块单独存储,这样即使有特殊材料,也只影响那一小块,不会影响整体。还用一种特别的调节器,确保每块都能准确表达。经过这样改进,工厂可以用更少的空间,依然保持高效工作,甚至比以前更快更稳定。这就像论文里的优化器,用少量存储空间训练出和大存储量一样好的模型。
ELI14 Explained like you're 14
想象你在玩一个超级复杂的游戏,你的角色有很多装备和技能。平时,你需要记住很多信息,比如每个技能的冷却时间、装备的耐久度等等。可是,这些信息太多了,记忆空间不够用,游戏变得很慢。于是,你的朋友告诉你一个秘密:用很少的数字(比如用8个数字)来代表每个技能和装备的信息。可是,这样可能会丢失一些细节,让游戏变得不稳定。于是,你们设计了一个聪明的办法,把这些信息分成小块,每块单独压缩,这样即使有极端情况(比如某个技能突然变得特别强或特别弱),也只影响那一小块,不会搞乱整个游戏。还用一种特别的调节方法,确保每个信息都能准确表达。这样,你就可以用更少的空间,玩得更快、更稳定,还能保持原来的水平。论文里的优化器就像这个聪明的游戏助手,用少量的存储空间,依然能训练出和以前一样好的模型,甚至更快更稳定!
Abstract
Stateful optimizers maintain gradient statistics over time, e.g., the exponentially smoothed sum (SGD with momentum) or squared sum (Adam) of past gradient values. This state can be used to accelerate optimization compared to plain stochastic gradient descent but uses memory that might otherwise be allocated to model parameters, thereby limiting the maximum size of models trained in practice. In this paper, we develop the first optimizers that use 8-bit statistics while maintaining the performance levels of using 32-bit optimizer states. To overcome the resulting computational, quantization, and stability challenges, we develop block-wise dynamic quantization. Block-wise quantization divides input tensors into smaller blocks that are independently quantized. Each block is processed in parallel across cores, yielding faster optimization and high precision quantization. To maintain stability and performance, we combine block-wise quantization with two additional changes: (1) dynamic quantization, a form of non-linear optimization that is precise for both large and small magnitude values, and (2) a stable embedding layer to reduce gradient variance that comes from the highly non-uniform distribution of input tokens in language models. As a result, our 8-bit optimizers maintain 32-bit performance with a small fraction of the memory footprint on a range of tasks, including 1.5B parameter language modeling, GLUE finetuning, ImageNet classification, WMT'14 machine translation, MoCo v2 contrastive ImageNet pretraining+finetuning, and RoBERTa pretraining, without changes to the original optimizer hyperparameters. We open-source our 8-bit optimizers as a drop-in replacement that only requires a two-line code change.