Full Parameter Fine-tuning for Large Language Models with Limited Resources

Kai Lv, Yuqing Yang, Tengxiao Liu, Qinghui Gao, Qipeng Guo, Xipeng Qiu

TL;DR

LOMO (LOw-Memory Optimization) is a new optimizer that enables full-parameter fine-tuning of massive models like LLaMA-65B on consumer-grade hardware (e.g., 8x RTX 3090 GPUs). By fusing gradient computation with parameter updates and switching to a memory-efficient SGD-based approach, it slashes training memory usage to just 10.8% of standard methods—effectively making the memory cost of training nearly identical to that of inference.

What Problem Does This Paper Address?

Fine-tuning Large Language Models (LLMs) is notoriously resource-intensive. While Parameter-Efficient Fine-Tuning (PEFT) methods like LoRA reduce the number of trainable weights, full-parameter fine-tuning often yields better performance but remains locked behind a "memory wall."

Standard training with optimizers like AdamW requires massive amounts of VRAM to store not just the model parameters, but also gradients and "optimizer states" (like momentum and variance). For a 65B parameter model, these overheads typically require enterprise-grade clusters (e.g., 8x A100 80GB GPUs), making full fine-tuning inaccessible to most academic labs and small companies. The authors aim to democratize LLM research by lowering this hardware threshold.

Methods

The researchers introduce LOMO, which optimizes memory usage across three main fronts:

  1. Rethinking the Optimizer: The authors argue that while AdamW is standard for pre-training, the loss surfaces of LLMs are smooth enough that Stochastic Gradient Descent (SGD) is sufficient for fine-tuning. Because SGD doesn't store intermediate states, it completely eliminates the memory footprint of optimizer states.
  2. Fused Backward and Update: In a standard setup, you compute all gradients, store them, and then update parameters. LOMO fuses these steps. As shown in Figure 1, LOMO computes the gradient for a single parameter tensor, updates that parameter immediately, and then clears the gradient from memory before moving to the next tensor. This reduces gradient memory complexity from $O(n)$ (all parameters) to $O(1)$ (the largest single tensor). Comparison of SGD and LOMO update stages
  3. Stabilizing Techniques: To handle the instabilities of mixed-precision training without the full gradient norm, LOMO incorporates dynamic loss scaling and selective full-precision transitions. It also offers "clipping by value" as a memory-efficient alternative to standard gradient clipping.
Figure 1: Comparison of SGD and LOMO in backpropagation and parameter update stages. Pi refers to the parameter of the model and Gi refers to the gradient corresponding to Pi. LOMO fused gradient computation and parameter update in one step to minimize the size of gradient tensors.

Datasets

The authors evaluated LOMO using the LLaMA family of models (7B, 13B, 30B, and 65B). Performance was benchmarked on the SuperGLUE dataset collection, specifically focusing on:

  • RTE (Recognizing Textual Entailment)
  • BoolQ (Yes/No questions)
  • WSC (Winograd Schema Challenge)
  • WIC (Word-in-Context)
  • MultiRC (Multi-Sentence Reading Comprehension)
  • COPA (Choice of Plausible Alternatives)

Following recent protocols, they used a few-shot setting with 1,000 training examples per task.

Key Insights and Ideas

  • Training Memory $\approx$ Inference Memory: By eliminating optimizer states and minimizing gradient storage, LOMO pushes the memory requirements of training down to the level of the forward pass. This is a significant milestone for resource-constrained environments.
  • The "Smoothness" Assumption: A core insight is that LLMs fine-tuned on natural language tasks don't face the "large curvature" problems that typically make SGD struggle. The pre-trained weights already place the model in a "valley" of the loss surface.
  • LOMO + LoRA: The paper reveals that LOMO and LoRA are not mutually exclusive. Using LOMO to tune the backbone while simultaneously using LoRA for adapters can actually lead to better performance than either method alone.

Key Results

  • Massive Memory Savings: For LLaMA-7B, LOMO (combined with activation checkpointing) reduced total memory usage from 102.2 GB to just 14.58 GB. Memory usage comparison table
  • Hardware Accessibility: The authors successfully fine-tuned a 65B model on a single machine with 8x RTX 3090 GPUs (24GB each).
  • Performance Gains: LOMO consistently outperformed LoRA across most SuperGLUE tasks. For LLaMA-13B, LOMO achieved an average score of 84.2, compared to LoRA's 81.4 and a zero-shot baseline of 57.2. Main results on SuperGLUE
  • Throughput: Because LOMO allows larger models to fit on fewer GPUs, it reduces inter-GPU communication overhead. For the 7B model, LOMO's throughput was roughly 11 times higher than AdamW because it could run on a single GPU. Throughput and hardware requirements
Memory usage comparison table
Main results on SuperGLUE
Throughput and hardware requirements

Limitations and Future Work

The authors acknowledge that their current implementation of gradient normalization requires an additional backward pass, which can slow down training. Furthermore, their experiments were limited to a subset of SuperGLUE and did not test performance on high-end enterprise GPUs like the A100.

Future work includes exploring parameter quantization (e.g., 4-bit or 8-bit) in conjunction with LOMO to further lower the memory ceiling, as well as developing more theoretical analyses for LLM optimization.

Summary updated

BibTeX
@inproceedings{lv2024full,
  author = {Kai Lv and Yuqing Yang and Tengxiao Liu and Qinghui Gao and Qipeng Guo and Xipeng Qiu},
  title = {{Full Parameter Fine-tuning for Large Language Models with Limited Resources}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.445},
}
Figure