{"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/rptq-reorder-based-post-training-quantization","title":"RPTQ: Reorder-based Post-training Quantization for Large Language Models","arxiv_id":"2304.01089","date":"2023-04-03","proceeding":null,"authors":["Zhihang Yuan","Lin Niu","Jiawei Liu","Wenyu Liu","Xinggang Wang","Yuzhang Shang","Guangyu Sun","Qiang Wu","Jiaxiang Wu","Bingzhe Wu"],"abstract":"Large-scale language models (LLMs) have demonstrated impressive performance, but their deployment presents challenges due to their significant memory usage. This issue can be alleviated through quantization. In this paper, we identify that the challenge in quantizing activations in LLMs arises from varying ranges across channels, rather than solely the presence of outliers. To address this challenge, we introduce a quantization method called RPTQ, which utilizes a reorder-based approach. By rearranging the channels and quantizing them in clusters, RPTQ effectively mitigates the impact of range differences between channels. To minimize the overhead of the reorder operation, we fuse it into the layer norm operation and weights in linear layers. In our experiments, RPTQ achieved a significant breakthrough by utilizing 3-bit activation in LLMs for the first time, resulting in a substantial reduction in memory usage. For instance, quantizing OPT-175b can lead to a memory consumption reduction of up to 80%.","url_abs":"https://arxiv.org/abs/2304.01089v4","url_pdf":"https://arxiv.org/pdf/2304.01089v4.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":"rptq-reorder-based-post-training-quantization","repo_url":"https://github.com/hahnyuan/rptq4llm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"quantization","task_name":"Quantization"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2304.01089","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2304.01089"}},"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/hahnyuan/rptq4llm","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":3,"ran_draft_wrong":1,"unverified":5},"by_repo_kind":{"official":{"samples":9,"ran":4,"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":"904cd61df2fe8fb9","entry":"find_layers","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"models/models_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/models/models_utils.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":"904cd61df2fe8fb9"}},{"code_sha256_prefix":"ea06eaae4fc1eaf0","entry":"hash_args","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"models/models_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/models/models_utils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ea06eaae4fc1eaf0"}},{"code_sha256_prefix":"4df9168e0a0c38eb","entry":"make_disjoint_window","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"models/models_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/models/models_utils.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":"4df9168e0a0c38eb"}},{"code_sha256_prefix":"aaa7723c864e0a5e","entry":"sort_layers_by_params","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"parallel_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/parallel_utils.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":"aaa7723c864e0a5e"}},{"code_sha256_prefix":"716c9b4e71ec3424","entry":"assign_layers_to_gpus","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"parallel_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/parallel_utils.py","link_basis":"harvester_set","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":"716c9b4e71ec3424"}},{"code_sha256_prefix":"a7b3cccc9ad0d188","entry":"get_c4","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/datautils.py","link_basis":"harvester_set","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":"a7b3cccc9ad0d188"}},{"code_sha256_prefix":"641a84aa48f6ef5f","entry":"get_lowest_occupied_gpu","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"parallel_utils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/parallel_utils.py","link_basis":"harvester_set","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":"641a84aa48f6ef5f"}},{"code_sha256_prefix":"53cc9d33d473dc6b","entry":"get_ptb","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/datautils.py","link_basis":"harvester_set","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":"53cc9d33d473dc6b"}},{"code_sha256_prefix":"8b5943596ef2fc63","entry":"get_wikitext2","repo":"hahnyuan/rptq4llm","repo_kind":"official","path":"datautils.py","file_url":"https://github.com/hahnyuan/rptq4llm/blob/HEAD/datautils.py","link_basis":"harvester_set","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":"8b5943596ef2fc63"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}