Papers › FlatQuant: Flatness Matters for LLM Quantization

FlatQuant: Flatness Matters for LLM Quantization

12 Oct 2024arXiv:2410.09426archive 2025-07-28

Yuxuan Sun, Ruikang Liu, Haoli Bai, Han Bao, Kang Zhao, Yuening Li, Jiaxin Hu, Xianzhi Yu, Lu Hou, Chun Yuan, Xin Jiang, Wulong Liu, Jun Yao

Recently, quantization has been widely used for the compression and acceleration of large language models~(LLMs). Due to the outliers in LLMs, it is crucial to flatten weights and activations to minimize quantization error with the equally spaced quantization points. Prior research explores various pre-quantization transformations to suppress outliers, such as per-channel scaling and Hadamard transformation. However, we observe that these transformed weights and activations can still remain steep and outspread. In this paper, we propose FlatQuant (Fast and Learnable Affine Transformation), a new post-training quantization approach to enhance flatness of weights and activations. Our approach identifies optimal affine transformations tailored to each linear layer, calibrated in hours via a lightweight objective. To reduce runtime overhead, we apply Kronecker decomposition to the transformation matrices, and fuse all operations in FlatQuant into a single kernel. Extensive experiments show that FlatQuant sets up a new state-of-the-art quantization benchmark. For instance, it achieves less than 1% accuracy drop for W4A4 quantization on the LLaMA-3-70B model, surpassing SpinQuant by 7.5%. For inference latency, FlatQuant reduces the slowdown induced by pre-quantization transformation from 0.26x of QuaRot to merely 0.07x, bringing up to 2.3x speedup for prefill and 1.7x speedup for decoding, respectively. Code is available at: \url{https://github.com/ruikangliu/FlatQuant}.

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="2410.09426")

Code

Syntology Ran 16 of 22 code samples harvested from 1 repository linked to this paper; 6 have no recorded run. Of those that ran: 3 ran · honoured contract; 4 ran · our draft was wrong; 9 ran with no contract checked.

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

ruikangliu/flatquant officialmentioned in papermentioned on GitHubpytorchMIT 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

22 samples harvested; 16 ran; 3 honoured the contract we drafted; 6 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.

3ran · honoured contract
4ran · our draft was wrong
9ran
6unverified

Licence: 0 of the 22 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 ruikangliu/flatquant. “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.

ActivationQuantizer ruikangliu/flatquant/flatquant/flat_linear.py official repository ran fingerprinted MIT (permissive) · fb8c9a5bb6eddb3a · report
WeightQuantizer ruikangliu/flatquant/flatquant/flat_linear.py official repository ran MIT (permissive) · c640fa304e83971e · report
asym_dequant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · honoured contract fingerprinted MIT (permissive) · 0225f1f47f1347ae · report
asym_quant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 5daeed014eb71da9 · report
asym_quant_dequant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · 1cff15f38a45ffdf · report
create_logger ruikangliu/FlatQuant/flatquant/args_utils.py official repository ran MIT (permissive) · 07d377e783931956 · report
get_act_stats ruikangliu/FlatQuant/flatquant/flatness.py official repository ran MIT (permissive) · ed340a7ba66258d0 · report
get_decompose_dim ruikangliu/FlatQuant/flatquant/function_utils.py official repository ran fingerprinted MIT (permissive) · 793e9add661c055d · report
get_init_scale ruikangliu/FlatQuant/flatquant/function_utils.py official repository ran MIT (permissive) · 8c5939efc897859f · report
get_qmin_qmax ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · honoured contract fingerprinted MIT (permissive) · 5e9e63617f0d5c45 · report
get_random_orthg ruikangliu/FlatQuant/flatquant/function_utils.py official repository ran fingerprinted MIT (permissive) · 344ae3d0d1bfe716 · report
load_flat_parameters ruikangliu/FlatQuant/flatquant/flat_utils.py official repository ran MIT (permissive) · fd3ef59f69a8d1f9 · report
reparameterize_model ruikangliu/FlatQuant/flatquant/flat_utils.py official repository ran MIT (permissive) · 44adddac22fc4be4 · report
sym_dequant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · honoured contract fingerprinted MIT (permissive) · 7240250f5015a29b · report
sym_quant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · d0ba87ceb3a23391 · report
sym_quant_dequant ruikangliu/flatquant/flatquant/flat_linear.py official repository ran · our draft was wrong fingerprinted MIT (permissive) · c4b090924d22c621 · report
FlatQuantizedLinear ruikangliu/flatquant/flatquant/flat_linear.py official repository unverified MIT (permissive) · 6f9dc3b96143740a · report
get_c4_new ruikangliu/FlatQuant/flatquant/data_utils.py official repository unverified MIT (permissive) · 5ce9fedf84036bba · report
get_ptb_new ruikangliu/FlatQuant/flatquant/data_utils.py official repository unverified MIT (permissive) · 88930c61cc7cd4ec · report
get_wikitext2 ruikangliu/FlatQuant/flatquant/data_utils.py official repository unverified MIT (permissive) · 4dd3c92f12273ec9 · report
kronecker_matmul ruikangliu/flatquant/flatquant/flat_linear.py official repository unverified MIT (permissive) · 0030c02f2d89d72e · report
ppl_eval ruikangliu/FlatQuant/flatquant/eval_utils.py official repository unverified MIT (permissive) · 395f9a60e4270266 · 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