LISA: Layerwise Importance Sampling for Memory-Efficient Large Language Model Fine-Tuning

Rui Pan, Xiang Liu, Shizhe Diao, Renjie Pi, Jipeng Zhang, Chi Han, Tong Zhang

Introduction

Fine-tuning Large Language Models (LLMs) has become a cornerstone of modern AI development, yet it remains a resource-intensive process. While Full-Parameter Training (FT) typically yields the highest performance, its memory requirements are often prohibitive—requiring over 60GB of VRAM for a standard 7B model. To mitigate this, the community has largely adopted Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA. However, LoRA introduces a "representation ceiling" because it restricts updates to a low-rank subspace, which can lead to suboptimal performance in complex tasks or continual pre-training.

LISA (Layerwise Importance Sampled AdamW) is a novel strategy designed to bridge this gap. It provides the performance benefits of full-parameter updates with the memory efficiency of LoRA by strategically unfreezing a subset of layers during training.

The Low-Rank Bottleneck and the Skewness Discovery

The primary motivation for LISA stems from the limitations of existing PEFT methods. In large-scale datasets or domain-specific tasks, the low-rank updates of LoRA often fail to capture the complexity required for significant model shifts.

Through empirical observation, researchers discovered a unique property in LLM training: weight norms are highly skewed. Specifically, the embedding layers and the language modeling (LM) head exhibit significantly larger weight norms than intermediate layers. This suggests that these "end" layers are disproportionately important for the model's update process. LISA leverages this insight to prioritize specific layers while cycling through others, bypassing the low-rank bottleneck entirely.

The LISA Methodology

LISA applies the concept of importance sampling to the model's architecture. The algorithm operates on three primary principles:

  1. Essential Layers: The embedding layer and the LM head are designated as "essential" and are kept unfrozen throughout the entire training process.
  2. Layerwise Sampling: For the intermediate transformer blocks, LISA randomly samples a small number of layers (denoted as $\gamma$) to unfreeze.
  3. Periodic Re-sampling: Every $K$ iterations, the set of unfrozen intermediate layers is updated.
  4. Optimization: Updates are performed using the AdamW optimizer, but only for the weights of the essential and currently sampled layers.

By limiting the number of active layers at any given time, LISA significantly reduces the memory footprint of the gradient and optimizer states. This allows for full-rank updates on any specific layer without requiring the memory overhead of unfreezing the entire model simultaneously.

Experimental Evaluation

The researchers evaluated LISA across models ranging from 120M to 70B parameters using a variety of benchmarks:

  • Instruction Following and Dialogue: Evaluated on Alpaca-GPT4 and MT-Bench.
  • General Knowledge: Tested via MMLU, AGIEval, and WinoGrande.
  • Domain-Specific Tasks: Focused on GSM8K (mathematics) and PubMedQA (medical).
  • Continual Pre-training: Conducted on a 1.5-billion-token subset of OpenWebMath.

Key Results and Insights

Performance and Efficiency

LISA demonstrated a clear advantage over traditional PEFT methods. On MT-Bench, LISA outperformed LoRA by 10% to 35%. Furthermore, it matched or exceeded the performance of full-parameter tuning on benchmarks like MMLU and AGIEval.

In terms of memory, LISA enabled the fine-tuning of a LLaMA-2-70B model on a single 80GB GPU—a task that frequently triggers Out-of-Memory (OOM) errors for high-rank LoRA configurations. Additionally, LISA proved to be faster than its counterparts, offering a 2.9x speedup over FT and a 1.5x speedup over LoRA, primarily due to the elimination of adapter-related overhead.

Implicit Regularization

One of the most surprising findings was that LISA occasionally outperformed full-parameter training. The authors hypothesize that the act of randomly freezing and unfreezing layers serves as a form of implicit regularization, similar to Dropout. This prevents the model from overfitting, particularly when working with smaller downstream datasets.

Domain Adaptation

In continual pre-training scenarios involving mathematical data, LISA achieved higher accuracy on GSM8K than full-parameter training while utilizing only half the memory. This suggests that LISA is particularly well-suited for "memorization-heavy" tasks where the model must absorb new, high-rank information.

Limitations and Future Directions

While LISA is highly efficient regarding optimizer states and gradients, the full model must still be loaded into memory for the forward pass. Future work may explore combining LISA with quantization techniques (such as QLoRA) to further lower hardware requirements.

Additionally, the current implementation uses uniform sampling for intermediate layers. The researchers suggest that non-uniform importance sampling—perhaps based on real-time gradient statistics—could further optimize the selection process. Finally, while LISA excels at memorization and general instruction following, the performance gap between LISA and LoRA is narrower in pure reasoning tasks like coding, representing an area for further refinement.

Summary updated

BibTeX
@inproceedings{pan2024lisa,
  author = {Rui Pan and Xiang Liu and Shizhe Diao and Renjie Pi and Jipeng Zhang and Chi Han and Tong Zhang},
  title = {{LISA: Layerwise Importance Sampling for Memory-Efficient Large Language Model Fine-Tuning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=L8ifDX5XNq},
}
Figure