Multi-mode jail break attack method and device for visual language model

By optimizing the image and text of the visual language model, a master key is generated to achieve a highly toxic positive reply, which solves the problem of low success rate of multi-modal attacks on the visual language model and the attack results not following user instructions, achieving high success rate and strict Compliance.

CN118550941AActive Publication Date: 2024-08-27FUDAN UNIVERSITY

Patent Information

Application Number
CN202410626602.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-20
Publication Date
2024-08-27
Estimated Expiration
2044-05-20

AI Technical Summary

Technical Problem

Existing visual language models have an under-exploited attack surface in terms of multi-modal attacks, resulting in a low success rate of jailbreak attacks. Existing methods are difficult to strictly follow user instructions during attacks and are prone to generate harmful remarks unrelated to queries. .

Method used

By collecting random noise as the initial adversarial image, the image and text are optimized to improve the probability of the visual language model generating a highly toxic reply, and by jointly optimizing the adversarial image prefix and the adversarial text suffix as a master key, combined with malicious queries to achieve a highly toxic positive reply.

Benefits of technology

It implements a high-success rate jailbreak attack on the visual language model, ensures that the attack results strictly comply with user instructions, and makes full use of both text and image attack surfaces to improve the attack success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550941A
    Figure CN118550941A
Patent Text Reader

Abstract

The invention provides a multi-mode jail break attack method and device for a visual language model, and the method is characterized in that the method comprises the following steps: S1, collecting random noise as an initial confrontation image; s2, optimizing the initial confrontation image according to a first optimization target to obtain an optimized confrontation image; s3, constructing an initial confrontation text; s4, performing joint optimization on the optimized adversarial image and the initial adversarial text according to a second optimization target to obtain an adversarial image prefix and an adversarial text suffix; and S5, inputting the adversarial image prefix, the malicious query and the adversarial text suffix as a whole into the visual language model to obtain a high-toxicity positive reply. In a word, the method can realize high-success-rate jailbreak attack aiming at the visual language model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence security, and in particular to a multimodal jailbreak attack method and device for a visual language model. Background Art

[0002] Recent advances in visual language models (VLMs), such as OpenAI's GPT-4 and Google's Flamingo, have attracted widespread attention from academia, industry, and the public. These developments have also attracted the attention of AI safety researchers, who are increasingly focused on evaluating the adversarial robustness of multimodal models. While VLMs are expected to exhibit the same alignment properties as large language models (LLMs), namely providing useful responses to user queries while rejecting requests that could cause harm, the additional visual modality introduces new vulnerabilities.

[0003] Greshake et al. explored the effectiveness of manually injecting deceptive text into input images. In contrast, other studies have proposed more sophisticated adversarial attack methods in the image domain. Carlini et al. fixed the starting part of the harmful target output and optimized the input image to increase the probability of generating it. Bagdasaryan et al. and Bailey et al. adopted a similar strategy by using teacher forcing techniques to generate text of the attacker's choice, although these texts may not be directly related to the harmful content. Another white-box attack proposed by Qi et al. adopts a similar principle to Bagdasaryan et al. and aims to find a universal adversarial visual input. Specifically, this attack no longer focuses on a specific output sentence, but instead attempts to maximize the probability of generating derogatory output from a corpus of 66 harmful sample sentences. This strategy is inspired by Wallace et al., who also used a discrete search-based optimization algorithm to find a universal adversarial trigger that increases the probability of generating a small set of harmful sentences. Shayegani et al. proposed attacking publicly available visual encoders, such as CLIP used in multimodal models, thereby eliminating the need for full white-box access.

[0004] While the above methods have shown impressive results, they mainly focus on exploring adversarial robustness under image-based unimodal attacks, a strategy based on the consensus that attacks in the continuous image space are more effective than attacks in the discrete text space.

[0005] However, the above methods result in the full attack surface available in the multimodal model not being fully utilized. Therefore, there is still room for further improvement in jailbreak attacks on multimodal models, namely visual language models. Summary of the invention

[0006] The present invention is made to solve the above-mentioned problem, and its purpose is to provide a multimodal jailbreak attack method and device for a visual language model.

