Papers › FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer

FQ-ViT: Post-Training Quantization for Fully Quantized Vision Transformer

27 Nov 2021arXiv:2111.13824archive 2025-07-28

Yang Lin, Tianyu Zhang, Peiqin Sun, Zheng Li, Shuchang Zhou

Network quantization significantly reduces model inference complexity and has been widely used in real-world deployments. However, most existing quantization methods have been developed mainly on Convolutional Neural Networks (CNNs), and suffer severe degradation when applied to fully quantized vision transformers. In this work, we demonstrate that many of these difficulties arise because of serious inter-channel variation in LayerNorm inputs, and present, Power-of-Two Factor (PTF), a systematic method to reduce the performance degradation and inference complexity of fully quantized vision transformers. In addition, observing an extreme non-uniform distribution in attention maps, we propose Log-Int-Softmax (LIS) to sustain that and simplify inference by using 4-bit quantization and the BitShift operator. Comprehensive experiments on various transformer-based architectures and benchmarks show that our Fully Quantized Vision Transformer (FQ-ViT) outperforms previous works while even using lower bit-width on attention maps. For instance, we reach 84.89% top-1 accuracy with ViT-L on ImageNet and 50.8 mAP with Cascade Mask R-CNN (Swin-S) on COCO. To our knowledge, we are the first to achieve lossless accuracy degradation (~1%) on fully quantized vision transformers. The code is available at https://github.com/megvii-research/FQ-ViT.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology: its repositories, every harvested function with whether it ran, its licence and the call to fetch it.

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

Code

Syntology Ran 3 of 3 code samples harvested from 1 repository linked to this paper; 0 have no recorded run. Of those that ran: 1 ran · honoured contract; 1 ran · our draft was wrong; 1 ran · fixture could not drive it.

By repository: official repository: 2 samples from 1 repository, 2 ran; 1 identical to code first harvested elsewhere. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

megvii-research/FQ-ViT officialmentioned in papermentioned on GitHubpytorch 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

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

1ran · honoured contract
1ran · our draft was wrong
1ran · fixture could not drive it

Licence: 1 of the 3 samples is 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 megvii-research/FQ-ViT. Some samples are identical code Syntology first harvested from another repository; for those, this paper's copy is not located and its licence is not recorded. “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.

str2model megvii-research/FQ-ViT/test_quant.py official repository ran · our draft was wrong Apache-2.0 (permissive) · e4b6f33d7173cf96 · report
validate megvii-research/FQ-ViT/test_quant.py official repository ran · honoured contract Apache-2.0 (permissive) · 0e215bc8d251972f · report
accuracy identical code first harvested elsewhere ran · fixture could not drive it licence of this copy not recorded · 18badd533b52adb3 · report

Tasks

Quantization

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Quantization ImageNet FQ-ViT (ViT-L) Activation bits 8 #1 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (ViT-L) Top-1 Accuracy (%) 85.03 #1 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (ViT-L) Weight bits 8 #1 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (ViT-B) Activation bits 8 #2 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (ViT-B) Top-1 Accuracy (%) 83.31 #2 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (ViT-B) Weight bits 8 #2 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-B) Activation bits 8 #3 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-B) Top-1 Accuracy (%) 82.97 #3 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-B) Weight bits 8 #3 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-S) Activation bits 8 #4 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-S) Top-1 Accuracy (%) 82.71 #4 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-S) Weight bits 8 #4 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-B) Activation bits 8 #5 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-B) Top-1 Accuracy (%) 81.20 #5 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-B) Weight bits 8 #5 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-T) Activation bits 8 #6 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-T) Top-1 Accuracy (%) 80.51 #6 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (Swin-T) Weight bits 8 #6 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-S) Activation bits 8 #7 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-S) Top-1 Accuracy (%) 79.17 #7 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-S) Weight bits 8 #7 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-T) Activation bits 8 #21 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-T) Top-1 Accuracy (%) 71.61 #21 of 27 Archive leaderboard report
Quantization ImageNet FQ-ViT (DeiT-T) Weight bits 8 #21 of 27 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPECascade Mask R-CNNConvolutionDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMask R-CNNMulti-Head AttentionPosition-Wise Feed-Forward LayerRPNResidual ConnectionRoIAlignSoftmaxTransformerVision Transformer

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