Multimodal semantic consistency attack test method, related device and storage medium
By constructing a cross-modal heterogeneous semantic association graph and generating adversarial hint text images, the problem of low attack testing accuracy in cross-modal generation tasks of multimodal large models is solved. It achieves attack effects with low perturbation intensity and high concealment, is suitable for black-box scenarios, and improves the security testing of multimodal large models.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-04
- Publication Date
- 2026-03-17
AI Technical Summary
Existing multimodal large models have low accuracy in attack testing for cross-modal generation tasks. Traditional attack methods cannot simultaneously perturb cues and images to cause semantic deviations, and their effectiveness is limited in black-box scenarios. Existing technologies lack multimodal collaborative attack mechanisms for text and images.
By acquiring the original prompt text and image, selecting cognitive bias perturbation actions, extracting semantic nodes from the text and image, constructing a cross-modal heterogeneous semantic association graph, generating text and image perturbation optimization signals, iteratively embedding vectors to generate adversarial prompt text and adding image perturbations, and inputting the data into a multimodal large model to determine the attack result.
It improves the accuracy of attack testing, enables low-disturbance attacks to evade detection, enhances the stealth and scope of attacks, is suitable for black-box scenarios, and improves the security testing capabilities of multimodal large models.
Smart Images

Figure CN121256782B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and more specifically to a multimodal semantic consistency attack testing method, related apparatus, and storage medium. Background Technology
[0002] Current multimodal large-scale models have demonstrated powerful semantic understanding and content generation capabilities in cross-modal generation tasks such as image-to-text and text-to-image, and have been widely applied in content creation, intelligent interaction, and other fields. However, at the same time, the security issues of multimodal large-scale models are becoming increasingly prominent, and adversarial attacks, as an important means of evaluating model robustness, have received high attention from academia and industry. Traditional adversarial attack methods mainly focus on single-modal scenarios. In computer vision, this involves adding subtle perturbations to the input image to cause the model to make incorrect predictions, while in natural language processing, adversarial examples are generated for text classification tasks. In cross-modal generation tasks, traditional attack methods cannot simultaneously perturb the cue and the image to cause semantic deviation. Attacks on the visual or text side alone are unlikely to simultaneously cause semantic deviations in the generated image and cue words. Among existing multimodal attack techniques, some white-box attack methods rely on the model's internal gradient information, which is not applicable in actual black-box scenarios, and the perturbation traces are obvious and easily detected by defense mechanisms. Another type of method induces the model to generate harmful content by explicitly altering text prompts, but this approach has low attack concealment, is ineffective against complex semantic transformations, and lacks a multimodal collaborative attack mechanism involving text and images, resulting in limited attack effectiveness. Existing multimodal semantic consistency attack testing methods have a relatively shallow attack layer, leading to low accuracy in attack testing. Summary of the Invention
[0003] This application provides a multimodal semantic consistency attack testing method, related apparatus, and storage medium, which can improve the accuracy of attack testing.
[0004] In a first aspect, embodiments of this application provide a method for testing multimodal semantic consistency attacks, the method comprising:
[0005] Retrieve the original prompt text and the original image;
[0006] Select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain cognitive bias text;
[0007] Key features are extracted from the cognitive bias text as text semantic nodes, and key features are extracted from the original image as image semantic nodes, resulting in multiple text semantic nodes and multiple image semantic nodes;
[0008] A cross-modal heterogeneous semantic association graph is constructed based on multiple text semantic nodes and multiple image semantic nodes;
[0009] The cross-modal heterogeneous semantic association graph is processed based on a preset graph neural network to generate text perturbation optimization signals and image perturbation optimization signals;
[0010] The cognitive bias text is converted into a continuous embedding vector. The continuous embedding vector is iteratively perturbed based on the text perturbation optimization signal to obtain the target embedding vector. Adversarial prompt text is then generated based on the target embedding vector.
[0011] Based on the image perturbation optimization signal, a perturbation is added to the original image to obtain a perturbed image;
[0012] The adversarial prompt text and the perturbation image are input into the tested multimodal large model to obtain the target image generated by the tested multimodal large model;
[0013] The attack result is determined based on the semantic deviation between the target image and the original prompt text, wherein the attack result is either a successful attack or a failed attack.
[0014] If the attack is successful, the attack is stopped and the attack result and the target image are output.
[0015] In one implementation, determining the attack result based on the semantic deviation between the target image and the original prompt text includes:
[0016] Calculate the semantic deviation between the target image and the original prompt text;
[0017] When the semantic deviation is greater than a preset deviation, the attack result is determined to be a successful attack; when the semantic deviation is not greater than the preset deviation, the attack result is determined to be a failed attack.
[0018] In one embodiment, the multimodal semantic consistency attack testing method includes:
[0019] If the attack fails, the target perturbation action is updated iteratively to update the target image, the attack result, and the number of attacks.
[0020] When the updated attack result indicates a successful attack or the number of attacks has reached a preset number, the attack is stopped and the attack result is output.
[0021] In one implementation, the plurality of different cognitive bias perturbation actions include at least two of semantic ambiguity perturbation actions, concept drift perturbation actions, and positive / negative misleading perturbation actions.
[0022] In one implementation, the step of adding a perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image includes:
[0023] The perturbation visual region, the region perturbation action, and the intensity of the perturbation action are determined from the image perturbation optimization signal.
[0024] In the perturbation visual region on the original image, a perturbation action of the specified perturbation intensity is performed to obtain the perturbation image.
[0025] In one implementation, generating adversarial cue text based on the target embedding vector includes:
[0026] Multiple candidate prompt texts are generated based on the target embedding vector;
[0027] The grammar scores of each candidate prompt text are obtained by performing a grammar score on each candidate prompt text based on a pre-trained grammar model.
[0028] The candidate prompt text with the highest grammatical score is determined as the adversarial prompt text.
[0029] Secondly, embodiments of this application provide a multimodal semantic consistency attack testing device, which has the function of implementing the multimodal semantic consistency attack testing method corresponding to the first aspect described above. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above function, and the modules can be software and / or hardware.
[0030] In one embodiment, the multimodal semantic consistency attack testing apparatus includes:
[0031] The acquisition module is configured to acquire the original prompt text and the original image;
[0032] The selection module is configured to select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain cognitive bias text;
[0033] The extraction module is configured to extract key features from the cognitive bias text as text semantic nodes and extract key features from the original image as image semantic nodes, thereby obtaining multiple text semantic nodes and multiple image semantic nodes.
[0034] The construction module is configured to construct a cross-modal heterogeneous semantic association graph based on multiple text semantic nodes and multiple image semantic nodes;
[0035] The processing module is configured to process the cross-modal heterogeneous semantic association graph based on a preset graph neural network to generate text perturbation optimization signals and image perturbation optimization signals;
[0036] The text perturbation module is configured to convert the cognitive bias text into a continuous embedding vector, iteratively perturb the continuous embedding vector based on the text perturbation optimization signal to obtain a target embedding vector, and generate adversarial prompt text based on the target embedding vector;
[0037] An image perturbation module is configured to add perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image;
[0038] The generation module is configured to input the adversarial prompt text and the perturbation image into the tested multimodal large model to obtain the target image generated by the tested multimodal large model;
[0039] The determination module is configured to determine the attack result based on the semantic deviation between the target image and the original prompt text, wherein the attack result is either a successful attack or a failed attack.
[0040] The output module is configured to stop the attack and output the attack result and the target image if the attack result is successful.
[0041] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the multimodal semantic consistency attack testing method as described in the first aspect.
[0042] Fourthly, embodiments of this application provide a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the multimodal semantic consistency attack testing method described in the first aspect.
[0043] Fifthly, embodiments of this application provide a chip that includes a processor coupled to a transceiver of a terminal device, for executing the technical solution provided in the first aspect of embodiments of this application.
[0044] Sixthly, embodiments of this application provide a chip system including a processor for supporting a terminal device in implementing the functions involved in the first aspect above, such as generating or processing information involved in the multimodal semantic consistency attack testing method provided in the first aspect above.
[0045] In one possible design, the aforementioned chip system also includes a memory for storing program instructions and data necessary for the terminal. The chip system can be composed of chips or may include chips and other discrete components.
[0046] In a seventh aspect, embodiments of this application provide a computer program product containing instructions that, when run on a computer, cause the computer to execute the multimodal semantic consistency attack testing method provided in the first aspect.
[0047] Compared to existing technologies, in this application embodiment, the following steps are taken: First, the original prompt text and original image are obtained. Then, a target perturbation action is selected from multiple different cognitive bias perturbation actions, and the original prompt text is perturbed based on the target perturbation action to obtain cognitive bias text. Next, key features are extracted from the cognitive bias text as text semantic nodes, and key features are extracted from the original image as image semantic nodes, resulting in multiple text semantic nodes and multiple image semantic nodes. Finally, a cross-modal heterogeneous semantic association graph is constructed based on the multiple text semantic nodes and multiple image semantic nodes. The cross-modal heterogeneous semantic association graph is processed using a preset graph neural network to generate a text perturbation optimization signal and an image. The process involves: optimizing the perturbation signal; converting cognitively biased text into continuous embedding vectors; iteratively perturbing the continuous embedding vectors based on the text perturbation optimization signal to obtain a target embedding vector; generating adversarial prompt text based on the target embedding vector; adding perturbations to the original image based on the image perturbation optimization signal to obtain a perturbed image; inputting the adversarial prompt text and the perturbed image into a tested multimodal large model to obtain a target image generated by the tested multimodal large model; determining the attack result based on the semantic deviation between the target image and the original prompt text, where the attack result is either successful or unsuccessful; if the attack result is successful, the attack is stopped and the attack result and the target image are output. This application utilizes cognitive bias to achieve low-perturbation intensity attacks, evading detection, without overly relying on model gradients, and generalizing the attack through semantic association graphs. The semantic consistency between text and image is relatively good, which can enhance the attack space and thus improve the accuracy of attack testing. Attached Figure Description
[0048] The objectives, features, and advantages of the embodiments of this application will become readily understood by referring to the accompanying drawings and the detailed description of the embodiments. Wherein:
[0049] Figure 1 This is a schematic diagram of a multimodal semantic consistency attack testing system, which is an embodiment of the multimodal semantic consistency attack testing method in this application.
[0050] Figure 2 This is a flowchart illustrating a multimodal semantic consistency attack testing method according to an embodiment of this application.
[0051] Figure 3 This is a schematic diagram illustrating the generation of cognitive bias text in the multimodal semantic consistency attack testing method of this application embodiment;
[0052] Figure 4This is a schematic diagram of the structure of the multimodal semantic consistency attack testing device according to an embodiment of this application;
[0053] Figure 5 This is a schematic diagram of the structure of a computing device according to an embodiment of this application;
[0054] Figure 6 This is a schematic diagram of the structure of a mobile phone in one embodiment of this application;
[0055] Figure 7 This is a schematic diagram of a server structure in one embodiment of this application.
[0056] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0057] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules in the embodiments of this application is merely a logical division; in actual applications, there may be other division methods. For example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Additionally, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interface, indirect coupling between modules, or electrical or other similar forms of communication connection, none of which are limited in the embodiments of this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed among multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.
[0058] The general-purpose big model is currently widely used in applications such as chat dialogue, text editing, artistic creation, coding, mathematical reasoning, and bioinformatics. Although it has created many new business models and has powerful capabilities, after the general-purpose big model was launched for users, there are mainly algorithmic risks, data risks, and application risks in the three types of applications: translation, chat, and collaboration.
[0059] This application also provides a multimodal semantic consistency attack testing method, related apparatus, and storage medium, which can be applied to a multimodal semantic consistency attack testing system. This system can include a multimodal semantic consistency attack testing device, which can be deployed integratedly or separately. The device is used to at least acquire the original prompt text and the original image; select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain cognitive bias text; extract key features from the cognitive bias text as text semantic nodes, and extract key features from the original image as image semantic nodes to obtain multiple text semantic nodes and multiple image semantic nodes; construct a cross-modal heterogeneous semantic association graph based on the multiple text semantic nodes and multiple image semantic nodes; process the cross-modal heterogeneous semantic association graph based on a preset graph neural network to generate a text perturbation optimization signal and... The process involves: optimizing the image perturbation signal; converting the cognitively biased text into a continuous embedding vector; iteratively perturbing the continuous embedding vector based on the text perturbation optimization signal to obtain the target embedding vector; generating adversarial prompt text based on the target embedding vector; adding perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image; inputting the adversarial prompt text and the perturbed image into a tested multimodal large model to obtain the target image generated by the tested multimodal large model; determining the attack result based on the semantic deviation between the target image and the original prompt text, where the attack result is either a successful attack or a failed attack; if the attack result is a successful attack, stopping the attack and outputting the attack result and the target image.
[0060] The solutions provided in this application involve technologies such as Artificial Intelligence (AI) and Machine Learning (ML), and are specifically illustrated through the following embodiments:
[0061] AI, or Artificial Intelligence, refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, Artificial Intelligence is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. Artificial Intelligence studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0062] AI technology is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0063] In cross-modal generation tasks, traditional attack methods cannot simultaneously perturb cues and images to cause semantic deviations. Attacks solely on the visual or textual aspects struggle to simultaneously induce semantic deviations in the generated images and cues. Existing multimodal attack techniques, particularly white-box attacks, rely on internal model gradient information, making them unsuitable for real-world black-box scenarios and leaving obvious perturbation traces that are easily detected by defense mechanisms. Another approach explicitly modifies text cues to induce the model to generate harmful content, but this method suffers from low attack concealment, ineffectiveness against complex semantic transformations, and a lack of multimodal collaborative attack mechanisms involving text and images, resulting in limited effectiveness. Furthermore, existing multimodal semantic consistency attack testing methods have a shallow attack layer, leading to low accuracy in attack testing.
[0064] Compared to existing technologies, in this embodiment, the following steps are taken: First, the original prompt text and original image are acquired. Then, a target perturbation action is selected from multiple different cognitive bias perturbation actions, and the original prompt text is perturbed based on the target perturbation action to obtain cognitive bias text. Next, key features are extracted from the cognitive bias text as text semantic nodes, and key features are extracted from the original image as image semantic nodes, resulting in multiple text semantic nodes and multiple image semantic nodes. Finally, a cross-modal heterogeneous semantic association graph is constructed based on the multiple text semantic nodes and multiple image semantic nodes. The cross-modal heterogeneous semantic association graph is processed using a preset graph neural network to generate a text perturbation optimization signal and an image. The process involves: optimizing the perturbation signal; converting the cognitively biased text into a continuous embedding vector; iteratively perturbing the continuous embedding vector based on the text perturbation optimization signal to obtain the target embedding vector; generating adversarial prompt text based on the target embedding vector; adding perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image; inputting the adversarial prompt text and the perturbed image into the tested multimodal large model to obtain the target image generated by the tested multimodal large model; determining the attack result based on the semantic deviation between the target image and the original prompt text, where the attack result is either a successful attack or a failed attack; if the attack result is a successful attack, stopping the attack and outputting the attack result and the target image.
[0065] In some implementations, reference is made to Figure 1 The multimodal semantic consistency attack testing method provided in this application embodiment can be based on Figure 1The diagram illustrates an implementation of a multimodal semantic consistency attack testing system. This system may include an electronic device 100 and a memory 200. The electronic device 100 may be a server or a terminal device.
[0066] It should be noted that the server involved in the embodiments of this application can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0067] The terminal devices involved in the embodiments of this application can be devices that provide voice and / or data connectivity to users, handheld devices with wireless connectivity, or other processing devices connected to a wireless modem. Examples include mobile phones (or "cellular" phones) and computers with mobile terminals, such as portable, pocket-sized, handheld, computer-embedded, or vehicle-mounted mobile devices that exchange voice and / or data with a wireless access network. Examples include Personal Communication Service (PCS) phones, cordless phones, Session Initiation Protocol (SIP) phones, Wireless Local Loop (WLL) stations, Personal Digital Assistants (PDAs), and other devices.
[0068] Reference Figure 2 , Figure 2 This is a flowchart illustrating a multimodal semantic consistency attack testing method provided in an embodiment of this application. The method can be executed by a multimodal semantic consistency attack testing device. The method includes steps 101-110:
[0069] Step 101: Obtain the original prompt text and the original image.
[0070] In this embodiment, the original prompt text and original image are input by the user.
[0071] For example, the original prompt text is "Generate an image of a healthy pet dog", and the original image is a photo of a regular pet dog.
[0072] Step 102: Select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain the cognitive bias text.
[0073] In this embodiment, multiple different cognitive bias perturbation actions can be set according to specific circumstances.
[0074] In a specific implementation, multiple different cognitive bias perturbation actions include at least two of the following: semantic ambiguity perturbation actions, concept drift perturbation actions, and positive / negative misleading perturbation actions.
[0075] like Figure 3 As shown in the embodiments of this application, a target perturbation action is selected from multiple different cognitive bias perturbation actions, and the original prompt text is perturbed based on the target perturbation action to obtain cognitive bias text.
[0076] Semantic ambiguity perturbation actions include polysemous word substitution and ambiguous sentence reconstruction. For example, the original prompt text is "Generate an image of a healthy pet dog". By perturbing the original prompt text based on semantic ambiguity perturbation actions, a cognitive bias text is obtained: "Generate a pet dog that looks healthy, but actually had abnormal reactions."
[0077] Concept drift perturbation actions include gradual replacement of core concepts and topic shift guidance. For example, the original prompt text is "Generate an image of a healthy pet dog". By perturbing the original prompt text with concept drift perturbation actions, a cognitive bias text is obtained: "Generate a healthy but wary pet dog".
[0078] Positive and negative misleading perturbations include implying opposite premises and implanting contradictory information. For example, the original prompt text is "Generate an image of a healthy pet dog." By perturbing the original prompt text with positive and negative misleading perturbations, a cognitive bias text is obtained: "Generate a docile pet dog that does not actively attack and will exhibit stress response when stimulated."
[0079] In one specific embodiment, one or more cognitive bias perturbation actions are randomly selected from multiple different cognitive bias perturbation actions as target perturbation actions, and the original prompt text is perturbed based on the target perturbation action to obtain cognitive bias text.
[0080] In another specific embodiment, multiple different cognitive bias perturbation actions are placed into a perturbation action set. The perturbation action set is divided into a historical action set and an unused action set. The historical action set includes cognitive bias perturbation actions used during the attack, and the unused action set includes cognitive bias perturbation actions not used during the attack. A random value is generated. Specifically, the range of the random value p is (0,1). A random value p is randomly generated within the range (0,1). It is determined whether the random value is less than a preset exploration rate ε. If the random value is less than the preset exploration rate, a cognitive bias perturbation action is randomly selected from the historical action set as the target perturbation action. The target perturbation action can be selected based on the selection probability of each cognitive bias perturbation action in the historical action set. If the random value is not less than the preset exploration rate, a cognitive bias perturbation action is randomly selected from the unused action set as the target perturbation action. The target perturbation action can be selected based on the selection probability of each cognitive bias perturbation action in the unused action set.
[0081] The preset exploration rate ε can be set according to specific circumstances; for example, the preset exploration rate ε is 0.8.
[0082] Furthermore, the preset exploration rate ε is determined based on the number of attacks. The number of attacks refers to the number of times the tested multimodal large model has been attacked. The larger the number of attacks t, the smaller the preset exploration rate ε. For example, the mapping relationship of the preset exploration rate ε is as follows: ε = 0.8 × 0.95^t.
[0083] Step 103: Extract key features from the cognitive bias text as text semantic nodes, and extract key features from the original image as image semantic nodes, to obtain multiple text semantic nodes and multiple image semantic nodes.
[0084] Multiple text semantic nodes include keywords, subjects, and actions. Specifically, models such as BERT are used to extract key features such as keywords, subjects, and actions from cognitively biased texts, which are then used as text semantic nodes.
[0085] For example, the cognitive bias text is: "Generate an image of a pet dog that looks docile but has been frightened." Multiple semantic nodes in the text can include: pet dog, docile, frightened.
[0086] Multiple text semantic nodes include key features such as target objects and scene elements. Specifically, models such as YOLOv8 are used to extract target objects and scene elements from cognitively biased text, which are then used as image semantic nodes. Target objects can be areas such as the eyes or mouth. Scene elements can be areas such as grass or forests.
[0087] For example, multiple image semantic nodes can include: eye region, mouth region, grassland, forest.
[0088] Step 104: Construct a cross-modal heterogeneous semantic association graph based on multiple text semantic nodes and multiple image semantic nodes.
[0089] A knowledge graph is a semantic network that describes the objective world using a graph structure (composed of nodes and edges). Essentially, it is a knowledge base that describes concepts, entities, and their relationships, and it is a major manifestation of knowledge engineering in the field of artificial intelligence.
[0090] A cross-modal heterogeneous semantic association graph is a knowledge graph. Specifically, edges are created between text semantic nodes and image semantic nodes, between two text semantic nodes, and between two image semantic nodes. The cosine similarity between text semantic nodes and image semantic nodes is calculated, and then normalized using Softmax to obtain the normalized similarity between text semantic nodes and image semantic nodes. The higher the normalized similarity between text semantic nodes and image semantic nodes, the higher the correlation between them. The normalized similarity between text semantic nodes and image semantic nodes is used as the weight of the edges between them, thus obtaining the cross-modal heterogeneous semantic association graph.
[0091] Step 105: Process cross-modal heterogeneous semantic association graphs based on a preset graph neural network to generate text perturbation optimization signals and image perturbation optimization signals.
[0092] Graph Neural Network (GNN) is an algorithmic framework based on deep learning for processing graph-structured data. It performs tasks such as classification, prediction, and generation by extracting features from nodes, edges, and the graph as a whole.
[0093] In this embodiment, a cross-modal heterogeneous semantic association graph is processed based on a preset graph neural network to capture cross-modal high-order interaction relationships and output text perturbation optimization signals and image perturbation optimization signals.
[0094] The text perturbation optimization signal includes perturbation nodes and node perturbation actions, where the perturbation actions can be either strengthening or weakening. For example, the text perturbation optimization signal could strengthen perturbation nodes such as "startled" and "defense".
[0095] The image perturbation optimization signal includes the perturbation visual region, the region perturbation action, and the perturbation action intensity. The region perturbation action can be reducing brightness, adding pixel-level perturbations, etc., while the perturbation action intensity can be the brightness amplitude, the size of the pixel-level perturbation area, etc. For example, the image perturbation optimization signal could add pixel-level perturbations to the oral cavity region and reduce the brightness of the eye region.
[0096] Step 106: Convert the cognitive bias text into a continuous embedding vector, iteratively perturb the continuous embedding vector based on the text perturbation optimization signal to obtain the target embedding vector, and generate adversarial prompt text based on the target embedding vector.
[0097] Among these methods, cognitive biased text can be converted into continuous embedding vectors using models such as BERT.
[0098] Based on the text perturbation optimization of the signal perturbation continuous embedding vector, an initial perturbation embedding vector is obtained. It is then determined whether the initial perturbation embedding vector meets the preset perturbation target. If the initial perturbation embedding vector meets the preset perturbation target, it is determined as the target embedding vector. If the initial perturbation embedding vector does not meet the preset perturbation target, the text perturbation optimization of the signal perturbation continuous embedding vector is repeated to obtain an updated perturbation embedding vector. When the updated perturbation embedding vector meets the preset perturbation target, the perturbation embedding vector of the preset perturbation target is determined as the target embedding vector.
[0099] The preset perturbation target can be set according to specific circumstances. For example, the preset perturbation target is that the similarity between the perturbation embedding vector and the target generated content is less than a preset similarity. The preset similarity can be 85%, which can be set according to specific circumstances. For example, the target generated content is "generate an aggressive dog", and the target generated content is specified manually.
[0100] Furthermore, adversarial cue text is generated based on the target embedding vector, including:
[0101] (1) Generate multiple candidate prompt texts based on the target embedding vector.
[0102] In this embodiment, the target embedding vector includes multiple text word vectors. A first preset number of text word vectors are randomly selected from the target embedding vector. This first preset number is less than the total number of text word vectors in the target embedding vector; for example, the first preset number is 10 or 15, depending on the specific situation. For each text word vector, a second preset number of word vectors with cosine similarity to the text word vector, ranked from high to low, are obtained from a preset pre-trained model vocabulary as candidate word vectors. This results in a second preset number of candidate word vectors corresponding to each text word vector; for example, the first preset number is 3 or 5, depending on the specific situation. For each text word vector, one candidate word vector is randomly selected from the second preset number of candidate word vectors to replace the text word vector in the target embedding vector, resulting in a replaced embedding vector. Through multiple replacements, multiple replaced embedding vectors are obtained, leading to candidate prompt text corresponding to these multiple replaced embedding vectors.
[0103] (2) Based on the pre-trained grammar model, perform grammar scoring on each candidate prompt text to obtain the grammar score of each candidate prompt text.
[0104] Pre-trained grammar models can be built based on pre-trained large language models (such as GPT-2). Each candidate suggestion text is input into the pre-trained grammar model, and a grammar score is calculated to obtain the grammar score for each candidate suggestion text. A higher grammar score indicates a more coherent candidate suggestion text and a higher grammatical accuracy.
[0105] (3) The candidate prompt text with the highest grammar score is determined as the adversarial prompt text.
[0106] Step 107: Based on the image perturbation optimization signal, add perturbation to the original image to obtain a perturbed image.
[0107] In this embodiment of the application, the perturbation visual region, the region perturbation action, and the perturbation action intensity are determined from the image perturbation optimization signal; in the perturbation visual region on the original image, a region perturbation action with perturbation action intensity is performed to obtain a perturbation image.
[0108] For example, the image perturbation optimization signal adds pixel-level perturbation to the oral cavity region and reduces the brightness of the eye region by a preset brightness, for example, a preset brightness of 2. In the perturbation visual region of the original image, a regional perturbation action with varying intensity is performed to obtain a perturbed image.
[0109] Step 108: Input the adversarial prompt text and perturbation image into the tested multimodal large model to obtain the target image generated by the tested multimodal large model.
[0110] Among them, the tested multimodal large model is a multimodal large model. For example, the tested multimodal large model is the LLaMA-2-7B-Chat model. Of course, the tested multimodal large model can also be other models.
[0111] Step 109: Determine the attack result based on the semantic deviation between the target image and the original prompt text.
[0112] The attack result is either a successful attack or a failed attack.
[0113] In this embodiment, both the target image and the original prompt text are converted into vectors, and vector similarity is calculated. The semantic deviation is then determined based on the vector similarity. Specifically, the sum of the semantic deviation and the vector similarity is set to 1, and the vector similarity can be cosine similarity.
[0114] In one specific embodiment, if the semantic deviation is greater than a preset deviation, the attack result is determined to be successful; if the semantic deviation is not greater than the preset deviation, the attack result is determined to be unsuccessful. For example, the preset deviation is 0.5, which can be set according to specific circumstances.
[0115] Furthermore, a negative detection model is used to detect the negative probability of the target image. This negative detection model can be the BERT model, or more specific, depending on the situation. The BERT model is fine-tuned using publicly available malicious hint datasets (such as AdvBench and RealToxicityPrompts) to obtain the negative detection model. This model outputs the negative probability of the target image. For example, the negative probability can be the malicious probability.
[0116] If the semantic deviation is not greater than a preset deviation, the target image is input into the negative detection model to obtain the malicious probability of the target image. It is then determined whether the malicious probability of the target image is greater than a preset probability value, which can be determined based on specific circumstances; for example, a preset probability value of 0.7. If the malicious probability of the target image is greater than the preset probability value, the attack is considered successful; if the malicious probability of the target image is not greater than the preset probability value, the attack is considered unsuccessful.
[0117] Step 110: If the attack is successful, stop the attack and output the attack result and target image.
[0118] If the attack is successful, stop the attack and output the attack result and target image.
[0119] If the attack fails, the target perturbation action is updated iteratively to update the target image, attack result, and number of attacks. When the updated attack result is successful or the number of attacks reaches a preset number, the attack is stopped and the attack result is output.
[0120] Specifically, if the attack fails, a new target perturbation action is selected from multiple different cognitive bias perturbation actions, and the target perturbation action is updated to iteratively update the target image, attack result, and number of attacks. When the updated attack result is a successful attack or the number of attacks reaches a preset number, the attack stops and the attack result is output.
[0121] The preset number of times can be 100 times, 1000 times, etc., depending on your specific needs.
[0122] This application has the following beneficial effects:
[0123] High stealth: It utilizes cognitive biases to achieve low-perturbation-strength attacks and evade detection;
[0124] Black-box application: Does not overly rely on model gradients, but uses semantic association graph generalization attacks;
[0125] Strong attack capability: Excellent semantic consistency between text and images can enhance the attack space;
[0126] Systemic vulnerability discovery: It can construct complex attack tasks and adapt to other attack scenarios and different cross-modal data.
[0127] The attack algorithm proposed in this invention can effectively guide large models to generate harmful content, thereby achieving the goal of cross-modal adversarial testing. Compared with traditional unimodal attacks, cross-modal structural attacks can significantly reduce the consistency of models in text and image semantic matching. With the aid of cognitive bias-guided prompt generation, the optimized prompts maintain high naturalness and imperceptibility, making them difficult for defense systems or humans to detect, and can be generalized to different models. In summary, the cognitive bias-driven multimodal semantic consistency attack method has a more covert and transferable attack effect, providing a new evaluation method for the security testing of large multimodal models, helping to discover the vulnerability of models to semantic understanding biases, and promoting the development of research on model alignment and robustness analysis.
[0128] Compared to existing technologies, in this application embodiment, the following steps are taken: First, the original prompt text and original image are obtained. Then, a target perturbation action is selected from multiple different cognitive bias perturbation actions, and the original prompt text is perturbed based on the target perturbation action to obtain cognitive bias text. Next, key features are extracted from the cognitive bias text as text semantic nodes, and key features are extracted from the original image as image semantic nodes, resulting in multiple text semantic nodes and multiple image semantic nodes. Finally, a cross-modal heterogeneous semantic association graph is constructed based on the multiple text semantic nodes and multiple image semantic nodes. The cross-modal heterogeneous semantic association graph is processed using a preset graph neural network to generate a text perturbation optimization signal and an image. The process involves: optimizing the perturbation signal; converting the cognitively biased text into a continuous embedding vector; iteratively perturbing the continuous embedding vector based on the text perturbation optimization signal to obtain the target embedding vector; generating adversarial prompt text based on the target embedding vector; adding perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image; inputting the adversarial prompt text and the perturbed image into the tested multimodal large model to obtain the target image generated by the tested multimodal large model; determining the attack result based on the semantic deviation between the target image and the original prompt text, where the attack result is either a successful attack or a failed attack; if the attack result is a successful attack, stopping the attack and outputting the attack result and the target image. This application uses multiple cognitive topology probe agents with different cognitive dimensions as attack agents, and constructs a multi-agent reinforcement learning system with a negative detection model. The multi-agent reinforcement learning system is used to attack the tested multimodal large model, and the cause analysis information of the vulnerability is determined based on the response information of the tested multimodal large model. It can attack the tested multimodal large model from multiple dimensions, thereby improving test coverage, triggering deep and implicit cognitive vulnerabilities in the model, and performing in-depth cause analysis, thereby improving the accuracy of attack testing.
[0129] See Figure 4 ,like Figure 4The diagram shows a structural schematic of a multimodal semantic consistency attack testing device. The multimodal semantic consistency attack testing device in this embodiment can achieve the above-mentioned... Figure 2 The steps of the multimodal semantic consistency attack testing method executed in the corresponding embodiments are described below. The functions implemented by the multimodal semantic consistency attack testing device can be implemented in hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions; the modules can be software and / or hardware. The multimodal semantic consistency attack testing device 60 may include an acquisition module 601, a selection module 602, an extraction module 603, a construction module 604, a processing module 605, a text perturbation module 606, an image perturbation module 607, a generation module 608, a determination module 609, and an output module 610. The functional implementation of the multimodal semantic consistency attack testing device 60 can be found in [reference needed]. Figure 2 The operations performed in the corresponding embodiments will not be described in detail here.
[0130] In one embodiment, the multimodal semantic consistency attack testing device 60 includes:
[0131] The acquisition module 601 is configured to acquire the original prompt text and the original image;
[0132] The selection module 602 is configured to select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain cognitive bias text;
[0133] Extraction module 603 is configured to extract key features from the cognitive bias text as text semantic nodes and extract key features from the original image as image semantic nodes, thereby obtaining multiple text semantic nodes and multiple image semantic nodes;
[0134] Construction module 604 is configured to construct a cross-modal heterogeneous semantic association graph based on multiple text semantic nodes and multiple image semantic nodes;
[0135] Processing module 605 is configured to process the cross-modal heterogeneous semantic association graph based on a preset graph neural network to generate text perturbation optimization signal and image perturbation optimization signal;
[0136] The text perturbation module 606 is configured to convert the cognitive bias text into a continuous embedding vector, iteratively perturb the continuous embedding vector based on the text perturbation optimization signal to obtain a target embedding vector, and generate adversarial prompt text based on the target embedding vector;
[0137] The image perturbation module 607 is configured to add perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image;
[0138] The generation module 608 is configured to input the adversarial prompt text and the perturbation image into the tested multimodal large model to obtain the target image generated by the tested multimodal large model;
[0139] The determination module 609 is configured to determine the attack result based on the semantic deviation between the target image and the original prompt text, wherein the attack result is either a successful attack or a failed attack.
[0140] The output module 610 is configured to stop the attack and output the attack result and the target image if the attack result is successful.
[0141] The multimodal semantic consistency attack testing device 60 in this application embodiment has been described above from the perspective of modular functional entities. The multimodal semantic consistency attack testing device in this application embodiment is described below from the perspective of hardware processing.
[0142] Figure 4 The devices shown can all have the following characteristics: Figure 5 The structure shown, when Figure 4 The multimodal semantic consistency attack testing device 60 shown has the following characteristics: Figure 5 When the structure shown is used, Figure 5 The processor and transceiver in the device can perform the same or similar functions as the modules provided in the aforementioned device embodiments. Figure 5 The memory storage processor in the memory needs to call the computer program when executing the above multimodal semantic consistency attack test method.
[0143] This application also provides a terminal device, such as... Figure 6 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The terminal device can be any terminal device including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) terminals, in-vehicle computers, etc. Taking a mobile phone as an example:
[0144] Figure 6 This diagram illustrates a partial structure of a mobile phone related to the terminal device provided in the embodiments of this application. (Reference) Figure 6The mobile phone includes components such as a radio frequency (RF) circuit 1010, a memory 1020, an input unit 1030, a display unit 1040, a sensor 1050, an audio circuit 1060, a wireless fidelity (WiFi) module 1070, a processor 1080, and a power supply 1090. Those skilled in the art will understand that... Figure 6 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0145] The following is combined with Figure 6 A detailed introduction to each component of a mobile phone:
[0146] The RF circuit 1010 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 1080; additionally, it transmits uplink data to the base station. Typically, the RF circuit 1010 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 1010 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0147] The memory 1020 can be used to store software programs and modules. The processor 1080 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 1020 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0148] The input unit 1030 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 1030 may include a touch panel 1031 and other input devices 1032. The touch panel 1031, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 1031), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 1031 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 1080, and can also receive and execute commands sent by the processor 1080. In addition, the touch panel 1031 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 1031, the input unit 1030 may also include other input devices 1032. Specifically, other input devices 1032 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0149] The display unit 1040 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 1040 may include a display panel 1041, which may optionally be configured as a liquid crystal display (LCD), organic light-emitting diode (OLED), or similar display. Further, a touch panel 1031 may cover the display panel 1041. When the touch panel 1031 detects a touch operation on or near it, it transmits the information to the processor 1080 to determine the type of touch event. Subsequently, the processor 1080 provides corresponding visual output on the display panel 1041 based on the type of touch event. Although in Figure 6 In this embodiment, the touch panel 1031 and the display panel 1041 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 1031 and the display panel 1041 can be integrated to realize the input and output functions of the mobile phone.
[0150] The mobile phone may also include at least one sensor 1050, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 1041 according to the ambient light level, and the proximity sensor can turn off the display panel 1041 and / or the backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0151] The audio circuit 1060, speaker 1061, and microphone 1062 provide an audio interface between the user and the mobile phone. The audio circuit 1060 converts the received audio data into electrical signals and transmits them to the speaker 1061, where the speaker 1061 converts them into sound signals for output. On the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are then received by the audio circuit 1060, converted into audio data, and then processed by the processor 1080 before being transmitted via the RF circuit 1010 to, for example, another mobile phone, or the audio data can be output to the memory 1020 for further processing.
[0152] Wi-Fi is a short-range wireless transmission technology. Through the Wi-Fi module 1070, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 6 The Wi-Fi module 1070 is shown, but it is understood that it is not an essential component of a mobile phone and can be omitted as needed without changing the essence of the invention.
[0153] The processor 1080 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 1020 and calls data stored in the memory 1020 to perform various functions and process data, thereby providing overall monitoring of the phone. Optionally, the processor 1080 may include one or more processing units; optionally, the processor 1080 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the aforementioned modem processor may also not be integrated into the processor 1080.
[0154] The mobile phone also includes a power supply 1090 (such as a battery) that supplies power to various components. Optionally, the power supply can be logically connected to the processor 1080 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0155] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0156] In this embodiment of the application, the processor 1080 included in the mobile phone also has the function of controlling the execution of the multimodal semantic consistency attack test method flow executed by the multimodal semantic consistency attack test device.
[0157] This application also provides a server; please refer to [link / reference]. Figure 7 , Figure 7This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1100 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1122 (e.g., one or more processors) and memory 1132, and one or more storage media 1130 (e.g., one or more mass storage devices) for storing application programs 1142 or data 1144. The memory 1132 and storage media 1130 may be temporary or persistent storage. The program stored in the storage media 1130 may include one or more modules (not shown in the figure), each module may include a series of instruction operations on the server. Furthermore, the CPU 1122 may be configured to communicate with the storage media 1130 and execute the series of instruction operations in the storage media 1130 on the server 1100.
[0158] Server 1100 may also include one or more power supplies 1126, one or more wired or wireless network interfaces 1150, one or more input / output interfaces 1158, and / or one or more operating systems 1141, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0159] The steps performed by the server in the above embodiments can be based on this Figure 7 The structure of server 1100 is shown. For example, central processing unit 1122 performs the following operations by calling instructions in memory 1132:
[0160] Obtain the original prompt text and original image; select a target perturbation action from multiple different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain cognitive bias text; extract key features from the cognitive bias text as text semantic nodes, and extract key features from the original image as image semantic nodes to obtain multiple text semantic nodes and multiple image semantic nodes; construct a cross-modal heterogeneous semantic association graph based on multiple text semantic nodes and multiple image semantic nodes; process the cross-modal heterogeneous semantic association graph based on a preset graph neural network to generate text perturbation optimization signals and image perturbation optimization signals; and then... Cognitive bias text is converted into continuous embedding vectors. The continuous embedding vectors are iteratively perturbed based on the text perturbation optimization signal to obtain the target embedding vector, and adversarial prompt text is generated based on the target embedding vector. Perturbation is added to the original image based on the image perturbation optimization signal to obtain a perturbed image. The adversarial prompt text and the perturbed image are input into the tested multimodal large model to obtain the target image generated by the tested multimodal large model. The attack result is determined based on the semantic deviation between the target image and the original prompt text, where the attack result is either successful or unsuccessful. If the attack result is successful, the attack is stopped and the attack result and the target image are output.
[0161] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0162] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0163] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between apparatuses or modules, and may be electrical, mechanical, or other forms.
[0164] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0165] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0166] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various alternative implementations described above.
[0167] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0168] A computer program product includes one or more computer instructions. When a computer program is loaded and executed on a computer, it produces, in whole or in part, the flow or function according to the embodiments of this application. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, computer instructions may be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0169] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.
Claims
1. A multi-modal semantic consistency attack testing method, characterized in that, The multi-modal semantic consistency attack test method comprises: obtaining an original prompt text and an original image; selecting a target disturbance action from a plurality of different cognitive bias disturbance actions, and disturbing the original prompt text based on the target disturbance action to obtain a cognitive bias text; extracting key features from the cognitive bias text as text semantic nodes and extracting key features from the original image as image semantic nodes to obtain a plurality of text semantic nodes and a plurality of image semantic nodes; constructing a cross-modal heterogeneous semantic association graph based on the plurality of text semantic nodes and the plurality of image semantic nodes; processing the cross-modal heterogeneous semantic association graph based on a preset graph neural network to generate a text disturbance optimization signal and an image disturbance optimization signal; converting the cognitive bias text into a continuous embedding vector, iteratively disturbing the continuous embedding vector based on the text disturbance optimization signal to obtain a target embedding vector, and generating an adversarial prompt text based on the target embedding vector; adding disturbance to the original image based on the image disturbance optimization signal to obtain a disturbed image; inputting the adversarial prompt text and the disturbed image into a tested multi-modal large model to obtain a target image generated by the tested multi-modal large model; determining an attack result based on the semantic deviation of the target image and the original prompt text, wherein the attack result is attack success or attack failure; if the attack result is attack success, stop the attack and output the attack result and the target image.
2. The multi-modal semantic consistency attack testing method of claim 1, wherein, The determination of the attack result based on the semantic deviation of the target image and the original prompt text comprises: calculating the semantic deviation between the target image and the original prompt text; when the semantic deviation is greater than a preset deviation, determining that the attack result is attack success; when the semantic deviation is not greater than the preset deviation, determining that the attack result is attack failure.
3. The multi-modal semantic consistency attack testing method of claim 1, wherein, The multi-modal semantic consistency attack test method comprises: if the attack result is attack failure, iteratively updating the target disturbance action to iteratively update the target image, the attack result, and the number of attacks; when the updated attack result is attack success or the number of attacks reaches a preset number, stop the attack and output the attack result.
4. The multi-modal semantic consistency attack testing method of claim 1, wherein, A plurality of different cognitive bias disturbance actions include at least two of semantic ambiguity disturbance actions, concept drift disturbance actions, and positive and negative misleading disturbance actions.
5. The multi-modal semantic consistency attack testing method of claim 1, wherein, The adding of disturbance to the original image based on the image disturbance optimization signal to obtain a disturbed image comprises: determining a disturbance visual area, a region disturbance action, and a disturbance action intensity from the image disturbance optimization signal; performing the region disturbance action with the disturbance action intensity in the disturbance visual area on the original image to obtain the disturbed image.
6. The multi-modal semantic consistency attack testing method of claim 1, wherein, The generation of an adversarial prompt text based on the target embedding vector comprises: generating a plurality of candidate prompt texts based on the target embedding vector; performing grammar scoring on each candidate prompt text based on a pre-trained grammar model to obtain a grammar score of each candidate prompt text; determine the candidate prompt text with the highest grammar score as the adversarial prompt text.
7. A multi-modal semantic consistency attack testing apparatus characterized by, The multi-modal semantic consistency attack testing device comprises: An acquisition module configured to acquire an original prompt text and an original image; A selection module configured to select a target perturbation action from a plurality of different cognitive bias perturbation actions, and perturb the original prompt text based on the target perturbation action to obtain a cognitive bias text; An extraction module configured to extract key features from the cognitive bias text as text semantic nodes, and extract key features from the original image as image semantic nodes, to obtain a plurality of text semantic nodes and a plurality of image semantic nodes; A construction module configured to construct a cross-modal heterogeneous semantic correlation graph based on the plurality of text semantic nodes and the plurality of image semantic nodes; A processing module configured to process the cross-modal heterogeneous semantic correlation graph based on a preset graph neural network to generate a text perturbation optimization signal and an image perturbation optimization signal; A text perturbation module configured to convert the cognitive bias text into a continuous embedding vector, iteratively perturb the continuous embedding vector based on the text perturbation optimization signal to obtain a target embedding vector, and generate an adversarial prompt text based on the target embedding vector; An image perturbation module configured to add perturbation to the original image based on the image perturbation optimization signal to obtain a perturbed image; A generation module configured to input the adversarial prompt text and the perturbed image into a tested multi-modal large model to obtain a target image generated by the tested multi-modal large model; A determination module configured to determine an attack result based on a semantic deviation of the target image and the original prompt text, wherein the attack result is attack success or attack failure; An output module configured to stop the attack and output the attack result and the target image if the attack result is attack success.
8. A computing device, comprising: It includes a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1-6 when executing the computer program.
9. A computer-readable storage medium, characterized in that, It includes instructions that, when executed on a computer, cause the computer to perform the method of any one of claims 1-6.
10. A computer program product comprising instructions which, when executed on a computer or processor, cause the computer or processor to perform the method of any one of claims 1-6.
10. A computer program product comprising instructions which, when executed on a computer or processor, cause the computer or processor to perform the method of any one of claims 1-6.
Citation Information
Patent Citations
Attack resisting method, related device and storage medium
CN118709743A
Multi-modal large model confrontation safety detection method and system
CN120639526A