{"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/modulora-finetuning-3-bit-llms-on-consumer","title":"ModuLoRA: Finetuning 2-Bit LLMs on Consumer GPUs by Integrating with Modular Quantizers","arxiv_id":"2309.16119","date":"2023-09-28","proceeding":null,"authors":["Junjie Yin","Jiahao Dong","Yingheng Wang","Christopher De Sa","Volodymyr Kuleshov"],"abstract":"We propose a memory-efficient finetuning algorithm for large language models (LLMs) that supports finetuning LLMs with 65B parameters in 2/3/4-bit precision on as little as one 24GB GPU. Our method, modular low-rank adaptation (ModuLoRA), integrates any user-specified weight quantizer with finetuning via low-rank adapters (LoRAs). Our approach relies on a simple quantization-agnostic backward pass that adaptively materializes low-precision LLM weights from a custom black-box quantization module. This approach enables finetuning 2-bit and 3-bit LLMs for the first time -- leveraging state-of-the-art 2-bit QuIP\\# quantization and 3-bit OPTQ quantization -- outperforming finetuning that relies on less sophisticated 4-bit and 8-bit methods. In our experiments, \\lplora~attains competitive performance on text classification, natural language inference, and instruction following tasks using significantly less memory than existing approaches, and we also surpass the state-of-the-art ROUGE score on a popular summarization task. We release \\lplora~together with a series of low-precision models as part of \\llmtune, a user-friendly library for quantizing, running, and finetuning LLMs on consumer GPUs.","url_abs":"https://arxiv.org/abs/2309.16119v2","url_pdf":"https://arxiv.org/pdf/2309.16119v2.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":"modulora-finetuning-3-bit-llms-on-consumer","repo_url":"https://github.com/kuleshov-group/llmtools","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"modulora-finetuning-3-bit-llms-on-consumer","repo_url":"https://github.com/kuleshov-group/modulora-experiment","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"modulora-finetuning-3-bit-llms-on-consumer","repo_url":"https://github.com/kuleshov-group/llmtune","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"instruction-following","task_name":"Instruction Following"},{"task_slug":"natural-language-inference","task_name":"Natural Language Inference"},{"task_slug":"quantization","task_name":"Quantization"},{"task_slug":"text-classification","task_name":"Text Classification"},{"task_slug":"text-classification-1","task_name":"text-classification"}],"methods":[{"method_slug":null,"method_name":"Library"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2309.16119","atlas_url":"https://app.syntology.ai/?focus=2309.16119","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2309.16119"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/kuleshov-group/llmtools","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kuleshov-group/llmtune","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/kuleshov-group/modulora-experiment","reach":null}],"summary":{"ran_draft_wrong":2,"ran":3,"unverified":4},"by_repo_kind":{"official":{"samples":9,"ran":5,"repositories":2}},"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":8,"samples":[{"code_sha256_prefix":"a9e7f2cdf016b88b","entry":"find_layers","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/utils.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/utils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a9e7f2cdf016b88b"}},{"code_sha256_prefix":"0b601a0502930f6a","entry":"load_llm","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/executor.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/executor.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0b601a0502930f6a"}},{"code_sha256_prefix":"a2178676d3e7abdd","entry":"load_tokenizer","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/executor.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/executor.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a2178676d3e7abdd"}},{"code_sha256_prefix":"bd72bc50b587388e","entry":"preprocess_logits_for_metrics","repo":"kuleshov-group/modulora-experiment","repo_kind":"official","path":"finetune/samsum-llama/train_samsum_4bit.py","file_url":"https://github.com/kuleshov-group/modulora-experiment/blob/HEAD/finetune/samsum-llama/train_samsum_4bit.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bd72bc50b587388e"}},{"code_sha256_prefix":"ce032426a6ed928c","entry":"to_half_precision","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/utils.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ce032426a6ed928c"}},{"code_sha256_prefix":"cf26abc9397a7e53","entry":"load_adapter","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/executor.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/executor.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cf26abc9397a7e53"}},{"code_sha256_prefix":"c127added3419e2f","entry":"load_bloom_unquantized","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/llms/bloom/model.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/llms/bloom/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c127added3419e2f"}},{"code_sha256_prefix":"36c4edd08c263380","entry":"load_llama2_unquantized","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/llms/llama2/model.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/llms/llama2/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"36c4edd08c263380"}},{"code_sha256_prefix":"de4a6d2be23fd557","entry":"load_llama_unquantized","repo":"kuleshov-group/llmtools","repo_kind":"official","path":"llmtools/llms/llama/model.py","file_url":"https://github.com/kuleshov-group/llmtools/blob/HEAD/llmtools/llms/llama/model.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"de4a6d2be23fd557"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}