Skip to content

Translation in progress Some entries still include text in the original language.

AnyAttack: a large-scale self-supervised adversarial attack against vision-language modelsAnyAttack: Towards Large-scale Self-supervised Adversarial Attacks on Vision-language Models

arXiv· arXiv:2410.05346· CVPR 2025· Jiaming Zhang, Junhong Ye, Xingjun Ma, Yige Li, Yunfan Yang, Yunhao Chen, Jitao Sang, Dit-Yan YeungHong Kong University of Science and Technology; Beijing Jiaotong University; Fudan University; Singapore Management University; Peng Cheng LaboratoryIndexed by this site · 27 days ago· Originally publishedSelected AttacksSelectedAttention40

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose a self-supervised adversarial attack framework, AnyAttack, pretraining a noise generator on LAION-400M, which the authors state can transfer to commercial VLMs such as Gemini and GPT.

Threat modeltransfer-based black-box attack: the attacker uses a fully accessible pretrained surrogate model fs to generate an adversarial image x′, with no knowledge of the target VLM ft's architecture, parameters, or outputs; the goal is to make ft incorrectly match x′ with the target text yt.

Questions
VLMs are vulnerable to image adversarial attacks, but traditional targeted attacks rely on target labels or target images for supervision, making them difficult to scale. The authors argue for a targeted attack method that does not rely on labels and can turn any image into an attack vector.
Methods
Proposes the self-supervised framework AnyAttack: using the original image itself as supervision, pretrain a noise generator on LAION-400M (frozen CLIP ViT-B/32 encoder plus decoder), then fine-tune it on downstream datasets per task, and introduce auxiliary model ensembles to improve transferability.
Experiments and results
On the retrieval, classification, and captioning tasks across 5 open-source VLMs, the authors report that AnyAttack outperforms baselines such as AttackVLM, SU, and SASD-WS in most settings; on Gemini 1.5 Flash and GPT-4o mini, ASR is 31 and 38, respectively (Table 5).
Limitations and future work
The authors state that future work should focus on building more robust VLMs and mitigation strategies (Conclusion). Experiments: the quantitative evaluation of commercial VLMs covers only Gemini 1.5 Flash and GPT-4o mini, with 100 target images each; the paper does not report the number of repetitions or statistical significance tests.
Experimental setupCLIP、BLIP et al. · MSCOCO、Flickr30K et al. · ASR、TR@1/5/10 et al.
Evaluated models
CLIPBLIPBLIP2InstructBLIPMiniGPT-4Google Gemini (Gemini 1.5 Flash)OpenAI GPT (GPT-4o mini)Claude SonnetMicrosoft Copilot
Benchmarks
MSCOCOFlickr30KSNLI-VELAION-400MImageNet-1K
Metrics
ASRTR@1/5/10IR@1/5/10R@MeanSPICEBLEU-1BLEU-4METEORROUGE-LCIDEr
AI summaryand selection rationaleThe researchers propose AnyAttack, a self-supervised adversarial attack framework that pretrains a noise generator on LAION-400M, enabling any image to be converted into a targeted attack vector against vision-language models without label supervision. The framework uses a frozen CLIP ViT-B/32 encoder as the surrogate model and adopts a pretrain-then-finetune paradigm, which the authors call the first large-scale use of this paradigm for targeted adversarial attacks. On five open-source models—CLIP, BLIP, BLIP2, InstructBLIP, and MiniGPT-4—the attack outperforms baselines in image-text retrieval, multimodal classification, and image captioning tasks; on MSCOCO image-text retrieval, the best variant exceeds the strongest baseline by 15.02% to 18.54% under the three settings ViT-B/16, ViT-B/32, and ViT-L/14.

The researchers propose AnyAttack, a self-supervised adversarial attack framework that pretrains a noise generator on LAION-400M, enabling any image to be converted into a targeted attack vector against vision-language models without label supervision. The framework uses a frozen CLIP ViT-B/32 encoder as the surrogate model and adopts a pretrain-then-finetune paradigm, which the authors call the first large-scale use of this paradigm for targeted adversarial attacks. On five open-source models—CLIP, BLIP, BLIP2, InstructBLIP, and MiniGPT-4—the attack outperforms baselines in image-text retrieval, multimodal classification, and image captioning tasks; on MSCOCO image-text retrieval, the best variant exceeds the strongest baseline by 15.02% to 18.54% under the three settings ViT-B/16, ViT-B/32, and ViT-L/14.

