arXiv:2512.16523cs.CVcs.AI2025-12中稿 · the IEEE/CVF Confe…被引 2

TTP通过测试时填充检测对抗样本并自适应修复,提升视觉语言模型鲁棒性。

TTP: Test-Time Padding for Adversarial Detection and Robust Adaptation on Vision-Language Models

  • 用空间填充前后特征相似度变化检测对抗样本
  • 在多个数据集上实现更强的抗干扰能力且不损失正常精度
  • 无需重新训练,适合部署于安全关键场景

视觉语言模型(如CLIP)虽具备出色的零样本识别能力,但对对抗扰动极为敏感,危及安全关键应用。以往训练时防御需标注数据和昂贵重训练,现有测试时策略难以可靠区分干净与对抗输入,导致鲁棒性与准确率无法兼顾。为此,我们提出测试时填充(TTP),一种轻量级防御框架,在推理阶段先检测对抗样本,再进行针对性适配。TTP通过计算空间填充前后CLIP特征嵌入的余弦相似度变化,获得跨架构与数据集通用的可靠检测阈值。对于检测到的对抗样本,TTP使用可训练填充恢复被破坏的注意力模式,并结合相似性感知集成策略生成更鲁棒的最终预测;对于干净输入,默认保持不变,或可选集成现有测试时适配技术以进一步提升准确率。在多种CLIP骨干网络和细粒度基准上的全面实验表明,TTP持续优于当前最先进的测试时防御方法,在不损害干净准确率的前提下显著提升对抗鲁棒性。代码即将发布。

原文摘要 · Abstract (English)

Vision-Language Models (VLMs), such as CLIP, have achieved impressive zero-shot recognition performance but remain highly susceptible to adversarial perturbations, posing significant risks in safety-critical scenarios. Previous training-time defenses rely on adversarial fine-tuning, which requires labeled data and costly retraining, while existing test-time strategies fail to reliably distinguish between clean and adversarial inputs, thereby preventing both adversarial robustness and clean accuracy from reaching their optimum. To address these limitations, we propose Test-Time Padding (TTP), a lightweight defense framework that performs adversarial detection followed by targeted adaptation at inference. TTP identifies adversarial inputs via the cosine similarity shift between CLIP feature embeddings computed before and after spatial padding, yielding a universal threshold for reliable detection across architectures and datasets. For detected adversarial cases, TTP employs trainable padding to restore disrupted attention patterns, coupled with a similarity-aware ensemble strategy for a more robust final prediction. For clean inputs, TTP leaves them unchanged by default or optionally integrates existing test-time adaptation techniques for further accuracy gains. Comprehensive experiments on diverse CLIP backbones and fine-grained benchmarks show that TTP consistently surpasses state-of-the-art test-time defenses, delivering substantial improvements in adversarial robustness without compromising clean accuracy. The code for this paper will be released soon.

对抗防御视觉语言模型测试时适配CLIP

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