Constructing Adversarial Inputs for Large Vision-Language Models with Black-Box OptimizationCrafting Adversarial Inputs for Large Vision-Language Models Using Black-Box Optimization
ZO-SPSA performs black-box visual jailbreaks on three LVLMs; on AdvBench, InstructBLIP's human ASR is 83.0%.
Black-box: the attacker has no model knowledge, no gradient access, and only interacts through input–output, using ZO-SPSA to optimize visual perturbations; combined with arbitrary harmful text, it bypasses the victim LVLM's safety alignment in a single-turn conversation, causing it to execute harmful instructions and generate prohibited content. It also evaluates the transfer of samples across LVLMs.
- Visual jailbreaks of LVLMs mostly rely on white-box gradients, which are computationally expensive and hard to transfer to black-box settings. The authors aim to generate adversarial images with only input–output access and no gradients, bypassing safety alignment.
- ZO-SPSA applies positive and negative random perturbations to the image, estimates the gradient from the loss difference of two forward passes, takes the sign, and updates via PGD projection. No surrogate model is used; in experiments, h=0.0001 and the forward budget is 50,000.
- AdvBench human ASR is InstructBLIP 83.0%, LLaVA 73.0%, MiniGPT-4 60.0%. MiniGPT-4 samples transferred to InstructBLIP, Perspective toxicity rate 64.18.
- The authors note that many forward passes and noisy gradients make optimization time-consuming. Experiments cover three open-source LVLMs, AdvBench, VAJA, and RealToxicityPrompts; the paper does not report number of human evaluators or agreement with automatic review, nor does it specify the model used in ablations.
- Evaluated models
- InstructBLIPLLaVAMiniGPT-4
- Benchmarks
- AdvBenchVAJARealToxicityPrompts
- Metrics
- ASRToxicity Rate
The researchers propose a black-box jailbreak attack method called ZO-SPSA targeting large vision-language models (LVLMs), using zeroth-order optimization and simultaneous perturbation stochastic approximation to generate adversarial inputs without needing internal model information. The method requires no gradients or surrogate models, approximates optimization through input-output interactions, and has lower memory usage. Evaluated on three model types—InstructBLIP, LLaVA, and MiniGPT-4—the jailbreak success rate on InstructBLIP reaches up to 83.0%, with perturbations as imperceptible as those of white-box methods; adversarial samples generated by MiniGPT-4 achieve an attack success rate (ASR) of 64.18% when transferred to other LVLMs. The authors state these results show black-box jailbreaks are feasible in practice and expose weaknesses in current LVLM safety mechanisms.
Paper analysis
What problem does this paper attempt to solve?
White-box gradient jailbreaks require full parameters and transfer poorly; the authors use gradient-free ZO-SPSA for black-box visual attacks.
How to jailbreak large vision-language models (LVLMs) with visual perturbations in a black-box setting where gradients are unavailable.
- Appearance scenario: The authors state LVLMs have been used in various multimodal tasks, but the visual modality introduces new vulnerabilities; adversaries can construct visual inputs to bypass safety alignment and trigger harmful outputs.
- Existing shortcomings: The authors state existing adversarial jailbreaks mostly rely on white-box and gradient-based optimization, requiring access to all parameters, high computational cost, and insufficient transfer to black-box. In Figure 1(a), gradient backpropagation-generated images jailbreak MiniGPT-4 but fail to transfer to LLaVA with different architecture and alignment strategy.
- Authors' question: When gradients are unavailable, how to generate adversarial examples that jailbreak LVLMs.
- Proposed: ZO-SPSA (Zeroth-Order Simultaneous Perturbation Stochastic Approximation). Uses only input–output for gradient-free approximation, does not use surrogate model during optimization; the authors state lower GPU memory.
- Threat model
- Goal: Construct visual input, combined with arbitrary harmful text, to bypass target model's safety alignment in single-turn conversation, trigger harmful instruction and generate prohibited content; optimized image also makes model obey harmful prompts not explicitly optimized during attack.
- Knowledge: Black-box. No model knowledge, no access to internal gradients, only input–output interaction allowed.
- Capability: Iteratively update adversarial image with ZO-SPSA. Perturbation magnitude constrained by set B, implemented via PGD projection.
- Victim systems: InstructBLIP, LLaVA, MiniGPT-4. Also evaluate transfer of adversarial images across different LVLMs.
What related research exists?
The paper discusses visual jailbreaks, typographic attacks, and zeroth-order optimization; the experimental baseline is white-box VAJA.
LVLMs and Safety Alignment
- Zhang et al. (2024a) describe common LVLMs as vision modules, projectors, and LLM text modules: the vision side extracts features (e.g., CLIP's ViT), the projector aligns them to the text latent space, and free text is generated jointly.
- The text module is usually a pretrained LLM with safety alignment. The paper cites safety techniques from Solaiman and Dennison (2021), Bai et al. (2022), Korbak et al. (2023), and the survey by Ji et al. (2023), only as background without method comparison to this work.
- System examples mentioned include LLaVA (Liu et al., 2023), InstructBLIP (Dai et al., 2023), MiniGPT-4 (Zhu et al., 2023), OpenFlamingo (Awadalla et al., 2023), and Multi-modal GPT (Gong et al., 2023).
Jailbreaks Against LVLMs
- Carlini et al. (2023), Tu et al. (2023), and Zhao et al. (2023): visual adversarial examples can cause LVLMs to produce harmful outputs. Dong et al. (2023) is cited in the introduction to illustrate that the visual modality introduces new vulnerabilities.
- Niu et al. (2024) use maximum-likelihood-based jailbreaks with imperceptible perturbations to make models respond inappropriately to multiple unseen prompts and images. Qi et al. (2024) use a small derogatory corpus for gradient-based visual adversarial attacks, referred to as VAJA in this paper. Wang et al. (2024) jointly optimize adversarial image prefixes and text suffixes under white-box settings.
- Typographic direction: Shayegani et al. (2024) conduct cross-modal attacks inducing toxic activations in encoder embedding space; Gong et al. (2025)'s FigStep renders harmful text content as typographic visual forms to bypass alignment. The authors state that this paper extends visual modality perturbations, targeting safety alignment under black-box settings.
Zeroth-Order Optimization
- Zhang et al. (2024b), Chen et al. (2024)'s DeepZero, and Malladi et al. (2023) use zeroth-order methods to fine-tune LLMs and reduce GPU memory. Liu et al. (2020) is a survey of zeroth-order optimization.
- For black-box adversarial attacks: Chen et al. (2017)'s ZOO uses zeroth-order stochastic coordinate descent without training surrogate models; Liu et al. (2019)'s ZO-signSGD and Chen et al. (2019)'s ZO-AdaMM are used to generate adversarial perturbations. SPSA comes from Spall (1987, 1992). Projected updates cite Madry et al. (2018)'s PGD.
- The authors state that ZO-SPSA can perform black-box adversarial attacks on LVLMs with lower computational overhead. The paper provides no numerical comparison with ZOO, ZO-signSGD, or ZO-AdaMM.
Baseline Methods and Benchmarks
- Baseline method: white-box VAJA (Qi et al., 2024). The no-attack control is a benign image.
- Benchmarks/datasets: AdvBench (Zou et al., 2023); VAJA's harmful corpus and 40 test instructions; a 1,225-entry subset of RealToxicityPrompts (Gehman et al., 2020). The human evaluation protocol follows Wang et al. (2024).
The authors position this work outside white-box gradient jailbreaks: no gradient access, no surrogate model during optimization, relying only on input–output queries to estimate gradients, and examining transfer across LVLMs.
How does the paper address this problem?
ZO-SPSA estimates gradient via two forward differences, then updates adversarial image with sign step and PGD.
ZO-SPSA replaces the white-box gradient update with a difference estimate relying only on forward queries, then updates the image along the sign of the estimated gradient, increasing the generation probability of a small set of harmful response texts.
Problem Setting and Formalization
- The victim LVLM has parameters θ. The input is an adversarial image and harmful text xt. The corpus Y = {yi} comes from a small set of harmful responses, with n being the number of entries.
- The optimization objective is to minimize the sum of negative log-likelihoods within the perturbation set B: xadv=argminx̂adv∈ B∑i −log p(yi∣ x̂adv,xt,θ). This means making the model more likely to generate harmful responses from the corpus under the adversarial image and harmful text. This formula requires gradients and is unusable under black-box settings.
- Evaluation success is separate from the optimization objective: if the model generates harmful output, rather than merely showing tendencies toward certain keywords, the attack succeeds; otherwise it fails. Human evaluation is also conducted.
ZO-SPSA Gradient Estimation
- SPSA with symmetric differences is used. At any point x, only the objective function value f(x) is used, with no backpropagation.
- The estimate is ĝ=[f(x+hΔ)−f(x−hΔ)]/(2hΔi), where each component Δi is independently drawn from the standard normal N(0,1). The authors state that two function evaluations give a dimension-independent approximation of ∇f(x).
- All main experiments use h = 0.0001. The sign of the current estimate is taken, and the update is projected back into the allowed perturbation via PGD.
Algorithm Flow and Experimental Parameters
- Initialize xadv with the original image.
- Iterate T times: sample a random seed, construct two perturbed inputs +hΔ and −hΔ, compute losses on both sides, and obtain estimated_grad via the difference.
- Update as x − α · sign(estimated_grad) clipped to (x, ε). The perturbation function samples Δ dimension-wise with the same seed.
- Running parameters given in the paper: batch size 8, step size α = 1, total forward budget 50,000. Generation uses temperature T = 1 and nucleus sampling with p = 0.9. A single A100 (80GB), no additional system prompt. Table 6 lists ZO-SPSA as 50,000 iterations and white-box VAJA as 5,000.
- Direct attacks do not train or query a surrogate model. Transfer experiments separately use one LVLM as a surrogate to generate images, then test on other models; this is a different setting from "the optimization itself does not use a surrogate model."
Alternative Estimation in Ablations
- The main estimate uses Gaussian directions. The ablation fixes the difference magnitude at δ = 1×10^−5 and varies iterations from 5,000 to 40,000.
- Another set uses Rademacher perturbations: each component takes +1 or −1 with equal probability, and the division by noise in the estimate is changed to multiplication. The paper does not state which LVLM these two ablation sets use.
Success Determination and Toxicity Scoring
- ASR: AdvBench uses human judgment on whether safety constraints are bypassed. VAJA's 40 instructions use GPT-4o, with each prompt repeated 10 times, across categories Identity Attack, Disinformation, Violence/Crime, and X-risk. The main text states that ASR is averaged across harmful categories to reduce randomness; the appendix states that an attempt succeeds if at least one of ten repetitions contains inappropriate content. The two statements differ, and the paper does not explain how they are reconciled. Appendix A provides the fixed review prompt.
- Toxicity rate: Perspective API and Detoxify each score six attributes, with scores from 0 to 1. The proportion of responses with scores above 0.5 is computed, repeated three times, and the mean and standard deviation are reported. Transfer experiments report the proportion of outputs containing at least one toxicity attribute.
What experiments did the paper conduct?
The three LVLMs have human ASRs of 83.0%, 73.0%, and 60.0% on AdvBench.
Experimental Setup
- Models under test: InstructBLIP, LLaVA, MiniGPT-4. Among the first two and MiniGPT-4, InstructBLIP and MiniGPT-4 use Vicuna-13B as the frozen LLM backbone (based on LLaMA), with ViT as the vision encoder; LLaVA uses LLaMA-2-13B-Chat and undergoes instruction fine-tuning and iterative RLHF based on red-team data.
- Data: AdvBench harmful behaviors, 66 training and 100 test, protocol follows Wang et al. (2024). VAJA small harmful corpus used to generate adversarial images; evaluation is 40 instructions, four risk categories. RealToxicityPrompts challenge subset 1,225. The paper does not report the number of items per category.
- Baselines: No attack benign image; white-box VAJA. Perturbations are ε = 16/255, 32/255, 64/255 and unconstrained.
- Metrics: ASR; toxicity rate is the proportion of scores > 0.5 across six attributes. Transfer also reports the proportion of at least one toxic attribute.
- Review and repetition: AdvBench is human, header is Test ASR. VAJA set is GPT-4o, 10 times per prompt. Toxicity tools each repeated 3 times. The paper does not report the number of human evaluators or agreement with automatic review.
- Run: batch size 8, α = 1, h = 0.0001, forward budget 50,000, T = 1, p = 0.9, single A100 80GB, no additional system prompt.
Main Results
Swipe horizontally to read the table
Model Training time Single-sample test time Test ASR InstructBLIP 10.3h 0.91s 83.0% LLaVA 19.4h 6.35s 73.0% MiniGPT-4 29.5h 55.03s 60.0% According to Table 3, AdvBench harmful instructions; the text states corresponding unconstrained perturbed images.
- The authors state that unconstrained perturbed images increase ASR, with InstructBLIP highest and MiniGPT-4 lowest among the three models.
- The authors state that model architecture changes optimization time and single-sample attack time: InstructBLIP shortest, MiniGPT-4 longest.
- The abstract calls the result of transferring MiniGPT-4 generated samples to other LVLMs an ASR of 64.18%. Table 5 records that number as Perspective API toxicity rate (MiniGPT-4 → InstructBLIP, compared to VAJA 57.5).
GPT-4o Evaluation on VAJA Four Categories
- What was tested: 40 instructions, four risk categories, compared to benign image, budget from ε = 16/255 to unconstrained (Table 1). Table 2 only compares Diff with VAJA on MiniGPT-4.
- Results: InstructBLIP's Identity Attack from benign 5.0% to unconstrained 80.0%, Violence/Crime to 93.8%. LLaVA unconstrained these two categories are 70.0% (table +57.8) and 90.0% (table +74.6). MiniGPT-4 at ε = 64/255 Disinfo is 100.0%, benign 48.9%. Same cell VAJA 84.4%, Diff +15.6; Identity Attack Diff +14.6. ε = 32/255 X-risk 50.0%, VAJA 73.3%, Diff −23.3.
- Authors' interpretation and exceptions: The authors state that the proportion of harmful responses increases relative to no attack across categories and budgets; at small budgets ZO-SPSA is worse than VAJA, but at larger budgets and unconstrained it remains competitive. Table 1 is not monotonically increasing with ε, e.g., InstructBLIP's Violence/Crime at ε = 32/255 is 87.5%, at ε = 64/255 81.3%; MiniGPT-4's Identity Attack at ε = 64/255 is 92.3%, unconstrained 80.0%.
Toxicity Rate and Cross-Model Transfer
- RealToxicityPrompts, Perspective API Any (Table 4, parentheses VAJA): InstructBLIP from clean 34.2±0.5 to unconstrained 64.0±1.1 (55.7); LLaVA from 9.2±0.3 to unconstrained 60.1±0.4 (50.6); MiniGPT-4 from 34.8±1.6 to unconstrained 54.1±0.6 (66.0). Detoxify Any unconstrained respectively 61.2±1.4 (56.9), 50.6±0.3 (40.5), 45.0±0.8 (61.0).
- Authors' claims and counterexamples in table: The authors state that with constraints the parenthetical VAJA is higher, and unconstrained ZO-SPSA is higher on LLaVA and InstructBLIP. LLaVA's constrained Any does not fit the first half: at ε = 16/255 Perspective is 61.4±1.7, parenthetical 30.3. MiniGPT-4 unconstrained Any is lower than parenthetical VAJA, consistent with "only higher on the first two models."
- Transfer: Table 5 takes the stronger of each ε, Perspective API. When MiniGPT-4 is surrogate, InstructBLIP 64.18 (VAJA 57.5), LLaVA 61.52 (17.9), itself 54.11 (67.2); no-attack baseline 34.2, 9.2, 34.8. The authors state that MiniGPT-4 as surrogate gives the strongest transfer. In the column transferring to LLaVA, InstructBLIP is 61.58, higher than 61.52. Table 9 labels 64.18±1.11 as MiniGPT-4 → InstructBLIP, unconstrained, Any. Table 5's Detoxify row does not align with Table 10 columns, so that row is not cited; in Table 10 the same pair, unconstrained, Detoxify Any is 61.05±0.61.
Memory, Time, Loss, and Visualization
- Table 6 (VAJA dataset): ZO-SPSA / VAJA for MiniGPT-4 16 GB, 55 h vs 32 GB, 9 h; LLaVA 30 GB, 48 h vs 62 GB, 6 h; InstructBLIP 29 GB, 22 h vs 38 GB, 3 h. The text says MiniGPT-4 ZO-SPSA is 5 hours, inconsistent with table's 55 h; here the table is taken as authoritative. The authors state memory is lower, but more iterations and longer processing time.
- Figure 2 is loss boxplots on AdvBench and VAJA. The authors state loss fluctuates within bounded range rather than monotonically decreasing, and consider it entering quasi-stationary region; full theoretical convergence is not necessary for generating adversarial examples. Text does not give boxplot endpoints.
- Figure 3 shows clean image, perturbation, and adversarial image under ℓ∞, ε = 32, 50,000 iterations. The authors state perturbation is almost imperceptible to human eye, and adversarial image with harmful prompt can trigger harmful response, while clean image fails under same prompt. Harmful response original text not paraphrased.
Other Ablations and Analyses
- Difference magnitude δ = 1×10^−5, iterations 5K–40K (Table 7, paper does not specify model): Perspective Any 39.7±1.9, 54.0±0.6, 37.5±0.2, 36.0±0.4, 47.2±1.1. The authors state that with more iterations toxicity rate is lower, and smaller perturbations weaken attack; in table 10K, 40K higher than 20K, 30K. The table's Detoxify 5K row has exactly same numbers as Perspective 5K row, not adopted.
- Rademacher perturbation (Table 8, paper does not specify model): Perspective Any 5K 42.2±0.8, 30K 49.7±2.3, 40K 35.2±0.3; Toxicity at 30K 43.5±2.2. Detoxify Any at 30K 40.3±1.8, 40K 28.2±0.5. The authors state peak at 30,000 iterations, inconsistent performance across iterations.
What are some points that can be further explored?
The authors only point out that excessive forward passes and noisy gradients make optimization time-consuming, without writing future directions.
Limitations and Future Directions Noted by the Authors
- The method requires many forward passes on the target model, which the authors state causes computational inefficiency (Limitations).
- The optimization relies on noisy gradient approximations, which the authors state makes it time-consuming (Limitations).
- The Limitations section contains only these two points. The conclusion restates ASR, transfer, and computational complexity without listing additional future directions. The paper does not specifically write a future work plan.
Experimental Coverage
- The tested LVLMs are InstructBLIP, LLaVA, and MiniGPT-4, 3 in total; backbones are Vicuna-13B and LLaMA-2-13B-Chat, with ViT on the vision side.
- Data include AdvBench (66 training, 100 test), VAJA's 40 instructions across four categories, and a 1,225-entry subset of RealToxicityPrompts. The paper does not report the number of entries per category.
- Comparisons include benign images and white-box VAJA; perturbations are ε = 16/255, 32/255, 64/255, and unconstrained. Direct attacks use a forward budget of 50,000 and h = 0.0001; Table 6 lists VAJA as 5,000 iterations.
- Evaluation uses human review for AdvBench, GPT-4o for the VAJA set (10 repetitions per prompt), and Perspective API with Detoxify (each repeated 3 times). The paper does not report the number of human evaluators or agreement between human and automatic review. The main text and appendix differ in how "one success out of ten repetitions" is described.
- Transfer is conducted among these three LVLMs, with one model as surrogate and the others as targets; Appendix Tables 9 and 10 list toxicity attribute proportions by ε. Ablations vary iteration count, difference magnitude, and Rademacher directions; the paper does not state which model the ablations use.
Summarize the main content of the paper
ZO-SPSA attacks three LVLMs under black-box settings; on AdvBench, InstructBLIP's human ASR is 83.0%.
ZO-SPSA is a black-box visual jailbreak for LVLMs: it does not read gradients, only estimates gradient via loss difference from two forward passes, then updates image with sign step and PGD.
- Problem: The authors consider white-box gradient attacks require full parameters, high computational cost, and in Figure 1 gradient samples that jailbreak MiniGPT-4 do not transfer to LLaVA. Victim system is LVLM in single-turn conversation, attacker only controls image perturbation and harmful text, goal is to bypass safety alignment and generate prohibited content.
- Method: Minimize negative log-likelihood on small corpus of harmful responses. SPSA uses symmetric difference with h = 0.0001, Δ standard normal; experimental step size α = 1, forward budget 50,000. No surrogate model used during optimization.
- AdvBench human Test ASR (Table 3, unconstrained images): InstructBLIP 83.0%, LLaVA 73.0%, MiniGPT-4 60.0%. Optimization times 10.3h, 19.4h, 29.5h respectively.
- VAJA four categories (Table 1–2, GPT-4o): Relative to benign image, ASR increases across categories. MiniGPT-4 at ε = 64/255 Disinfo 100.0%, Diff +15.6 relative to VAJA; ε = 32/255 X-risk Diff −23.3. Several categories do not increase with ε.
- Toxicity and transfer: On RealToxicityPrompts, unconstrained ZO-SPSA Perspective Any for InstructBLIP 64.0±1.1, LLaVA 60.1±0.4, higher than parenthetical VAJA; MiniGPT-4 54.1±0.6, lower than parenthetical 66.0 (Table 4). MiniGPT-4 transferred to InstructBLIP Perspective toxicity rate 64.18 (Table 5); abstract calls this number ASR.
- Authors' conclusion: Black-box jailbreak is feasible under what they call practical constraints, and exposes weaknesses in current LVLM safety mechanisms; replacing gradient computation with gradient estimation reduces computational complexity. In Table 6 ZO-SPSA has lower memory, longer average optimization time. The authors also note many forward passes and noisy gradients make optimization time-consuming. Conclusion states transfer does not require surrogate model; transfer experiments still use one LVLM to generate images then test on another.