Why it was selectedThe paper shows that self-supervised pretraining can turn any image into a targeted attack vector and transfer to commercial models; teams building multimodal applications can use this to assess image-input risk.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Traditional targeted adversarial attacks rely on target label supervision and are difficult to scale; the authors propose a label-free self-supervised attack framework.

    Core problem: targeted adversarial attacks on VLMs rely on target labels or target images for supervision, making training difficult to scale; the authors attempt to make any image an attack vector.

    • Problem setting: The authors state that VLMs are vulnerable to image adversarial attacks, and targeted attacks can induce the model to output attacker-specified harmful content, posing a threat to downstream applications such as content moderation.
    • Shortcomings of existing methods: The authors point out that existing targeted attacks require target labels or target images for supervision; for example, generators trained on ImageNet struggle to generate effective adversarial noise for VLMs, limiting practical impact.
    • Core idea: Use the original image itself as the supervision signal (self-supervision), pretrain a noise generator on large-scale unlabeled data to learn general noise patterns, then fine-tune per downstream task.
    • Paper proposes: AnyAttack—an adversarial noise generation framework self-supervised pretrained on LAION-400M and fine-tuned on downstream datasets; the authors claim this is the first application of the "pretrain-fine-tune" paradigm to large-scale targeted adversarial attacks.
    • Threat model (Section 3.1, terminology as in the original):
      • Goal: Make the target VLM ft incorrectly match the adversarial image x′ with the target text description yt as a valid image-text pair.
      • Knowledge: transfer-based black-box—the attacker has no knowledge of ft's architecture, parameters, or outputs.
      • Capability: Full access to a pretrained surrogate model fs, used to generate x′.
      • Victim systems: Open-source VLMs (CLIP, BLIP, BLIP2, InstructBLIP, MiniGPT-4) and commercial systems (Gemini, Claude Sonnet, Copilot, GPT).
  2. What related research exists?

    Related work falls into three categories: targeted attacks on vision models, VLM jailbreaks, and VLM adversarial attacks; the authors position their work as a self-supervised method that requires no text guidance.

    Targeted adversarial attacks on vision models

    • Input augmentation category: image translation [4], cropping [24], mixup [11, 23], scaling [27], etc., used to increase adversarial input diversity and improve cross-model transferability.
    • Surrogate model augmentation category: adversarial fine-tuning and model augmentation techniques [19, 25, 32], retraining the surrogate model with a mix of clean and adversarial samples to improve robustness to future attacks.
    • Optimization technique category: adaptive learning rates, gradient clipping, etc. [3, 10, 22], used to stabilize the update process of adversarial training.

    VLM jailbreak attacks

    • Multimodal jailbreaks: manipulating text [26], images [1, 7, 14, 15], or both simultaneously [21, 30] to induce harmful but non-predetermined responses. The paper notes that this differs from image adversarial attacks: the latter manipulate the image encoder to induce a predetermined response specified by the attacker.

    VLM adversarial attacks

    • Co-Attack [31]: the paper states it is an earlier work that performs white-box untargeted attacks on multiple VLMs; subsequent methods improve black-box untargeted transferability [12, 28, 29, 34].
    • Cross-Prompt Attack [13]: studies an adversarial transferability setting based on LLM prompts.
    • AttackVLM [33]: the paper states it is the closest to this paper, using text input plus a text-to-image model to generate guiding images to construct targeted adversarial images; the paper points out that this paper's difference is being self-supervised and not relying on any text guidance.

    Baselines and benchmarks: the comparison baselines are AttackVLM (two variants, AttackVLM-ii / AttackVLM-it) and SU [24] and SASD-WS [25] for vision classification models (the authors adapted them into cosine loss and MSE loss versions); the evaluation datasets are MSCOCO, Flickr30K, SNLI-VE.

    Author positioning: existing strategies rely on explicit target supervision (Table 1), whereas AnyAttack is unsupervised and is the first targeted attack framework to do "pretraining-fine-tuning" on a large-scale dataset (as stated by the authors).

  3. How does the paper address this problem?

    A two-stage self-supervised framework: pretrain a noise generator on LAION-400M, then fine-tune it on downstream datasets according to task objectives, with optional auxiliary model ensembling.

    AnyAttack overall idea: using the original image itself as supervision, train a generator that maps image embeddings to adversarial noise, so that when the noise is added to any random image, it is interpreted as the original image in the surrogate model's embedding space. The framework has two stages, pretraining and fine-tuning (Figure 2).

    Problem formulation

    • Let the surrogate model be fs and the dataset be D = {(x, y)}; the attacker constructs x′ = x + δ so that the target model ft outputs a predetermined target yt; Table 1 compares the formulations of three strategies: target label supervision, target image supervision, and the unsupervised form in this paper.
    • Objective of this paper: min L(fs(δ + xr), fs(x)), where xr is a random image unrelated to x, i.e., making "random image plus noise" align with the original image x in embedding space, and L is a similarity function.

    Self-supervised adversarial noise pretraining

    • Architecture: a frozen CLIP ViT-B/32 image encoder E (embedding dimension 512) plus an initialized decoder F, which maps embedding z to noise δ; the expectation is E(xr + δ) = E(x).
    • K-augmentation: within each mini-batch, the noise and the original images are replicated K times, the original images are shuffled, and then added to the noise, increasing the number of random images per batch; the paper states the purpose is to enhance generalization and computational efficiency.
    • Pretraining loss LPre: a contrastive loss that maximizes the cosine similarity of positive pairs (adversarial/original image embeddings at the same index) and minimizes that of negative pairs; each batch has n positive pairs and n(n−1) negative pairs.
    • Temperature schedule: τ(t) = τ0 exp(−λ t), gradually decreasing from the initial temperature τ0 to τfinal; the paper states this is used to dynamically adjust negative sample difficulty.

    Self-supervised adversarial noise fine-tuning

    • Approach: fine-tune F on the downstream dataset Df while E remains frozen; because Df is much smaller than the pretraining data, images are randomly drawn from an external dataset De as xr to be added to the noise.
    • Auxiliary models: in addition to encoder E, auxiliary models are added to form an ensemble surrogate; the paper states this is used to improve transferability.
    • Two fine-tuning objectives: retrieval tasks use a bidirectional contrastive loss LBi (z(adv)→z and z→z(adv) in both directions); general tasks such as captioning and classification use a cosine similarity loss LCos.

    Key parameters (Section 4.1)

    • Perturbation constrained by ℓ∞ norm, ϵ = 16/255; pretraining for 520,000 steps, batch size 600 per GPU, three NVIDIA A100 80GB GPUs; AdamW, initial learning rate 1×10⁻⁴, cosine annealing.
    • Downstream fine-tuning for 20 epochs; auxiliary models are ViT-B/16 and ViT-L/14 EVA trained from scratch on ImageNet-1K; K = 5; τ0 = 1, τfinal = 0.07, T = 10,000.
  4. What experiments did the paper conduct?

    Compared with 3 categories of baselines on three types of tasks across 5 open-source VLMs, and also tested 4 commercial VLMs; the authors report outperforming the baselines in most settings.

    Experimental setup

    • Models evaluated: open-source VLMs are CLIP, BLIP, BLIP2, InstructBLIP, MiniGPT-4; commercial ones are Google Gemini (Gemini 1.5 Flash), OpenAI GPT (GPT-4o mini), Claude Sonnet, Microsoft Copilot.
    • Datasets: downstream tasks use MSCOCO, Flickr30K, SNLI-VE, taking the first 1,000 images of each task; following [33], the first 1,000 images of the ImageNet-1K validation set are used as clean (random) images.
    • Baselines: AttackVLM-ii, AttackVLM-it (both with CLIP ViT-B/32 as the surrogate model, same as this paper); SU-Cos/SU-MSE (surrogate model CLIP ViT-B/32), SASD-WS-Cos/SASD-WS-MSE (using officially released weights).
    • Metrics: the main metric is ASR, defined differently by task—for retrieval tasks, the recall of adversarial images against ground-truth text (TR@1/5/10, IR@1/5/10, R@Mean); for classification tasks, the accuracy of correctly pairing "adversarial image with ground-truth description"; for captioning tasks, SPICE, BLEU-1/4, METEOR, ROUGE-L, CIDEr.
    • Method variants: AnyAttack-Cos, AnyAttack-Bi, AnyAttack-Cos w/ Aux, AnyAttack-Bi w/ Aux.
    • Evaluation method: for the commercial VLM quantitative experiments, prompts are used to have the model assess image-text relevance and choose among three options, and the proportion of "highly and partially relevant" is counted; the paper does not report the number of repetitions.

    Main results

    MSCOCO image-text retrieval (according to Table 2, metric is R@Mean):

    Swipe horizontally to read the table

    Target modelStrongest baselineAnyAttack-BiAnyAttack-Bi w/ Aux
    ViT-B/1620.86 (SU-Cos)26.2335.88
    ViT-L/1415.22 (SASD-WS-MSE)17.3433.66
    ViT-L/14×33614.64 (SASD-WS-MSE)15.2133.18
    • The authors state that AnyAttack-Bi w/ Aux exceeds the strongest baseline by 15.02%, 18.44%, and 18.54% on the three models respectively (note: the Table 2 column headers are ViT-B/16, ViT-L/14, ViT-L/14×336, while the main text writes ViT-B/16, ViT-B/32, ViT-L/14; the model names do not match between the two places).
    • The authors state that the auxiliary module brings improvements of 6.455%, 13.75%, and 15.875% (AnyAttack w/ Aux vs. without Aux).
    • The authors state that the bidirectional loss LBi consistently outperforms LCos on retrieval tasks; in Table 2, AnyAttack-Cos (13.34) on ViT-L/14×336 is lower than SASD-WS-MSE (14.64), which is an exception.

    Multimodal classification and image captioning

    • SNLI-VE classification (Table 3): the Accuracy of AnyAttack-Cos w/ Aux is 44.8, and the strongest baseline SASD-WS-MSE is 24.8; the authors state this exceeds it by 20.0%; AnyAttack-Cos without Aux (17.5) is lower than both SASD-WS variants (24.3, 24.8).
    • MSCOCO captioning (Table 4): on InstructBLIP, BLIP2, BLIP, MiniGPT-4, the authors state that AnyAttack-Cos w/ Aux outperforms the baselines on all metrics, e.g., on InstructBLIP CIDEr 20.3 vs. the strongest baseline 11.8 (SASD-WS-MSE).
    • Exception: in Table 4, AnyAttack-Cos without Aux is lower than SASD-WS-Cos/MSE on most metrics, e.g., on MiniGPT-4 CIDEr 1.9 vs. 2.6/2.8.

    Transfer to commercial VLMs

    • Quantitative (Table 5): with 100 MSCOCO target images, the ASR of AnyAttack-Cos w/ Aux on Gemini 1.5 Flash is 31 (baseline maximum 5), and on GPT-4o mini is 38 (baseline maximum 28, SASD-WS-Cos).
    • Qualitative (Figure 3): the authors uploaded adversarial images to the public web interfaces of four commercial VLMs and show example responses from Claude Sonnet, Copilot, Gemini, and GPT, stating that the parts marked in red in the responses correspond to the target images; the figure shows that each model's output contains descriptive text related to the target image.
    • The authors state that the method consistently outperforms the baselines on all tested commercial models.

    Other ablations and analyses

    • Training method ablation (Figure 4, MSCOCO retrieval): the authors state that fine-tuning the pretrained model works best, and training from scratch (Scratch) is clearly worse, indicating that pretraining is key to task adaptation; the legend includes Scratch-Cos/Bi, AnyAttack-Pre, Cos, Bi, and two w/ Aux variants; specific bar values are not labeled with numbers in the figure.
    • Auxiliary model and loss ablation (Figure 4): the authors state that adding auxiliary models consistently improves transferability, and LBi consistently outperforms LCos.
    • Efficiency (Figure 5): generating 1,000 adversarial images (single A100 80GB, batch size 250), the authors state that this method is better than SU, SASD-WS, and AttackVLM in both memory usage and time consumption; the axes are Memory Usage (MB) (0–8000) and Time Consumption (s) (0–1500); specific values are not readable in the figure.
  5. What are some points that can be further explored?

    The authors state that future work should study more robust VLMs and defense strategies; the experiments cover quantitative evaluation of 5 open-source VLMs on three tasks and 2 commercial VLMs.

    Limitations and future directions noted by the authors

    • Defense direction (Conclusion): the authors state that the results highlight the urgent need for robust defense mechanisms for VLM systems, and that future work should focus on developing more resilient VLMs and exploring mitigation strategies against such targeted attacks.
    • The paper does not have a dedicated Limitations section; apart from the call in the Conclusion above, it does not explicitly list limitations of the method itself.

    Scope of experiments

    • Models evaluated: 5 open-source (CLIP, BLIP, BLIP2, InstructBLIP, MiniGPT-4); 4 commercial, but the quantitative results (Table 5) cover only Gemini 1.5 Flash and GPT-4o mini, while Claude Sonnet and Microsoft Copilot have only qualitative examples in Figure 3.
    • Tasks and data: retrieval (MSCOCO; Flickr30K results in the appendix), classification (SNLI-VE), captioning (MSCOCO); the first 1,000 images per task, and 100 target images for the commercial quantitative experiments.
    • Perturbation setting: only one constraint, ℓ∞ norm with ϵ = 16/255; the surrogate model is CLIP ViT-B/32, and the auxiliary models are two ViTs trained on ImageNet-1K.
    • Evaluation method: the ASR for commercial VLMs is computed from the models' own three-option answers on image-text relevance; the paper does not report human evaluation, number of repetitions, or statistical significance tests.
    • Defense evaluation: the paper does not evaluate any defense method (no defense experiments appear in the experimental section of the paper).
  6. Summarize the main content of the paper

    The self-supervised targeted adversarial attack framework AnyAttack, a pretrain-fine-tune paradigm; the authors claim it is effective against both open-source and commercial VLMs.

    A paper on image adversarial attacks against VLMs, proposing the self-supervised framework AnyAttack.

    • Problem: Traditional targeted attacks rely on target label or target image supervision, making them difficult to scale; the authors aim to make any image an attack vector pointing to any target output.
    • Method: Using the original image itself as supervision, pretrain a noise generator on LAION-400M (frozen CLIP ViT-B/32 encoder + decoder, K-augmentation and contrastive loss, 520,000 steps), then fine-tune on downstream datasets per task (bidirectional contrastive loss LBi for retrieval, LCos for general tasks), with the option to ensemble two auxiliary ViT models to improve transferability; perturbation constraint ℓ∞, ϵ = 16/255.
    • Open-source model results: On MSCOCO retrieval, R@Mean of AnyAttack-Bi w/ Aux on ViT-B/16, ViT-L/14, and ViT-L/14×336 is 35.88, 33.66, and 33.18, respectively, higher than the strongest baseline (Table 2); SNLI-VE classification Accuracy 44.8 vs. 24.8 for the strongest baseline (Table 3); on the captioning task, the authors state that the w/ Aux variant outperforms baselines on all metrics across four VLMs (Table 4). Variants without the auxiliary models are lower than the SASD-WS baseline in some settings.
    • Commercial transfer: On 100 target images, ASR on Gemini 1.5 Flash and GPT-4o mini is 31 and 38, respectively, higher than all baselines (Table 5); qualitative examples are also given for Claude Sonnet and Copilot.
    • Authors' conclusion: The authors claim this is the first application of the "pretrain-fine-tune" paradigm to large-scale targeted adversarial attacks, revealing vulnerabilities in SOTA models and calling for research on robust defenses and mitigation strategies.

Related papers

Show 3 more papers
Read originalCVPR 2025