Visual language large model illusion relieving method based on attention hijacking detection
The method addresses the limitations of existing hallucination mitigation methods by identifying and isolating attention hijackers in vision-language models, effectively reducing hallucinations and improving contextual integration.
Patent Information
- Application Number
- CN202510407689.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2025-07-15
AI Technical Summary
The existing visual semantics model has hallucinations between generating text output and visual input. The existing mitigation methods are expensive or ignore the impact of visual interaction, making it difficult to effectively solve the hallucination problem.
By identifying and blocking attention hijackers in the visual language model, analyzing the interference of command markers on visual attention, using attention hijacking detection method, cutting off the interaction between the hijacker and the visual area, and restoring the model's context perception ability.
Significantly reduce hallucinations and improve the accuracy and effectiveness of visual language models in image retrieval, subtitle generation, and multimodal tasks, especially in complex tasks.
Smart Images

Figure CN120317283A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vision - language large models, and more specifically, relates to a method for alleviating hallucinations in vision - language large models based on attention hijacking detection. Background Art
[0002] The hallucination problem is still a major challenge faced by vision - semantic large models. This problem occurs when there is a difference between the text output generated by the model and the actual visual input, which may manifest as irrelevant or absurd answers, or errors in aspects such as color, quantity, and object position. Existing methods for alleviating the hallucination problem can be divided into two categories. One category relies on supervised fine - tuning, but this method requires creating a high - quality dataset and involves high training costs. The other category attempts to enhance the interaction between the model in image tagging and text, but ignores the visual impact of instruction tags in the decoding process of vision - semantic large models. These problems limit the effectiveness of these methods in alleviating hallucinations. Summary of the Invention
[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method for alleviating hallucinations in vision - language large models based on attention hijacking detection. By identifying instruction tags that continuously distort the visual perception of vision - language large models during the decoding process and masking their visual attention, the interference of these tags on visually weaker regions can be isolated, the context - aware attention ability of the model can be restored, and the occurrence of hallucinations can be reduced.
[0004] To achieve the above - mentioned invention purpose, the method for alleviating hallucinations in vision - language large models based on attention hijacking detection of the present invention includes the following steps:
[0005] S1: Select the first L attention layers from the autoregressive language decoder of the vision - language large model as the target attention layers according to actual needs;
[0006] S2: The i - th layer of the target attention layer processes the received image tags, instruction tags, and generated tags using the attention mechanism. According to the calculated attention weights between the tags, new image tags, instruction tags, and generated tags are generated. Denote the visual information of each image tag t obtained by the i - th layer of the target attention layer as Vis i (t), t ∈ T i , T i represents the set of image tags of the i - th layer; Denote the visual information of each instruction tag s as Ins i (s), s ∈ S i , S i represents the set of instruction tags of the i - th layer; Denote the amount of visual information passed from each instruction tag s to each generated tag d as d ∈ D i , Di Denote the set of generated tokens for the $i$-th layer, where $i = 0, 1, \ldots, L$;
[0007] S3: For each target attention layer, calculate the hijacker evaluation score for each instruction token $s$ using the following formula
[0008]
[0009] S4: For each target attention layer, sort the $|S|$ instruction tokens in descending order according to the hijacking evaluation score, where $| |$ represents the number of individuals in the set, and select the top $K$ instruction tokens as attention hijackers to form the attention hijacker set $H$ of the $i$-th layer target attention layer i The value of $K$ is set according to actual needs; i
[0010] S6: For each instruction token in the attention hijacker set $H$ i Set the instruction token received by the $i$-th layer target attention layer to 0, then re - process the received image tokens, instruction tokens, and generated tokens using the attention mechanism, re - generate image tokens, instruction tokens, and generated tokens, and calculate the visual information of the instruction token for which attention is detached according to the following formula
[0011]
[0012] where, represents the visual attention weight of the re - generated instruction token $s'$ to the instruction token represents the set of instruction tokens that interact with itself with the instruction token in the $i$-th layer;
[0013] Then update the visual information of each instruction token The hallucination mitigation ends, and continue with subsequent operations.
[0014] The method for mitigating hallucinations in a vision - language large model based on attention hijacking detection selects target attention layers from the autoregressive language decoder of the vision - language large model according to actual needs. During the processing of each target attention layer, calculate the hijacker evaluation score for each instruction token based on the amount of visual information passed from each instruction token to each generated token, select the instruction tokens with higher hijacker evaluation scores as attention hijackers to form an attention hijacker set, and then perform attention detachment processing to achieve hallucination mitigation.
[0015] The present invention has the following beneficial effects:
[0016] 1) By analyzing that hallucinations stem from the interference interaction with certain instruction tokens (i.e., attention hijackers) and deeply analyzing how these hijackers interfere with the visual attention of the model, the present invention provides a new method for analyzing the hallucination problem of visual language models;
[0017] 2) By locating potential attention hijackers and then deconstructing the hijacked attention by cutting off the visual sources related to the attention hijackers, the present invention significantly reduces the hallucination phenomenon of large visual language models. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flowchart of a specific implementation manner of the method for alleviating hallucinations of a large visual language model based on attention hijacking detection according to the present invention;
[0019] Figure 2 is an example diagram of attention hijacker detection in this embodiment;
[0020] Figure 3 is an example diagram of the optimization of the attention hijacker set in this embodiment;
[0021] Figure 4 is a comparison diagram of the evaluation results of the present invention and the comparative method on the general benchmark MMBench in Embodiment 2. DETAILED DESCRIPTION OF THE INVENTION
[0022] The following describes the specific implementation manner of the present invention with reference to the accompanying drawings so that those skilled in the art can better understand the present invention. It should be particularly noted that in the following description, when the detailed description of known functions and designs may dilute the main content of the present invention, these descriptions will be omitted here.
[0023] To better illustrate the technical solution of the present invention, the technical principle of the present invention will be briefly described first.
[0024] Large visual language models generally include a visual encoder, an embedding projector for aligning visual and language representations, and an autoregressive language decoder, where there are several stacked attention layers in the autoregressive language decoder. In the attention layer, each attention head performs repeated attention operations with the same input shape, and the output can be expressed as:
[0025] O h =A h V h
[0026]
[0027] Each attention head h uses its own query Key Sum value where n represents the sequence length, and d k represents the hidden dimension. The output is obtained by multiplying the value by the attention weights The attention weights A h Each row in represents the weight of each token in the feature mixing process.
[0028] During the autoregressive process, the generated tokens are affected by the previous instruction tokens, and this influence is strengthened through the key-value cache, which saves and reuses past attention patterns. Some instruction tokens continuously distort the visual perception of the vision-language large model during the decoding process, hijack its visual attention, making it focus on less discriminative visual regions, preventing the model from integrating broader context information from the image, and ultimately leading to the phenomenon of hallucination. This phenomenon is called "attention hijacking", and the instruction tokens with interfering effects are called "attention hijackers".
[0029] For the above reasons, the present invention first detects attention hijackers by calculating the instruction-driven visual information volume in all tokens. This process includes two integrated stages: self-interaction of image tokens and cross-interaction between images and instruction tokens; followed by an attention-based information aggregation stage, that is, calculating the information volume of visual information transmitted to the generated tokens, and finally detecting hijackers.
[0030] Based on the above analysis, the present invention proposes a method for alleviating hallucination of a vision-language large model based on attention hijacking detection. Figure 1 is a flowchart of a specific implementation manner of the method for alleviating hallucination of a vision-language large model based on attention hijacking detection according to the present invention. As Figure 1 shown, the specific steps of the method for alleviating hallucination of a vision-language large model based on attention hijacking detection according to the present invention include:
[0031] S101: Determine the target attention layer:
[0032] Select the first L attention layers from the autoregressive language decoder of the vision-language large model as the target attention layer according to actual needs.
[0033] S102: Preliminary inference of the attention mechanism:
[0034] Each layer of the target attention layer processes the received image tokens, instruction tokens, and generated tokens respectively using the attention mechanism. According to the calculated attention weights between the tokens, new image tokens, instruction tokens, and generated tokens are generated. Denote the visual information of each image token t obtained by the i-th layer of the target attention layer as Vis i (t), t ∈ T i, T i represents the set of image tags for the i-th layer; denote the visual information of each obtained instruction tag s as Ins i (s), s ∈ S i , S i represents the set of instruction tags for the i-th layer; denote the amount of visual information passed from each instruction tag s to each generated tag d as d ∈ D i , D i represents the set of generated tags for the i-th layer, i = 0, 1, …, L.
[0035] In this embodiment, the visual information of each image tag is Vis i (t) based on the self-interaction calculation of the image tag. The self-interaction of the image tag will reallocate the visual attention of the visual language model, so that subsequent tags carry more visual information than early tags and provide different degrees of visual information for hijackers. The visual information of each image tag calculated based on the self-interaction of the image tag in this implementation is as follows:
[0036]
[0037] where Vis i (t) represents the visual information of image tag t in the i-th layer, and Vis i-1 (t′) represents the visual information of image tag t′ in the i - 1-th layer, t′ ∈ T t i , T t i represents the set of image tags that perform self-interaction with image tag t in the i-th layer. In practical applications, the set of image tags T can be determined by the attention weight index related to the self-interaction with image tag t t i , in this embodiment T t i = {1, 2, …, t}, represents the attention weight of image tag t′ to image tag t in the i-th layer.
[0038] In this embodiment, the visual information of the 0-th layer is initialized to be the same for all image tags, so that it can evolve during subsequent interaction processes.
[0039] In the cross-interaction between image tags and instruction tags, visual information will be integrated into the instruction tags. Therefore, the visual information of the instruction tags can come directly from the image or indirectly from previous instruction tags. Therefore, the following formula is used in the present invention to calculate the visual information of each instruction tag:
[0040]
[0041] Among them, Ins i (s) represents the visual information of instruction marker s at the i-th layer, represents the attention weight of image marker t to instruction marker s, Vis i-1 (s′) represents the visual information of instruction marker s′ at the (i - 1)-th layer, represents the set of instruction markers that perform self-interaction with instruction marker s in the i-th layer. Similarly, the set of instruction markers can be determined through the attention weight index related to the self-interaction of instruction marker s In this embodiment represents the attention weight of instruction marker s′ to instruction marker s.
[0042] In this embodiment, at the 0-th layer, the visual information of all instruction markers is initialized to 0 because these markers come from user prompts and lack visual modality data. In subsequent layers, each instruction marker directly integrates visual information from image markers and indirectly from instruction markers that have absorbed visual information in the previous layer.
[0043] In the present invention, attention hijackers in instruction markers are detected according to the amount of visual information passed from each instruction marker to the generated marker. In this embodiment, the amount of visual information passed from instruction markers to the generated marker mainly comes from instruction markers and the markers generated in the previous step. The calculation formula is as follows:
[0044]
[0045] Among them, represents the attention weight of instruction marker s to generated marker d in the i-th layer, represents the attention weight of generated marker d′ to generated marker d in the i-th layer, represents the set of generated markers that perform self-interaction with generated marker d in the i-th layer. Similarly, the set of generated markers can be determined through the attention weight index related to the self-interaction of generated marker d In this embodiment represents the amount of visual information passed from instruction marker s to generated marker d′ in the i-th layer, represents the attention weight of generated marker d to itself in the i-th layer, represents the amount of visual information passed from instruction marker s to generated marker d in the (i - 1)-th layer.
[0046] S103: Calculate the hijacker evaluation score:
[0047] For each target attention layer, the hijacker evaluation score of each instruction marker therein is calculated using the following formula
[0048]
[0049] S104: Detect attention hijackers:
[0050] For each target attention layer, arrange the |S i | instruction tokens in descending order according to the hijacking evaluation score where | | represents obtaining the number of individuals in the set, and select the top K instruction tokens as attention hijackers to form the attention hijacker set H of the i-th layer target attention layer i , and the value of K is set according to actual needs.
[0051] Figure 2 is an example diagram of attention hijacker detection in this embodiment. As Figure 2 shown, the input of this target attention layer in this embodiment includes 4 image tokens, 4 instruction tokens, and 2 generation tokens. Calculate the hijacker evaluation score of each generated instruction token, and select the one with the largest hijacker evaluation score as the attention hijacker.
[0052] After calculating the visual information amount transmitted by the instruction tokens and identifying the attention hijackers, it is necessary to release the model's visual attention from the hijacker tokens. However, widely masking instruction tokens, especially when these tokens provide context information necessary for comprehensive visual understanding, may inadvertently weaken the contribution of non-hijacking instruction tokens. Therefore, in this embodiment, the attention hijacker set H i is further optimized by comparing the attention instruction-driven visual saliency and the image-driven visual saliency before and after removing the attention hijackers, and selectively retaining the attention hijackers. That is, compare the visual impact of each instruction token (i.e., instruction-driven visual saliency) with the visual impact of the image token (i.e., image-driven visual saliency). Only when the impact of the instruction token decreases relative to the image token after removing the instruction token serving as the attention hijacker, the attention hijacker is retained. The specific method is as follows:
[0053] Use the following formula to calculate the visual information amount transmitted by all image tokens to each generation token
[0054]
[0055] where represents the attention weight of the image token t to the generation token d in the i-th layer,, represents the attention weight of the generation token d to itself in the i-th layer, Represents the visual information passed from all image tokens in the (i - 1)-th layer to the generated token d.
[0056] Then, for the set H of attention hijackers i each instruction token in it is separately subjected to an attention detachment test. The specific method is as follows: Set the instruction token received by the target attention layer in the i-th layer to 0, and then re-use the attention mechanism to process the received image tokens, instruction tokens, and generated tokens, re-calculate the attention weights between the tokens, and generate image tokens, instruction tokens, and generated tokens. Among them, the visual information of the instruction token with attention detachment is calculated using the following formula:
[0057]
[0058] Where represents the attention weight of the re-generated instruction token s′ to the instruction token , represents the set of instruction tokens that perform self-interaction with the instruction token in the i-th layer. In this embodiment
[0059] Then update the visual information of the instruction token
[0060] Denote the visual information of each image token obtained in the i-th layer after update as the visual information of each instruction token as the visual information passed from each instruction token to each generated token as At the same time, re-calculate the visual information passed from all image tokens to each generated token Then determine whether the following conditions are met:
[0061]
[0062] If it is met, retain the instruction token as an attention hijacker. Otherwise, delete the instruction token from the hijacker set H i .
[0063] Figure 3 is an example diagram of the optimization of the attention hijacker set in this embodiment. As Figure 3 shown, in this embodiment, by calculating the visual information passed from the instruction tokens and image tokens to the generated tokens before and after the attention hijacker detachment, the attention hijackers are further screened.
[0064] S105: Attention detachment:
[0065] To alleviate the hallucination phenomenon of the vision-language large model, attention detachment is required to remove the visual influence of hijacking tokens, that is, to cut off the interaction between tokens carrying image information that meet the conditions (including image tokens and instruction tokens without hijacking) and the hijackers, while ensuring that the remaining instruction tokens still receive image information. The specific method is as follows:
[0066] For each set of attention hijackers H i for each instruction token in and at the same time, for each instruction token received by the target attention layer of each layer set it to 0, then re - use the attention mechanism to process the received image tokens, instruction tokens, and generated tokens, and regenerate the image tokens, instruction tokens, and generated tokens. Among them, the visual information of the instruction tokens after attention detachment is calculated using the following formula:
[0067]
[0068] where represents the attention weight of the regenerated instruction token s′ to the instruction token ; represents the set of instruction tokens that perform self - interaction with the instruction token in the i - th layer. In this embodiment
[0069] Then update the visual information of each instruction token The hallucination alleviation ends, and continue with the subsequent operations.
[0070] To better illustrate the technical effects of the present invention, specific examples are used to conduct experimental verification on the present invention.
[0071] Example 1
[0072] In this example, the experimental conditions are set as follows: System: Ubuntu 20.04, Software: Python 3.10, Processor: Intel(R)Xeon(R)Gold 5220R CPU@2.20GHz×2, Memory: 512GB.
[0073] To more accurately evaluate the effectiveness of the present invention in the image retrieval task, a large number of experiments are conducted in this embodiment on three professional hallucination benchmark tests, namely, Polling-based Object Probing Evaluation (POPE), Caption Hallucination Evaluation with Image Relevance (CHAIR), and Evaluation of Multimodal Large Model Subsets (MME). In this embodiment, the hallucination mitigation method of the present invention (denoted as AID) is integrated into two well-known vision-language large models: LLaVA-1.5 and Qwen-VL, and the present invention is compared with several current state-of-the-art methods. The comparison methods include:
[0074] VCD, for details, see the literature "Sicong Leng, Hang Zhang, Guanzheng Chen, Xin Li, Shi-591jian Lu, Chunyan Miao, and Lidong Bing. Mitigating object 592 hallucinations in large vision-language models through vi-593 sual contrastive decoding. arXiv preprint arXiv:2311.16922,594 2023.6,7,8";
[0075] OPERA, for details, see the literature "Qidong Huang, Xiaoyi Dong, Pan Zhang, Bin Wang, Con-567 ghui He, Jiaqi Wang, Dahua Lin, Weiming Zhang, and 568 Nenghai Yu. Opera: Alleviating hallucination in multi-569 modal large language models via over-trust penalty and 570 retrospection-allocation. arXiv preprint arXiv:2311.17911,571 2023.6,7,8";
[0076] Table 1 is a comparison table of the present invention and the comparison methods in Example 1 based on the POPE evaluation on three datasets: MSCOCO, A-OKVQA, and GQA.
[0077]
[0078] Table 1
[0079] As shown in Table 1, the present invention has achieved consistent improvements on three datasets. Among them, the accuracy of the A-OKVQA dataset has increased by an average of +7.6%, and the F1 score has increased by +7.5%, verifying the effectiveness of the model.
[0080] Table 2 is a comparison table of the present invention and the comparative method in Example 1 based on the CHAIR hallucination evaluation.
[0081] Method Length <![CDATA[CHAIR S > <![CDATA[CHAIR I > Recall LLaVA-1.5 100.6 50.0 15.4 77.1 +VCD 100.4 48.6 14.9 77.3 +OPERA 98.6 47.8 14.6 76.8 +This invention 99.5 41.8 13.0 77.1
[0082] Table 2
[0083] As shown in Table 2, the present invention has achieved significant improvements in the CHAIR evaluation. Compared with the basic version LLaVA-1.5-7B, the accuracy on the CHAIR I has increased by up to 8.2%.
[0084] Table 3 is a comparison table of the present invention and the comparative method in Example 1 based on the hallucination evaluation of the MME subset.
[0085]
[0086] Table 3
[0087] As shown in Table 3, the present invention has shown continuous enhancement in dealing with object-level and attribute-level hallucinations, as well as common sense reasoning tasks. The present invention has made significant progress in the "existence", "counting", and "color" categories, especially in the counting score, which has increased by 35.5 points compared to LLaVA-1.5.
[0088] Example 2
[0089] In order to more accurately evaluate the effectiveness of the present invention in a continuous learning environment, the present invention was evaluated on the general benchmarks MMBench and MM-Vet in this example. Similarly, the VCD algorithm and the OPERA algorithm of the present invention were compared.
[0090] Figure 4 is a comparison graph of the evaluation results of the present invention and the comparative method in Example 2 on the general benchmark test MMBench. As Figure 4 shown, the present invention is highly competitive compared to the state-of-the-art methods.
[0091] Table 4 is a comparison table of the present invention and the comparative method on the general benchmark test MM-Vet.
[0092] Method gn_kw_rec rec ocr_sp ocr ocr_sp_rec ocr_kw_rec ocr_gn_sp Total LLaVA1.5-7B 18.1 67.6 17.7 48.3 60.0 21.2 10.0 31.1 +VCD 19.2 62.2 15.8 29.2 42.5 17.5 60.0 30.2 +OPERA 21.8 61.9 21.5 51.7 56.2 11.2 30.0 32.0 This invention 19.5 70.3 18.5 55 58.3 27.8 12.5 31.8
[0093] Table 4
[0094] The evaluation results in Table 4 cover multiple complex multimodal tasks: gn represents language generation; kw represents knowledge, that is, the ability of the model to process and apply external knowledge bases, usually involving the understanding of facts, common sense or domain knowledge; sp represents spatial perception, and rec represents recognition. As shown in Table 4, the present invention has achieved a significant improvement in overall performance, especially in OCR and spatial reasoning tasks, with an average increase of 6.7%.
[0095] Through the above data analysis and comparison, it can be known that the present invention is superior to other methods for alleviating hallucinations in vision-language large models, and these results verify the effectiveness and superiority of the present invention.
[0096] Although the above-described illustrative specific embodiments of the present invention have been described to facilitate those skilled in the art to understand the present invention, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention defined and determined by the appended claims, these changes are obvious, and all inventions made using the concept of the present invention are within the scope of protection.
Claims
1. A method for alleviating hallucinations in vision-language large models based on attention hijacking detection, characterized in that Including the following steps: S1: Select the first L layer attention layers from the autoregressive language decoder of the vision-language large model as the target attention layers according to actual needs; S2: The $i$-th layer of the target attention layer processes the received image tokens, instruction tokens, and generated tokens using the attention mechanism, and generates new image tokens, instruction tokens, and generated tokens according to the calculated attention weights between the tokens. Denote the visual information of each image token $t$ obtained by the $i$-th layer of the target attention layer as $Vis i (t), t ∈ T i , T i represents the set of image tokens in the $i$-th layer; Denote the visual information of each instruction token $s$ obtained as $Ins i (s), s ∈ S i , S i represents the set of instruction tokens in the $i$-th layer; Denote the amount of visual information passed from each instruction token $s$ to each generated token $d$ as D i represents the set of generated tokens in the $i$-th layer, $i = 0, 1, …, L$; S3: For each target attention layer, calculate the hijacker evaluation score for each instruction token s using the following formula S4: For each target attention layer, take |S i | instruction tokens and sort them in descending order according to the hijacking evaluation score where | | represents obtaining the number of individuals in the set. Select the top K instruction tokens as attention hijackers to form the attention hijacker set H of the i-th layer of the target attention layer i , and the value of K is set according to actual needs; S6: For each instruction token in the set H of attention hijackers i set the instruction token received by the target attention layer of the i-th layer to 0, then re-use the attention mechanism to process the received image tokens, instruction tokens, and generated tokens, re-generate the image tokens, instruction tokens, and generated tokens, and calculate the visual information of the instruction token where attention is detached according to the following formula of the instruction token received by the target attention layer of the i-th layer and the generated token Among them, represents the visual attention weight of the re-generated instruction token s′ to the instruction token ; represents the set of instruction tokens that perform self-interaction with the instruction token in the i-th layer; Then update each instruction marker of the visual information The hallucination mitigation ends, and continue with subsequent operations.
2. The visual language large model hallucination mitigation method according to claim 1, wherein The calculation formula for the visual information of each image token in step S3 is as follows: Among them, Vis i (t) represents the visual information of the image tag t at the i-th layer, and Vis i-1 (t′) represents the visual information of the image tag t′ at the (i - 1)-th layer, where t′ ∈ T t i , T t i represents the set of image tags that perform image tag self-interaction with the image tag t in the i-th layer, represents the attention weight of the image tag t′ to the image tag t in the i-th layer.
3. The visual language large model hallucination mitigation method according to claim 1, wherein The visual information of each instruction token in step S3: where, Ins i (s) represents the visual information of instruction marker s at the i-th layer, represents the attention weight of image marker t to instruction marker s in the i-th layer, Vis i-1 (s′) represents the visual information of instruction marker s′ at the (i - 1)-th layer, represents the set of instruction markers that perform self-interaction with instruction marker s in the i-th layer, represents the attention weight of instruction marker s′ to instruction marker s.
4. The method for alleviating visual language large model hallucinations according to claim 1, wherein The visual information amount passed from each instruction tag to each generated tag in step S3 is calculated as follows: Among them, represents the attention weight of the instruction token s in the i-th layer for generating the token d, represents the attention weight of the generated token d' for generating the token d in the i-th layer, represents the set of generated tokens that perform self-interaction with the generated token d in the i-th layer, represents the visual information amount transmitted from the instruction token s to the generated token d' in the i-th layer, represents the attention weight of the generated token d for itself in the i-th layer, represents the visual information amount transmitted from the instruction token s to the generated token d in the (i - 1)-th layer.
5. The method for alleviating visual language large model hallucinations according to claim 1, wherein In step 5, the hijacker set H i is further screened. The specific method is as follows: The visual information amount passed from all image tags to each generated tag is calculated using the following formula as Among them, represents the attention weight of the image marker t in the i-th layer for generating the marker d, represents the visual attention weight of the generated marker d for itself in the i-th layer, represents the visual information amount transmitted from all image markers in the (i - 1)-th layer to the generated marker d; Then, for the set H of attention hijackers i each instruction token in it is respectively subjected to an attention detachment test. The specific method is as follows: Set the instruction token received by the target attention layer of the i-th layer to 0, and then re-use the attention mechanism to process the received image tokens, instruction tokens, and generated tokens, re-calculate the attention weights between the tokens, and generate image tokens, instruction tokens, and generated tokens. The visual information of the instruction token with attention detachment is calculated using the following formula: Among them, represents the attention weight of the regenerated instruction token s′ to the instruction token ; represents the set of instruction tokens that perform self-interaction with the instruction token in the i-th layer; Then update the instruction flag of the visual information Denote the visual information of each image marker obtained at the $i$-th layer after the update as The visual information of each instruction marker is The amount of visual information passed from each instruction marker to each generation marker is At the same time, recalculate the amount of visual information passed from all image markers to each generation marker Then determine whether the following conditions are met: If satisfied, retain the instruction flag as an attention hijacker, otherwise remove the instruction flag from the hijacker set H i delete it
Citation Information
Cited By
Multi-modal large model illusion detection and suppression method based on attention time sequence difference
CN121438067A
Method for hallucination detection and suppression of multi-modal large model based on attention time difference
CN121438067B
