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.
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.
Here is how it works:
- 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.
- 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.
- 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