A reasoning-time visual language model alignment method based on word-level guidance
By constructing a preference dataset and training a lightweight autoregressive lexical-level reward model, the illusion problem in the visual language model generation process is solved, achieving instant correction and low-cost alignment, supporting compatibility with different model architectures, and improving the accuracy of generated responses.
Patent Information
- Application Number
- CN202611278710.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-11-27
AI Technical Summary
Existing visual language models are prone to producing illusions during the generation process, leading to inconsistent information. Furthermore, existing alignment methods require repeated model training, are costly, and have coarse feedback granularity, making them difficult to adapt to rapidly evolving multimodal application scenarios.
By constructing a preference dataset, a lightweight autoregressive lexical-level reward model is trained. Lexical-level guidance is used to guide the generation process of the target visual language model during inference, achieving alignment and avoiding model parameter updates.
It enables real-time correction during the visual language model generation process, reduces alignment costs, improves the consistency between generated responses and image facts, supports compatibility with different model architectures, and reduces inference latency and overhead.
Smart Images

Figure CN123180334A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual language model technology, and specifically to a visual language model alignment method based on lexical-level guided inference without updating the parameters of the target visual language model. Background Technology
[0002] Visual-language models (VLMs) demonstrate superior performance in tasks such as image-text question answering, image captioning, and visual reasoning by jointly processing images and text. However, despite their powerful capabilities, these models still face the illusion problem. Sometimes, the models generate fluent and coherent text that is inconsistent with the facts of the images, which can lead to the spread of misinformation, posing significant security risks and limiting their trustworthy deployment and application in high-risk fields such as medical diagnosis and scientific reasoning.
[0003] Ultimately, the hallucination problem stems from an imbalance between visual evidence and linguistic priors during the decoding phase: visual-language models are influenced by both visual input and linguistic priors during generation. When visual signals are blurred, the model tends to rely more on textual priors rather than fully focusing on the image itself, leading to factual inconsistencies. Therefore, the key to mitigating hallucinations lies in curbing the excessive dominance of linguistic priors and maintaining a more reasonable balance between visual evidence and linguistic expression.
[0004] To achieve this balance, existing visual language model alignment methods are mainly divided into two categories.
[0005] The first category is training-time alignment methods. These methods perform supervised fine-tuning or reinforcement learning based on manually labeled or model-generated preference data. However, when adapting to new tasks or preferences, these methods require retraining the entire backbone model. This process not only requires significant computational resources but also expensive labeling budgets and specially constructed preference labels, severely limiting their adaptability in rapidly evolving multimodal application scenarios.
[0006] The second category is inference-time alignment methods. To avoid retraining the model, these methods guide the decoding process of the frozen visual-language model through an external reward model. However, these methods are mostly sequence-level, meaning the model needs to generate multiple complete candidate responses before evaluating their quality. This results in only delayed and coarse-grained feedback, and the inference latency is significantly increased due to the need to sample multiple complete sequences. Summary of the Invention
[0007] This invention aims to address the problems of existing visual language model alignment methods, such as the high cost of repeated model training, coarse feedback granularity and high latency during inference, and difficulty in timely correcting deviations of visual facts during generation. It proposes a visual language model alignment method for inference based on word-level guidance.
[0008] The core idea of this invention is to transform sparse sequence-level feedback into dense autoregressive signals, without requiring fine-tuning of the target visual language model. Instead, a lightweight reward model is trained to approximate the preference distribution. During inference, implicit preference signals are extracted using the log-probability ratio between the reward model and the target visual language model, dynamically guiding the decoding process. Simultaneously, a lexical mapping mechanism ensures compatibility between heterogeneous word segmenters, enabling plug-and-play alignment capabilities for existing visual language models without modifying their parameters.
[0009] The present invention provides a visual language model alignment method for inference based on lexical-level guidance, comprising the following steps: S1. Construct a preference dataset; collect image-text samples containing query prompts and images from a visual question-answering dataset; apply various image enhancements to each image-text sample to obtain multiple enhanced images; input each enhanced image and its corresponding query prompt into a target visual language model to generate multiple candidate responses; simultaneously, input the original image and its corresponding query prompt into the target visual language model to generate inferior responses; fuse the multiple candidate responses to generate a preferred response; combine the query prompts, original images, preferred responses, and inferior responses to form a preference data sample and aggregate them into a preference dataset; S2. Train an autoregressive lexical-level reward model; using the preference dataset constructed in step S1, perform preference optimization training on the reward model so that, given the query prompt words, images, and generated text prefixes, the conditional probability of each lexical in the preferred response is higher than the conditional probability of the corresponding lexical in the undesirable response, thereby obtaining an autoregressive lexical-level reward model for representing lexical-level visual preferences. S3. Implement lexical-level guidance during the inference phase; for the query prompts and images to be processed, input the currently generated text prefixes into the target visual language model with frozen parameters and the autoregressive reward model trained in step S2 respectively to obtain the target probability distribution and reward probability distribution of the next word; when the two models use different word segmenters, convert and map the words with probabilities higher than the threshold in the reward probability distribution to the word space of the target visual language model; based on the target probability distribution, the mapped reward probability distribution and the preset guidance coefficient, generate the aligned probability distribution of the next word, and select the next word from it to append to the generated text prefix, repeating the process until a complete response is generated.
[0010] Preferably, in step S1, the visual question-answering dataset is used... The image and text samples in the dataset are converted into preference data containing preferred and unpreferred responses, and the preference dataset is constructed. It includes the following steps: S11: Collect image and text samples containing query prompts and images from the visual question answering dataset; [The sentence is incomplete and requires more context to be translated accurately.] Each image and text sample is represented as follows: ,in, For search suggestions, The image is the one corresponding to the query suggestion; for each of the image and text samples, a preset method is used. Image enhancement methods The images were processed separately to obtain a set of enhanced images. ,in, ; S12: Transfer the original image and corresponding query suggestions Input target visual language model Generate inferior response ; the enhanced images described in step S11 and corresponding query suggestions Input the target visual language model respectively Generate candidate responses corresponding to each enhanced image. ; S13: Assign each of the candidate responses The input is concatenated with preset fusion prompts and then fed into the target visual language model to generate an optimal response. The fusion prompts are used to guide the target visual language model to integrate visual information from multiple candidate responses, generating a more complete and consistent preferred response with the original image. S14: Search suggestions Original image Optimal response and inferior response Combined into preference data samples And store it in the preference dataset. By iterating through each image and text sample, a preference dataset is obtained for training the autoregressive lexical reward model.
[0011] Preferably, step S2 includes: S21: Construct a lightweight autoregressive visual language model as a reward model The word sequence of the response is represented as follows: ,in, Indicates the first Each word element, Indicates the first The response prefixes generated before each word element; the reward model, given the query suggestion words. ,image and the generated reply prefix Under the given conditions, output the next word. conditional probability And based on the conditional probability of each word, the word-level reward for the response is accumulated:
[0012] in, It is a learnable conditional probability distribution function; S22: Preference dataset constructed in step S1 For the reward model Training is conducted to increase the optimal response. Reply to the inferior option The difference in conditional probabilities between terms allows the reward model to assign higher probabilities to each term in the preferred response; the training loss function of the reward model is:
[0013] in, For the Sigmoid function, This is a hyperparameter used to adjust the preference strength based on the difference between the optimal and undesirable response probabilities. The preferred response is in the first... The word element at each position, The inferior response is in the first The word element at each position, and The preferred and unpreferred responses were respectively selected in the [number]th ...]. The response prefix before each word element; Preferably, step S3 includes: S31: Obtain query suggestions to be processed ,image and the currently generated response prefix The target visual language model is frozen by inputting the three parameters respectively. The autoregressive reward model obtained from step S2 training To obtain the target visual language model for the next word element The target probability distribution, and the autoregressive reward model for the next word. The reward probability distribution; S32: Analyze the word segmenter of the target visual language model. Tokenizer with Autoregressive Reward Model Are they the same? If they are different, select the one with the highest probability from the reward probability distribution. Each reward word is decoded into a text string, and then the word segmenter of the target visual language model is used. The text string is re-encoded, and the corresponding reward probability is mapped to the lexical space of the target visual language model; if they are the same, the reward probability distribution output by the reward model is directly adopted. S33: Based on the target probability distribution, the reward probability distribution or the mapped reward probability distribution, and the preset scaling factor... Calculate the aligned decoding probability distribution When the two word segmenters are identical, the aligned decoding probability distribution is as follows:
[0014] When the two word segmenters are different, the aligned decoding probability distribution is as follows:
[0015] in, This represents the probability distribution of each word after the original predicted scores of the model output are normalized using the Softmax function. This represents the reward probability distribution of the reward model in its lexical space. Indicates the highest probability of reward. Each reward word element, This represents the reward probability distribution after mapping to the lexical space of the target visual language model; S34: From the aligned decoding probability distribution Choose the word with the highest probability as the next word. and the next term Append to the currently generated response prefix to obtain the updated response prefix. Repeat steps S31 to S34 until a termination word is generated or the preset response length is reached to obtain the final response.
[0016] Key aspects of this invention include: 1. Automatic Preference Data Construction: By applying multiple image enhancements to the same image, the target visual language model is driven to generate multiple sets of candidate responses; then, the multiple sets of candidate responses are merged into the preferred response, and the response corresponding to the original image is used as the inferior response, thereby automatically constructing preference data containing query prompts, images, preferred responses, and inferior responses, without the need for manual annotation of preference relationships.
[0017] 2. A word-level guided inference alignment method: Train an autoregressive reward model to assign a high conditional probability to words in the preferred response; during inference, combine the word-level preference information output by the reward model with the word probabilities output by the target visual language model with the parameters frozen to guide the generation process of each word in real time without updating the parameters of the target visual language model.
[0018] 3. Cross-segmenter lexical mapping mechanism: When the reward model and the target visual language model use different segmenters, select multiple lexical units with higher probabilities in the reward model, decode them into text strings, and then re-encode them by the segmenter of the target visual language model. The corresponding reward probabilities are then mapped to the lexical space of the target model to achieve lexical-level probability fusion between heterogeneous models.
[0019] 4. Weak-to-strong inference guidance mechanism: The reward model and the target visual language model are decoupled. The reward model, which has a smaller parameter scale and lower training cost, can be used to perform inference alignment on the target visual language model, which has a larger parameter scale and is kept frozen. This improves the consistency of visual facts while avoiding the need to retrain the large model.
[0020] The advantages of this invention are: 1. No need to update the target visual language model parameters. This invention only trains a lightweight autoregressive reward model and guides the target visual language model with frozen parameters during the inference phase, avoiding repeated training of large-scale models due to changes in the target model, application domain, or preference requirements, thus reducing alignment costs.
[0021] 2. It enables timely correction at the word level. Unlike sequence-level methods that evaluate or reorder responses after generating complete responses, this invention integrates visual preference information during the generation of each word, which can suppress the generation trend that deviates from the image facts earlier and reduce visual illusions.
[0022] 3. Low inference overhead. This invention does not require generating multiple complete candidate responses for the same input and then filtering them. Instead, it directly completes the probability guidance during the autoregressive decoding process. The next word can be generated simply by combining the current outputs of the target visual language model and the reward model at each word position.
[0023] 4. Excellent model compatibility. Through a cross-segmenter lexical mapping mechanism, this invention allows the reward model and the target visual language model to use different vocabularies and model architectures, and supports the guidance of a large target visual language model by a small reward model, facilitating deployment among visual language models of different sizes and types. Attached Figure Description
[0024] Figure 1 This is the overall flowchart of the method of the present invention.
[0025] Figure 2 This is an example of preference data construction according to the present invention.
[0026] Figure 3 This is a specific implementation example of the present invention. Detailed Implementation
[0027] The technical solution of the present invention will be further described below with reference to the accompanying drawings.
[0028] This embodiment provides a visual language model alignment method based on lexical-level guidance during reasoning, which can improve the consistency between the generated response and the image facts.
[0029] The method for aligning visual language models during inference based on lexical-level guidance provided by this invention includes the following specific steps: Step S1: Construct the preference dataset.
[0030] We collected 8000 image-text samples each containing query prompts and images from the visual question-answering datasets TextVQA and OCRvQA, for a total of 16000 image-text samples. Each image and text sample is represented as follows: ,in, For search suggestions, An image corresponding to the query suggestion.
[0031] For each image and text sample, for the image Apply separately Preset image enhancement methods ,get An enhanced image. In this embodiment... The image enhancement method, defined as method 3, includes a weak diffusion perturbation method, a contrast enhancement method, and a gamma correction method. Specifically, the weak diffusion perturbation method introduces Gaussian noise into the image by performing 200 diffusion steps to create a moderate visual perturbation; the contrast enhancement method increases the image contrast to twice its original value to highlight visual boundaries and feature differences; and the gamma correction method processes the image with a gamma value of 0.8 to brighten dark areas. Different enhanced images can highlight different visual cues in the original image, thereby enabling the target visual language model to generate candidate responses with different focuses.
[0032] Original image and corresponding search suggestions Input target visual language model Received a negative response :
[0033] Each enhanced image and search suggestions Input the target visual language model respectively Get the corresponding candidate responses :
[0034] Then Each candidate response is concatenated with a preset fusion prompt and then input again into the target visual language model. The fusion prompt is used to instruct the model to integrate the visual information from the candidate responses and generate a more complete and image-consistent preferred response. :
[0035] Search suggestions Original image Optimal response and inferior response Combined into preference data samples and write it into the preference dataset. After traversing all image and text samples, the preference dataset used to train the reward model is obtained:
[0036] In this embodiment, to verify the quality of the preferred responses in the constructed preference data, evaluation sets were constructed from TextVQA and OCRVQA respectively. GPT-4o-2025-03-26 was used as an independent evaluation model to perform pairwise comparisons between the fused preferred responses and the inferior responses generated from the original images. Evaluation results show that on the TextVQA dataset, the win rate of the preferred responses was 97.30%, the win rate of the inferior responses was 0.44%, and the tie rate was 2.26%; on the OCRVQA dataset, the win rate of the preferred responses was 85.12%, the win rate of the inferior responses was 2.95%, and the tie rate was 11.93%. Figure 2 As shown, further qualitative analysis reveals that the advantage of the preferred response does not stem solely from the increased length of the response, but rather from the more comprehensive utilization of fine-grained visual evidence. By integrating candidate responses corresponding to different enhanced images, it is possible to supplement information such as spatial location and local text that are easily overlooked in responses generated from the original image, thereby improving the factual accuracy of the response and reducing visual illusions.
[0037] Step S2: Train an autoregressive word-level reward model.
[0038] A lightweight visual language model is used as an autoregressive reward model. In this embodiment, TinyLLaVA-1.5B with a parameter size of 1.5B is used. The preference dataset constructed in step S1 is utilized. The reward model was trained. Training was performed using eight NVIDIA A100 80GB graphics processors, and the training time was approximately 0.4 hours. Compared to scalar reward models that only output a single score for complete responses, the autoregressive reward model outputs conditional probabilities for the next lexical term given query hints, images, and generated response prefixes, thus forming a dense lexical-level preference signal.
[0039] For any reply ,in, Indicates the first Each word element, Indicates the first The response prefixes generated before each lexical unit; the reward model outputs the conditional probability at each lexical unit position. And based on the conditional probability of each word, the respondent receives a cumulative word-level reward:
[0040] Using preference datasets The reward model is trained such that the cumulative conditional probability of each word element in the preferred response is higher than the cumulative conditional probability of each word element in the undesirable response. The training loss function is:
[0041] in, For the Sigmoid function, This is an alignment hyperparameter used to adjust the preference strength, which is used to adjust the probability difference between the preferred and undesired responses. The preferred response is in the first... The word element at each position, The inferior response is in the first The word element at each position, and The preferred and unpreferred responses were respectively selected in the [number]th ...]. The response prefix preceding each lexical unit. Through the training described above, the reward model is able to provide a preference probability related to the image content at each lexical position in the generated response.
[0042] Step S3: Lexical level guidance during reasoning.
[0043] This embodiment uses an autoregressive reward model with a parameter size of 1.5B to provide word-level guidance during inference for a target visual language model LLaVA-1.5-7B with a parameter size of 7B. For example... Figure 3 As shown, during the inference phase, the word-level reward probability output by the lightweight autoregressive reward model is fused with the target probability output by the parameter-frozen target visual language model to guide the generation of the next word.
[0044] For query suggestions to be processed ,image and the currently generated response prefix The parameters are then input into the target visual language model and frozen. and the trained autoregressive reward model .
[0045] The target visual language model outputs the target probability distribution of the next word; the autoregressive reward model outputs the reward probability distribution of the next word. This represents the probability distribution of each word after the original predicted scores of the model output are normalized using the Softmax function.
[0046] When the reward model's word segmenter Word segmenter for target visual language model When the probabilities of the two outputs are the same, the word probabilities are directly fused to obtain the aligned decoding probability distribution:
[0047] in, This is a scaling factor used to adjust the guiding strength of the reward model; in this embodiment, Set it to 0.6.
[0048] When the reward model's word segmenter Word segmenter for target visual language model When they are different, first select the top reward with the highest probability from the reward probability distribution of the reward model. Each reward term In this embodiment, The values can be 5, 10, 20, or 50; the reward lexical units are decoded into text strings, then re-encoded by the word segmenter of the target visual language model, mapping the corresponding reward probabilities to the lexical space of the target visual language model, to obtain... Then, the mapped reward probability distribution and the target probability distribution are fused:
[0049] After normalizing the aligned decoding probability distribution, the term with the highest probability is selected as the next term. And append the term to the currently generated response prefix:
[0050] Repeat the above process until a terminator is generated or the preset response length is reached to obtain the final response.
[0051] With a single NVIDIA A100 80GB graphics processor, greedy decoding, and a batch size of 4, and using LLaVA-1.5-7B as the target model, the average single query inference time of this invention is 1.6 seconds, which is only 0.1 seconds longer than the 1.5 seconds of the basic model.
[0052] In this embodiment, the lightweight autoregressive reward model is decoupled from the target visual language model. Therefore, a reward model with a smaller parameter size and lower training cost can be used to guide the inference process of the target visual language model, which has a larger parameter size and remains frozen. For example, a small reward model can be used to learn a preference for image factual consistency, and this preference information can then be used to guide the word-by-word meta-generation process of a larger-scale target visual language model without retraining the large-scale target visual language model.
[0053] The embodiments described in this specification are merely examples of implementations of the inventive concept. The scope of protection of this invention should not be considered as limited to the specific forms stated in the embodiments. The scope of protection of this invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.
Claims
1. A visual language model alignment method based on lexical-level guided inference, comprising the following steps: S1. Construct a preference dataset; collect image-text samples containing query prompts and images from the visual question-answering dataset; apply various image enhancements to each image-text sample to obtain multiple enhanced images; Each enhanced image and its corresponding query suggestion are input into the target visual language model to generate multiple candidate responses; at the same time, the original image and its corresponding query suggestion are input into the target visual language model to generate the inferior response. The multiple candidate responses are merged to generate a preferred response; The query suggestions, original images, preferred responses, and unpreferred responses are used to form a preference data sample, which is then aggregated into a preference dataset. S2. Train an autoregressive lexical-level reward model; using the preference dataset constructed in step S1, perform preference optimization training on the reward model so that, given the query prompt words, images, and generated text prefixes, the conditional probability of each lexical in the preferred response is higher than the conditional probability of the corresponding lexical in the undesirable response, thereby obtaining an autoregressive lexical-level reward model for representing lexical-level visual preferences. S3. Implement lexical-level guidance during the inference phase; for the query prompts and images to be processed, input the currently generated text prefixes into the target visual language model with frozen parameters and the autoregressive reward model trained in step S2 respectively to obtain the target probability distribution and reward probability distribution of the next word; when the two models use different word segmenters, convert and map the words with probabilities higher than the threshold in the reward probability distribution to the word space of the target visual language model; based on the target probability distribution, the mapped reward probability distribution and the preset guidance coefficient, generate the aligned probability distribution of the next word, and select the next word from it to append to the generated text prefix, repeating the process until a complete response is generated.
2. The visual language model alignment method for inference based on lexical-level guidance as described in claim 1, in step S1, by using a visual question-answering dataset... The image and text samples in the dataset are converted into preference data containing preferred and unpreferred responses, and the preference dataset is constructed. It includes the following steps: S11: Collect image and text samples containing query prompts and images from the visual question-answering dataset; [The sentence is incomplete and requires more context to translate accurately.] Each image and text sample is represented as follows: ,in, For search suggestions, The image is the one corresponding to the query suggestion; for each of the image and text samples, a preset method is used. Image enhancement methods The images were processed separately to obtain a set of enhanced images. ,in, ; S12: Transfer the original image and corresponding query suggestions Input target visual language model Generate inferior response ; the enhanced images described in step S11 and corresponding query suggestions Input the target visual language model respectively Generate candidate responses corresponding to each enhanced image. ; S13: Assign each of the candidate responses The input is concatenated with preset fusion prompts and then fed into the target visual language model to generate an optimal response. The fusion prompts are used to guide the target visual language model to integrate visual information from multiple candidate responses, generating a more complete and consistent preferred response. S14: Search suggestions Original image Optimal response and inferior response Combined into preference data samples And store it in the preference dataset. By iterating through each image and text sample, a preference dataset is obtained for training the autoregressive lexical reward model.
3. The visual language model alignment method for inference based on lexical-level guidance as described in claim 1, step S2 includes: S21: Construct a lightweight autoregressive visual language model as a reward model The word sequence of the response is represented as follows: ,in, Indicates the first Each word element, Indicates the first The response prefixes generated before each word element; the reward model, given the query suggestion words. ,image and the generated reply prefix Under the given conditions, output the next word. conditional probability And based on the conditional probability of each word, the word-level reward for the response is accumulated: in, It is a learnable conditional probability distribution function; S22: Preference dataset constructed in step S1 For the reward model Training is conducted to increase the optimal response. Reply to the inferior option The difference in conditional probabilities between terms allows the reward model to assign higher probabilities to each term in the preferred response; the training loss function of the reward model is: in, For the Sigmoid function, This is a hyperparameter used to adjust the preference strength based on the difference between the optimal and undesirable response probabilities. The preferred response is in the first... The word element at each position, The inferior response is in the first The word element at each position, and The preferred and unpreferred responses were respectively selected in the [number]th ...]. The response prefix before each word element.
4. The visual language model alignment method for inference based on lexical-level guidance as described in claim 1, step S3 includes: S31: Obtain query suggestions to be processed ,image and the currently generated response prefix The target visual language model is frozen by inputting the three parameters respectively. The autoregressive reward model obtained from step S2 training To obtain the target visual language model for the next word element The target probability distribution, and the autoregressive reward model for the next word. The reward probability distribution; S32: Analyze the word segmenter of the target visual language model. Tokenizer with Autoregressive Reward Model Are they the same? If they are different, select the one with the highest probability from the reward probability distribution. Each reward word is decoded into a text string, and then the word segmenter of the target visual language model is used. The text string is re-encoded, and the corresponding reward probability is mapped to the lexical space of the target visual language model; if they are the same, the reward probability distribution output by the reward model is directly adopted. S33: Based on the target probability distribution, the reward probability distribution or the mapped reward probability distribution, and the preset scaling factor... Calculate the aligned decoding probability distribution When the two word segmenters are identical, the aligned decoding probability distribution is as follows: When the two word segmenters are different, the aligned decoding probability distribution is as follows: in, This represents the probability distribution of each word after the original predicted scores of the model output are normalized using the Softmax function. This represents the reward probability distribution of the reward model in its lexical space. Indicates the highest probability of reward. Each reward word element, This represents the reward probability distribution after mapping to the lexical space of the target visual language model; S34: From the aligned decoding probability distribution Choose the word with the highest probability as the next word. and the next term Append to the currently generated response prefix to obtain the updated response prefix. Repeat steps S31 to S34 until a termination word is generated or the preset response length is reached to obtain the final response.
