SLTrain: a sparse plus low-rank approach for parameter and memory efficient pretraining

Andi Han, Jiaxiang Li, Wei Huang, Mingyi Hong, Akiko Takeda, Pratik Jawanpuria, Bamdev Mishra

TL;DR

SLTrain is a new approach for pretraining Large Language Models (LLMs) that models weight matrices as a sum of low-rank and sparse components ($W = BA + S$). By using a simple, fixed-random support for the sparse component, SLTrain achieves performance comparable to full-rank training while reducing memory requirements by up to 73% for a LLaMA 7B model.

What Problem Does This Paper Address?

Training LLMs from scratch is notoriously resource-intensive. The primary bottleneck is often GPU memory, driven not just by the model weights themselves, but by the massive optimizer states (like those in Adam) required for training.

While low-rank methods like LoRA have revolutionized fine-tuning by restricting updates to a low-dimensional subspace, they generally fail at pretraining. Pretraining requires the model to learn complex, high-rank features from scratch; forcing weights into a low-rank structure during this phase severely limits the model's representational power and leads to significant performance degradation. Existing sparse training methods (like "prune-and-grow") often introduce their own overhead by requiring the storage of dense masks or full weight matrices during the search for the best sparse structure.

Methods

The authors propose SLTrain, which parameterizes weights as $W = BA + S$.

  • Low-Rank ($BA$): Learned via standard matrix factorization.
  • Sparse ($S$): Instead of using complex algorithms to find the "best" sparse connections, SLTrain uses a fixed, uniformly random support. A small percentage of entries (e.g., 3-5%) are chosen at the start of training, and only those specific values are learned.

To make this GPU-friendly, the authors implemented a custom linear layer. During the forward pass, the sparse values are "scatter-added" into the dense product of the low-rank factors. This avoids the computational bottlenecks typically associated with unstructured sparse tensor operations on modern hardware. Crucially, because the sparse support is fixed, the model only needs to store the indices and values of the non-zero entries, making the optimizer states scale with the number of non-zeros rather than the full matrix size.

Datasets

The researchers evaluated SLTrain using the C4 (Colossal Clean Crawled Corpus) dataset for pretraining. They tested the method across a range of LLaMA model sizes, from a tiny 60M parameter version up to the 7B parameter model. For fine-tuning evaluations, they used the standard GLUE benchmark.

Key Insights and Ideas

  • The Power of "Sparse + Low-Rank": The authors provide a theoretical proposition (Proposition 1) showing that a low-rank matrix plus a sparse matrix with random support is full-rank with high probability. This effectively bypasses the expressivity bottleneck that plagues pure low-rank pretraining.
  • Why Random Support Works: By analyzing pretrained models, the authors found that after removing the top singular values (the low-rank part), the residual weight magnitudes are relatively small and smoothly distributed.
Figure 2: Illustration of the last attention layer of pretrained full-rank LLaMA 60M model on 1.1B tokens. (a): singular value magnitudes of weight matrices where we observe a rapid decay of singular values. (b): Visualization of full-rank pretrained attention output matrix W0 in magnitude and the residual matrix after removing the best rank-r (r = 128) approximation of the W0 by SVD. We observe the magnitudes of the residual vary smoothly across different neuron-neuron interactions. (c): Cumulative density of the residual matrix in magnitude where we include a cut-off fraction at 0.97. We observe 97% entries in the residual matrix have magnitude less than 0.04.

This "smoothness" suggests that you don't need to be surgical about which sparse weights you pick; a random selection is sufficient to capture the necessary high-rank information.

  • Synergy with Other Techniques: SLTrain is orthogonal to other memory-saving tricks. When combined with 8-bit quantization and per-layer weight updates, the memory savings become massive.

Key Results

SLTrain hits a "sweet spot" in the trade-off between perplexity (model quality), parameter count, and memory usage.

Figure 1: Shown are perplexity, memory, and pa- rameter size for pretraining LLaMA 1B on the C4 dataset with different methdods. The radius and color of each circle scale with parameter size. Overall, the methods which have smaller, lighter circles on the left bottom corner are desirable for pretraining. The details are in Section 5.1.
  • Performance: On a LLaMA 1B model, SLTrain achieved a perplexity of 16.14, very close to the 15.56 of full-rank training, while using roughly half the trainable parameters.
  • Memory Efficiency: For the LLaMA 7B model, SLTrain (combined with 8-bit Adam and per-layer updates) reduced the actual memory footprint from 67.4 GB to just 18.3 GB—a 73% reduction. This allows pretraining a 7B model on a single consumer-grade or mid-range enterprise GPU (like an A100 40GB).
  • Inference: Unlike some training-only compression methods, the sparse+low-rank structure can be maintained for inference, leading to up to 35% memory savings during model deployment for larger models.

Limitations and Future Work

  • Throughput Trade-off: The "scatter-add" operation for sparse weights introduces a slight computational overhead. SLTrain's throughput (tokens per second) is roughly 5-10% lower than full-rank training. The authors suggest that more optimized kernels could bridge this gap.
  • Fixed vs. Dynamic Support: While random fixed support is highly memory-efficient, exploring dynamic support (changing which weights are sparse during training) might further improve performance, though likely at the cost of higher memory overhead.
  • Beyond Transformers: The current work focuses on LLMs; extending this to other architectures like Vision Transformers or Diffusion models remains an open area for exploration.

Summary updated

BibTeX
@inproceedings{han2024sltrain,
  author = {Andi Han and Jiaxiang Li and Wei Huang and Mingyi Hong and Akiko Takeda and Pratik Jawanpuria and Bamdev Mishra},
  title = {{SLTrain: a sparse plus low-rank approach for parameter and memory efficient pretraining}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=MXze4H7opg},
}
Figure