Q-SAM2: Accurate Quantization for Segment Anything Model 2

Nicola Farronato, Florian Scheidegger, Mattia Rigotti, Cristiano Malossi, Michele Magno, Haotong QinarXiv 2025 · DOI

Introduction

The Segment Anything Model 2 (SAM2) has set a new standard for promptable segmentation in both images and video. However, its massive parameter count and high computational demands present significant challenges for deployment on resource-constrained edge devices, such as mobile phones or embedded robotics. While quantization—reducing precision from 32-bit to 4-bit or 2-bit—is a common solution for model compression, SAM2's "heavy-tailed" weight and activation distributions often lead to catastrophic accuracy loss in low-bit regimes. Q-SAM2 addresses these issues through a novel two-stage quantization-aware training (QAT) pipeline.

The Q-SAM2 Framework

Q-SAM2 introduces two primary innovations designed to stabilize and optimize low-bit quantization: Variance-Reduced Calibration (VRC) and Learnable Statistical Clipping (LSC).

Variance-Reduced Calibration (VRC)

Before the training phase begins, VRC acts as a surgical initialization step. Most QAT methods start with a "broken" quantized model and attempt to recover performance during training. In contrast, VRC "cleans" the model's weight distributions using a small calibration batch. By applying a Moore-Penrose pseudoinverse with Tikhonov regularization, the framework projects weights into a subspace that preserves the layer's output while significantly reducing weight variance (by 10-20% on average). This provides a much more stable starting point for the quantization process.

Learnable Statistical Clipping (LSC)

During the training phase, Q-SAM2 employs LSC to manage the clipping bounds of the quantizers. A key insight of this research is that extreme outliers in SAM2 can be clipped without destroying the model's predictive power; the difficulty lies in optimizing the remaining dense part of the distribution.

Instead of allowing clipping bounds to float freely—which often leads to convergence failures in ultra-low bit-widths—LSC anchors them to the data's actual statistics. It tracks the mean (μ) and standard deviation (σ) using an Exponential Moving Average and learns a single coefficient (k) per quantizer to find the optimal balance between clipping outliers and maintaining precision.

The Q-SAM2 pipeline, illustrating the Variance-Reduced Calibration (VRC) and Learnable Statistical Clipping (LSC) mechanisms.

Evaluation and Results

The authors evaluated Q-SAM2 on several large-scale benchmarks, including SA-1B for image pre-training, SA-V and MOSE for video segmentation, and COCO2017 for instance segmentation. Notably, the framework achieved state-of-the-art results using only a fraction of the original training data (~8% of SA-1B and ~45% of SA-V).

Massive Compression and Superior Accuracy

Q-SAM2 achieved an 8x reduction in model size compared to the BF16 baseline. For example, a SAM2-B+ model was shrunk to just 38.8 MB. In the 4-bit (W4A4) regime, Q-SAM2 outperformed the best competing QAT models by 9.7 percentage points (ppt) in video segmentation (J&F) and 7.3 ppt in instance segmentation (mIoU).

Even at the extreme W2A2 (2-bit weights and activations) level, Q-SAM2 maintained accuracy comparable to much larger, higher-precision state-of-the-art methods. Qualitative results confirm that Q-SAM2 produces cleaner masks with fewer artifacts and better object tracking over time compared to standard baselines like PACT or T-LSQ+.

Accuracy (mAP) vs. Model Size (MB) on a log scale. Q-SAM2 (green and red circles) occupies the top-left Pareto frontier, offering higher accuracy at smaller sizes compared to PTQ and other QAT baselines.

Conclusion

Q-SAM2 demonstrates that high-fidelity quantization of large vision foundation models is achievable even in the ultra-low 2-bit regime. By focusing on variance reduction at initialization and statistically-anchored clipping during training, the framework enables advanced vision tasks on edge hardware. Future research will explore layer-specific adaptive regularization and the implementation of these 2-bit kernels on specific hardware to measure real-world latency and power savings.

Summary updated

BibTeX
@misc{farronato2025q,
  author = {Nicola Farronato and Florian Scheidegger and Mattia Rigotti and Cristiano Malossi and Michele Magno and Haotong Qin},
  title = {{Q-SAM2: Accurate Quantization for Segment Anything Model 2}},
  year = {2025},
  eprint = {2506.09782},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2506.09782},
}
Figure