Quamba2: A Robust and Scalable Post-training Quantization Framework for Selective State Space Models

Hung-Yueh Chiang, Chi-Chih Chang, Natalia Frumkin, Kai-Chiang Wu, Mohamed S. Abdelfattah, Diana Marculescu

Abstract

State Space Models (SSMs), such as Mamba, have emerged as efficient alternatives to Transformers due to their linear scaling and constant memory requirements during inference. However, deploying these models on memory-constrained edge devices remains a challenge due to their sheer parameter count. This paper presents Quamba2, a robust post-training quantization (PTQ) framework designed specifically for the unique architectural characteristics of SSMs. By leveraging predictable activation patterns and introducing novel techniques like Sort-and-Cluster and Per-State-Group quantization, Quamba2 enables 4-bit and 8-bit precision with minimal accuracy loss. Our results demonstrate up to a 4x reduction in memory and a 3x increase in generation speed, facilitating the deployment of 8B-parameter models on edge hardware.

Introduction

The rapid advancement of Large Language Models (LLMs) has traditionally been dominated by the Transformer architecture. While effective, Transformers suffer from quadratic complexity and an ever-expanding Key-Value (KV) cache, which limits their efficiency in long-sequence processing. Selective State Space Models (SSMs), such as Mamba1 and Mamba2, address these limitations by maintaining a constant state size.

Despite these architectural advantages, the sheer size of high-performing SSMs—often reaching billions of parameters—presents a significant barrier to deployment on edge devices and cost-effective cloud serving. Post-training quantization (PTQ) is the standard approach to reduce model size by converting weights and activations from FP16 to lower-bit integers (e.g., INT8 or INT4). However, SSMs are notoriously sensitive to quantization; the linear recurrence mechanism at their core tends to amplify small numerical errors, leading to significant performance degradation. Quamba2 is introduced to bridge this gap, providing a specialized framework that respects the mathematical properties of SSMs while achieving aggressive compression.

Methodology

Quamba2 introduces several novel techniques to stabilize the quantization of SSMs without requiring expensive retraining.

Sort-and-Cluster Quantization

Standard quantization often struggles with "outlier" activations that skew the scaling factors for an entire layer. Quamba2 exploits the discovery that activation channels in SSMs are remarkably consistent across time steps. The framework sorts activation channels based on their maximum values and clusters similar channels together. By applying specific scaling factors to these clusters rather than a global scale, Quamba2 preserves precision in sensitive channels while maintaining efficiency.

Per-State-Group Quantization

In architectures like Mamba2, the input-dependent parameters $B$ and $C$ are critical for the model's selective mechanism. Quamba2 applies quantization to specific "state groups" rather than globally. This localized approach protects sensitive values within the state transition matrices, preventing the error amplification typically seen in recurrent structures.

Offline Weight Reordering and Hadamard Fusion

To ensure that the Sort-and-Cluster method does not introduce latency during inference, Quamba2 performs weight reordering offline. The weights are rearranged to match the clustered activation channels. Additionally, Hadamard matrices—used to smooth out outlier values—are fused directly into the model weights. This ensures the mathematical integrity of the smoothing process while incurring zero computational overhead at runtime.

Head-to-Toe (H2T) and Mixed-Precision (W4AX)

For extreme memory constraints, Quamba2 employs Head-to-Toe quantization, which compresses the embedding layers and final output heads—components usually left in FP16. To balance this compression with the need for complex reasoning, the framework uses an evolutionary algorithm to identify sensitive layers. These layers are kept at higher precision (W4A16), while the rest of the model is compressed to W4A8, a strategy termed W4AX.

Experimental Results

Efficiency and Speed

Quamba2 was evaluated on Nvidia A5000 GPUs and the Nvidia Orin Nano edge platform. For a Mamba2-8B model, Quamba2 (W4A8) achieved a 4x reduction in memory usage and a 3x speedup in token generation compared to the FP16 baseline. Notably, the framework enabled the 8B model to run at 13 tokens/second on an 8GB Orin Nano, a device where the FP16 version failed due to Out-Of-Memory (OOM) errors.

Accuracy and Generalization

Evaluation across zero-shot tasks (including LAMBADA, HellaSwag, and PIQA) showed that the W4A8 model maintained high performance, with an average accuracy drop of only 1.6%. Furthermore, the W4AX mixed-precision approach proved vital for general reasoning. On the MMLU benchmark, the mixed-precision model improved accuracy by 2.9% over the pure W4A8 version, demonstrating that selective precision is necessary to maintain the model's ability to handle complex, multi-tasking scenarios.

Discussion and Insights

A key insight from this work is the inherent predictability of SSM states. Unlike Transformers, where attention patterns can vary wildly, SSM activation channels remain stable. This predictability is the "secret sauce" that allows for effective channel clustering. However, the authors note a "generalization trap": models may perform well on simple benchmarks while failing on complex reasoning tasks like MMLU. This highlights the importance of comprehensive evaluation beyond basic zero-shot metrics when assessing quantized models.

Conclusion

Quamba2 provides a robust path forward for the deployment of large-scale State Space Models. By tailoring quantization techniques to the specific mathematical structure of SSMs, the framework achieves significant gains in hardware efficiency without sacrificing the model's core capabilities. Future work will focus on refining mixed-precision search algorithms to further narrow the gap between low-bit models and their full-precision counterparts.

Summary updated

BibTeX
@inproceedings{chiang2025quamba,
  author = {Hung-Yueh Chiang and Chi-Chih Chang and Natalia Frumkin and Kai-Chiang Wu and Mohamed S. Abdelfattah and Diana Marculescu},
  title = {{Quamba2: A Robust and Scalable Post-training Quantization Framework for Selective State Space Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=Zm0Kper4yx},
}
Figure