Introduction
Training Large Language Models (LLMs) often hits a "memory wall" caused by massive optimizer states and activations. This paper introduces Randomized Subspace Optimization (RSO), a framework that decomposes high-dimensional training into smaller, random subproblems. Unlike previous methods that only shrink optimizer states, RSO simultaneously slashes activation memory and communication overhead, achieving training speeds up to 3x faster than standard Adam while maintaining comparable model performance.
The Memory Bottleneck: Optimizer States and Activations
The primary bottleneck in scaling LLMs isn't just the number of parameters; it’s the memory required to train them. When using the industry-standard Adam optimizer, storing "moments" (running averages of gradients) can consume twice as much memory as the model itself.
While recent techniques like GaLore have successfully compressed these optimizer states, they leave a second giant problem untouched: activations. Activations are the intermediate values stored during the forward pass to calculate gradients during the backward pass. For models handling long sequences or large batches, activation memory quickly becomes the dominant constraint.
Furthermore, many existing memory-efficient methods lack rigorous theoretical proofs guaranteeing convergence to an optimal solution.
Methodology: Randomized Subspace Optimization (RSO)
To tackle both optimizer state and activation memory, the authors propose Randomized Subspace Optimization (RSO). The core idea is to avoid updating the entire high-dimensional weight matrix $W$ at once. Instead, at each iteration, the algorithm:
- Samples a random subspace: It picks a low-rank projection matrix $P$.
- Solves a subproblem: It optimizes a small set of parameters $B$ such that the weight update is $W + PB$.
- Updates the model: Only the low-dimensional $B$ is updated using a standard optimizer (like Adam or SGD).
Why is this better than GaLore? GaLore relies on Singular Value Decomposition (SVD) of the full gradient to find a projection, which still requires computing full-rank gradients and storing full-rank activations. RSO uses random projections. Because the optimization happens entirely within the projected subspace, the backward pass only needs to store "projected activations" ($YP$), which are significantly smaller than the original activations ($Y$). This structured reduction allows RSO to save memory on both fronts.
Key Insights
- The Activation "Aha!" Moment: By defining the layer output as $Z = Y(W + PB)$, the gradient with respect to the low-rank weights $B$ only requires the term $YP$. Since $P$ is a thin matrix, $YP$ is much smaller than the full activation $Y$, yielding massive memory savings.
- Communication is the New Bottleneck: In distributed training, syncing large gradients is slow. Because RSO only communicates low-dimensional gradients ($B$), it drastically reduces network overhead, leading to much higher throughput.
- Randomness is Sufficient: Unlike GaLore, which spends compute time finding the "best" subspace via SVD, RSO demonstrates that picking a random subspace is theoretically sound and empirically effective, provided enough subspaces are iterated through over time.
Key Results
The researchers evaluated RSO across standard benchmarks, including pre-training LLaMA models (60M to 7B parameters) on the C4 dataset, and fine-tuning on GLUE, WinoGrande, and COPA.
- Memory Efficiency: RSO consistently outperforms both Adam and GaLore in memory footprint. On a LLaMA-7B model, RSO reduced peak memory usage to 54.81 GB, compared to 78.92 GB for Adam and 75.33 GB for GaLore.
- Training Speed: RSO is significantly faster. For LLaMA-7B, RSO completed the training task in 64 hours, while GaLore took 134 hours and Adam took 216 hours.
- Performance Parity: Despite the massive compression, RSO achieved validation perplexity and task accuracy comparable to—and sometimes better than—Adam and GaLore. On the GLUE benchmark, RSO (rank=8) achieved an average score of 86.77, slightly outperforming Adam's 86.28.
Limitations and Future Work
While RSO makes a significant dent in activation memory, it doesn't eliminate it entirely, as some "residual" activation memory remains. Future work could explore more aggressive partitioning strategies to further reduce this footprint. Additionally, the low-dimensional nature of RSO's subproblems makes them ideal candidates for second-order optimization methods. These methods use curvature information and are usually too expensive for full LLM training, but they might be highly feasible and effective within RSO's small subspaces.
Summary updated