[Paper Review] Full Parameter Fine-tuning for Large Language Models with Limited Resources
Introduces LOw-Memory Optimization (LOMO), an optimizer that fuses gradient computation and parameter updates to enable full parameter fine-tuning of very large language models on limited hardware by dramatically reducing memory usage. Demonstrates feasibility on up to 65B models with 8 RTX 3090 GPUs and shows competitive downstream performance.
Large Language Models (LLMs) have revolutionized Natural Language Processing (NLP) but demand massive GPU resources for training. Lowering the threshold for LLMs training would encourage greater participation from researchers, benefiting both academia and society. While existing approaches have focused on parameter-efficient fine-tuning, which tunes or adds a small number of parameters, few have addressed the challenge of tuning the full parameters of LLMs with limited resources. In this work, we propose a new optimizer, LOw-Memory Optimization (LOMO), which fuses the gradient computation and the parameter update in one step to reduce memory usage. By integrating LOMO with existing memory saving techniques, we reduce memory usage to 10.8% compared to the standard approach (DeepSpeed solution). Consequently, our approach enables the full parameter fine-tuning of a 65B model on a single machine with 8 RTX 3090, each with 24GB memory.Code and data are available at https://github.com/OpenLMLab/LOMO.
Motivation & Objective
- Motivate and enable full parameter fine-tuning of large language models (LLMs) with limited GPU resources.
- Reduce memory usage during training while preserving equivalence to SGD updates.
- Demonstrate practical feasibility on 65B parameter models and assess downstream performance.
- Explore stabilization techniques to support mixed-precision training with the new optimizer.
Proposed method
- Propose LOw-Memory Optimization (LOMO) that fuses gradient computation and parameter update in one step to avoid storing gradient tensors.
- Advocate SGD as a viable optimizer for full fine-tuning of LLMs in this context, arguing smooth loss surfaces and local Optima are acceptable for fine-tuning tasks.
- Integrate LOMO with common memory-saving techniques (activation checkpointing, mixed-precision) and employ a two-pass approach for dynamic loss scaling to maintain stability.
- Provide a theoretical discussion on implicit batch size and stability under SGD for large, smooth loss landscapes.
- Empirically evaluate memory usage, throughput, and downstream task performance (SuperGLUE) across LLaMA models from 7B to 65B, with comparisons to AdamW and LoRA.
Experimental results
Research questions
- RQ1Can SGD be a practical optimizer for full parameter fine-tuning of LLMs under memory constraints?
- RQ2How much memory can be saved by fusing gradient computation and parameter updates (LOMO) and by combining with activation checkpointing and mixed-precision?
- RQ3What are the throughput and memory trade-offs when fine-tuning 7B–65B models on consumer GPUs using LOMO?
- RQ4How does full-parameter fine-tuning with LOMO perform on downstream tasks compared to zero-shot and LoRA?
- RQ5Is LOMO compatible and complementary with LoRA for further performance gains?
Key findings
- LOMO reduces gradient memory to the size of the largest gradient tensor, significantly lowering total memory usage.
- Memory usage with LOMO drops from 102.20 GB (AdamW) to 14.58 GB for LLaMA-7B when combined with activation checkpointing, enabling training on a single machine of 8× RTX 3090 GPUs.
- LOMO enables training of a 65B model on 8 RTX 3090 GPUs with a reported throughput of 4.93 tokens per GPU per second (TGS).
- In downstream SuperGLUE tasks, LOMO with 65B parameters achieves an average performance of 89.9, outperforming Zero-shot and generally surpassing LoRA in several datasets (e.g., RTE, BoolQ, WSC, WIC, MultiRC, COPA as reported).
- LoRA+LOMO can further enhance performance, indicating complementary benefits between full-parameter fine-tuning and low-rank adaptation.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.