RPFQ-ViT: Rotated Phase-Frame Quantization for Extremely Low-Bit Weights in Vision Transformers

Mengyuan Fan, Bokai Huang, JiaMing Pan, Xiaokun Yuan, Peizhuang Cong, Zhewen Tan, Tong YangNeurIPS 2026

TL;DR

Squeezing Vision Transformers (ViTs) down to 2-bit weights usually ruins their accuracy because standard quantization rounds each number on a 1D line, scrambling the high-dimensional directions that attention mechanisms rely on. RPFQ-ViT pairs up channels into 2D planes and quantizes their compass directions (phases) instead, shrinking models by up to 7.1× and speeding up real smartphone inference by ~1.5× while keeping accuracy remarkably close to full-precision models.

What Problem Does This Paper Address?

Vision Transformers are powerhouse models for image recognition, but their massive linear projection layers make them heavy to store and slow to run on edge devices like smartphones. A popular fix is quantization—shrinking 32-bit floating-point weights down to tiny 4-, 3-, or 2-bit integers using Quantization-Aware Training (QAT), where the model learns to adapt to low precision during training.

However, ViTs fall apart at 2 bits. Prior research blamed unstable training dynamics, proposing complex knowledge distillation (teacher-student training) to compensate. The authors here spot a more fundamental, geometric flaw: Transformer attention relies on inner products between Queries and Keys, meaning it cares deeply about the angle (direction) of vectors. Standard quantizers round every scalar weight independently onto a 1D number line. At 2 bits, snapping coordinates independently to a rigid grid collapses local subspace directions onto the coordinate axes, warping attention maps.

Figure 2: Phase-geometry view of low-bit quantization on half-split channel pairs from a ViT-B/16 linear layer. (a) Full-precision weights concentrate around a dominant direction. (b) Independent real-valued ternary quantization collapses directions toward the coordinate axes and induces large angular error. (c) RPFQ rotates a four-phase codebook toward the local dominant direction, substan- tially reducing the angular error under 2-bit quantization.

Methods

Instead of treating weights as isolated numbers, Rotated Phase-Frame Quantization (RPFQ) quantizes them as 2D vectors. Crucially, it acts as a drop-in replacement for standard nn.Linear layers—leaving attention, activations, normalization, and standard deployment graphs completely untouched.

Figure 1: Overview of RPFQ. Even-dimensional ViT linear layers are rewritten in paired complex coordinates, quantized with a learnable rotated phase frame plus least-squares magnitude fitting and residual refinement, and then mapped back to standard real-valued weights. Attention, normaliza- tion, and activation layers remain unchanged.

Here is how it works:

  1. Deterministic Half-Split Pairing: Because ViT linear layers almost always have even channel dimensions ($2m$), RPFQ pairs channel $j$ with channel $j+m$. Algebraically, this rewrites a real weight matrix into an exact, equivalent pair of complex matrices—turning pairs of scalars into 2D points ($z = \rho e^{i\theta}$) with a magnitude and a phase angle, without adding routing overhead.
  2. Learnable Rotated Phase Frame: A basic 2-bit compass has four fixed directions ($\pm 1, \pm i$). Because ViT weight clusters don't naturally align with global axes, RPFQ learns a group-wise rotation angle ($\theta_g$) and four fine-tuned phase anchors to align the compass with each group's dominant direction.
  3. Magnitude Fitting & Residual Refinement: Once weights snap to their nearest 2-bit direction, RPFQ recovers their scale using a fast least-squares scalar fit ($\alpha_g$). Because one real matrix splits into two complex matrices, one 2-bit complex pass actually costs just 1 effective bit per original real weight. To reach a 2-bit budget (W2), RPFQ takes the leftover error (residual) from the first pass and runs a second phase-quantization step on it!

Datasets

All training and accuracy evaluations are conducted on ImageNet-1K (single-crop $224 \times 224$ resolution) using standard ViT-B/16, DeiT-S, and Swin-T backbones. No new datasets are introduced.

