GRASS: Gradient-based Adaptive Layer-wise Importance Sampling for Memory-efficient Large Language Model Fine-tuning

Kaiyuan Tian, Linbo Qiao, Yu Tang, Gongqingjian Jiang, Baihui Liu, Yifu Gao, Xialin Su, Dongsheng Li

TL;DR

Fine-tuning Large Language Models (LLMs) usually forces a tough choice between the high memory costs of full-parameter tuning and the performance trade-offs of parameter-efficient methods like LoRA. GRASS (Gradient-based Adaptive Layer-wise Importance Sampling) bridges this gap by dynamically selecting and updating only the most important layers during training based on real-time gradient signals. This approach matches or exceeds full-parameter tuning performance while slashing GPU memory usage and maintaining high training throughput.

What Problem Does This Paper Address?

Full-parameter fine-tuning (FFT) updates all weights in an LLM, yielding top-tier performance but requiring massive GPU memory to store optimizer states. Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA bypass this by freezing the model and training small, low-rank adapter matrices. However, LoRA's low-rank constraint restricts the model's expressiveness, often leading to degraded performance on complex tasks.

An alternative is layer-wise fine-tuning (such as LISA), which updates a full subset of layers at a time, preserving full capacity while saving memory. The catch? Existing layer-wise methods use static, uniform, or heuristic sampling. They assume every layer's importance remains constant across different tasks and throughout the entire training process. As the authors demonstrate, layer importance is actually highly dynamic; static strategies waste compute on irrelevant layers and underperform on challenging benchmarks.

Figure 1: Layer importance varies significantly across tasks and training steps on TinyLlama.

Methods

The authors introduce GRASS, a framework that replaces static heuristics with dynamic optimization signals. It operates in two main phases:

  1. Probing Phase: For the first few steps ($T_p$), GRASS runs standard forward and backward passes without updating parameters. This allows it to collect initial gradient statistics without incurring optimizer memory overhead.
  2. Adaptive Fine-Tuning Phase: GRASS calculates the Mean Gradient Norm (MGN) for each layer, which acts as a proxy for how much updating that layer will reduce the loss. It converts these MGNs into a probability distribution via a softmax function, dynamically sampling a subset ($\gamma$) of layers to activate and update for the next training period ($Ts$). The probabilities are continuously updated using an exponential moving average (EMA).
Figure 2: Overview of GRASS dynamic sampling vs static sampling.

To solve the memory bottleneck of keeping optimizer states for all potentially trainable layers, GRASS implements a Layer-wise Optimizer State Offloading mechanism. It stores optimizer states on the CPU and asynchronously prefetches them to the GPU layer-by-layer, perfectly overlapping data transfer with computation to maintain high throughput.

Figure 3: Vanilla vs Overlapped Layer-wise Offloading.

Datasets

The framework was evaluated across three model scales (TinyLlama, Gemma-2B, LLaMA2-7B) using:

  • Arithmetic Reasoning Benchmarks: MultiArith, AddSub, GSM8K, AQuA, SingleEq, and SVAMP.
  • Commonsense Reasoning Benchmarks: BoolQ, PIQA, SIQA, HellaSwag, WinoGrande, ARC-c, ARC-e, and OBQA.
  • Alpaca-GPT4: Used to evaluate convergence behavior.

Key Insights and Ideas

  • Layer Importance is Task-Dependent: A layer that is critical for commonsense reasoning might be completely passive during arithmetic tasks. For instance, layer 20 in TinyLlama shows high gradient activity in commonsense tasks but drops significantly in math tasks.
  • Gradients are Better Than Weights for Selection: While previous methods looked at weight norms to guess layer importance, gradient norms directly reflect how sensitive the loss function is to parameter updates at any given moment.
  • Implicit Regularization: Dynamically freezing and unfreezing layers acts as a powerful regularizer, allowing GRASS to occasionally outperform full-parameter fine-tuning by preventing overfitting.
  • Hiding Communication Latency: CPU offloading usually tanks training speed due to PCIe bottlenecks. By prefetching optimizer states asynchronously at the individual layer level, the communication cost is entirely hidden behind the backward pass computation.

Key Results

  • Superior Accuracy: GRASS consistently outperformed LoRA, DoRA, and LISA. On arithmetic tasks, it achieved an average accuracy improvement of up to 4.38 points over $\text{LoRA}_{r=128}$. On LLaMA2-7B, it achieved the closest performance to full-parameter fine-tuning.
  • Memory Efficiency: GRASS reduced peak GPU memory usage by up to 19.97% compared to LISA.
  • Long-Context Scalability: At a sequence length of 1792 on LLaMA2-7B, LoRA and DoRA exceeded the 24GB GPU memory limit, while GRASS remained safely below it at 23.25GB.
Figure 4: Peak memory consumption and scalability across sequence lengths for LLaMA2-7B.
  • High Throughput: Thanks to the overlapped offloading mechanism, GRASS achieved a 1.08× throughput speedup over non-overlapped offloading, matching the training speed of standard LoRA.

Limitations and Future Work

  • Computational Overhead: Tracking gradient statistics and performing probing introduces a minor computational overhead, accounting for roughly 2% to 6% of total training time. However, this overhead decreases relatively as the model size scales up.
  • Architecture and Modality Scope: The current evaluation is limited to decoder-only large language models on text-based NLP benchmarks. The authors note that exploring GRASS's applicability to encoder-decoder architectures and multimodal models (like vision-language models) remains an open direction for future work.

Summary updated

BibTeX
@inproceedings{tian2026grass,
  author = {Kaiyuan Tian and Linbo Qiao and Yu Tang and Gongqingjian Jiang and Baihui Liu and Yifu Gao and Xialin Su and Dongsheng Li},
  title = {{GRASS: Gradient-based Adaptive Layer-wise Importance Sampling for Memory-efficient Large Language Model Fine-tuning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.findings-acl.475},
}
Figure