Abstract
Training large-scale AI models is increasingly constrained by the "activation memory wall," where intermediate activations required for backpropagation exceed GPU capacity. We present Hadamard-based Optimized Training (HOT), a framework that leverages computationally efficient Hadamard transformations to enable aggressive 4-bit and 8-bit quantization and low-rank approximations during the backward pass. HOT achieves up to a 75% reduction in memory consumption and a 2.6× hardware speedup on consumer-grade GPUs with negligible impact on model accuracy.
Introduction
The rapid evolution of Large Language Models (LLMs) and Vision Transformers (ViT) has pushed the boundaries of hardware capabilities. While parameter-efficient fine-tuning (PEFT) methods like LoRA successfully reduce the memory footprint of weights and optimizer states, they do not address the massive memory required for intermediate activations. During the backward pass, these activations must be stored to compute gradients, creating a bottleneck that limits batch sizes and model depth, especially on consumer hardware like the NVIDIA RTX 3090.
Previous attempts to compress activations often faced a trade-off between accuracy and hardware acceleration. Low-bit quantization typically introduces significant noise due to outlier values in gradients, while low-rank approximations can fail to capture essential information for specific gradient paths. HOT addresses these challenges by using Hadamard Transformations (HT) to redistribute outlier energy, making tensors more amenable to compression without sacrificing performance.
Methodology: Hadamard-based Optimization
The core of HOT lies in the selective application of Hadamard Transformations (HT) and quantization across the different paths of the backpropagation algorithm. HT is an $O(n \log n)$ operation involving only additions and subtractions, making it extremely efficient on modern hardware.
HOT introduces four primary innovations:
- Hadamard Quantization (HQ) for Input Gradients ($g_x$): The path for calculating input gradients is sensitive to rank reduction but robust to quantization. HOT applies HT followed by 4-bit (INT4) quantization, which is then accelerated using custom CUDA kernels for Tensor Cores.
- Hadamard Low-Rank Approximation (HLA) for Weight Gradients ($g_w$): Conversely, weight gradients are robust to low-rank approximations. HOT utilizes HLA combined with 8-bit (INT8) quantization in this path.
- Activation Buffer Compression (ABC): To solve the activation memory wall, HOT compresses activations immediately during the forward pass using HLA and INT8, significantly reducing the storage requirement for the backward pass.
- Layer-wise Quantizer Selection (LQS): Recognizing that gradient distributions vary across layers, HOT employs a calibration-based selection mechanism to choose between per-token and per-tensor quantization, balancing accuracy and speed.
Experimental Results
The authors evaluated HOT across diverse architectures (ViT, Llama3, ResNet, YOLO) and tasks (classification, detection, language modeling).
Memory and Hardware Efficiency
HOT demonstrates substantial memory savings, enabling the training of large models on hardware previously considered insufficient. For instance, on a single RTX 3090 (24GB), standard FP32 training of a ViT-B model fails at a batch size of 256. HOT allows this same hardware to handle a batch size of 1024.
Key performance metrics include:
- Memory Savings: Up to 75% reduction in ViT models and 86% in ResNet-50.
- Speedup: An average 2.6× acceleration across layers due to optimized INT4/INT8 CUDA kernels.
- Stability: Unlike prior methods like LUQ or LBP-WHT, HOT remained stable during the training of deep models like Llama3-8B, maintaining competitive perplexity.
Accuracy Preservation
Across most fine-tuning benchmarks, the accuracy loss associated with HOT was minimal, typically less than 0.5%. In certain vision tasks, HOT even slightly outperformed full-precision training, suggesting a potential regularizing effect from the quantization noise.
Conclusion and Future Work
HOT provides a viable path for training massive models on resource-constrained hardware by effectively breaking the "activation memory wall." By exploiting the mathematical asymmetry of backpropagation and the outlier-smearing properties of Hadamard transformations, HOT achieves significant compression and acceleration. Future research will focus on scaling these techniques to even deeper architectures and exploring synergies with other parameter-efficient training strategies.
Summary updated