Key Insights and Ideas

  • Direction beats scalar precision at ultra-low bits: In ablations, RPFQ cuts weight angular error by more than half (from 1.00 down to 0.43 normalized error) compared to standard real-valued quantization, which directly cuts attention-score distortion in half and preserves token features.
  • Residual phase refinement does heavy lifting: Using the second bit to capture the angle of the error from the first bit produces the single largest accuracy jump (+2.18% Top-1 on ViT-B/16) in the component ablations.
  • No teacher required: Because the representation naturally fits Transformer geometry, RPFQ needs no teacher model or attention-distillation losses. On 8×H800 GPUs, a 300-epoch ViT-B/16 run finishes in 46.55 hours, compared to a projected 160.21 hours for the distillation-heavy Q-ViT baseline.

Key Results

Across three-seed averages on ImageNet-1K under 2-bit weight budgets (W2), RPFQ consistently outperforms existing QAT baselines:

  • ViT-B/16 (W2/A4): Reaches 79.33% Top-1 accuracy, beating LSQ++KD (75.10%) and reproduced Q-ViT (62.38%), and slightly edging out the 32-bit baseline (77.89%)—likely due to a mild regularization effect.
  • DeiT-S (W2/A8): Achieves 77.41% Top-1, surpassing OFQ (75.72%) and Q-ViT (72.10%).
  • Swin-T (W2/A8): Hits 79.30% Top-1, ahead of OFQ (78.52%) and Q-ViT (74.70%).
  • Real-World Mobile Deployment: Exported to native iOS (MLX Swift) and Android (JNI/C++) phones with 2-bit packed weights, RPFQ shrinks ViT-B/16 from 338.6 MB to 47.7 MB (7.1× smaller) and Swin-T from 110.2 MB to 20.4 MB (5.4× smaller), delivering 1.41× to 1.58× end-to-end latency speedups.

Limitations and Future Work

  • Task Scope: Experiments are currently limited to ImageNet-1K image classification; dense prediction tasks (like object detection or segmentation) remain untested.
  • Ultra-low-bit Activations: While weights drop cleanly to 2 bits alongside 4- or 8-bit activations, pushing activations down to 2 bits (A2) remains unstable.
  • Hardware & Metrics: Current mobile runtimes still partially unpack 2-bit weights during execution, leaving further kernel-level speedups on the table, and direct on-device energy consumption was not measured. The authors also highlight evaluating robustness, fairness, and privacy in downstream deployments as necessary next steps.

Summary updated

Abstract

Vision Transformers (ViTs) achieve strong performance on image recognition and mobile vision applications, but their high-dimensional linear projections and attention computations still impose substantial storage and inference costs. Extremely low-bit quantization is a promising solution, yet ViTs often suffer severe accuracy degradation because conventional real-valued scalar codebooks are poorly matched to the directional geometry of Transformer projections. We present RPFQ-ViT, a Rotated Phase-Frame Quantization method that quantizes paired channels in two-dimensional phase planes, enabling low-bit codes to better preserve projection directions while recovering magnitude with lightweight scaling. RPFQ-ViT serves as a drop-in QAT replacement for \texttt{nn.Linear} and does not modify the standard real-valued attention, normalization, or activation computation graph. On ImageNet-1K, RPFQ-ViT-B/16 reaches 79.33\% Top-1 / 94.48\% Top-5 under W2/A4, Swin-T reaches 79.30\% Top-1 / 94.79\% Top-5 under W2/A8, and DeiT-S reaches 77.41\% Top-1 / 93.11\% Top-5 under W2/A8. Ablations, phase-geometry analysis, and direction-preservation metrics show that channel pairing, learnable rotation, phase-anchor learning, and residual phase refinement each improve quantization quality. We further deploy RPFQ-ViT image-classification models on native iOS and Android runtime stacks; with 2-bit packed weights, model size shrinks by roughly $5.4$--$7.1\times$ relative to FP32 and end-to-end on-device latency drops by $1.4$--$1.6\times$. All ImageNet results trained in our codebase use a matched 300-epoch recipe and are reported as mean accuracies over three independent runs. These results show that RPFQ-ViT provides a favorable trade-off among accuracy, compression, and practical mobile deployment for extremely low-bit ViTs.
BibTeX
@inproceedings{fan2026rpfq,
  author = {Mengyuan Fan and Bokai Huang and JiaMing Pan and Xiaokun Yuan and Peizhuang Cong and Zhewen Tan and Tong Yang},
  title = {{RPFQ-ViT: Rotated Phase-Frame Quantization for Extremely Low-Bit Weights in Vision Transformers}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=XB7p2Y3eXt},
}
Figure