A trusted decoding method for multi-modal large model sequence generation
By combining local focusing and global noise processing with modality dependency evaluation criteria, high-risk lexical units are dynamically identified and calibrated, solving the modality illusion problem in multimodal generation models and improving the credibility and consistency of generated content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SOUTH CHINA UNIV OF TECH
- Filing Date
- 2025-09-04
- Publication Date
- 2026-05-01
AI Technical Summary
Existing multimodal generation models suffer from modal illusion during the generation process, making it difficult to effectively identify and intervene in high-risk lexical terms. This results in insufficient credibility and consistency of the generated content, which may pose security risks, especially in high-risk domains.
Local visual input and global noise visual input are generated by local focusing and global noise processing. Combined with modality dependency evaluation criteria, high-risk hallucination lexical units are dynamically identified and calibrated, and the attention mechanism of a multimodal large language model is used for calibration.
It significantly reduces the probability of modal illusion, improves the accuracy and consistency of generated content, and enhances the robustness and credibility of the model in practical applications.
Smart Images

Figure CN121074159B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence technology, and in particular to a reliable decoding method for generating multimodal large model sequences. Background Technology
[0002] With the rapid development of multimodal large language models (MLLMs), artificial intelligence systems have made significant progress in tasks such as image and text understanding, visual question answering, and image description. By integrating data inputs from both image and text modalities, these models can generate semantically clear and contextually coherent natural language content in complex contexts, demonstrating broad application prospects in education, healthcare, scientific research, and human-computer interaction.
[0003] However, although current mainstream multimodal models have shown strong performance in language generation, they still generally suffer from modality hallucination. This phenomenon manifests as a discrepancy between the content generated by the model and the input image, or even the inclusion of fictitious or irrelevant information. This hallucination may mislead users in practical applications, especially in high-risk areas such as medical assisted diagnosis, financial analysis, and legal question answering, and may even lead to security risks and ethical problems.
[0004] To address the problem of modal illusion, existing research mainly explores three aspects: first, expanding the coverage of training data through diverse data augmentation; second, optimizing model architecture to enhance the fusion capability between modalities; and third, designing new training paradigms or adjusting loss functions to enhance semantic consistency constraints.
[0005] However, these methods have some limitations in practical applications. First, they fail to fully consider the differences in the model's dependence on image and text modalities when generating different lexical units, making it difficult to effectively suppress the hallucination tendency of high-risk lexical units using a uniform processing approach. Second, these methods lack precise risk detection mechanisms, making it impossible to accurately identify and specifically intervene in those parts that are prone to hallucinations, which makes it difficult to achieve an ideal balance between the overall quality and credibility of the generated content. In addition, multimodal models also face the problem of insufficient local detail modeling ability when dealing with complex image and text contexts. Due to the lack of an effective mechanism to capture the fine-grained alignment relationship between local regions of the image and specific text fragments, the existing hallucination detection granularity is usually relatively coarse, making it difficult to support high-precision, low-false-positive intervention strategies.
[0006] Therefore, how to utilize the features or attention mechanisms within the model to dynamically identify lexical units with a high risk of hallucination and implement selective contrast calibration intervention has become a major challenge in improving the credibility of multimodal content generation. Summary of the Invention
[0007] (1) Technical problems to be solved
[0008] This invention discloses a reliable decoding method for generating large multimodal model sequences, aiming to solve the problem of poor ability of existing multimodal generation models to handle modal illusions.
[0009] (2) Technical solution
[0010] This invention discloses a reliable decoding method for generating large multimodal model sequences, comprising the following steps:
[0011] Step 1: Obtain the original image and text input;
[0012] Step 2: Perform local focusing processing and global noise processing on the original image to obtain local visual input and global noise visual input;
[0013] Step 3: Input the original image, local visual input, and global noise visual input together with the text input into the multimodal large language model to obtain the original output distribution, local focused output distribution, and global noise output distribution of the generated word units;
[0014] Step 4: Calculate the calibrated output distribution based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution;
[0015] Step 5: Combine modality dependency evaluation criteria to dynamically identify high-risk hallucination words, and use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words.
[0016] Furthermore, step 2 is specifically as follows:
[0017] Step 201: Perform local focusing processing on the original image to obtain local visual input;
[0018] Step 202: Perform global noise processing on the original image to obtain global noise visual input.
[0019] Furthermore, step 201 specifically includes the following steps:
[0020] Step 20101: Segment the original image using a segmentation model to obtain multiple segmentation regions and the mask and area corresponding to each segmentation region;
[0021] Step 20102: Sort the segments in descending order of their areas, and select the largest segment from the sorted list. Each segmented region;
[0022] Step 20103, for Each of the segmented regions generates a corresponding local focusing visual input, and the local focusing visual inputs are integrated to obtain a local visual input.
[0023] Furthermore, the specific process of step 20103 is as follows:
[0024] For the selected The masks of each segmented region generate corresponding local focus visual inputs. The generation of local focus visual inputs is achieved by preserving the visual information in the segmented regions and masking other parts of the original image. This generation process is implemented by the function Focus.
[0025] Next, the local focusing visual inputs are integrated to obtain local visual inputs.
[0026] Further, step 202 specifically involves the following steps: adding a global noise perturbation to the original image to generate a noisy global visual input.
[0027] Furthermore, the global noise disturbance is Gaussian noise.
[0028] Furthermore, the specific steps of step 3 are as follows:
[0029] Step 301: Input the original image and text input together into the multimodal large language model to obtain the original output distribution of generated word units;
[0030] Step 302: Each local focus visual input in the local visual input is fed together with the text input into the multimodal large language model, and integrated to obtain the local focus output distribution of generated word units;
[0031] Step 303: Input both the global noise visual input and the text input into the multimodal large language model to obtain the global noise output distribution of the generated lexical units.
[0032] Furthermore, step 302 specifically involves the following steps:
[0033] Step 30201, in the local visual input Each localized focused visual input is fed together with the text input into a multimodal large language model to obtain the output distribution corresponding to the localized focused visual input of each selected segmentation region;
[0034] Step 30202, will The local focused visual inputs of each segmented region are weighted and summed to obtain the local focused output distribution of the generated word.
[0035] Furthermore, the calibrated output distribution is calculated by introducing a hyperparameter that controls the calibration intensity.
[0036] Furthermore, in step 4, the calibrated output distribution is calculated based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution. Its formula is:
[0037]
[0038] in, Represents the original output distribution, Indicates localized focused output distribution, This represents the global noise output distribution; For text input, For visual input of global noise, For local visual input, For the original image, To generate word elements; and These are two hyperparameters that control the intensity of local focus calibration and global noise calibration, respectively.
[0039] Furthermore, step 5 specifically involves the following steps:
[0040] Step 501: Input the original image and text input together into the multimodal large language model to obtain visual features and text features. Then extract the attention weights of the visual features and text features, and calculate the sum of visual attention weights and the sum of text attention weights corresponding to the generated word units.
[0041] Step 502: Calculate the modality dependency score of the generated word unit using the sum of visual attention weights and the sum of text attention weights;
[0042] Step 503: Identify high-risk hallucination morphemes using modality dependency scores;
[0043] Step 504: Use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words.
[0044] Furthermore, the specific process of step 501 is as follows:
[0045] Step 50101, in the text generation stage, the model's decoder has a total of Layer, number The layer represents the last layer and contains One's attention, This refers to the set of visual features extracted from the original input image by the model's visual encoder. For the number of visual features, Indicates the first The first visual feature; the decoder generates the second... When there are tokens, the existing ones The hidden state sequence of each token is denoted as... For the last layer of the decoder Each attention head Obtain the model in the generation of the first When a token is assigned, it is assigned to each visual feature. The attention weight is denoted as , Indexes representing visual features; in the last layer All attention head The formula for the sum of attention weights for all visual features is as follows:
[0046]
[0047] in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights for all visual features after aggregation is called the sum of visual attention weights.
[0048] Step 50102, for the last layer of the decoder Each attention head Assign hidden state to each previous token The attention weight is denoted as , Indicates the index of the previously hidden state of the token; at the last level. All attention head The formula for the sum of attention weights for the hidden state corresponding to each previous text token is as follows:
[0049]
[0050] in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights applied to all previous text tokens is called the total text attention weight.
[0051] Furthermore, in step 502, the first... The sum of visual attention weights for each word token Sum of text attention weights Calculate and generate the first Modal dependency score for each word token The specific formula is as follows:
[0052]
[0053] in, .
[0054] Furthermore, in step 503, a threshold is preset. For the first The token generated by each token If the word element Modal dependency score If the value exceeds this threshold, the word is considered a potentially high-risk hallucination word.
[0055] Furthermore, in step 504, the output probability distribution of potentially high-risk hallucination words is calibrated using the calibrated output distribution to obtain the final decoding formula:
[0056] ;
[0057]
[0058] in, Indicates the first Each token generates a word element. Modal dependency score, It is a preset threshold; Indicates the first The output words before each token ; indicates the first The original output distribution of the word elements before each token; Indicates the first Localized focused output distribution of the output words before each token; Indicates the first The global noise output distribution of the previous tokens; Input the original image. For text input, For local visual input, For visual input of global noise, and Two hyperparameters, denoted as , control the intensity of local focus calibration and global noise calibration, respectively, while softmax represents the normalization function used to output specific probability values.
[0059] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0060] By introducing a reliable decoding method for generating multimodal large model sequences, this method can dynamically assess and identify the modal dependency strength and illusion risk of each word during the generation process. Differential calibration is implemented for high-risk words, effectively avoiding blind intervention in the overall generation result. At the same time, a calibration branch is constructed using the model's internal attention mechanism and intermediate features, and a contrastive learning strategy is used to improve the model's ability to finely align text and image information, significantly reducing the probability of modal illusion. This method not only improves the accuracy and consistency of multimodal generated content, but also ensures the efficiency and controllability of the calibration process. It is applicable to a variety of complex multimodal tasks and enhances the robustness and reliability of the model in practical applications. Attached Figure Description
[0061] Figure 1 This is an overall flowchart of the present invention;
[0062] Figure 2 This is a flowchart of the process of performing local focusing on the original image in step 2 of this invention.
[0063] Figure 3 This is a flowchart of step 5 in this invention. Detailed Implementation
[0064] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0065] For the sake of clarity and reference, the technical terms, abbreviations, or acronyms used below are summarized and explained as follows:
[0066] Multimodal Large Language Models (MLLMs): An artificial intelligence model that can process multiple types of data input simultaneously (such as images, text, speech, etc.).
[0067] Modality hallucination refers to the phenomenon where a multimodal model generates false information that is inconsistent with or irrelevant to a certain modality of the input (such as an image), resulting in unrealistic or unreliable output content.
[0068] Lexicon: The smallest unit of language that can be processed by a model. It can be a single character, word, or fragment of words. It is the basic unit for generating or understanding text.
[0069] Calibration: Adjusting and optimizing the probability distribution or prediction results of a model output through specific methods or mechanisms.
[0070] Contrastive learning: a machine learning method that trains a model to distinguish between similar and dissimilar inputs by constructing pairs of positive and negative samples.
[0071] Attention: A mechanism that enables a model to dynamically focus on key parts of the input information based on the current task.
[0072] Segmentation model: A visual model used to divide an image into regions with specific semantics or instances.
[0073] Decoding: The process of converting the hidden representations within a model into a specific output sequence (such as text), usually referring to the step of generating text.
[0074] refer to Figure 1 This invention proposes a reliable decoding method for generating large multimodal model sequences, which specifically includes the following steps:
[0075] Step 1: Obtain the original image and text input;
[0076] Step 2: Perform local focusing processing and global noise processing on the original image to obtain local visual input and global noise visual input;
[0077] Step 3: Input the original image, local visual input, and global noise visual input together with the text input into the multimodal large language model to obtain the original output distribution, local focused output distribution, and global noise output distribution of the generated word units;
[0078] Step 4: Calculate the calibrated output distribution based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution;
[0079] Step 5: Combine modality dependency evaluation criteria to dynamically identify high-risk hallucination words, and use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words.
[0080] The following example illustrates a reliable decoding method for generating large multimodal model sequences:
[0081] Step 1, obtaining the original image and text input, specifically includes the following steps:
[0082] Step 101: The original image can be acquired by a camera or other acquisition device and processed by an upstream algorithm to obtain the image input;
[0083] Step 102: Text input can be collected by the user through a data acquisition device and processed by an upstream algorithm to obtain text input, or the system can directly input text.
[0084] Specifically, in step 2, the original image undergoes local focusing processing and global noise processing to obtain local visual input and global noise visual input. The specific steps are as follows:
[0085] Step 201: Perform local focusing processing on the original image to obtain local visual input;
[0086] Step 202: Perform global noise processing on the original image to obtain global noise visual input;
[0087] Steps 201 and 202 can be performed in any order.
[0088] Specifically, step 201, which involves performing local focusing processing on the original image to obtain local visual input, includes the following algorithm flow, as referred to below. Figure 2 :
[0089] Step 20101: Segment the original image using a segmentation model to obtain multiple segmentation regions and the mask and area corresponding to each segmentation region;
[0090] Step 20102: Sort the segments in descending order of their areas, and select the largest segment from the sorted list. Each segmented region ( (The value is a preset positive integer).
[0091] Step 20103, for Each of the segmented regions generates a corresponding local focusing visual input, and the local focusing visual inputs are integrated to obtain a local visual input.
[0092] Specifically, in step 20101, the original image is segmented using a segmentation model to obtain multiple segmented regions and the corresponding masks and areas for each segmented region. The specific process is as follows:
[0093] The original image was processed using the Segment Anything Model (SAM). Perform semantic-level segmentation to obtain content and List of masks corresponding to each detected segmented region and area set ,in, Indicates the first in the mask list The mask corresponding to each of the segmented regions. Then it represents the first area in the set of areas. The area corresponding to each of the aforementioned segmented regions is given by the following formula:
[0094]
[0095] Simultaneously, calculate the original image Total area The expression is:
[0096] ;
[0097] in, The original image height, The original image The width.
[0098] Specifically, in step 20102, the regions are sorted in descending order according to their area, and the region with the largest area is selected from the sorted list. The process of dividing the region is as follows:
[0099] Sort all the segmented regions in descending order based on their area, and select the region with the largest area from the sorted list. If there are 3 segmented regions, then the list of selected segmented region masks is: The corresponding area set is ;in, This represents the index of each of the segmented regions after being sorted in descending order of area. Indicates the selected number The mask of the segmented region, Indicates the selected number The area of each of the segmented regions.
[0100] Specifically, in step 20103... Each of the segmented regions generates a local focusing visual input, and the local focusing visual inputs are integrated to obtain a local visual input. The specific process is as follows:
[0101] For the selected The masks of each segmented region are used to generate corresponding localized focusing visual inputs. The generation of these localized focusing visual inputs involves preserving some visual information within the segmented regions while masking the original image. The remaining parts are implemented through the function Focus, whose expression is:
[0102]
[0103] in, Indicates that the selected The index of each of the segmented regions in the segmented regions. Indicates the selected number The mask of the segmented region, Represents the original image. Indicates the selected number The localized focusing visual inputs generated by the segmented regions are then integrated to obtain the localized visual input. .
[0104] Specifically, the segmentation model used in step 201 is SAM, which is based on the Vision Transformer architecture. It achieves segmentation of any object through a separate image encoder and cue encoder structure. During the processing, the input image is first extracted with high-resolution visual feature maps by the image encoder. At the same time, the model receives different forms of cue input (such as dots, boxes or text cues). These cue inputs are encoded by the cue encoder and fused with the image features. The fused features are input into a lightweight mask decoder, which quickly generates multiple high-quality candidate segmentation masks through an attention mechanism. The final output is selected by combining the predicted mask quality scores.
[0105] Specifically, in step 202, global noise processing is performed on the original image to obtain global noise visual input. The specific steps are as follows: In the original image Add a global noise perturbation (such as Gaussian noise) to generate a noisy global visual input. .
[0106] Specifically, in step 3, the original image, local visual input, and global noise visual input are input together with the text input into the multimodal large language model to obtain the original output distribution, local focused output distribution, and global noise output distribution of the generated words. The specific steps are as follows:
[0107] Step 301, extract the original image and text input Common input to multimodal large language model Obtain generated lexical units The original output distribution ;
[0108] Step 302, local visual input Each localized visual input in the input is associated with a text input. Common input to multimodal large language model And integrate to obtain generated lexical units Localized focused output distribution ;
[0109] Specifically, step 302 involves the following steps:
[0110] Step 30201, input local visual data In Localized visual input and text input are respectively... Common input to multimodal large language model In the middle, the selected number was obtained. Localized focusing visual input of the segmented regions Corresponding output distribution ;
[0111] Step 30202, will The output distributions corresponding to the local focused visual inputs of each segmented region are weighted and summed to obtain the generated word. Localized focused output distribution The formula is as follows:
[0112]
[0113] in, Indicates the selected number The area of each of the segmented regions Represents the original image Total area This indicates the number of selected segmented regions;
[0114] Step 303: Visually input the global noise. and text input Common input to multimodal large language model Obtain generated lexical units Global noise output distribution .
[0115] Specifically, in step 4, the calibrated output distribution is calculated based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution. Its formula is:
[0116]
[0117] in, Represents the original output distribution, Indicates localized focused output distribution, This represents the global noise output distribution; Input text For visual input of global noise, For local visual input, For the original image, To generate word elements; and Two hyperparameters control the intensity of local focus calibration and global noise calibration, respectively, to remove erroneous signals dominated by statistical bias and language priors from the original output distribution. For example, in the absence of visual evidence, the model may be more inclined to output the common character "A" rather than the rare character "Z" due to character frequency. Adjusting this hyperparameter can weaken such bias and strengthen the real visual evidence signal.
[0118] By employing the comparative learning strategy in steps 3 and 4, the model's ability to finely align textual and graphical information was further improved, significantly reducing the probability of modal illusion.
[0119] Specifically, in step 5, high-risk hallucinogenic words are dynamically identified by combining modality dependency evaluation criteria, and the output probability distribution of high-risk hallucinogenic words is calibrated using the calibrated output distribution. Figure 3 :
[0120] Step 501: Input the original image and text input together into the multimodal large language model to obtain visual features and text features. Then extract the attention weights of the visual features and text features, and calculate the sum of visual attention weights and the sum of text attention weights corresponding to the generated word units.
[0121] Step 502: Calculate the modality dependency score of the generated word unit using the sum of visual attention weights and the sum of text attention weights;
[0122] Step 503: Identify high-risk hallucination morphemes using modality dependency scores;
[0123] Step 504: Use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words.
[0124] Specifically, in step 501, the original image and text input are jointly input into a multimodal large language model to obtain visual features and text features. Then, the attention weights of the visual features and text features are extracted, and the sum of the visual attention weights and the sum of the text attention weights corresponding to the generated lexical units of the current token are calculated. The specific process is as follows:
[0125] Step 50101, in the text generation stage, the model's decoder has a total of Layer, number The layer represents the last layer and contains There are 12 attention heads, each used to independently compute the attention distribution. This refers to the set of visual features extracted from the original input image by the model's visual encoder. For the number of visual features, Indicates the first The first visual feature; the decoder generates the second... When there are tokens, the existing ones The hidden state sequence of each token is denoted as... For the last layer of the decoder Each attention head Obtain the model in the generation of the first When a token is assigned, it is assigned to each visual feature. The attention weight is denoted as , The index represents the visual feature; this weight comes from the multi-head attention mechanism in the decoder, where the query is the [index]. The hidden state of each token, with the key being a visual feature, is obtained by applying a softmax function after a dot product; for the last layer... All attention head The formula for the sum of attention weights for all visual features is as follows:
[0126]
[0127] in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights for all visual features after aggregation is called the sum of visual attention weights.
[0128] Step 50102, for the last layer of the decoder Each attention head Assign hidden state to each previous token The attention weight is denoted as , This represents the index of the previously hidden state of the token. This weight also comes from the multi-head self-attention mechanism of the decoder: the query is the... The hidden state of each token, with the key being the previously hidden state of the token, is obtained by applying a dot product followed by softmax; for the last layer... All attention head The formula for summing the attention weights of the hidden states corresponding to each previous text token is:
[0129]
[0130] in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights applied to all previous text tokens is called the total text attention weight.
[0131] Specifically, in step 502, the first The sum of visual attention weights for each word token Sum of text attention weights Calculate and generate the first Modal dependency score for each word token The specific formula is as follows:
[0132]
[0133] The score ,when When it is close to 1, it indicates that the model is generating the first... When dealing with a single token, the focus is more on textual features, with visual information contributing relatively little. Therefore, the token is more likely to be influenced by textual information and produce illusions.
[0134] Specifically, in step 503, potential hallucinatory word elements are identified based on modality dependency scores exceeding a preset threshold; in practical applications, a preset threshold is used. For the first The token generated by each token If the word element Modal dependency score If the value exceeds this threshold, the word is considered a potentially high-risk hallucination word.
[0135] Specifically, in step 504, the output probability distribution of potentially high-risk hallucination words is calibrated using the calibrated output distribution to obtain the final decoding formula:
[0136] ;
[0137]
[0138] in, Indicates the first Each token generates a word element. Modal dependency score, It is a preset threshold; Indicates the first The output of the previous token depends on the input and output before that time. Indicates the first The original output distribution of the word elements before each token; Indicates the first Localized focused output distribution of the output words before each token; Indicates the first The global noise output distribution of the previous tokens; Input the original image. For text input, For local visual input, For visual input of global noise, and These are two hyperparameters that control the intensity of local focus calibration and global noise calibration, respectively. softmax represents the normalization function used to output specific probability values.
[0139] By utilizing the model's internal attention mechanism and intermediate features (visual and textual features) to construct a calibration branch and calculate the modality dependency score of the generated lexical unit, if the modality dependency score of the lexical unit is... Greater than this threshold If the word is considered a potential illusion word, then the output distribution calibration of the word is performed according to the above formula. Otherwise, no calibration is performed. This decoding formula weakens statistical bias and language prior by comparative calibration, and suppresses tokens with insufficient visual evidence by modality dependency evaluation criteria, thus providing the reliability of the output.
[0140] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0141] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0142] The technical features of the above embodiments can be combined arbitrarily. Furthermore, the numbering of each step is not intended to constrain the order of the steps; their order is permissible as long as there are no strict constraints on the sequence. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, any combination of these technical features that does not contradict each other should be considered within the scope of this specification.
[0143] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A reliable decoding method for generating large multimodal model sequences, characterized in that: Includes the following steps: Step 1: Obtain the original image and text input; Step 2: Perform local focusing processing and global noise processing on the original image to obtain local visual input and global noise visual input; Step 3: Input the original image, local visual input, and global noise visual input together with the text input into the multimodal large language model to obtain the original output distribution, local focused output distribution, and global noise output distribution of the generated word units; Step 4: Calculate the calibrated output distribution based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution; Step 5: Combine modality dependency evaluation criteria to dynamically identify high-risk hallucination words, and use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words; The specific steps of step 5 are as follows: Step 501 includes the following steps: Step 50101, in the text generation stage, the model's decoder has a total of Layer, number The layer represents the last layer and contains One point of attention, This refers to the set of visual features extracted from the original input image by the model's visual encoder. For the number of visual features, Indicates the first The first visual feature; the decoder generates the second... When there are tokens, the existing ones The hidden state sequence of each token is denoted as . For the last layer of the decoder Each attention head Obtain the model in the generation of the first When a token is assigned to each visual feature The attention weight is denoted as , Indexes representing visual features; in the last layer All attention head The formula for the sum of attention weights for all visual features is as follows: ; in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights for all visual features after aggregation is called the sum of visual attention weights. Step 50102, for the last layer of the decoder Each attention head Assign hidden state to each previous token The attention weight is denoted as , Indicates the index of the previously hidden state of the token; at the last level. All attention head The formula for the sum of attention weights for the hidden state corresponding to each previous text token is as follows: ; in, Indicates the decoder's first Generate the first layer in the layer All attention is focused on each token. The sum of attention weights applied to all previous text tokens is the sum of text attention weights. Step 502, using the first The sum of visual attention weights for each word token Sum of text attention weights Calculate and generate the first Modal dependency score for each word token The specific formula is as follows: ; in, ; Step 503: Identify high-risk hallucination morphemes using modality dependency scores; Step 504: Use the calibrated output distribution to calibrate the output probability distribution of high-risk hallucination words, and obtain the final decoding formula: ; ; in, Indicates the first Each token generates a word element. Modal dependency score, It is a preset threshold; Indicates the first The output words preceding each token; Indicates the first The original output distribution of the word elements before each token; Indicates the first Localized focused output distribution of the output words before each token; Indicates the first The global noise output distribution of the previous tokens; Input the original image. For text input, For local visual input, For visual input of global noise, and Two hyperparameters, denoted as , control the intensity of local focus calibration and global noise calibration, respectively, while softmax represents the normalization function used to output specific probability values.
2. The reliable decoding method for generating multimodal large model sequences according to claim 1, characterized in that: The specific steps of step 2 are as follows: Step 201: Perform local focusing processing on the original image to obtain local visual input; Step 202: Perform global noise processing on the original image to obtain global noise visual input.
3. The reliable decoding method for generating multimodal large model sequences according to claim 2, characterized in that: Step 201 specifically includes the following steps: Step 20101: Segment the original image using a segmentation model to obtain multiple segmentation regions and the mask and area corresponding to each segmentation region; Step 20102: Sort the segments in descending order of their areas, and select the largest segment from the sorted list. Each segmented region; Step 20103, for Each of the segmented regions generates a corresponding local focusing visual input, and the local focusing visual inputs are integrated to obtain a local visual input.
4. A reliable decoding method for generating multimodal large model sequences according to claim 3, characterized in that: The specific process of step 20103 is as follows: For the selected The masks of each segmented region generate corresponding local focus visual inputs. The generation of the local focus visual inputs is achieved by preserving the visual information in the segmented regions and masking other parts of the original image. Next, the local focusing visual inputs are integrated to obtain local visual inputs.
5. A reliable decoding method for generating multimodal large model sequences according to claim 2, characterized in that: The specific steps of step 202 are as follows: A global noise perturbation is added to the original image to generate a noisy global visual input.
6. A reliable decoding method for generating multimodal large model sequences according to claim 5, characterized in that: The global noise disturbance is Gaussian noise.
7. A reliable decoding method for generating multimodal large model sequences according to claim 1, characterized in that: The specific steps of step 3 are as follows: Step 301: Input the original image and text input together into the multimodal large language model to obtain the original output distribution of generated word units; Step 302: Each local focus visual input in the local visual input is fed together with the text input into the multimodal large language model, and integrated to obtain the local focus output distribution of generated word units; Step 303: Input both the global noise visual input and the text input into the multimodal large language model to obtain the global noise output distribution of the generated lexical units.
8. A reliable decoding method for generating multimodal large model sequences according to claim 7, characterized in that: The specific steps of step 302 are as follows: Step 30201, in the local visual input Each localized focused visual input is fed together with the text input into a multimodal large language model to obtain the output distribution corresponding to the localized focused visual input of each selected segmentation region; Step 30202, will The local focused visual inputs of each segmented region are weighted and summed to obtain the local focused output distribution of the generated word.
9. A reliable decoding method for generating multimodal large model sequences according to claim 1, characterized in that: The calibrated output distribution is calculated by introducing a hyperparameter that controls the calibration intensity.
10. A reliable decoding method for generating multimodal large model sequences according to claim 9, characterized in that: In step 4, the calibrated output distribution is calculated based on the differences between the original output distribution, the local focused output distribution, and the global noise output distribution. Its formula is: ; in, Represents the original output distribution, Indicates localized focused output distribution, This represents the global noise output distribution; For text input, For visual input of global noise, For local visual input, For the original image, To generate word elements; and These are two hyperparameters that control the intensity of local focus calibration and global noise calibration, respectively.
11. A reliable decoding method for generating multimodal large model sequences according to claim 1, characterized in that: In step 503, a threshold is preset. For the first The token generated by each token If the word element Modal dependency score If the value exceeds this threshold, the word is considered a potentially high-risk hallucination word.
Citation Information
Patent Citations
Chinese sentiment classification method and device based on multiple modes and electronic equipment
CN119202850A
Multi-modal aspect-level sentiment analysis method based on multi-scale text visual feature enhancement
CN120123978A