{"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/apollo-sgd-like-memory-adamw-level","title":"APOLLO: SGD-like Memory, AdamW-level Performance","arxiv_id":"2412.05270","date":"2024-12-06","proceeding":null,"authors":["Hanqing Zhu","Zhenyu Zhang","Wenyan Cong","Xi Liu","Sem Park","Vikas Chandra","Bo Long","David Z. Pan","Zhangyang Wang","Jinwon Lee"],"abstract":"Large language models (LLMs) are notoriously memory-intensive during training, particularly with the popular AdamW optimizer. This memory burden necessitates using more or higher-end GPUs or reducing batch sizes, limiting training scalability and throughput. To address this, various memory-efficient optimizers have been proposed to reduce optimizer memory usage. However, they face critical challenges: (i) reliance on costly SVD operations; (ii) significant performance trade-offs compared to AdamW; and (iii) still substantial optimizer memory overhead to maintain competitive performance. In this work, we identify that AdamW's learning rate adaptation rule can be effectively coarsened as a structured learning rate update. Based on this insight, we propose Approximated Gradient Scaling for Memory-Efficient LLM Optimization (APOLLO), which approximates learning rate scaling using an auxiliary low-rank optimizer state based on pure random projection. This structured learning rate update rule makes APOLLO highly tolerant to further memory reductions while delivering comparable pre-training performance. Even its rank-1 variant, APOLLO-Mini, achieves superior pre-training performance compared to AdamW with SGD-level memory costs. Extensive experiments demonstrate that the APOLLO series performs on-par with or better than AdamW, while achieving greater memory savings by nearly eliminating the optimization states of AdamW. These savings provide significant system-level benefits: (1) Enhanced Throughput: 3x throughput on an 8xA100-80GB setup compared to AdamW by supporting 4x larger batch sizes. (2) Improved Model Scalability: Pre-training LLaMA-13B with naive DDP on A100-80GB GPUs without system-level optimizations. (3) Low-End GPU Friendly Pre-training: Pre-training LLaMA-7B on a single GPU using less than 12 GB of memory with weight quantization.","url_abs":"https://arxiv.org/abs/2412.05270v4","url_pdf":"https://arxiv.org/pdf/2412.05270v4.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":"apollo-sgd-like-memory-adamw-level","repo_url":"https://github.com/zhuhanqing/APOLLO","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}}],"tasks":[{"task_slug":null,"task_name":"GPU"},{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"adamw","method_name":"AdamW"},{"method_slug":"apollo","method_name":"Apollo"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.05270","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.05270"}},"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/zhuhanqing/APOLLO","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran_fixture":1,"ran_draft_wrong":1,"unverified":7},"by_repo_kind":{"official":{"samples":9,"ran":2,"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":9,"samples":[{"code_sha256_prefix":"f725bc2d76076485","entry":"apply_rotary_pos_emb","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/modeling_llama.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f725bc2d76076485"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/modeling_llama.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b99eea6376d1e212"}},{"code_sha256_prefix":"2cdd377d5ff74882","entry":"check_args_torchrun_main","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/argparse.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/argparse.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"2cdd377d5ff74882"}},{"code_sha256_prefix":"fef15e00e18cb2e3","entry":"max_train_tokens_to_number","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/argparse.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/argparse.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"fef15e00e18cb2e3"}},{"code_sha256_prefix":"79cccd597fa5d84b","entry":"next_seed","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"apollo_torch/random_projector.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/apollo_torch/random_projector.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"79cccd597fa5d84b"}},{"code_sha256_prefix":"dc86d6e2692ce573","entry":"parse_args","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/argparse.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/argparse.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"dc86d6e2692ce573"}},{"code_sha256_prefix":"e48f9d860da3434a","entry":"prepare_model_for_int8_training_simulation","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/fake_quantization.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/fake_quantization.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"e48f9d860da3434a"}},{"code_sha256_prefix":"85da4c29558f6526","entry":"setup_dataset","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"utils/dataloader.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/utils/dataloader.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"85da4c29558f6526"}},{"code_sha256_prefix":"efcffc3e39a1020d","entry":"stable_randn","repo":"zhuhanqing/APOLLO","repo_kind":"official","path":"apollo_torch/random_projector.py","file_url":"https://github.com/zhuhanqing/APOLLO/blob/HEAD/apollo_torch/random_projector.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NOASSERTION","inline_ok":false,"mcp_get_code":{"code_sha256":"efcffc3e39a1020d"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}