[0007] The present invention provides a multimodal jailbreak attack method for a visual language model, which is used for jailbreaking a visual language model through a malicious query to obtain a corresponding highly toxic positive response, and has the following characteristics, including the following steps: step S1, collecting random noise as an initial adversarial image; step S2, using the initial adversarial image as an input of the visual language model, and optimizing the initial adversarial image according to a first optimization goal, to obtain an optimized initial adversarial image as an optimized adversarial image; step S3, constructing an initial adversarial text; step S4, using the optimized adversarial image, the initial adversarial text and an existing malicious user query as inputs of the visual language model, and jointly optimizing the optimized adversarial image and the initial adversarial text according to a second optimization goal, to obtain an optimized optimized adversarial image as an adversarial image prefix, and an optimized initial adversarial text as an adversarial text suffix; step S5, inputting the adversarial image prefix, the malicious query and the adversarial text suffix as a whole into the visual language model, to obtain a highly toxic positive response, wherein the first optimization goal is to increase the probability that the visual language model generates a highly toxic response according to the initial adversarial image, and the second optimization goal is to increase the probability that the visual language model generates a positive response according to the optimized adversarial image and the initial adversarial text.

[0008] In the multimodal jailbreak attack method for the visual language model provided by the present invention, it can also have the following characteristics: wherein the expression of the first optimization objective is: In the formula is the initial adversarial image, The text input of the visual language model is empty, s i is a highly toxic reply, m is the sample size of the highly toxic reply corpus, and a highly toxic reply is a text reply containing harmful content.

[0009] The multimodal jailbreak attack method for the visual language model provided by the present invention may also have the following feature: wherein, in step S2, the first optimization objective is solved by a projected gradient descent method to obtain an optimized adversarial image.

[0010] The multimodal jailbreak attack method for the visual language model provided by the present invention may also have the following feature: wherein the initial adversarial text is a plurality of exclamation marks.

[0011] In the multimodal jailbreak attack method for the visual language model provided by the present invention, it can also have the following characteristics: wherein the expression of the second optimization objective is: In the formula To optimize the adversarial image, is the initial adversarial text, t i For an affirmative response, g i is a malicious user query, and m is the sample size of the corpus.

[0012] In the multimodal jailbreak attack method for the visual language model provided by the present invention, it can also have the following characteristics: wherein, in step S4, the image domain optimization problem in the second optimization objective is solved by the projected gradient descent method, and the text domain optimization problem in the second optimization objective is solved by the greedy coordinate gradient to obtain the adversarial image prefix and the adversarial text suffix.

[0013] The present invention also provides a multimodal jailbreak attack device for a visual language model, which is used to jailbreak the visual language model through malicious queries to obtain corresponding highly toxic positive replies, and has the following characteristics, including: a model storage module, which is used to store the visual language model; a universal master key generation module, which is used to generate adversarial image prefixes and adversarial text suffixes according to the visual language model; a malicious reply generation module, which is used to input the adversarial image prefix, malicious query and adversarial text suffix as a whole into the visual language model to obtain highly toxic positive replies, wherein the universal master key generation module includes: an initial adversarial image generation unit, which is used to collect random noise as an initial adversarial image; an optimized adversarial image generation unit, which is used to use the initial adversarial image as the input of the visual language model, and optimize the adversarial image according to the first optimization objective. An initial adversarial image is optimized to obtain an optimized initial adversarial image as an optimized adversarial image; an initial adversarial text generation unit is used to construct an initial adversarial text; a universal master key generation unit stores a training data set containing multiple malicious user queries, and is used to use the optimized adversarial image, the initial adversarial text and the malicious user query as inputs of a visual language model, and jointly optimize the optimized adversarial image and the initial adversarial text according to a second optimization goal to obtain an optimized optimized adversarial image as an adversarial image prefix and an optimized initial adversarial text as an adversarial text suffix, wherein the first optimization goal is to increase the probability that the visual language model generates a highly toxic response based on the initial adversarial image, and the second optimization goal is to increase the probability that the visual language model generates a positive response based on the optimized adversarial image and the initial adversarial text.

[0014] Functions and Effects of the Invention

[0015] According to the multimodal jailbreak attack method and device for the visual language model involved in the present invention, the initial adversarial image is optimized by the first optimization goal to obtain an optimized adversarial image with high toxicity, and then the optimized adversarial image and the initial adversarial text are jointly optimized by the second optimization goal, and a master key that can obtain a positive reply is further generated, and finally the master key is combined with the malicious query to enable the visual language model to generate a corresponding high-toxic positive reply. Therefore, the multimodal jailbreak attack method and device for the visual language model of the present invention can make full use of the two attack surfaces of text and image to achieve a high success rate jailbreak attack on the visual language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 is a schematic diagram of the working principle of a multi-modal jailbreak attack device in an embodiment of the present invention;

[0017] Figure 2 is a block diagram of a multi-modal jailbreak attack device in an embodiment of the present invention;

