Full-matrix preconditioners can significantly improve the performance of deep learning optimizers by leveraging second-order information about the loss landscape. However, they typically require massive amounts of GPU memory to store past gradients, making them impractical for modern, large-scale models.
To bridge this gap, researchers have introduced Error Feedback for Compressed Preconditioning (EFCP), a technique that compresses the optimizer's gradient history by up to 99% using sparsity or low-rank approximations. By feeding the compression error back into future steps, EFCP slashes memory requirements by up to two orders of magnitude without sacrificing accuracy, allowing advanced second-order optimizers to run efficiently on a single GPU.
The Memory Bottleneck of Second-Order Optimizers
While standard optimizers like SGD and Adam are the workhorses of deep learning, algorithms that use "second-order" information—which accounts for the curvature of the loss landscape—can converge faster and find better solutions. Methods like M-FAC and GGT achieve this via full-matrix preconditioning.
However, there is a massive catch: to approximate this full matrix, these optimizers must store a "sliding window" of the last $m$ gradients. If a model has $d$ parameters (often in the millions or billions), storing $m$ gradients requires $O(md)$ memory. For example, fine-tuning a standard BERT-Base model with the dense M-FAC optimizer requires over 450 GB of GPU RAM. This is impossible on any single consumer or standard server GPU, rendering full-matrix preconditioning highly impractical for modern deep learning architectures.
The EFCP Solution
The authors propose EFCP to drastically shrink the memory footprint of the gradient sliding window through three core mechanisms:
- Gradient Compression: Instead of storing dense gradients, the algorithm compresses them before they enter the preconditioner's memory buffer. The primary method used is Top-$k$ sparsification, where only the largest 1% of gradient values are kept.
- Error Feedback: Simply truncating 99% of the gradient would normally cause the optimizer to diverge. To fix this, the authors employ error feedback. The difference between the dense gradient and the compressed gradient (the "error") is saved and added to the next iteration's gradient. This ensures no gradient information is permanently lost; it is merely delayed.
- Custom CUDA Kernels: Standard sparse tensor formats (like COO or CSR) are inefficient for the specific math required by these optimizers. The authors engineered a novel "dynamic sparse ring-buffer" with custom GPU kernels to efficiently compute Sparse Scalar Products and Linear Combinations of Gradients directly in hardware.
Key Results and Insights
The authors evaluated their method on standard vision and language modeling benchmarks, including ImageNet-1K (ResNet-18), CIFAR-10, and the GLUE Benchmark (BERT models). The results demonstrate that extreme sparsity is safe for preconditioners when paired with error feedback.
Massive Memory Savings and Unlocked Scale
By designing algorithms that specifically leverage GPU shared memory and thread blocks, the authors translated theoretical $O(md)$ reductions into actual, wall-clock speedups and RAM savings.
As shown above, on ImageNet with ResNet-18, the Sparse M-FAC (S-MFAC) optimizer used only 14.3 GB of RAM, compared to 58.5 GB for the Dense M-FAC (D-MFAC) version. More impressively, the authors successfully trained BERT-Base using full-matrix preconditioning on a single GPU, consuming just 14.8 GB of memory. Attempting this with the dense version immediately triggers an Out of Memory (OOM) error.
Maintained Accuracy and Competitive Runtimes
Despite discarding 99% of the gradient data before feeding it into the preconditioner, the optimizer behaves almost exactly like its memory-hogging dense counterpart.
Sparse M-FAC achieved a 70.01% Top-1 accuracy on ImageNet, matching the Dense M-FAC (70.03%) and outperforming a highly-tuned SGD baseline (69.12%). Furthermore, S-MFAC completed training in 4h 21m, which is nearly as fast as standard SGD (4h 10m) and significantly faster than Dense M-FAC (5h 33m).
Limitations and Future Work
While the custom CUDA kernels are highly optimized for ResNets, the authors note a runtime overhead when training BERT models. Optimizing these kernels for transformer architectures remains an ongoing engineering challenge. Additionally, while the authors provide a solid theoretical proof for convergence in the diagonal preconditioning case, providing a strict theoretical guarantee for the highly complex full-matrix case remains an open problem.
Future work will explore larger-scale validation on more diverse architectures and apply this compression-plus-error-feedback technique to other preconditioning mechanisms, potentially making second-order optimization a standard tool for everyday deep learning.
Summary updated