Abstract
Understanding the vulnerability of large-scale pre-trained vision-language models like CLIP against adversarial attacks is key to ensuring zero-shot generalization capacity on various downstream tasks. State-of-the-art defense mechanisms generally adopt prompt learning strategies for adversarial fine-tuning to improve the adversarial robustness of the pre-trained model while keeping the efficiency of adapting to downstream tasks. Such a setup leads to the problem of over-fitting which impedes further improvement of the model's generalization capacity on both clean and adversarial examples. In this work, we propose an adaptive Consistency-guided Adversarial Prompt Tuning (CAPT) framework that utilizes multi-modal prompt learning to enhance the alignment of image and text features for adversarial examples and leverage the strong generalization of pre-trained CLIP to guide the model—enhancing its robust generalization on adversarial examples while maintaining its accuracy on clean ones. We also design a novel adaptive consistency objective function to balance the consistency of adversarial inputs and clean inputs between the fine-tuning model and the pre-trained model. We conduct extensive experiments across 14 datasets and 4 data sparsity schemes to show the superiority of CAPT over other state-of-the-art adaptation methods.
Introduction
Large-scale Vision-Language Models (VLMs), most notably CLIP, have revolutionized zero-shot learning by aligning visual and textual representations. However, these models are notoriously fragile when faced with adversarial attacks—tiny, calculated perturbations to an image that can trick a model into misclassification. While full adversarial training is computationally prohibitive for models with billions of parameters, researchers have turned to Prompt Tuning. In this paradigm, only a small set of "prompt" vectors are learned while the backbone remains frozen.
Despite its efficiency, adversarial prompt tuning suffers from severe "robust overfitting," particularly in few-shot scenarios. The prompts tend to learn specific noise patterns of training examples rather than generalizable robust features, leading to a trade-off where gains in robustness come at the cost of clean-image accuracy and cross-dataset generalization. The CAPT framework addresses this by utilizing multi-modal prompts and an adaptive consistency loss guided by the original frozen pre-trained model.
The CAPT Framework
The CAPT framework is built upon three primary technical pillars designed to mitigate overfitting and preserve the inherent generalization of the pre-trained model:
- Multi-modal Prompting: Unlike previous methods that focus solely on text or visual prompts, CAPT applies learnable prompts to both the image and text encoders. This dual-branch approach ensures that the internal alignment between visual and textual features remains robust even when the input image is corrupted by adversarial noise.
- Frozen CLIP Guidance: To prevent the fine-tuned model from drifting away from the generalized feature space of the original model, CAPT uses the original, frozen CLIP model as an "anchor." This guidance encourages the features of the fine-tuned model to remain consistent with the highly generalized features of the pre-trained model.
- Adaptive Consistency Objective: A novel loss function balances classification accuracy on clean images, internal consistency (treating adversarial images similarly to clean ones), and external consistency (maintaining the "common sense" of the frozen CLIP model). Crucially, the model dynamically weights these losses based on the reliability of the frozen model's prediction for each specific sample.
Experimental Evaluation
The authors conducted an exhaustive evaluation using 14 different datasets to test in-distribution performance and cross-dataset generalization. The core benchmarks included ImageNet, Caltech101, OxfordPets, and StanfordCars, among others. Testing was performed across various data sparsity schemes, ranging from 1-shot to full-data training settings.
Key Results
CAPT demonstrated clear superiority over state-of-the-art baselines like APT (Adversarial Prompt Tuning) and AVP (Adversarial Visual Prompting). On ImageNet, CAPT outperformed the previous best method by an average of 16.91% in clean accuracy and 7.51% in adversarial robustness across different shot settings.
Beyond standard benchmarks, CAPT showed remarkable stability against stronger attacks (higher perturbation budgets) and maintained high zero-shot generalization. When trained on ImageNet and tested on entirely different datasets, CAPT's robust generalization remained significantly higher than competitors, proving that the framework effectively avoids memorizing specific noise distributions.
Conclusion
The CAPT framework successfully addresses the robust overfitting problem in adversarial prompt tuning for VLMs. By leveraging multi-modal prompts and an adaptive consistency mechanism guided by the original pre-trained model, CAPT achieves a superior balance between clean accuracy and adversarial robustness. While the method shows some limitations in extreme domain shifts (e.g., satellite imagery in EuroSAT), it represents a significant step forward in making large-scale foundation models both efficient to adapt and robust to adversarial threats.
Summary updated