arXiv:2605.16901cs.CV2026-05被引 2

针对SAM模型量化时注意力失效问题,提出跨注意力重建方法。

CAR-SAM: Cross-Attention Reconstruction for Post-Training Quantization of the Segment Anything Model

论文配图:CAR-SAM: Cross-Attention Reconstruction for Post-Training Quantization of the Segment Anything Model
图 1 · 摘自论文原文
  • 引入矩阵乘法感知补偿机制,缓解注意力信息衰减。
  • 联合重建双向注意力分支,解决优化震荡问题。
  • 4比特量化下性能优于现有方法,适合移动端部署。

分割一切模型(SAM)在计算机视觉中广泛用于通用图像分割,但其高计算与内存需求使其难以在资源受限设备上部署。后训练量化(PTQ)是常用的模型压缩与加速技术,然而现有方法未考虑SAM解码器中的交叉注意力结构。该问题主要源于两大挑战:(1) 注意力耗散,即解码器中对分割掩码至关重要的注意力信息在低比特量化下会退化为弥散且无语义的形式;(2) 重建振荡,双向变压器内部的双向耦合导致跨分支误差干扰,破坏收敛稳定性。为此,我们提出专为SAM设计的统一量化框架CAR-SAM。首先,通过矩阵乘法感知补偿(MAC)机制,将乘法操作引发的量化误差从MatMul转移到前序线性权重;其次,提出联合交叉注意力重建(JCAR)策略,协同重建耦合注意力分支,抑制振荡行为并促进稳定收敛。大量实验表明,CAR-SAM可将SAM模型稳健量化至4比特精度,在SAM-B和SAM-L上分别超越现有方法14.6%和6.6%的mAP。

原文摘要 · Abstract (English)

Segment Anything Models (SAMs) are extensively used in computer vision for universal image segmentation, but deploying them on resource-constrained devices is challenging due to their high computational and memory demands. Post-Training Quantization (PTQ) is a widely used technique for model compression and acceleration. However, existing PTQ methods fail to consider the cross-attention architecture in the SAM decoder. This degradation primarily stems from the unique challenges posed by SAMs: (1) Attention dissipation, where the attention information in the decoder, which is crucial for representing segmentation masks, collapses into a diffuse and non-semantic form under low-bit quantization; and (2) Reconstruction oscillation, where bidirectional coupling within the two-way transformer introduces cross-branch error interference and destabilizes convergence. To tackle these issues, we propose CAR-SAM, a unified quantization framework tailored for SAMs. Firstly, to mitigate attention dissipation, we introduce MatMul-Aware Compensation (MAC) mechanism that transfers activation-induced quantization errors from MatMul to preceding linear weights. Secondly, to mitigate oscillation in decoder optimization, we develop a Joint Cross-Attention Reconstruction (JCAR) strategy that jointly reconstructs coupled attention branches, suppressing oscillatory behavior and promoting stable convergence. Extensive experiments show that CAR-SAM robustly quantizes SAM models down to 4-bit precision, surpassing existing methods by 14.6% and 6.6% mAP on SAM-B and SAM-L respectively.

量化SAM注意力推理加速

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。