[0018] Figure 3 It is a flowchart of a multimodal jailbreak attack method for a visual language model in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to make the technical means, creative features, objectives and effects achieved by the present invention easy to understand, the following embodiments and the accompanying drawings specifically illustrate the multimodal jailbreak attack method and device for the visual language model of the present invention.

[0020] This embodiment provides a multimodal jailbreak attack device for a visual language model, which is used to perform a jailbreak attack on the visual language model through malicious queries to obtain a corresponding highly toxic affirmative response.

[0021] In this embodiment, the malicious query is an instruction containing harmful information, and the corresponding highly toxic positive response is a text response generated by the visual language model that is related to the malicious query and contains harmful content. For example, if the user orders the visual language model to provide a specific plan for doing a bad thing as a malicious query, the corresponding highly toxic positive response is the specific plan for doing the bad thing generated by the visual language model.

[0022] Figure 1 It is a schematic diagram of the working principle of the multi-modal jailbreak attack device in an embodiment of the present invention.

[0023] like Figure 1As shown, the multimodal jailbreak attack device generates adversarial image prefixes and adversarial text suffixes for the visual language model as a master key through joint optimization. When the user queries, the master key and the harmful instructions, i.e., the malicious query, are input into the visual language model as a whole. The visual language model first processes the adversarial image prefix in the input through the visual encoder and mapping layer to obtain the corresponding image features, and then uses the image features, the harmful instructions, and the adversarial text suffix as a whole vector for text generation through the subsequent language model, thereby obtaining a highly toxic affirmative response, i.e., "Okay, here are the detailed steps of how to do... (a bad thing):..." Among them, according to "Okay, here are the detailed steps of how to do... (a bad thing):", it can be seen that the visual language model has generated corresponding content for the malicious query, which indicates that the content is a targeted affirmative response, rather than other content unrelated to the malicious query.

[0024] Figure 2 4 is a block diagram of a multi-modal jailbreak attack device in an embodiment of the present invention.

[0025] like Figure 2 As shown, the multi-modal jailbreak attack device 100 includes a model storage module 10, a universal master key generation module 20, a malicious reply generation module 30 and a control module 40 for controlling the operation of the above modules.

[0026] The model storage module 10 is used to store the visual language model.

[0027] The universal master key generation module 20 is used to generate adversarial image prefixes and adversarial text suffixes according to the visual language model stored in the model storage module 10, and includes an initial adversarial image generation unit 201, an optimized adversarial image generation unit 202, an initial adversarial text generation unit 203 and a universal master key generation unit 204.

[0028] The initial adversarial image generating unit 201 is used to collect random noise as an initial adversarial image.

[0029] The optimized adversarial image generating unit 202 is used to use the initial adversarial image as the input of the visual language model, and optimize the initial adversarial image according to the first optimization target to obtain the optimized initial adversarial image as the optimized adversarial image.

[0030] Among them, the first optimization goal is to improve the probability of the visual language model generating a high toxicity response based on the initial adversarial image, which is expressed as:

[0031]

[0032] In the formula is the initial adversarial image, The text input of the visual language model is empty, that is, the optimized adversarial image generation unit 202 only uses the initial adversarial image as the input of the visual language model, s i is the high toxicity reply, and m is the sample size of the high toxicity reply corpus.

[0033] In this embodiment, the first optimization objective is solved by the projected gradient descent method to obtain an optimized adversarial image.

[0034] The initial confrontation text generation unit 203 is used to construct the initial confrontation text. In this embodiment, the initial confrontation text is 20 consecutive exclamation marks "!".

[0035] The universal master key generation unit 204 stores a training data set including multiple malicious user queries, and is used to use the optimized adversarial image, the initial adversarial text and the malicious user query as inputs of the visual language model, and jointly optimize the optimized adversarial image and the initial adversarial text according to the second optimization goal, to obtain the optimized adversarial image as the adversarial image prefix, and the optimized initial adversarial text as the adversarial text suffix.

[0036] Among them, the second optimization goal is to improve the probability of the visual language model generating a positive response based on the optimized adversarial image and the initial adversarial text, and its expression is:

[0037]

[0038] In the formula To optimize the adversarial image, is the initial adversarial text, t i For an affirmative response, g i is a malicious user query, and m is the sample size of the corpus.

[0039] In this embodiment, the image domain optimization problem in the second optimization objective is solved by the projected gradient descent method, and the text domain optimization problem in the second optimization objective is solved by the greedy coordinate gradient to obtain the adversarial image prefix and the adversarial text suffix.

