{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/llmem-estimating-gpu-memory-usage-for-fine","title":"LLMem: Estimating GPU Memory Usage for Fine-Tuning Pre-Trained LLMs","arxiv_id":"2404.10933","date":"2024-04-16","proceeding":null,"authors":["TaeHo Kim","Yanming Wang","Vatshank Chaturvedi","Lokesh Gupta","Seyeon Kim","Yongin Kwon","Sangtae Ha"],"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.","url_abs":"https://arxiv.org/abs/2404.10933v1","url_pdf":"https://arxiv.org/pdf/2404.10933v1.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"llmem-estimating-gpu-memory-usage-for-fine","repo_url":"https://github.com/taehokim20/llmem","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"decoder","task_name":"Decoder"},{"task_slug":null,"task_name":"GPU"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2404.10933","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.10933"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/taehokim20/llmem","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/taehokim20/LLMem","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":11,"unverified":2},"by_repo_kind":{"official":{"samples":13,"ran":11,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"d11e60ed4e63403d","entry":"apply_rotary_pos_emb","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_codegen.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_codegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d11e60ed4e63403d"}},{"code_sha256_prefix":"fea555fa29409762","entry":"bloom_gelu_forward","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_bloom.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_bloom.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fea555fa29409762"}},{"code_sha256_prefix":"4a678475b134e3a3","entry":"build_alibi_tensor","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_bloom.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_bloom.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4a678475b134e3a3"}},{"code_sha256_prefix":"c2217cd556fe5607","entry":"create_sinusoidal_positions","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_codegen.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_codegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c2217cd556fe5607"}},{"code_sha256_prefix":"280bd05460216db0","entry":"dropout_add","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_bloom.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_bloom.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"280bd05460216db0"}},{"code_sha256_prefix":"49334501abd461a4","entry":"masked_softmax","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_gpt_bigcode.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_gpt_bigcode.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"49334501abd461a4"}},{"code_sha256_prefix":"87770cda7e05b48c","entry":"move_to_cuda","repo":"taehokim20/llmem","repo_kind":"official","path":"dp_real.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/dp_real.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"87770cda7e05b48c"}},{"code_sha256_prefix":"817d5f759487007d","entry":"preprocess","repo":"taehokim20/llmem","repo_kind":"official","path":"dp_real.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/dp_real.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"817d5f759487007d"}},{"code_sha256_prefix":"2e3bec9f0c9b1973","entry":"rotate_every_two","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_codegen.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_codegen.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2e3bec9f0c9b1973"}},{"code_sha256_prefix":"38cab2f301010b6d","entry":"upcast_masked_softmax","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_gpt_bigcode.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_gpt_bigcode.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"38cab2f301010b6d"}},{"code_sha256_prefix":"49527b68e554c71a","entry":"upcast_softmax","repo":"taehokim20/llmem","repo_kind":"official","path":"real_models/modeling_gpt_bigcode.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/real_models/modeling_gpt_bigcode.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"49527b68e554c71a"}},{"code_sha256_prefix":"2d6cdec623b61202","entry":"SizeEstimator","repo":"taehokim20/LLMem","repo_kind":"official","path":"size_estimator.py","file_url":"https://github.com/taehokim20/LLMem/blob/HEAD/size_estimator.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2d6cdec623b61202"}},{"code_sha256_prefix":"57ebefbf9f9142ef","entry":"preprocess","repo":"taehokim20/llmem","repo_kind":"official","path":"tp_real.py","file_url":"https://github.com/taehokim20/llmem/blob/HEAD/tp_real.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"57ebefbf9f9142ef"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}