TL;DR
Why does a clever math trick used to compress Large Language Models down to 4 bits sometimes cause Vision Transformers to completely collapse? This paper solves the mystery: GELU activations in vision models don't cancel out around zero, causing standard Hadamard rotations to accidentally pile every channel's average into a single massive "super-outlier." By breaking the rotation into bite-sized 64-channel groups that fuse directly into existing GPU kernels, the authors unlock fast, genuinely accurate 4-bit vision models.
What Problem Does This Paper Address?
To run massive neural networks cheaply, engineers use Post-Training Quantization (PTQ) to shrink weights and activations from 16-bit floating-point down to 4-bit integers (W4A4). On widely deployed GPUs (like NVIDIA's Ampere and Ada consumer cards), 4-bit tensor cores offer double the throughput of 8-bit ones.
The catch? Four bits only give you 16 distinct values, and transformers are notorious for "outlier channels"—a handful of features with huge magnitudes that stretch the quantization grid and ruin precision for everything else. In LLMs, the standard fix is an online Hadamard rotation: an orthogonal matrix multiplication that smears outliers evenly across all channels without changing the layer's mathematical output.
When researchers tried copying this exact playbook to Vision Transformers (ViTs), it proved wildly unstable—helping a little on some models while dropping DINOv3-L accuracy to literal random chance (0.10%). Worse, fixing it with randomized signs requires an extra pass over GPU memory, which eats up the entire 4-bit speedup!
Methods
Instead of a full-width rotation across all $K$ channels, the authors introduce SGHAQuant, built on three lightweight, hardware-aware pieces:
- Grouped Hadamard (GH): They split channels into independent groups (specifically $n=64$ at the troublesome
fc2layer) and rotate each group separately. Because each group only sums 64 channels instead of thousands, the accumulated sum stays small. Crucially, 64 channels fit neatly inside the GPU register tile of the preceding layer's (fc1) matrix-multiply epilogue—meaning zero extra memory passes. - Channel Scaling ($S$) & Output Affine Map ($A$): Because grouping is narrower, a group containing a natural outlier still stands out slightly. When not using heavy weight-reconstruction methods, the authors freeze the pretrained weights and Sandwich the layer with two fast corrections: a closed-form SmoothQuant-style scaling ($S$) before the rotation to tame outliers, and a learned per-channel gain/bias ($A$) after the matrix multiply, folded directly into layer norms and GEMM scales.
Datasets
The authors calibrate and evaluate across standard vision benchmarks without introducing new datasets:
- ImageNet: Validation top-1 accuracy (and zero-shot classification for DINOv3-L), using 512–1,024 training images for calibration.
- COCO: Instance segmentation (mask AP with YOLOX/DINO boxes for SAM, and point-prompt mIoU on 4,629 instances for SAM2.1), calibrated on 32–64 images.
- SA-V: Video segmentation ($J\&F$ score) for SAM2.1-Tiny.
Key Insights and Ideas
- It’s the activation function, not the modality: Why did LLMs survive unsigned Hadamard rotations while ViTs died? Modern LLMs (like Llama/Qwen) use SwiGLU, whose outputs naturally center around zero so channel means cancel out. Most ViTs (and older LLMs like GPT-2/OPT) use GELU before their second MLP layer (
fc2). Because GELU is bounded below near zero, its outputs are skewed positive. The first row of a standard Hadamard matrix is all ones—meaning it literally adds up every positive channel mean and dumps the massive sum into the very first coordinate! - Memory traffic is the real boss: Mathematically, subtracting per-token means or multiplying by random $\pm 1$ signs fixes the GELU spike. Practically, doing that across a full row requires reading and writing gigabytes of activations to VRAM, wiping out the INT4 compute advantage. Grouping solves the math problem and the systems bottleneck simultaneously.
Key Results
- Universal Plug-in Gains: Dropped directly into four existing PTQ methods on ImageNet, GH improved all 28 method-model pairs (e.g., boosting RepQ-ViT by +1.5 to +8.9 percentage points). On AHCQ-SAM, it boosted mask AP by +3.0 to +6.1 points.
- Rescuing DINOv3: On DINOv3-L at W4A4, standard full-width Hadamard collapsed to 0.10% accuracy. GH restored it to 80.44% (within 0.95% of FP32) while running 1.30$\times$ faster than W8A8.
- Real Hardware Speedups: Using their custom CUDA INT4 engine on an RTX 4090, SGHAQuant kept all four SAM2.1 encoders within 0.4 mIoU of floating-point while running 1.12 to 1.27$\times$ faster than their engine's W8A8 path, and 1.78 to 2.78$\times$ faster than TensorRT FP16. The GH transform itself adds just 0.7% to 2.3% latency at
fc2.
Limitations and Future Work
- Hardware generational quirk: The real-world speedups rely on INT4 tensor cores found in NVIDIA Ampere (RTX 30-series) and Ada (RTX 40-series) GPUs. Newer data-center architectures like Hopper and Blackwell actually dropped native INT4 tensor cores.
- Partial quantization scope: Their native CUDA engine only quantizes
qkv,fc1, andfc2linear layers, leaving attention matrix products, output projections, and mask decoders in FP16/FP32. - Future trade-offs: Without $S$ and $A$, a randomized full-width Hadamard beats GH by up to 1 accuracy point; if future hardware architectures ever make that extra memory pass cheap, full-width randomized rotations would become preferable.
Summary updated