[0040] The malicious reply generation module 30 is used to input the adversarial image prefix, the malicious query and the adversarial text suffix into the visual language model as a whole to obtain a highly toxic positive reply.

[0041] The control module 40 stores a control program for controlling the operation of each module.

[0042] The following describes the process of using the multimodal jailbreak attack device 100 to perform a multimodal jailbreak attack method on a visual language model in conjunction with the accompanying drawings.

[0043] Figure 3It is a flowchart of a multimodal jailbreak attack method for a visual language model in an embodiment of the present invention.

[0044] like Figure 3 As shown, the multimodal jailbreak attack method for the visual language model includes the following steps:

[0045] Step S1: using the initial adversarial image generation unit 201 to collect random noise as an initial adversarial image.

[0046] Step S2: using the optimized adversarial image generation unit 202 to take the initial adversarial image as the input of the visual language model, and optimizing the initial adversarial image according to the first optimization target to obtain an optimized initial adversarial image.

[0047] Step S3, using the initial adversarial text generation unit 203 to construct the initial adversarial text.

[0048] Step S4, using the universal master key generation unit 204 to take the optimized adversarial image, the initial adversarial text and the existing malicious user query as the input of the visual language model, and jointly optimize the optimized adversarial image and the initial adversarial text according to the second optimization goal, to obtain the optimized optimized adversarial image as the adversarial image prefix, and the optimized initial adversarial text as the adversarial text suffix.

[0049] Step S5, using the malicious reply generation module 30 to input the adversarial image prefix, malicious query and adversarial text suffix as a whole into the visual language model to obtain a highly toxic positive reply.

[0050] In this embodiment, first, the initial adversarial image is optimized by executing steps S1 to S2 to obtain an optimized adversarial image infused with toxic semantics, which can enable the visual language model to generate a highly toxic response. Next, by executing steps S3 to S4, the optimized adversarial image and the initial adversarial text are jointly optimized to obtain the adversarial image prefix and the adversarial text suffix as a master key, which can enable the visual language model to further generate an affirmative response. Finally, the master key and the malicious query are input into the visual language model as a whole, so that it generates a highly toxic and affirmative response, that is, a highly toxic affirmative response.

[0051] In this embodiment, on the basis of the existing visual language model, the multimodal jailbreak attack method for the visual language model of this embodiment, i.e., the method of the present invention, and the jailbreak attack method mentioned in the existing document “Qi X, Huang K, Panda A, et al. Visual adversarial examples jailbreak large language models[J]. arXiv preprint arXiv: 2306.13213, 2023.”, i.e., the general jailbreak method, are used to perform jailbreak attacks. Finally, the success rate of the method of the present invention is 96%, while the success rate of the general jailbreak method is 64%. It can be seen that the method of the present invention has a better attack success rate than the existing method.

[0052] In addition, the existing jailbreak attack method for visual language models only optimizes the adversarial target without text input, which makes it impossible to strictly follow the user's instructions during the jailbreak attack, that is, it is easier to generate some harmful remarks that are irrelevant to the user's query. The method of the present invention solves the above problem by setting the first optimization target and the second optimization target, and achieves the effect of strictly following the user's instructions during the jailbreak attack.

[0053] The multimodal jailbreak attack method for the visual language model of this embodiment can be further used for security detection of the visual language model. The jailbreak success rate of the visual language model to be detected is obtained through this method, thereby evaluating and improving the security performance of the visual language model to be detected.

[0054] Functions and Effects of the Embodiments

[0055] According to the multimodal jailbreak attack method and device for the visual language model involved in this embodiment, the initial adversarial image is optimized by the first optimization goal to obtain an optimized adversarial image with high toxicity, and then the optimized adversarial image and the initial adversarial text are jointly optimized by the second optimization goal, and a master key that can obtain a positive reply is further generated. Finally, the master key is combined with the malicious query to enable the visual language model to generate a corresponding high-toxic positive reply. In short, this method can make full use of the two attack surfaces of text and image to achieve a high success rate of jailbreak attacks on visual language models.

[0056] Those skilled in the art should understand that the present invention is not limited to the above embodiments, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements fall within the scope of the present invention to be protected. The scope of protection of the present invention is defined by the attached claims and their equivalents.

Claims

