用CLIP自身能力在测试时反制对抗攻击,无需训练即可提升鲁棒性。
CLIP is Strong Enough to Fight Back: Test-time Counterattacks towards Zero-shot Adversarial Robustness of CLIP
- 利用预训练视觉编码器在推理时主动对抗扰动图像
- 16个数据集上稳定提升鲁棒性,不损害干净图像性能
- 无需训练、兼容已加固模型,适合部署场景
尽管CLIP在零样本图像文本匹配中广泛应用,但其易受图像上的对抗扰动影响。现有方法通过在线生成对抗样本微调视觉编码器以提升鲁棒性,称为零样本鲁棒性。本文指出,旨在最大化分类损失的恶意扰动会导致“虚假稳定”图像,并提出利用预训练的CLIP视觉编码器在推理时反制此类对抗图像,实现无需训练的测试时防御。该方法简单且与现有提升零样本鲁棒性的方法正交。我们在16个分类数据集上验证,相比不依赖外部网络的现有测试时防御方法,本方法在保持干净图像性能的同时取得稳定一致的提升。此外,该策略可应用于已被对抗微调的CLIP模型,进一步增强测试时鲁棒性。代码已开源。
原文摘要 · Abstract (English)
Despite its prevalent use in image-text matching tasks in a zero-shot manner, CLIP has been shown to be highly vulnerable to adversarial perturbations added onto images. Recent studies propose to finetune the vision encoder of CLIP with adversarial samples generated on the fly, and show improved robustness against adversarial attacks on a spectrum of downstream datasets, a property termed as zero-shot robustness. In this paper, we show that malicious perturbations that seek to maximise the classification loss lead to `falsely stable' images, and propose to leverage the pre-trained vision encoder of CLIP to counterattack such adversarial images during inference to achieve robustness. Our paradigm is simple and training-free, providing the first method to defend CLIP from adversarial attacks at test time, which is orthogonal to existing methods aiming to boost zero-shot adversarial robustness of CLIP. We conduct experiments across 16 classification datasets, and demonstrate stable and consistent gains compared to test-time defence methods adapted from existing adversarial robustness studies that do not rely on external networks, without noticeably impairing performance on clean images. We also show that our paradigm can be employed on CLIP models that have been adversarially finetuned to further enhance their robustness at test time. Our code is available \href{https://github.com/Sxing2/CLIP-Test-time-Counterattacks}{here}.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。