ViM-VQ: Efficient Post-Training Vector Quantization for Visual Mamba

Juncan Deng, Shuaiting Li, Zeyu Wang, Kedong Xu, Hong Gu, Kejie Huang

TL;DR

This paper introduces ViM-VQ, a novel post-training vector quantization method specifically designed for Visual Mamba networks (ViMs). ViM-VQ tackles the challenges of outlier-rich weights in ViMs and the limitations of existing VQ methods, achieving state-of-the-art low-bit quantization performance with significantly reduced calibration time and memory usage.

What Problem Does This Paper Address?

Visual Mamba networks (ViMs) are a promising new architecture for computer vision tasks, extending the capabilities of state space models to handle visual data efficiently. However, deploying these powerful models on resource-constrained edge devices is challenging due to their large size and computational demands. Model quantization, particularly vector quantization (VQ), offers a solution by compressing model weights. While VQ has been successful in other architectures like CNNs and Transformers, directly applying existing VQ methods to ViMs results in significant accuracy degradation. This is primarily due to two key issues: 1) ViM weights contain numerous outliers that amplify quantization errors, and 2) existing VQ methods suffer from high memory consumption, lengthy calibration procedures, and suboptimal performance when dealing with the complex, multi-layered structure of ViMs. This paper aims to bridge this gap by developing an efficient VQ method tailored specifically for ViMs.

Methods

The core contribution of this paper is ViM-VQ, an efficient post-training vector quantization (PTQ) method for ViMs. ViM-VQ introduces two main innovations:

  1. Fast Convex Combination Optimization Algorithm: This algorithm efficiently searches for optimal codewords by operating on convex combinations of nearby candidate codewords and their soft assignment ratios. It rapidly optimizes both the convex combinations and the convex hulls, significantly accelerating the search process and reducing computational and memory overhead compared to previous methods. This approach avoids the need for expensive secondary computations like Hessian traces or SVD.
  2. Incremental Vector Quantization Strategy: To mitigate truncation errors introduced during the conversion from soft to hard assignments (a common issue in VQ), ViM-VQ employs an incremental approach. It progressively confirms optimal codewords by transitioning candidate codewords with high soft assignment ratios (e.g., > 0.99) to hard assignments. This allows remaining sub-vectors still undergoing calibration to compensate for quantization errors, leading to more robust and accurate final quantized weights.

The overall ViM-VQ framework is fully differentiable and aims to balance quantization accuracy with efficiency.

Datasets

The paper evaluates ViM-VQ on standard computer vision benchmarks:

  • ImageNet-1K: Used for image classification tasks.
  • ADE20K: Used for semantic segmentation tasks.
  • MSCOCO: Used for object detection and instance segmentation tasks.

The authors use a calibration set of 100 images per category from the training set for evaluating the quantization process.

Key Insights and Ideas

  • ViM weights are outlier-rich: This is a critical observation that explains why standard VQ methods fail on ViMs. The presence of outliers significantly amplifies quantization errors, leading to performance drops.
  • Existing VQ methods are not a good fit for ViMs: The paper highlights that methods designed for CNNs or Transformers struggle with the unique architecture and weight distribution of ViMs, leading to high memory usage, long calibration times, and suboptimal accuracy.
  • Convex combinations are powerful for VQ: By optimizing convex combinations of codewords and their assignments, ViM-VQ can efficiently search for optimal representations without requiring complex, computationally expensive operations.
  • Incremental confirmation is key to reducing truncation errors: The incremental strategy effectively addresses the loss incurred when converting soft assignments to hard ones, a crucial step for achieving high accuracy in low-bit quantization.
  • ViM-VQ achieves a strong trade-off: The method demonstrates that it's possible to achieve significant compression (low-bit quantization) for ViMs without sacrificing substantial accuracy, making them more deployable on edge devices.

Key Results

ViM-VQ demonstrates state-of-the-art performance across various tasks and model scales:

  • Image Classification (Vim-T/S/B on ImageNet-1K): ViM-VQ consistently outperforms other advanced VQ methods (DKM, VQ4DiT) and even basic UQ methods, achieving accuracies very close to the full-precision baseline, even at 1-bit quantization. For Vim-T at 2-bit, it achieves 72.17% Top-1 accuracy, a significant improvement over baselines.
  • Semantic Segmentation (VMamba-T on ADE20K): At 2-bit quantization, ViM-VQ achieves mIoU scores comparable to full-precision models (e.g., 44.4% single-scale, 45.4% multi-scale), outperforming other methods.
  • Object Detection and Instance Segmentation (VMamba-T on MSCOCO): ViM-VQ achieves excellent results, with 46.0% box AP and 41.8% mask AP at 2-bit, and maintains high performance even at 1-bit.
  • Efficiency: ViM-VQ significantly reduces calibration time and GPU memory requirements compared to existing methods. Table 5 shows ViM-VQ requiring less memory and fewer epochs for calibration than DKM. Table 6 indicates that ViM-VQ, with a custom CUDA kernel, achieves inference speeds close to the original full-precision ViM.

Limitations and Future Work

  • Limitations: The paper acknowledges that while ViM-VQ significantly reduces truncation errors, some residual error may still exist, especially at extremely low bit-widths. The performance gains are most pronounced when quantizing linear projection layers within ViM blocks, suggesting that other components might also benefit from specialized quantization.
  • Future Work: The authors suggest that their ViM-VQ framework provides a robust foundation for further research into efficient quantization of ViMs. Future work could explore adaptive quantization strategies for different layers or components within ViMs, investigate the impact of activation quantization in conjunction with weight quantization, and explore the application of ViM-VQ to even more complex ViM variants or other state space model architectures.

Summary updated

BibTeX
@inproceedings{deng2025vim,
  author = {Juncan Deng and Shuaiting Li and Zeyu Wang and Kedong Xu and Hong Gu and Kejie Huang},
  title = {{ViM-VQ: Efficient Post-Training Vector Quantization for Visual Mamba}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure