LLMem: Estimating GPU Memory Usage for Fine-Tuning Pre-Trained LLMs

Taeho Kim, Yanming Wang, Vatshank Chaturvedi, Lokesh Gupta, Seyeon Kim +2 more
4/16/2024
cs.AIcs.CLcs.LG

No official code found. Best implementation: taehokim20/LLMem (30 stars, MIT, last commit 2025-05-31).

Abstract

Fine-tuning pre-trained large language models (LLMs) with limited hardware presents challenges due to GPU memory constraints. Various distributed fine-tuning methods have been proposed to alleviate memory constraints on GPU. However, determining the most effective method for achieving rapid fine-tuning while preventing GPU out-of-memory issues in a given environment remains unclear. To address this challenge, we introduce LLMem, a solution that estimates the GPU memory consumption when applying distributed fine-tuning methods across multiple GPUs and identifies the optimal method. We conduct GPU memory usage estimation prior to fine-tuning, leveraging the fundamental structure of transformer-based decoder models and the memory usage distribution of each method. Experimental results show that LLMem accurately estimates peak GPU memory usage on a single GPU, with error rates of up to 1.6%. Additionally, it shows an average error rate of 3.0% when applying distributed fine-tuning methods to LLMs with more than a billion parameters on multi-GPU setups.

View on arXivView PDF

Code Implementations(1)

taehokim20/LLMemCommunity100%
MIT

LLMem: GPU Memory Estimation for Fine-Tuning Pre-Trained LLMs

303C, C++Jan 15, 20241 years agoMIT

Similar Papers

Cite this paper

@article{kim2024llmem,
  title  = {LLMem: Estimating GPU Memory Usage for Fine-Tuning Pre-Trained LLMs},
  author = {Taeho Kim and Yanming Wang and Vatshank Chaturvedi and Lokesh Gupta and Seyeon Kim and Yongin Kwon and Sangtae Ha},
  year   = {2024},
  eprint = {2404.10933},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2404.10933v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2404.10933.svg)](https://codeofpaper.com/paper/2404.10933)

Discussion