1. A multimodal jailbreak attack method for a visual language model, which is used to jailbreak the visual language model through malicious queries to obtain corresponding highly toxic positive responses, characterized in that: The following steps are involved: Step S1, collecting random noise as an initial adversarial image; Step S2, using the initial adversarial image as the input of the visual language model, and optimizing the initial adversarial image according to a first optimization objective to obtain an optimized initial adversarial image as an optimized adversarial image; Step S3, constructing an initial adversarial text; Step S4, taking the optimized adversarial image, the initial adversarial text and the existing malicious user query as inputs of the visual language model, and jointly optimizing the optimized adversarial image and the initial adversarial text according to a second optimization objective, to obtain an optimized optimized adversarial image as an adversarial image prefix, and an optimized initial adversarial text as an adversarial text suffix; Step S5, inputting the adversarial image prefix, the malicious query and the adversarial text suffix as a whole into the visual language model to obtain the highly toxic positive response, The first optimization goal is to increase the probability that the visual language model generates a high toxicity response based on the initial adversarial image. The second optimization goal is to increase the probability that the visual language model generates a positive response based on the optimized adversarial image and the initial adversarial text.

2. The multimodal jailbreak attack method for a visual language model according to claim 1, characterized in that: in, The expression of the first optimization objective is: In the formula is the initial adversarial image, The text input of the visual language model is empty, s i is the highly toxic response, m is the sample size of the highly toxic response corpus, The highly toxic reply is a text reply containing harmful content.

3. The multimodal jailbreak attack method for a visual language model according to claim 2, characterized in that: in, In the step S2, the first optimization objective is solved by a projected gradient descent method to obtain the optimized adversarial image.

4. The multimodal jailbreak attack method for a visual language model according to claim 1, characterized in that: in, The initial confrontation text is a plurality of exclamation marks.

5. The multimodal jailbreak attack method for a visual language model according to claim 1, characterized in that: in, The expression of the second optimization objective is: In the formula For the optimized adversarial image, is the initial adversarial text, t i For an affirmative response, g i is the malicious user query, and m is the sample size of the corpus.

6. The multimodal jailbreak attack method for a visual language model according to claim 5, characterized in that: in, In step S4, the image domain optimization problem in the second optimization objective is solved by the projected gradient descent method, and the text domain optimization problem in the second optimization objective is solved by the greedy coordinate gradient to obtain the adversarial image prefix and the adversarial text suffix.

7. A multimodal jailbreak attack device for a visual language model, used to jailbreak the visual language model through malicious queries to obtain a corresponding highly toxic positive response, characterized in that: include: A model storage module, used for storing the visual language model; A universal master key generation module, used for generating adversarial image prefixes and adversarial text suffixes according to the visual language model; A malicious reply generation module is used to input the adversarial image prefix, the malicious query and the adversarial text suffix as a whole into the visual language model to obtain the highly toxic positive reply, Wherein, the universal master key generation module includes: An initial adversarial image generating unit, used for collecting random noise as an initial adversarial image; An optimized adversarial image generating unit, configured to use the initial adversarial image as an input of the visual language model, and optimize the initial adversarial image according to a first optimization objective to obtain an optimized initial adversarial image as an optimized adversarial image; An initial adversarial text generation unit, used to construct an initial adversarial text; The universal master key generation unit stores a training data set including multiple malicious user queries, and is used to use the optimized adversarial image, the initial adversarial text and the malicious user query as inputs of the visual language model, and jointly optimize the optimized adversarial image and the initial adversarial text according to a second optimization objective to obtain an optimized optimized adversarial image as a prefix of the adversarial image and an optimized initial adversarial text as a suffix of the adversarial text. The first optimization goal is to increase the probability that the visual language model generates a high toxicity response based on the initial adversarial image. The second optimization goal is to increase the probability that the visual language model generates a positive response based on the optimized adversarial image and the initial adversarial text.

Citation Information

Patent Citations

  • Image labeling method and device

    CN110163230A

  • Text-to-image generation method based on hybrid network model

    CN110751698A

  • Visual pre-training model-based migration adversarial attack method and analysis device

    CN117809130A

  • Contextual Application Switch Based on User Behaviors

    US20210311774A1

Cited By

  • Multi-mode black box attack method and device for large visual language model

    CN119415728A

  • Video frame-based video multi-mode large model jailbreak attack method, system and equipment and medium

    CN119862573A

  • Multi-modal large model jailbreak attack method and device based on controllable diffusion guided adaptive disturbance balance, and medium

    CN121919885A

  • Multi-modal large model jailbreaking attack method and device based on controllable diffusion guided adaptive perturbation balance and medium

    CN121919885B

  • Large language model jailbreak attack test method based on submerged space optimization

    CN122286786A