Papers › AffineQuant: Affine Transformation Quantization for Large Language Models

AffineQuant: Affine Transformation Quantization for Large Language Models

19 Mar 2024arXiv:2403.12544archive 2025-07-28

Yuexiao Ma, Huixia Li, Xiawu Zheng, Feng Ling, Xuefeng Xiao, Rui Wang, Shilei Wen, Fei Chao, Rongrong Ji

The significant resource requirements associated with Large-scale Language Models (LLMs) have generated considerable interest in the development of techniques aimed at compressing and accelerating neural networks. Among these techniques, Post-Training Quantization (PTQ) has emerged as a subject of considerable interest due to its noteworthy compression efficiency and cost-effectiveness in the context of training. Existing PTQ methods for LLMs limit the optimization scope to scaling transformations between pre- and post-quantization weights. In this paper, we advocate for the direct optimization using equivalent Affine transformations in PTQ (AffineQuant). This approach extends the optimization scope and thus significantly minimizing quantization errors. Additionally, by employing the corresponding inverse matrix, we can ensure equivalence between the pre- and post-quantization outputs of PTQ, thereby maintaining its efficiency and generalization capabilities. To ensure the invertibility of the transformation during optimization, we further introduce a gradual mask optimization method. This method initially focuses on optimizing the diagonal elements and gradually extends to the other elements. Such an approach aligns with the Levy-Desplanques theorem, theoretically ensuring invertibility of the transformation. As a result, significant performance improvements are evident across different LLMs on diverse datasets. To illustrate, we attain a C4 perplexity of 15.76 (2.26 lower vs 18.02 in OmniQuant) on the LLaMA2-7B model of W4A4 quantization without overhead. On zero-shot tasks, AffineQuant achieves an average of 58.61 accuracy (1.98 lower vs 56.63 in OmniQuant) when using 4/4-bit quantization for LLaMA-30B, which setting a new state-of-the-art benchmark for PTQ in LLMs.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2403.12544")

Code

Syntology Ran 8 of 15 code samples harvested from 1 repository linked to this paper; 7 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 7 ran with no contract checked.

By repository: official repository: 15 samples from 1 repository, 8 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

bytedance/affinequant officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

15 samples harvested; 8 ran; 0 honoured the contract we drafted; 7 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · our draft was wrong
7ran
7unverified

Licence: 0 of the 15 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from bytedance/affinequant. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

ampscaler_get_grad_norm bytedance/affinequant/utils.py official repository ran Apache-2.0 (permissive) · 4ac3f836e543e81c · report
find_layers bytedance/affinequant/models/models_utils.py official repository ran Apache-2.0 (permissive) · 904cd61df2fe8fb9 · report
get_act_scales bytedance/affinequant/generate_act_scale_shift.py official repository ran Apache-2.0 (permissive) · bd1c7aaaa05aeaf3 · report
get_act_shifts bytedance/affinequant/generate_act_scale_shift.py official repository ran Apache-2.0 (permissive) · 550d556e74fb20f7 · report
make_disjoint_window bytedance/affinequant/models/models_utils.py official repository ran Apache-2.0 (permissive) · 4df9168e0a0c38eb · report
sort_layers_by_params bytedance/affinequant/parallel_utils.py official repository ran Apache-2.0 (permissive) · aaa7723c864e0a5e · report
truncate_number bytedance/affinequant/models/transformation.py official repository ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 94587954e392b665 · report
truncate_number bytedance/affinequant/models/models_utils.py official repository ran fingerprinted Apache-2.0 (permissive) · 4e53fbbdfa160f7d · report
assign_layers_to_gpus bytedance/affinequant/parallel_utils.py official repository unverified Apache-2.0 (permissive) · 7e3ef1ed347af0f3 · report
build_model_and_tokenizer bytedance/affinequant/generate_act_scale_shift.py official repository unverified Apache-2.0 (permissive) · a041d7c9b413c995 · report
create_logger bytedance/affinequant/utils.py official repository unverified Apache-2.0 (permissive) · 87877d0c60858bff · report
get_lowest_occupied_gpu bytedance/affinequant/parallel_utils.py official repository unverified Apache-2.0 (permissive) · 3c6439a3c61dd2bb · report
get_pile bytedance/affinequant/datautils.py official repository unverified Apache-2.0 (permissive) · fe6f95071099234c · report
get_ptb bytedance/affinequant/datautils.py official repository unverified Apache-2.0 (permissive) · bd4f416e271c2fb5 · report
get_wikitext2 bytedance/affinequant/datautils.py official repository unverified Apache-2.0 (permissive) · 406294899f965c2f · report

Tasks

Quantization

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections