Robust SAM: On the Adversarial Robustness of Vision Foundation Models

Jiahuan Long, Zhengqin Xu, Tingsong Jiang, Wen Yao, Shuai Jia, Chao Ma, Xiaoqian Chen · DOI

Abstract

The Segment Anything Model (SAM) has revolutionized image segmentation, yet it exhibits significant fragility when subjected to adversarial noise. This paper identifies a critical "cross-prompt" vulnerability where adversarial attacks designed for one prompt type (e.g., points) often fail to transfer to others (e.g., boxes). We introduce a novel Cross-Prompt Attack (CPA) that targets shared feature channels to achieve high transferability. To defend against such attacks, we propose Robust SAM, which utilizes Singular Value Decomposition (SVD) to adapt a mere 512 parameters. This method restores adversarial robustness without the "catastrophic forgetting" typically associated with full-model retraining, maintaining high performance on clean data while significantly improving mIoU under attack.

Introduction

Vision foundation models like SAM are trained on vast datasets to perform zero-shot segmentation. However, their reliance on specific internal feature distributions makes them susceptible to invisible adversarial perturbations. A primary challenge is the "robustness-accuracy trade-off": standard defenses often degrade performance on clean images or are computationally prohibitive for models with millions of parameters. Furthermore, existing attacks are often "brittle," failing when the user changes the prompt type.

Figure 1: Comparison between the original SAM and Robust SAM. The original model fails on adversarial examples (mIoU: 0.26), while Robust SAM restores segmentation performance (mIoU: 0.98) by adapting feature distributions.

Methodology

Cross-Prompt Adversarial Attack (CPA)

The authors developed a Key Feature Selection algorithm to identify internal encoder channels critical to both point and box prompts. By targeting the intersection of these features, the CPA generates adversarial noise that disrupts the common processing pathways SAM uses, regardless of the prompt type. This results in a "universal" attack that is significantly more effective than prompt-specific alternatives.

Few-Parameter SVD Defense (Robust SAM)

Robust SAM addresses vulnerability by fine-tuning the final convolutional layers of the encoder. Using Singular Value Decomposition (SVD), the weight matrices are decomposed into $U, P, \text{ and } V^T$. By freezing the basis matrices ($U, V$) and training only the diagonal singular value matrix ($P$), the defense adapts only 512 parameters. This "re-scaling" of feature importance allows the model to ignore adversarial noise while preserving its foundational segmentation logic.

Figure 3: Overview of the proposed framework: (a) the Cross-prompt adversarial attack (CPA) targeting key features, and (b) the few-parameter adversarial defense using SVD to update the parameter space.

Experimental Results

The proposed methods were evaluated on benchmarks including SA1B, VOC, COCO, and DAVIS.

  • Attack Effectiveness: The CPA achieved a 75.6% success rate on the SA1B dataset, demonstrating superior transferability across prompt types compared to baseline attacks.
  • Defense Performance: Robust SAM improved mIoU by at least 15% under various attack scenarios. Crucially, it maintained a clean mIoU of 80.9 on VOC data, significantly outperforming other adaptation methods like SAM-LoRA (63.4 mIoU), which suffered from greater performance degradation on non-adversarial images.
  • Efficiency: With only 512 trainable parameters, Robust SAM is highly efficient, operating at 11.5 FPS—faster than many existing adaptation frameworks.

Conclusion and Future Work

Robust SAM demonstrates that adversarial robustness in foundation models can be achieved through targeted, low-parameter adaptation rather than exhaustive retraining. By focusing on the singular values of key feature layers, the model effectively filters adversarial noise. Future research will explore extending this SVD-based defense to text-based prompts and other vision foundation model architectures.

Summary updated

BibTeX
@inproceedings{long2025robust,
  author = {Jiahuan Long and Zhengqin Xu and Tingsong Jiang and Wen Yao and Shuai Jia and Chao Ma and Xiaoqian Chen},
  title = {{Robust SAM: On the Adversarial Robustness of Vision Foundation Models}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i6.32616},
}
Figure