Training method and device of large visual language model, equipment, medium and product
By employing iterative training and a reason self-calibration mechanism, candidate pairs of the large visual language model are screened and adjusted, solving the problem of discrepancies between the reasons and the facts in the image when the model generates answers. This improves the logical consistency and interpretability of the answers, making it suitable for fields such as content understanding and content moderation.
Patent Information
- Application Number
- CN202510661873.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-21
- Publication Date
- 2026-11-24
AI Technical Summary
When generating answers, large visual language models may give reasons that do not match the facts in the image or lack support from the facts in the image. This may result in reasoning errors or insufficient reasoning, leading to distorted answers and insufficient interpretability. They perform poorly, especially in complex tasks such as visual question answering and content understanding.
By using an iterative training method, multiple candidate pairs of samples generated by the large visual language model are obtained. Candidate pairs with preference differences are selected, and the model parameters are adjusted with the goal of maximizing preference differences. A reason self-calibration mechanism is introduced to improve the logical consistency and interpretability of reasons and answers.
It improves the reasoning ability and interpretability of the large visual language model, and enhances the model's performance in complex tasks, especially in terms of accuracy and interpretability in content understanding and content review scenarios.
Smart Images

Figure CN123159581A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a training method, apparatus, device, medium, and product for a large visual language model. Background Technology
[0002] Driven by multimodal research and the development of large models, Large Vision Language Models (LVLMs) are showing increasing feasibility in various application scenarios such as content understanding, visual question answering, and image parsing.
[0003] In related technologies, images and questions are input into a large visual language model, which directly outputs the corresponding answers. However, while the large visual language model can provide answers based on images and questions, the reasons it generates for those answers may not match the facts in the images, lack supporting facts, or contain reasoning errors or insufficient reasoning, resulting in distorted answers and insufficient interpretability. Summary of the Invention
[0004] This application provides a method, apparatus, device, medium, and product for training a large visual language model. The technical solution is as follows:
[0005] On the one hand, a training method for a large visual language model is provided, the method comprising:
[0006] Obtain N candidate pairs of samples corresponding to the sample input data. The sample input data includes pairs of sample questions and sample images. Each of the N candidate pairs of samples includes a sample reason and a sample answer that match the sample input data. The candidate pairs of samples are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1.
[0007] Determine the first and second candidate sample pairs that meet the screening criteria among the N candidate sample pairs. The first and second candidate sample pairs are candidate pairs with preference differences, and the preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training.
[0008] With the goal of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, the model parameters of the large visual language model after the (t-1)th round of training are adjusted to obtain the large visual language model after the tth round of training.
[0009] In some embodiments, the trained large visual language model is applied to content moderation scenarios, and the method further includes:
[0010] Obtain the audit input data, which includes pairs of audit questions and audit images;
[0011] The audit input data is input into the trained large visual language model to generate audit output data, which includes audit reasons and audit conclusions that match the audit input data.
[0012] On the other hand, a training device for a large visual language model is provided, the device comprising:
[0013] The acquisition module is used to acquire N sample candidate pairs corresponding to the sample input data. The sample input data includes paired sample questions and sample images. Each of the N sample candidate pairs includes a sample reason and a sample answer that match the sample input data. The sample candidate pairs are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1.
[0014] The determination module is used to determine the first and second sample candidate pairs among the N sample candidate pairs that meet the screening conditions. The first and second sample candidate pairs are candidate pairs with preference differences, and the preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training.
[0015] The training module is used to adjust the model parameters of the large visual language model after the (t-1)th round of training with the training objective of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, so as to obtain the large visual language model after the tth round of training.
[0016] On the other hand, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the training method for the large visual language model as described above.
[0017] On the other hand, a computer-readable storage medium is provided that stores a computer program, which is loaded and executed by a processor to implement the training method for the large visual language model as described above.
[0018] On the other hand, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium, wherein a processor retrieves the computer instructions from the computer-readable storage medium, causing the processor to load and execute them to implement the training method for the large visual language model as described above.
[0019] The beneficial effects of the technical solutions provided in this application include at least the following:
[0020] This paper presents a post-training method for a large visual language model based on reason self-calibration. The large visual language model is trained iteratively. For the t-th round of training, N candidate sample pairs generated by the large visual language model after the (t-1)-th round of training are obtained based on the sample input data. Each candidate sample pair includes a matching sample reason and a sample answer. By filtering the N candidate sample pairs, the first and second candidate sample pairs with preference differences are determined. By maximizing the preference difference between the first and second candidate sample pairs, the model parameters of the large visual language model after the (t-1)-th round of training are adjusted, thus obtaining the large visual language model after the t-th round of training. This iterative preference alignment training process introduces the alignment of the relationship between the reason and answer in the question-answering process of the large visual language model after each round of training, which can gradually improve the reasoning ability of the large visual language model after each round of training. This enables the large visual language model after each round of training to improve the correctness and consistency of the reason and answer pairing, enhance the interpretability of the answer, and improve the model performance of the large visual language model. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a block diagram of a computer system provided in an exemplary embodiment;
[0023] Figure 2 This is a schematic diagram illustrating the reasons and answers provided by an exemplary embodiment;
[0024] Figure 3 This is a schematic diagram illustrating related technology training provided in an exemplary embodiment;
[0025] Figure 4 This is a schematic diagram of a training method for a large visual language model provided in an exemplary embodiment;
[0026] Figure 5 This is a flowchart of a training method for a large visual language model provided in an exemplary embodiment;
[0027] Figure 6 This is an exemplary embodiment of the application of a large visual language model.
[0028] Figure 7This is an architecture diagram of a training method for a large visual language model provided by an exemplary embodiment;
[0029] Figure 8 This is a framework diagram of a training method for a large visual language model provided by an exemplary embodiment;
[0030] Figure 9 This is a block diagram of a training apparatus for a large visual language model provided in an exemplary embodiment;
[0031] Figure 10 This is a structural block diagram of a computer device provided in an exemplary embodiment. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0033] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0034] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a,” “the,” and “the” used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
[0035] It should be understood that although the terms first, second, etc., may be used in this application to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, a first parameter may also be referred to as a second parameter, and similarly, a second parameter may also be referred to as a first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."
[0036] It should be noted that this application may display prompt interfaces, pop-ups, or output voice prompts before and during the collection of user data. These prompt interfaces, pop-ups, or voice prompts are used to inform the user that their data is being collected. This ensures that the application only begins the steps for collecting user data after receiving confirmation from the user regarding the prompt interface or pop-up. Otherwise, if no confirmation is received from the user, the steps for collecting user data end, and no user data is collected. In other words, all user data collected in this application is collected with the user's consent and authorization, and the collection, use, and processing of related user data must comply with the relevant laws, regulations, and standards of the relevant countries and regions.
[0037] First, let me briefly introduce the terms used in the embodiments of this application:
[0038] Large Vision-Language Model (LVLM): This refers to a model that, based on the Large Language Model (LLM), introduces an additional Vision Encoder to achieve understanding of visual modalities such as images or videos, and performs multimodal alignment and unified modeling with the text modal. It can handle tasks in various application scenarios such as image-text dialogue, visual question answering, content understanding, and image parsing. In this embodiment, the input data of the LVLM are: instructions / questions and images, and the output data are: reasons and answers.
[0039] Post-training refers to a training method that further refines feature and preference alignment on a model that has already undergone basic multimodal pre-training and initial instruction fine-tuning, in order to enhance its performance on a specific task or improve its model characteristics. The training method for the large visual language model in this embodiment is a type of post-training method.
[0040] Preference Alignment: Based on contrastive loss or preference loss, such as Direct Preference Optimization (DPO) techniques, the model parameters of the large visual language model are adjusted so that the large visual language model tends to output a "relatively better" answer / response or reason. In this embodiment, it is mainly used to align the correctness and consistency of "reason-answer" pairings.
[0041] Vision-Text Alignment: This refers to the establishment of accurate semantic mapping and consistency between visual and textual modalities by a large visual language model. For example, matching visual elements in images with textual descriptions to ensure that visual information such as images and videos matches the corresponding textual descriptions or answers.
[0042] Self-Rationale Calibration (SRC): This is the post-training method of the model in this embodiment. By introducing the alignment of the relationship between the "rationale" and "answer" in the process of the large visual language model answering questions, iteratively improves the interpretability and task performance of the large visual language model.
[0043] Low-Rank Adaptation (LoRA) fine-tuning technique: This is an efficient model fine-tuning method. By introducing low-rank matrix factorization, it updates only some parameters of the pre-trained large visual language model in low rank while keeping the core model parameters unchanged, thereby achieving lightweight model adaptation.
[0044] Figure 1 This is a block diagram of a computer system provided as an exemplary embodiment. Computer system 100 can implement a system architecture for a training method of a large visual language model. Computer system 100 includes: a terminal 120 and a server 140.
[0045] Terminal 120 can be an electronic device such as a mobile phone, tablet computer, vehicle terminal (vehicle system), wearable device, PC (Personal Computer), unmanned reservation terminal, smart home appliance, smart voice interaction device, unmanned vending terminal, etc. In some embodiments, terminal 120 stores a large visual language model or supports calling the large visual language model. Alternatively, a client running a target application can also be installed on terminal 120. The target application can be an application for the large visual language model, an application for training and / or using the large visual language model, or an application that provides training and / or using functions for the large visual language model; there is no limitation on this. In addition, the form of the target application is not limited, including but not limited to Apps (Applications), applets, etc. installed on terminal 120, and can also be in the form of a web page.
[0046] Server 140 can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. In some embodiments, server 140 stores a large visual language model or supports terminal 120 invoking the large visual language model from server 140. Alternatively, server 140 can also be a backend server for the aforementioned target application, providing backend services to the client of the target application. In some optional embodiments, server 140 can also be implemented as a node in a blockchain system.
[0047] Terminal 120 and server 140 can communicate via a network, such as a wired or wireless network.
[0048] The training method for a large visual language model provided in this application embodiment can be executed by a computer device, which refers to an electronic device with data computing, processing, and storage capabilities. Figure 1 Taking the implementation environment of the scheme shown as an example, the training method of the large visual language model can be executed by the terminal 120. For example, the client of the target application installed and running in the terminal 120 can execute the training method of the large visual language model, or the server 140 can execute the training method of the large visual language model, or the terminal 120 and the server 140 can interact and cooperate to execute it. There is no limitation on this.
[0049] Those skilled in the art will understand that the number of terminals 120 can be more or less. For example, there may be only one terminal 120, or there may be dozens or hundreds of terminals 120, or more. The embodiments of this application do not limit the number of terminals 120 or the type of device.
[0050] Driven by multimodal research and the development of large models, large visual language models are showing increasing feasibility in various application scenarios such as content understanding, visual question answering, and image parsing.
[0051] In related technologies, images and questions are input into a large visual language model, which directly outputs the corresponding answer. However, while the large visual language model can provide an answer based on the image and question, the reasons generated for that answer still suffer from mismatches, fallacies, or insufficient reasoning. For example, the reason may not match the facts in the image, lack supporting facts, or contain reasoning errors or inadequacies. This leads to distorted answers, insufficient interpretability, and may adversely affect practical applications, such as the need for explanation and traceability in content understanding. For example, referencing... Figure 2As shown in (1), for an image of a tent, the question is: What color is the tent? The answer is: The tent is blue and white. The reasoning is that the tent's color scheme is blue and white, with blue covering most of the tent and white emphasizing the edges and roof. This is a typical image comprehension error. (Reference) Figure 2 As shown in (2), for a clock image, the question is: How many sides does this clock have? The answer is: This clock has 4 sides. The reasoning is: The clock in the image has a round dial and a square base. The round dial indicates it has four sides. The square base further confirms that the clock has four sides. This is a typical example of insufficient reasoning.
[0052] In related technologies, post-training methods for large visual language models often focus on "image-text alignment" itself or utilize preference alignment to suppress situations where the model output contradicts visual information. In large visual language models, the inherent mismatch between the visual and textual modalities—for example, text descriptions failing to accurately correspond to image visual elements—has prompted many studies to employ methods such as direct preference optimization to alleviate this problem. For example, referencing... Figure 3 Some studies construct image-text pairs to obtain image-text pairs, manually labeling high-quality and low-quality descriptions to determine good / bad image-text pairs, or automatically labeling and scoring the image-text pairs to build a preference dataset. They then use techniques such as direct preference optimization or reinforcement learning to train the original visual language model for preference optimization. Other studies introduce large-scale model teachers, using a larger-scale language model as the teacher to label or score the generated image-text descriptions, transferring knowledge to the student model through knowledge distillation. However, these methods typically only focus on the correctness of the answer or the accuracy of the image-text description, neglecting the consistency between the reasoning and the answer. For complex tasks, such as visual question answering and content understanding, focusing solely on the correctness of the answer cannot ensure the internal logical consistency of the model; the reasoning may still be fictitious or insufficient. Furthermore, some studies attempt to instruct the large visual language model to generate chain-of-thought (CoT) during the training phase through prompt engineering, and then use knowledge distillation or reinforcement learning for multiple rounds of iterative optimization. However, these methods typically rely on large-scale, high-quality inference path datasets and have high requirements in terms of human resources and computing power. They also face the problem of noisy learning caused by excessively long inference paths.
[0053] In summary, the relevant technologies have at least the following problems:
[0054] 1. Post-training methods for large visual language models are limited to vision-text alignment, neglecting the logical consistency between reason and answer: Preference alignment methods are mainly aimed at image captioning tasks, focusing on the matching of visual elements and text descriptions (vision-text alignment), but they do not solve the problem of logical mismatch between the "reason" and "answer" generated by the model in application scenarios such as visual question answering. For example, a large visual language model may generate the correct answer, but with irrelevant or contradictory reasoning processes / reasons, resulting in insufficient interpretability of the answer.
[0055] 2. CoT (Coarse Language Transmission) learning relies on large-scale data and long-path inference, resulting in insufficient lightweight adaptability: The CoT method uses large datasets, with hundreds of thousands to tens of millions of samples, to train a large visual language model to generate lengthy inference paths. This leads to high computational costs and makes it difficult to adapt to business scenarios with high responsiveness requirements, such as content moderation. Furthermore, its inference path generation relies on explicit prompt templates, making it difficult to autonomously adapt to complex and ever-changing real-world task requirements.
[0056] 3. Lack of an efficient automatic comparison mechanism for multiple candidate outputs: Under a visual instruction, a large visual language model may output multiple "answer-reason" candidate results. Related technologies mostly rely on manual review or a single scoring model to evaluate these multiple candidate results, making it difficult to compare these multiple candidate results and identify which reason is more reasonable.
[0057] 4. Insufficient adaptability to business scenarios: In specific scenarios with high requirements for content understanding, such as content review scenarios, the visual language models of related technologies often generate review reasons with ambiguity or incomplete reasoning chains, which makes it difficult to meet the traceability and credibility required for manual review, thus limiting the effectiveness of model deployment in actual business scenarios.
[0058] This embodiment provides a training method for a large visual language model, specifically a post-training method based on reason self-calibration. Its core objective is not to instruct the large visual language model to generate a chain of thought (CoT) reasoning process / reason, but rather to improve the model's ability to ensure consistency between its output and the final answer, thereby enhancing the overall performance and interpretability of the answer. Specifically, it iteratively scores the "reason-answer" alignment and compares relative preferences among these candidate reasons, ultimately calibrating and optimizing the model's internal reasoning process. The core idea is that for the same visual input and instruction / question, the large visual language model often has several feasible outputs. Some output reasons have a higher match with the answer, while others are unreasonable or inconsistent with the answer. By selecting the best / worst candidate pairs, the model is further trained on preference alignment, thereby improving its overall performance and interpretability. In content understanding scenarios, the large visual language model is particularly needed to provide reasonable explanations for "image understanding," such as identifying key regions in an image and explaining the basis for judgment. This embodiment enables the final deployed large visual language model to have a stable and consistent reasoning chain / reason when providing understanding answers / conclusions, thereby better assisting human understanding, significantly reducing content understanding errors or misjudgments, and improving the efficiency and reliability of content understanding.
[0059] In summary, the training method for the large visual language model in this embodiment addresses at least the following issues:
[0060] 1. Constructing a Reason-Answer Alignment Preference Optimization Paradigm: This embodiment uses an iterative training paradigm to perform bidirectional scoring and preference alignment on candidate "reason-answer" pairs generated by the large visual language model. While maintaining answer accuracy, it significantly improves the logical consistency and interpretability between reasons and answers. This optimization paradigm is not only applicable to content understanding scenarios but can also be widely applied to knowledge reasoning, question answering systems, and other fields to improve the performance of large visual language models in complex tasks.
[0061] 2. Efficient multi-candidate comparison and adaptive fusion: By comparing multiple candidate outputs for the same question pairwise and weighting them with confidence, the large visual language model can efficiently identify the quality differences between the good and bad reasons and the final answer, select the relatively best / worst sample candidate pairs, and perform preference optimization for reason-answer alignment.
[0062] 3. Explainable Content Understanding and Generation: In content understanding and generation tasks, large visual language models typically output answers directly, lacking explanation of the answer generation process. This embodiment introduces a reason generation mechanism, enabling the large visual language model to generate concise and logically consistent reasons while outputting the answer, enhancing explainability. This feature is not only applicable to content understanding business scenarios but can also be widely applied in fields such as educational assistance and medical diagnosis, providing a reference for subsequent manual review or decision-making.
[0063] As an example, Figure 4 This is a schematic diagram illustrating a training method for a large visual language model provided in an exemplary embodiment. The method is described using an example where it is executed by a computer device, which can be... Figure 1 The terminal 120 and / or server 140 shown store the large visual language model 200. The steps of this method are briefly described below:
[0064] Step 1: Obtain N candidate sample pairs corresponding to the input data. The input data includes paired sample questions and sample images. Each of the N candidate sample pairs includes a sample reason and a sample answer that match the input data. The candidate sample pairs are generated by the large visual language model after training for the (t-1)th round based on the input data, where N is greater than 1 and t is greater than 1. (Reference) Figure 4 The sample input data 10 includes a sample question and a sample image. For example, the sample question is: "What type of food is in the white plate?". The sample image is a white plate with three pieces of food. Using the large visual language model 200 trained in the (t-1)th round, N sample candidate pairs 20 are generated based on the sample input data 10. Each sample candidate pair includes a sample reason and a sample answer that match the sample input data 10. For example, a sample reason is: "There are two pieces of food on the plate, one looks like a muffin or cookie, and the other looks like a sandwich or similar food...".
[0065] Step 2: Determine the first and second candidate sample pairs from the N candidate sample pairs that meet the screening criteria. The first and second candidate sample pairs are candidate pairs with preference differences, and the preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training; refer to Figure 4The process involves identifying a first candidate pair 21 and a second candidate pair 22 from N candidate pairs 20 that meet the selection criteria. The first candidate pair 21 is the best candidate pair among the N candidate pairs 20 compared to the others, and the second candidate pair 22 is the worst candidate pair among the N candidate pairs 20 compared to the others. For example, the rationale for the first candidate pair 21 might be "The image shows a white plate with three different things on it: a round, seemingly tacky food item, similar to a muffin or cookie...", while the rationale for the second candidate pair 22 might be "There are two pieces of food on the plate, one that looks like a muffin or cookie, and the other that looks like a sandwich...". It is clear that the rationale for the first candidate pair 21 is more consistent with the image facts, while the rationale for the second candidate pair 22 is clearly inconsistent with the image facts. The image facts are characterized by at least one of the following: image elements, image semantics, image style, image subject, image title, image source, and image author.
[0066] Step 3: With the training objective of maximizing the preference difference between the first and second candidate sample pairs, adjust the model parameters of the large visual language model after the (t-1)th round of training to obtain the large visual language model after the tth round of training; (Refer to...) Figure 4 With the training objective of maximizing the preference difference between the first sample candidate pair 21 and the second sample candidate pair 22, the model parameters of the large visual language model 200 after the (t-1)th round of training are adjusted to obtain the large visual language model 200 after the tth round of training. The trained large visual language model 200 can be obtained after the training ends / the iteration ends.
[0067] Figure 5 This is a flowchart illustrating a training method for a large visual language model provided in an exemplary embodiment. The method is explained using an example where it is executed by a computer device, which can be... Figure 1 The terminal 120 and / or server 140 are shown. The method includes at least a portion of steps 320, 340, and 360:
[0068] Step 320: Obtain N candidate pairs of samples corresponding to the sample input data. The sample input data includes paired sample questions and sample images. Each of the N candidate pairs of samples includes a sample reason and a sample answer that match the sample input data. The candidate pairs of samples are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1.
[0069] The Large Vision-Language Model (LVLM) is a model that, based on the Large Language Model (LLM), introduces an additional vision encoder to understand visual modalities such as images or videos. It also performs multimodal alignment and unified modeling with the text modal, enabling tasks in various application scenarios such as text-to-image dialogue, visual question answering, content understanding, and image parsing. In this embodiment, the input data of the LVLM are: instructions / questions and images, and the output data are: reasons and answers. The instructions / questions, reasons, and answers represent the text modalities, while the images represent the visual modalities.
[0070] The large visual language model is trained iteratively. For the first round of training, the model parameters of the original large visual language model are fine-tuned, and the fine-tuned large visual language model is used as the large visual language model after the first round of training. For the second round of training, it is performed based on the large visual language model after the first round of training. For the t-th round of training, it is performed based on the large visual language model after the (t-1)-th round of training, where t is greater than 1. It should also be noted that the original large visual language model is a large visual language model that has already completed multimodal pre-training. The method in this embodiment is not training from scratch, but rather a post-training method.
[0071] The sample input data is the data used for training the large visual language model. The sample input data used in each round of training for the large visual language model can be different or partially different. The sample input data includes pairs of sample questions and sample images, where the sample question is related to / matches the sample image. The sample question is a question about a visual element in the sample image, and the answer can be directly obtained from the sample image; alternatively, the sample question is a question derived from the sample image, and the answer can be inferred from the sample image. For example, if the sample image is a tent image, the sample question might be: "What color is the tent?", or "I pitched a tent at a campsite at the foot of the mountain; could you help me write a camping journal?".
[0072] The large visual language model trained in round t-1 is used to generate N candidate sample pairs based on the sample input data. These N candidate sample pairs can also be understood as the sample output data of the large visual language model trained in round t-1, where N is greater than 1. Each of the N candidate sample pairs includes a sample reason and a sample answer that match the sample input data. It is understood that the N candidate sample pairs are diverse; the sample reason and sample answer in each candidate pair can be correct, sufficient, and reasonable, or incorrect, insufficient, and unreasonable. The sample reasons and sample answers in different candidate sample pairs can be semantically similar, semantically completely different, or semantically partially similar. The N candidate sample pairs also need to be filtered according to certain rules before use.
[0073] Step 340: Determine the first and second candidate samples among the N candidate sample pairs that meet the screening criteria. The first and second candidate samples are candidate pairs with preference differences. The preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training.
[0074] The first and second candidate pairs are two candidate pairs from N candidate pairs that meet the selection criteria. The first candidate pair is the optimal candidate pair compared to the others, as its content is more accurate, reasonable, and sufficient. The second candidate pair is the worst candidate pair compared to the others, as its content is less accurate, reasonable, and sufficient. Therefore, the first and second candidate pairs are candidate pairs with a preference difference. This preference indicates the data generation tendency of the large visual language model after training round t. The large visual language model after training round t should tend to output the first candidate pair and not tend to output the second candidate pair.
[0075] The first and second candidate pairs are obtained by filtering N candidate pairs using at least one of the following methods: filtering by scoring and filtering by confidence. The scoring is used to obtain a winning score for each of the N candidate pairs, indicating the relative superiority of each candidate pair compared to the others. The confidence score indicates the large visual language model's own generation preference for each candidate pair and also indicates the generation probability of each candidate pair's association. The difference in preference between the first and second candidate pairs is characterized by at least one of the following parameters: winning score and confidence score.
[0076] Step 360: With the goal of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, adjust the model parameters of the large visual language model after the (t-1)th round of training to obtain the large visual language model after the tth round of training.
[0077] In this embodiment, the training objective is to maximize the preference difference between the first and second candidate sample pairs. The model parameters of the large visual language model after the (t-1)th training round are adjusted to obtain the large visual language model after the tth training round. Next, t is updated to t+1, and training continues for the t+1th round until the training termination condition is met, resulting in the trained large visual language model. The training termination condition includes at least one of the following: reaching the maximum number of iterations or reaching the maximum model accuracy.
[0078] In summary, the training method for the large visual language model provided in this application involves a computer device acquiring N candidate sample pairs corresponding to sample input data. The sample input data includes paired sample questions and sample images. Each of the N candidate sample pairs includes a sample reason and a sample answer that match the sample input data. The candidate sample pairs are generated by the large visual language model after training for the (t-1)th round based on the sample input data, where N is greater than 1 and t is greater than 1. The method then determines the first and second candidate sample pairs among the N candidate sample pairs that meet the selection criteria. The first and second candidate sample pairs are candidate pairs with preference differences, where the preference indicates the data generation tendency of the large visual language model after training for the tth round. Finally, the method adjusts the model parameters of the large visual language model after training for the (t-1)th round with the training objective of maximizing the preference difference between the first and second candidate sample pairs, thus obtaining the large visual language model after training for the tth round. Accordingly, a post-training method for a large visual language model based on reason self-calibration is provided. The large visual language model is trained iteratively. For the t-th round of training, N sample candidate pairs generated by the large visual language model after the (t-1)-th round of training are obtained based on the sample input data. Each sample candidate pair includes a matching sample reason and a sample answer. By filtering the N sample candidate pairs, the first and second sample candidate pairs with preference differences are determined. By maximizing the preference difference between the first and second sample candidate pairs, the model parameters of the large visual language model after the (t-1)-th round of training are adjusted, and the large visual language model after the t-th round of training can be obtained. This iterative preference alignment training process introduces the alignment of the relationship between the reason and the answer in the question-answering process of the large visual language model after each round of training, which can gradually improve the reasoning ability of the large visual language model after each round of training. This enables the large visual language model after each round of training to improve the correctness and consistency of the reason and answer pairing, enhance the interpretability of the answer, and improve the model performance of the large visual language model.
[0079] In some embodiments, step 360 is implemented as steps 362 and 364:
[0080] Step 362: Determine the loss function based on the first and second candidate sample pairs;
[0081] Step 364: With minimizing the loss function as the training objective, adjust the model parameters of the large visual language model after the (t-1)th round of training to obtain the large visual language model after the tth round of training.
[0082] The loss function is determined based on the first and second candidate sample pairs, which are also called preference samples. The training method in this embodiment is direct preference optimization, and the loss function is contrastive loss or preference loss. Based on this loss function, the model parameters of the large visual language model are adjusted so that the large visual language model tends to output a "relatively better" answer / response or reason, which corresponds to the first candidate sample pair in this embodiment. The large visual language model in round t is based on the large visual language model trained in round t-1, which is an iterative training process used to gradually improve the reasoning ability and interpretability of the large visual language model after each round of training.
[0083] For example, a loss function is determined based on the first and second candidate sample pairs. The model parameters of the large visual language model after training in round t-1 are adjusted with minimizing the loss function as the training objective, resulting in the large visual language model after training in round t.
[0084] This embodiment provides a specific training method for the large visual language model in the t-th round, realizing preference alignment training, which makes the large visual language model tend to output the "relatively better" first sample candidate pair. It also improves the interpretability and task performance of the large visual language model by introducing the relationship alignment between its own reasons and answers in the process of answering questions.
[0085] In some embodiments, the method for determining the loss function is specifically implemented as steps 3621, 3622, 3623, 3624, and 3625:
[0086] Step 3621: Determine, given the sample input data, the first probability ratio corresponding to the probability of the large visual language model after training for the tth round and the second probability ratio corresponding to the probability of the large visual language model after training for the (t-1)th round, respectively;
[0087] Step 3622: Take the logarithm of the first probability ratio and scale it using a scaling factor to obtain the first logarithmic ratio; and take the logarithm of the second probability ratio and scale it using a scaling factor to obtain the second logarithmic ratio.
[0088] Step 3623: Subtract the second logarithmic ratio from the first logarithmic ratio to obtain the difference in logarithmic ratios;
[0089] Step 3624: Map the logarithmic ratio difference using an activation function and take the logarithm to obtain the mapped difference;
[0090] Step 3625: Determine the loss function based on the negative value of the expected value corresponding to the mapping difference.
[0091] The sample input data includes sample images and sample questions; this sample input data is also called multimodal input data. The activation function in this embodiment includes the sigmoid function. The expectation is also known as the mathematical expectation. In some embodiments, the loss function L is expressed as follows:
[0092]
[0093] Where, π t π represents the model parameters in the t-th iteration. t-1 Let y represent the model parameters in the (t-1)th iteration. w This represents the optimal sample candidate pair, corresponding to the first sample candidate pair in this embodiment, y l This represents the worst sample candidate pair, corresponding to the second sample candidate pair in this embodiment. x represents the sample input data, β is the scaling factor, and σ(·) represents the sigmoid function. This is the first probability ratio. The first logarithmic ratio, This is the second probability ratio. The second logarithmic ratio, The difference between the logarithmic ratios. Let E be the mapping difference, and E be the expectation.
[0094] This embodiment provides a specific loss function for the large visual language model in round t, achieving preference alignment training, which can progressively improve the reasoning ability and interpretability of the generated answers of the large visual language model. This loss function ensures that the large visual language model tends to output higher-quality first-sample candidate pairs by maximizing the preference difference between the first and second sample candidate pairs.
[0095] In some embodiments, the selection of N candidate sample pairs is determined based on the final winning score. Step 340 is specifically implemented as steps 342 and 344:
[0096] Step 342: Score each of the N candidate sample pairs to obtain the final winning score for each candidate sample pair;
[0097] Step 344: The sample candidate pair with the highest final winning score is determined as the first sample candidate pair, and the sample candidate pair with the lowest final winning score is determined as the second sample candidate pair.
[0098] The scoring in this embodiment is used to determine the final winning score for each of the N candidate sample pairs. Each candidate sample pair has a corresponding final winning score, which is obtained based on the winning score and / or confidence level, and is used to indicate the quality of the candidate sample pair.
[0099] For example, each of the N candidate pairs is scored to obtain a final winning score for each candidate pair. The candidate pair with the highest final winning score is determined as the first candidate pair, and the candidate pair with the lowest final winning score is determined as the second candidate pair. Generally, there is one first candidate pair and one second candidate pair. If there are candidates with the same final winning score, one can be selected through manual screening, or by selecting the candidate with the highest winning score as a benchmark, or by selecting the candidate with the highest confidence level as a benchmark, or by setting other screening methods to select one; there are no restrictions on this.
[0100] This embodiment provides a specific method for determining the first and second sample candidate pairs, which can accurately and quickly determine the relatively optimal first sample candidate pair and the relatively worst second sample candidate pair from N sample candidate pairs. This is beneficial for the subsequent preference alignment training process and improves training efficiency.
[0101] In some embodiments, the final winning score is obtained based on the winning score and confidence level, specifically including the following steps: determining the winning score based on a two-way scoring method; determining the confidence level; and performing a weighted summation based on a confidence level weighting mechanism. Specifically, step 342 is implemented as steps 3421, 3422, and 3423:
[0102] Step 3421: Perform bidirectional scoring on every two pairs of N candidate pairs to obtain a winning score for each candidate pair. The winning score is used to indicate the relative superiority of each candidate pair relative to other candidate pairs.
[0103] Step 3422: Determine the confidence level of each candidate sample pair;
[0104] Step 3423: Perform a weighted summation based on the score and confidence level of each candidate sample pair to obtain the final winning score for each candidate sample pair.
[0105] Two-way scoring is a method of scoring every two candidate pairs of N candidate pairs twice, also known as pairwise two-way scoring. The winning score for each candidate pair is determined based on that candidate pair and any of the other N candidate pairs; the winning score indicates the relative superiority of each candidate pair compared to the other candidate pairs. It should also be noted that each candidate pair can also be compared to itself, in which case the winning score can be 0.
[0106] The confidence score indicates the large visual language model's own generation preference for each candidate pair of samples, and also indicates the generation probability of each candidate pair being associated. Weighted summation is a method of calculating the sum after assigning weight factors to the winning score and confidence score respectively. In some embodiments, considering the challenge of potential "range and size inconsistencies" in the winning score and confidence score of each candidate pair, a sorting and mapping process is performed before performing weighted summation on the winning score and confidence score.
[0107] For example, bidirectional scoring is performed on every two candidate pairs of N candidate pairs to obtain a winning score for each candidate pair, which is used to indicate the relative superiority of each candidate pair relative to other candidate pairs; the confidence level of each candidate pair is determined; and a weighted sum is performed based on the winning score and confidence level of each candidate pair to obtain the final winning score of each candidate pair.
[0108] This embodiment provides a method for calculating the final winning score of each sample candidate pair, which can accurately evaluate the quality of each sample candidate pair and provide more reliable first and second sample candidate pairs for subsequent training processes.
[0109] In some embodiments, for calculating the winning score, specifically, for the i-th sample candidate pair among N sample candidate pairs, where i is greater than 0, step 3421 is implemented as steps 34211, 34212, and 34213:
[0110] Step 34211: Based on the scoring model, the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair to obtain the first score; and the j-th sample candidate pair is taken as the main candidate pair and the i-th sample candidate pair is taken as the comparison candidate pair to obtain the second score; the j-th sample candidate pair is any sample candidate pair among the N sample candidate pairs, and j is greater than 0;
[0111] Step 34212: Subtract the second score from the first score to obtain the score difference;
[0112] Step 34213: Accumulate the j score differences corresponding to the i-th sample candidate pair to obtain the winning score of the i-th sample candidate pair.
[0113] The scoring model (R-Scorer) is a large language model-based scoring model designed in this embodiment, specifically for performing relative quality comparisons / pairwise scoring comparisons on candidate pairs. The scoring model employs a two-way scoring strategy to ensure fairness and accuracy. Specifically, for candidate pair A and any candidate pair B, the scoring model performs two scoring operations: ① In the first scoring, candidate pair A is used as the primary candidate pair and candidate pair B as the comparison candidate pair, resulting in a first score; ② In the second scoring, candidate pair B is used as the primary candidate pair and candidate pair A as the comparison candidate pair, resulting in a second score.
[0114] The scoring rules of the scoring model include at least one of the following:
[0115] (1) The sample answers in the sample candidate pairs are aligned with the preset reference answers.
[0116] (2) The sample reason in the sample candidate pair does not contain content that does not exist in the sample image.
[0117] (3) The semantic support of the sample reasons in the sample candidate pairs is used to generate sample answers.
[0118] In some embodiments, the score range for candidate sample pairs is ± a preset value, for example, the preset value may be set to 5. The symbol is used to indicate which candidate sample pair is better.
[0119] When candidate pair A is the primary candidate pair and candidate pair B is the comparison pair: if candidate pair A is superior to candidate pair B, the first score is positive (close to the positive preset value); if candidate pair A is inferior to candidate pair B, the first score is negative (close to the negative preset value); if candidate pair A and candidate pair B are equal in quality, the first score is 0. If candidate pair A meets all three scoring rules, while candidate pair B does not meet all three rules or only meets some of them, then candidate pair A is superior to candidate pair B.
[0120] When candidate pair B is the primary candidate pair and candidate pair A is the comparison pair: if candidate pair B is superior to candidate pair A, the second score is positive; if candidate pair B is inferior to candidate pair A, the second score is negative; if candidate pair B and candidate pair A are equally superior, the second score is 0. It is understandable that the absolute values of the first and second scores can be the same or different, depending on the specific output value of the scoring model.
[0121] In some embodiments, the input prompts for the scoring model are:
[0122] You are the precise evaluator of candidate pair quality. Each sample candidate pair has two parts: reason and answer. Your task is to compare candidate pair A and candidate pair B based on the question, image facts, and reference answer in the sample input data. Candidate pair A is the primary candidate pair, and candidate pair B is the comparison pair.
[0123] Please evaluate from the following perspectives: (1) The sample answer in the sample candidate pair must be aligned with the reference answer. (2) Does the sample reason in the sample candidate pair contain content that does not exist in the sample image? (3) Does the semantics of the sample reason in the sample candidate pair support the generation of the sample answer?
[0124] Scoring criteria: The comparison score ranges from -5 to 5. The sign of the score must clearly reflect which response is better: if A is better than B, a positive value (close to 5) must be assigned. If B is better than A, a negative value (close to -5) must be assigned.
[0125] Return: Please evaluate your answer in one sentence first, and return the final score at the end.
[0126] Example: (1) A is better than B, with a positive score: Candidate pair A correctly describes xxx, which is visible in the image, while candidate pair B inaccurately describes the counterfactual xxx. Therefore, candidate pair A is more accurate and reliable. B is better than A, with a negative score: Candidate pair A incorrectly describes xxx, which is not visible in the image, while candidate pair B accurately describes xxx without any content that violates the facts of the image. Therefore, candidate pair B is more accurate and reliable.
[0127] In this embodiment, the above-mentioned candidate pair A is the i-th sample candidate pair, and the above-mentioned candidate pair B is the j-th sample candidate pair.
[0128] If the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair, and the sample answer in the i-th sample candidate pair is aligned with the preset reference answer, and the sample reason in the i-th sample candidate pair does not contain content that does not exist in the sample question, and the semantics of the sample reason in the i-th sample candidate pair supports the sample answer, then the i-th sample candidate pair is determined to be superior to the j-th sample candidate pair, and the first score is positive; otherwise, the first score is negative.
[0129] If the j-th sample candidate pair is taken as the main candidate pair and the ith sample candidate pair is taken as the comparison candidate pair, and the sample answer in the j-th sample candidate pair is aligned with the preset reference answer, and the sample reason in the j-th sample candidate pair does not contain content that does not exist in the sample question, and the semantics of the sample reason in the j-th sample candidate pair supports the sample answer, then the j-th sample candidate pair is determined to be superior to the ith sample candidate pair, and the second score is positive; otherwise, the second score is negative.
[0130] In some embodiments, after completing N(N-1) pairwise scoring processes, optionally, a scoring matrix M∈R can also be constructed. N×N , of which M i,j =s i,j M i,j It is the value in the i-th row and j-th column of the score matrix, s i,j The first score is obtained by using the i-th sample candidate pair as the main candidate pair and the j-th sample candidate pair as the comparison candidate pair. j,i =s j,i M j,i It is the value in the j-th row and i-th column of the score matrix, s j,i The second score is obtained by using the j-th candidate sample pair as the primary candidate pair and the i-th candidate sample pair as the comparison candidate pair. The first score is subtracted from the second score to obtain the score difference; the sum of the j score differences corresponding to the i-th candidate sample pair yields the winning score for the i-th candidate sample pair. After obtaining the score matrix M, the i-th candidate sample pair C is defined. i The winning score w relative to other sample candidate pairs i for:
[0131]
[0132] Among them, M i,j M is the value in the i-th row and j-th column of the score matrix, representing the first score obtained with the i-th sample candidate pair as the primary candidate pair and the j-th sample candidate pair as the comparison candidate pair; j,i This is the value in the j-th row and i-th column of the score matrix. It represents the second score obtained by using the j-th sample candidate pair as the primary candidate pair and the i-th sample candidate pair as the comparison candidate pair. The winning score is w. i Used to indicate the i-th sample candidate pair C i The relative superiority of other sample candidate pairs among N sample candidate pairs.
[0133] This embodiment provides a method for performing pairwise bidirectional scoring through a scoring model, as well as specific scoring rules for the scoring model. This ensures the fairness and accuracy of the scoring, and the winning score of each sample candidate pair can characterize the relative superiority of that sample candidate pair compared to other sample candidate pairs among the N sample candidate pairs, making the characterization more accurate.
[0134] In some embodiments, since multiple candidate sample pairs may have similar or identical quality, this may lead to situations where winning scores are the same. This embodiment further introduces a confidence score to ensure that the selected candidate sample pairs not only have high relative quality but also conform to the generation preferences of the large visual language model itself. Specifically, for the calculation of the confidence score, for the i-th candidate sample pair among N candidate sample pairs, where i is greater than 0, step 3422 is implemented as steps 34221 and 34222:
[0135] Step 34221: Determine the number of sentences in the i-th sample candidate pair and the number of sentences for each sentence;
[0136] Step 34222: Multiply the conditional probabilities corresponding to each sentence in the i-th sample candidate pair to obtain the confidence level of the i-th sample candidate pair; where the conditional probability corresponding to the m-th sentence in the i-th sample candidate pair is the probability of generating the m-th sentence given the sample input data and the first m-1 sentences, where m is greater than or equal to 1.
[0137] Since each candidate sample pair includes a sample reason and a sample answer, the number of sentences is the sum of the number of sentences in the sample reason and the sample answer. Here, a series of words ending with a period are considered a single sentence. The confidence score of the i-th candidate sample pair is obtained by performing a cumulative product of the conditional probabilities of each sentence in the i-th candidate sample pair. Let the i-th candidate sample pair C... i confidence level p i Defined as:
[0138]
[0139] Where, len(C i ) represents the i-th sample candidate pair C i The number of sentences in the input data, x represents the sample input data, i.e., multimodal input data, including sample images and sample questions, s m Let C represent the i-th sample candidate pair. i The m-th sentence in the sequence. s1, s2, ..., s m-1 The i-th sample candidate pair C is represented sequentially. i The first m-1 sentences in the text, P(s m |x,s1,s2,…,s m-1 ) is the conditional probability corresponding to the m-th sentence in the i-th candidate sample pair. Confidence level p i The higher the value, the more likely the large visual language model is to select that sample candidate pair as its output / response.
[0140] This embodiment provides a method for determining the confidence level of each sample candidate pair. This confidence level can characterize the large visual language model's own generation preference for each sample candidate pair, and can provide additional probabilistic basis for the large visual language model during the preference alignment training process.
[0141] In some embodiments, since directly combining the winning score and confidence of the i-th sample candidate pair presents a challenge of "range and scale inconsistency", this embodiment first performs a mapping on the winning score and confidence to convert them into uniform ranking-based values, and then performs a weighted summation of the two.
[0142] Specifically, for the i-th sample candidate pair among the N sample candidate pairs, where i is greater than 0, step 3423 is implemented as steps 34231, 34232, and 34233:
[0143] Step 34231: Transform the winning score of the i-th sample candidate pair to obtain the mapped winning score;
[0144] Step 34232: Transform the confidence of the i-th sample candidate pair to obtain the mapped confidence.
[0145] Step 34233: Using a preset weighting factor, perform a weighted summation of the mapping winning score and mapping confidence of the i-th sample candidate pair to obtain the final winning score of the i-th sample candidate pair.
[0146] Mapped winning score is the value obtained by transforming the winning score, and mapped confidence score is the value obtained by transforming the confidence score. Both mapped winning score and mapped confidence score are sorted values. The weighting factor is preset and can be set according to actual technical needs.
[0147] For example, the winning score of the i-th sample candidate pair is transformed to obtain the mapped winning score; the confidence of the i-th sample candidate pair is transformed to obtain the mapped confidence; and the mapped winning score and the mapped confidence of the i-th sample candidate pair are weighted and summed using a preset weight factor to obtain the final winning score of the i-th sample candidate pair.
[0148] This embodiment introduces a method to convert winning scores and confidence levels into unified, sorted numerical values. This method maps each value of the winning score and confidence level to the interval [0,1], achieving normalized sorting. It solves the problem of "inconsistent range and scale" in obtaining scores and confidence levels, achieves accurate weighted summation, and improves the accuracy of the final winning score representation.
[0149] In some embodiments, step 34231 is implemented as steps A and B:
[0150] Step A: Determine the winning score sequence for each of the N candidate sample pairs, and sort the winning score sequences in descending order of winning score.
[0151] Step B: Divide the ordinal position of the winning score of the i-th sample candidate pair in the winning score sequence by N to obtain the mapped winning score of the i-th sample candidate pair.
[0152] The winning score sequence is a combination of the winning scores of each of the N candidate pairs. The winning score sequence contains N elements, each representing a winning score. The winning score sequence is sorted in descending order, meaning it is ordered from largest to smallest winning score. The higher the winning score of a candidate pair, the higher its ranking in the winning score sequence. The ordinal position represents the position of the winning score within the sequence. If a candidate pair has the maximum winning score, its ordinal position is 1; if it has the minimum winning score, its ordinal position is N.
[0153] For example, suppose {z1, z2, ..., z N} is a set of numerical values, sorted in descending order, z1, z2, ..., z N Let z represent the winning score of the 1st to Nth candidate sample pairs. Define a sorting transformation function R that maps each value to a normalized sort within the interval [0,1]. The i-th value z i After conversion, it can be represented as:
[0154]
[0155] Among them, rank(z) i z ∈ {1,2,…,N} represents z i The ordinal position in descending order, where an ordinal position of 1 indicates the maximum value. The mapping winning score of the i-th candidate sample pair is represented as R(w i ).
[0156] This embodiment provides a method for converting winning scores into mapped winning scores, which can improve the accuracy of mapped winning scores and is beneficial for subsequent weighted summation of winning scores and confidence levels.
[0157] In some embodiments, step 34232 is implemented as steps C and D:
[0158] Step C: Determine the confidence score sequence for each of the N candidate sample pairs, and sort the confidence score sequences in descending order of confidence score.
[0159] Step D: Divide the ordinal position of the confidence score of the i-th candidate sample pair in the confidence score sequence by N to obtain the mapped confidence score of the i-th candidate sample pair.
[0160] The confidence score sequence is a combination of the confidence scores of each of the N candidate sample pairs. The sequence contains N elements, each representing a confidence score. The confidence score sequence is sorted in descending order, meaning it is ordered from highest to lowest confidence score. The higher the confidence score of a candidate sample pair, the higher its ranking in the sequence. The ordinal position represents the position of the confidence score within the sequence. A candidate sample pair with the highest confidence score has an ordinal position of 1, while a candidate sample pair with the lowest confidence score has an ordinal position of N.
[0161] For example, suppose {z1, z2, ..., z N} is a set of numerical values, sorted in descending order, z1, z2, ..., z N Let z represent the confidence score of the 1st to Nth candidate sample pairs. Define a sorting transformation function R that maps each value to a normalized sort within the interval [0,1]. The i-th value z... i After conversion, it can be represented as:
[0162]
[0163] Among them, rank(z) i z ∈ {1,2,…,N} represents z i In descending order sorting, the ordinal position is used, where an ordinal position of 1 indicates the maximum value. The mapping confidence of the i-th candidate sample pair is represented as R(p i ).
[0164] This embodiment provides a method for converting confidence scores into mapped confidence scores, which can improve the accuracy of mapped confidence scores and is beneficial for subsequent weighted summation of winning scores and confidence scores.
[0165] In some embodiments, after obtaining the mapping win score and mapping confidence of the i-th sample candidate pair, the two are weighted and summed using a weighting factor. Step 34233 is implemented as steps E and F:
[0166] Step E: Multiply the weight factor by the mapping winning score of the i-th sample candidate pair to obtain the first product result; multiply the difference between the preset value and the weight factor by the mapping confidence of the i-th sample candidate pair to obtain the second product result.
[0167] Step F involves adding the first product result and the second product result to obtain the final winning score of the i-th sample candidate pair.
[0168] The weighting factor is preset, and its value ranges from [0,1]. The preset value can be set to 1. The final winning score is used to characterize the performance of the i-th candidate sample pair in terms of both winning score and confidence. The higher the final winning score of the i-th candidate sample pair, the better it performs in both aspects. The final winning score of the i-th candidate sample pair... Represented as:
[0169]
[0170] Where, the weighting factor α∈[0,1], R(w i R(p) represents the winning score. i ) is the mapping confidence level, α*R(w) i ) is the result of the first product, (1-α)*R(p) i The result of the second product is the final winning score of the i-th sample candidate pair. The higher the value, the better the i-th sample candidate pair performs in terms of both pairwise bidirectional scoring and confidence.
[0171] This embodiment provides a confidence-weighted mechanism. Based on this mechanism, the first candidate pair with the highest final winning score and the second candidate pair with the lowest final winning score can be selected more accurately, thus providing more reliable positive and negative sample pairs for subsequent preference alignment training. This confidence-weighted mechanism not only improves the overall ranking quality of candidate pairs but also provides additional probabilistic basis for the large visual language model in the alignment process between answers and reasons, ensuring that the final large visual model, after preference fine-tuning, can better balance factual accuracy and logical rationality when generating answers.
[0172] In some embodiments, when t equals 2, the large visual language model after the (t-1)th training round is the large visual language model after the first training round. The large visual language model after the first training round is obtained by fine-tuning the model parameters of the original large visual language model. That is, for the first training round, fine-tuning training is performed on the model parameters of the original large visual language model. The method further includes steps 220 and 240:
[0173] Step 220: Perform sampling from the visual question answering dataset to construct sample fine-tuning data; the sample fine-tuning data includes sample input data and sample output data, the sample input data includes paired sample images and sample questions, and the sample output data includes sample reasons and sample answers that match the sample input data;
[0174] Step 240: Fine-tune the model parameters of the original large visual language model based on the sample fine-tuning data to obtain the large visual language model after the first round of training; wherein, the visual question answering dataset includes at least one of the following: perception and common sense dataset, graph understanding dataset, and mathematics and science dataset. The perception and common sense dataset is a dataset that covers visual perception tasks and common sense reasoning tasks. The graph understanding dataset is a dataset that covers at least one processing task among graphs, tables and documents. The mathematics and science dataset is a dataset that covers visual reasoning tasks in the fields of mathematics and science.
[0175] The visual question-answering dataset used in this embodiment includes at least one of the following:
[0176] (1) Perception and Common Sense Datasets: These datasets cover visual perception tasks and common sense reasoning tasks. They mainly include datasets such as LLaVA-150k, VQAv2, ShareGPT-4V, GQA, IDK, TallyQA, VizWiz, and OODVQA. These datasets cover a wide range of visual perception and common sense reasoning tasks, helping large visual language models learn basic visual understanding and common sense reasoning abilities.
[0177] (2) Chart Understanding Datasets: These are datasets that cover at least one processing task among charts, tables, and documents. They mainly include datasets such as ChartQA and DocVQA. These datasets focus on chart and document understanding tasks, helping large visual language models learn complex visual reasoning abilities, especially when processing charts, tables, and documents.
[0178] (3) Mathematics and Science Datasets: These are datasets covering visual reasoning tasks in the fields of mathematics and science. They mainly include datasets such as MathVision and AI2D. These datasets cover visual reasoning tasks in the fields of mathematics and science, and can help large visual language models learn high-level logical reasoning and scientific knowledge.
[0179] Sampling can be random sampling, for example, randomly obtaining relevant data from a visual question-answering dataset. Sample data in a visual question-answering dataset includes sample questions, sample images, and sample answers. Using advanced visual language expert models or open-source large language models, the sample data in these datasets is augmented with reasoning to generate sample reasons corresponding to the sample answers.
[0180] In some embodiments, filtering is also performed on the generated sample reasons, according to the following criteria:
[0181] ① Validity: The generated sample reasons must be able to support the final sample answer.
[0182] ② Consistency: The generated sample reasoning must be logically consistent and structurally clear.
[0183] ③ Reasonableness: The reasons for generating the samples must conform to common sense and professional knowledge, such as mathematical and scientific knowledge.
[0184] Based on this filtering process, and using a 2:1:1 data sampling ratio, sample fine-tuning data was constructed from perception and common sense datasets, graph understanding datasets, and mathematics and science datasets. Each sample fine-tuning dataset includes sample input data and sample output data. The sample input data includes paired sample images and sample questions, and the sample output data includes sample reasons and sample answers that match the sample input data. Using LoRA fine-tuning technology, the model parameters of the original large visual language model were fine-tuned based on the sample fine-tuning data to obtain the large visual language model after the first round of training. The large visual language model after the first round of training can be used as the large visual language model in the second round of training to generate N candidate sample pairs based on the sample input data.
[0185] This embodiment provides a method for fine-tuning the model parameters of the original large visual language model, which enables the large visual language model to generate sample reasons corresponding to sample answers during subsequent training. The large visual language model after this fine-tuning can be used as a seed model for subsequent training, generating N sample candidate pairs in each round, thereby achieving iterative preference alignment training with self-calibration of the reasons of the large visual language model.
[0186] In some embodiments, for the large visual language model trained in the (t-1)th round, N candidate sample pairs can be directly output based on the sample input data, or 2N candidate sample pairs can be output based on the sample input data, and N candidate sample pairs can be selected from them. Step 320 is specifically implemented as steps 322 and 324:
[0187] Step 322: Input the sample input data into the large visual language model after training in round t-1, and determine 2N candidate output data corresponding to the sample input data based on the sentence-level bundle search strategy;
[0188] Step 324: Based on the sentence embedding features corresponding to the 2N candidate output data, determine the N sample candidate pairs whose representativeness of the sentence embedding features is among the top N from the multiple candidate output data.
[0189] Beam Search is a heuristic search algorithm applied to generative models that generates the most probable output sequence based on input data. After training for epoch t-1, the large visual language model can generate the next possible sentence based on the sample input data, thus obtaining each possible candidate output data for the sample input data. The probability of each candidate output data is calculated, and the candidate output data with the highest probability in the top 2N are retained.
[0190] Sentence embedding features are the embedding features corresponding to each candidate output data. Sentence embedding features can be determined by a feature extraction model. The feature extraction model can be at least one of the following: an encoder, a word embedding model, a word vector model, or a convolutional neural network. The representativeness of a candidate output data's sentence embedding feature, which can also be understood as its discriminative power, can be determined by the distance between it and other sentence embedding features; the closer the distance, the more similar the features.
[0191] For example, the sample input data is input into the large visual language model after training for the (t-1)th round. Based on the sentence-level bundle search strategy, 2N candidate output data corresponding to the sample input data are determined. Based on the sentence embedding features corresponding to the 2N candidate output data, N sample candidate pairs whose representative sentence embedding features are located in the top N from the multiple candidate output data are determined.
[0192] This embodiment provides a method for generating N sample candidate pairs, which can ensure the diversity, representativeness and high quality of the N sample candidate pairs, and is beneficial to improving model performance.
[0193] In some embodiments, the method further includes steps 380 and 390:
[0194] Step 380: If the training termination conditions are met, the trained large visual language model is obtained.
[0195] Step 390: Deploy the trained large visual language model in the server environment; wherein the training termination condition includes at least one of the following: reaching the maximum number of iterations or reaching the maximum model accuracy.
[0196] The large visual language model is trained iteratively. In this embodiment, the training termination condition is set to at least one of the following: reaching the maximum number of iterations or reaching the maximum model accuracy. The server environment can specifically be a Linux system graphics processing unit (GPU) server environment.
[0197] For example, after the training termination conditions are met, a trained large visual language model is obtained; the trained large visual language model is then deployed in a server environment. After deployment, the trained large visual language model can be directly called and used.
[0198] This embodiment provides training termination conditions and system deployment methods, realizing the completion of iterative training and the deployment of the trained large visual language model. It can achieve efficient collaboration between model training and reason self-calibration in a high-performance computing environment, enhancing the reasoning ability of the large visual language model in complex visual question answering tasks and the interpretability of the generated answers.
[0199] In some embodiments, after obtaining and / or deploying the trained large visual language model, the method further includes steps 420 and 440:
[0200] Step 420: Obtain input data, which includes pairs of questions and images;
[0201] Step 440: Input the input data into the trained large visual language model to generate output data, which includes the reasons and answers that match the input data.
[0202] The input data for the trained large visual language model is multimodal input data, specifically: a question and an image. The output data consists of a reason and an answer that match the input data. When the accuracy of the trained large visual language model is high enough, the answer is close to the reference answer, the semantics of the reason fully support the generation of the answer, and the reason is related to the facts in the image.
[0203] For example, input data is acquired, which includes pairs of questions and images; the input data is fed into a trained large visual language model to generate output data, which includes reasons and answers that match the input data.
[0204] This embodiment introduces the application of the trained large visual language model, which can obtain output data corresponding to the input data. The output data includes reasons and answers, which enhances the interpretability of the answers and ensures the consistency of reasons and answers.
[0205] In some embodiments, after obtaining and / or deploying the trained large visual language model, the trained large visual language model can be applied to content moderation application scenarios. The method further includes steps 520 and 540:
[0206] Step 520: Obtain the audit input data, which includes pairs of audit questions and audit images;
[0207] Step 540: Input the audit input data into the trained large visual language model to generate audit output data. The audit output data includes audit reasons and audit conclusions that match the audit input data.
[0208] In content moderation applications, the input data for the trained large visual language model is multimodal input data, specifically: moderation questions and moderation images. The output data consists of moderation reasons and conclusions that match the input data. The moderation conclusion can be a type label assigned to the input data, such as a meeting scene, outdoor activity, or traffic accident scene. When the accuracy of the trained large visual language model is sufficiently high, the answer closely approximates the reference answer, the semantics of the reason fully support the generation of that answer, and the reason is relevant to the facts of the image.
[0209] For example, the review input data is obtained, which includes pairs of review questions and review images; the review input data is then input into a trained large visual language model to generate review output data, which includes review reasons and review conclusions that match the review input data.
[0210] In this embodiment, taking content moderation as an example, the specific application of the trained large visual language model is introduced. It can obtain the review reasons corresponding to the review conclusion, enhance the interpretability of the review conclusion, ensure the consistency between the review conclusion and the review reasons, reduce errors and misjudgments in content understanding, and improve processing efficiency and reliability.
[0211] The following examples, together with schematic diagrams, provide an overall explanation of the training method for large visual language models:
[0212] (I) Application Scenarios
[0213] In product applications, the training method for the large visual language model in this embodiment focuses on improving the reasoning ability and interpretability of the large visual language model in complex tasks, especially addressing the "reason-answer" consistency problem in scenarios such as visual question answering, content understanding, and content moderation, providing an efficient and low-cost post-training solution. By introducing reason self-calibration technology, the logical consistency and rationality of the reasoning process / reasoning in the large visual language model when generating answers can be significantly enhanced. In practical applications, through the "reason-answer" alignment mechanism, pairwise scoring and confidence weighting are applied to the N sample candidate pairs generated by the large visual language model to select the best / worst sample candidate pairs for preference alignment training, thereby improving the overall performance and interpretability of the large visual language model.
[0214] Taking "content moderation" as an example, large visual language models need to determine whether images or text contain sensitive elements. While related technologies may directly output a moderation conclusion, they lack a reasonable explanation of the basis for the judgment, making it difficult to trace or verify during manual review. This embodiment uses a reason self-calibration technology to enable the large visual language model to simultaneously output concise and logically consistent reasons for moderation when determining whether images or text contain sensitive elements, providing a reliable reference for subsequent manual review or verification. For example, referencing... Figure 6 The large visual language model's review conclusion for the image was "car accident scene," with the following reasoning: "This image shows a severely damaged white car parked on a street. There are obvious impact marks on the front and sides of the vehicle, the doors are deformed, and the hood is damaged. The wheels do not appear to be completely detached, but the car body is clearly tilted, indicating the severity of the accident." This reasoning matches the review conclusion, and the reasoning is sufficient and reasonable.
[0215] When handling complex visual question-answering tasks, the large visual language model in this embodiment can effectively avoid generating answers that are inconsistent with the facts of the image or lack sufficient reasoning, ensuring a high degree of consistency between the answer and the reasoning, thereby improving the credibility and practicality of the large visual language model in real-world applications. Through optimized training of the large visual language model, content understanding systems and content review systems can quickly generate accurate and interpretable analysis results in business scenarios with high responsiveness requirements, significantly reducing misjudgments or errors and improving processing efficiency and reliability. Furthermore, the large visual language model in this embodiment is also applicable to other task scenarios requiring high interpretability, such as medical diagnostic assistance and document image analysis, providing strong support and assurance for practical applications.
[0216] (II) Technical Implementation
[0217] The training method of the large visual language model in this embodiment comprehensively improves the understanding and reasoning capabilities of the large visual language model through self-correction between the sample reasons and answers generated by the model itself. This reduces misjudgments or errors in content understanding operations, thereby improving review efficiency and reliability. (Reference) Figure 7 The overall framework of this embodiment includes three core modules: the reason fine-tuning module 71, the multi-candidate scoring module 72, and the preference alignment fine-tuning module 73. Through the collaborative work of these three modules, the "reason-answer" alignment of the large visual language model is achieved.
[0218] (1) Reason Fine-tuning Module 71
[0219] Large visual language models in related technologies often tend to directly output short answers, neglecting to generate the corresponding reasoning process, i.e., the reasoning. While this design can meet the needs of some tasks, in scenarios requiring high interpretability, the answers generated by large visual language models lack reasonable justification, significantly reducing the interpretability and usability of the answers. This embodiment first introduces a reasoning fine-tuning module 71, which, through lightweight LoRA fine-tuning technology, instructs the large visual language model to generate a reasonable reasoning process, i.e., the reasoning, before outputting the answer, even without explicit prompts. (Reference) Figure 7 The LoRA fine-tuning module 71 mainly includes two steps: data construction and LoRA fine-tuning.
[0220] (1.1) Data Construction
[0221] To construct sample fine-tuning data for reasoning, samples were taken from several publicly available Visual Question Answering (VQA) datasets and their reasons were enhanced. Specifically, the Perception and Common Sense dataset, the Graph Understanding dataset, and the Mathematics and Science dataset were selected. The Perception and Common Sense dataset covers visual perception and common sense reasoning tasks; the Graph Understanding dataset covers at least one processing task among graphs, tables, and documents; and the Mathematics and Science dataset covers visual reasoning tasks in the fields of mathematics and science. Subsequently, the sample data from these datasets were enhanced with reasons using advanced visual language expert models or open-source large language models to generate sample reasons corresponding to the sample answers.
[0222] To ensure the rationality, consistency, and logic of the generated sample reasons, the generated sample reasons are filtered using the following three criteria:
[0223] ① Validity: The generated sample reasons must be able to support the final sample answer.
[0224] ② Consistency: The generated sample reasoning must be logically consistent and structurally clear.
[0225] ③ Reasonableness: The reasons for generating the samples must conform to common sense and professional knowledge, such as mathematical and scientific knowledge.
[0226] Based on this filtering process, a sample fine-tuning dataset for reason fine-tuning was finally constructed. Each sample fine-tuning dataset includes sample input data and sample output data. The format of the sample output data is "Thought: (Sample Reason) + Output: (Sample Answer)" to ensure that the large visual language model can output reasonable reasons at the same time when generating answers.
[0227] (1.2) LoRA fine-tuning
[0228] A 2:1:1 data sampling ratio was used to sample data from perception and common sense datasets, graph understanding datasets, and mathematics and science datasets to construct a sample fine-tuning dataset. Subsequently, LoRA fine-tuning technology was employed to fine-tune the model parameters of the original large visual language model, enabling it to generate reasons corresponding to the answers. The fine-tuned large visual language model will serve as the seed model for the subsequent "reason self-calibration" process, used to generate multiple candidate "reason-answer" pairs, referred to as sample candidate pairs.
[0229] (2) Multi-candidate scoring module 72
[0230] After generating N candidate sample pairs, each candidate pair is scored bidirectionally through pairwise comparisons. To efficiently accomplish this task, this embodiment designs a scoring model (R-Scorer) based on a large language model, specifically for comparing the relative quality of candidate sample pairs. The core objective is to select the best / worst candidate sample pairs by comparing the reasons and answers in different candidate sample pairs, for use in subsequent preference alignment training. (Reference) Figure 7 It mainly includes three steps: generating candidate sample pairs, a two-way scoring strategy, and a confidence weighting mechanism.
[0231] (2.1) Generate candidate pairs of samples
[0232] When generating N candidate sample pairs, a sentence-level beam search strategy is employed to ensure the diversity and high quality of the generated candidate pairs. Specifically, for each sample input data, which includes a sample question and a sample image, the large visual language model generates 2N candidate sample pairs, each consisting of a sample reason and a sample answer. To ensure the diversity of the candidate sample pairs, the sentence embedding features of each candidate pair are calculated, and the N most representative candidate sample pairs are selected based on these features for subsequent scoring and filtering.
[0233] (2.2) Two-way scoring strategy
[0234] This embodiment employs a two-way scoring strategy to ensure fairness and accuracy. Specifically, for candidate pair A and any candidate pair B among N candidate pairs, the R-Scorer model performs two scoring operations: ① In the first scoring, candidate pair A is used as the primary candidate pair and candidate pair B as the comparison candidate pair, resulting in a first score; ② In the second scoring, candidate pair B is used as the primary candidate pair and candidate pair A as the comparison candidate pair, resulting in a second score. After completing N(N-1) pairwise scoring operations, optionally, a scoring matrix M∈R can be constructed. N×N , of which M i,j =s i,j Mi,j It is the value in the i-th row and j-th column of the score matrix, s i,j The first score is obtained by using the i-th sample candidate pair as the primary candidate pair and the j-th sample candidate pair as the comparison candidate pair. After obtaining the score matrix M, the i-th sample candidate pair C is defined as follows: i The winning score w relative to other sample candidate pairs i for:
[0235]
[0236] Among them, M i,j M is the value in the i-th row and j-th column of the score matrix, representing the first score obtained with the i-th sample candidate pair as the primary candidate pair and the j-th sample candidate pair as the comparison candidate pair; j,i This is the value in the j-th row and i-th column of the score matrix. It represents the second score obtained by using the j-th sample candidate pair as the primary candidate pair and the i-th sample candidate pair as the comparison candidate pair. The winning score is w. i Used to indicate the i-th sample candidate pair C i The relative superiority of other sample candidate pairs among N sample candidate pairs.
[0237] For example, refer to Figure 7 In the multi-candidate scoring module 72, the score matrix has N candidate pairs, which are then divided into 4 candidate pairs. Taking the second candidate pair as an example, the winning score of the second candidate pair is calculated as follows:
[0238] w2=(M 2,1 -M 1,2 )+(M 2,2 -M 2,2 )+(M 2,3 -M 3,2 )+(M 2,4 -M 4,2 )
[0239] =(-4-2)+(0-0)+(-2-1)+(-3-2)=-14
[0240] (2.3) Confidence weighting mechanism
[0241] When multiple candidate pairs of samples have similar quality, it may lead to the assignment of neutral scores during the scoring process. This embodiment further introduces a confidence-weighted mechanism to ensure that the selected candidate pairs of samples not only have high relative quality but also conform to the generation preferences of the large visual language model itself. Specifically, each candidate pair of samples generated during the sentence-level bundle search is associated with a probability, which can be interpreted as a corresponding confidence score. This probability originates from the language decoder of the large visual language model and represents the cumulative log probability of generating a complete candidate pair of samples.
[0242] Let the i-th sample candidate pair C i confidence level p i Defined as:
[0243]
[0244] Where, len(C i ) represents the i-th sample candidate pair C i The number of sentences in the input data, x represents the multimodal input data, i.e., sample images and sample questions, s m Let C represent the i-th sample candidate pair. i The m-th sentence in the text. Confidence level p i The higher the value, the more likely the large visual language model is to select that sample candidate pair as its output / response.
[0245] Because the winning score w of the i-th sample candidate pair i and confidence level p i Direct combination presents the challenge of "inconsistency in scope and scale," and this embodiment will award a winning score of w. i and confidence level p i Perform the mapping to convert the data into uniform, sorted numerical values. Assume {z1, z2, ..., z...} N Let} be a set of numerical values, sorted in descending order, where z1, z2, ..., z N Let z1, z2, ..., z be the winning scores of the 1st to Nth sample candidate pairs. N Let z represent the confidence score of the 1st to Nth candidate sample pairs. Define a sorting transformation function R that maps each value to a normalized sort within the interval [0,1]. The i-th value z... i After conversion, it can be represented as:
[0246]
[0247] Among them, rank(z) i z ∈ {1,2,…,N} represents z i The ordinal position in descending order, where an ordinal position of 1 indicates the maximum value. The mapping winning score R(w) is obtained for the i-th candidate sample pair. i ) and mapping confidence R(p i Then, they are combined using weighting factors α∈[0,1] to obtain the final winning score of the i-th sample candidate pair. Represented as:
[0248]
[0249] Wherein, the final winning score of the i-th sample candidate pair A higher confidence level indicates that the i-th candidate sample pair performs exceptionally well in both pairwise bidirectional scoring and confidence. Based on the confidence weighting mechanism of this embodiment, the optimal candidate sample pair with the highest final winning score and the worst candidate sample pair with the lowest final winning score can be selected more accurately, thus providing more reliable positive and negative sample pairs for subsequent preference alignment training. This confidence weighting mechanism not only improves the overall ranking quality of candidate pairs but also provides additional probabilistic basis for the large visual language model in the alignment process between answers and reasons, ensuring that the final large visual model, after preference fine-tuning, can better balance factual accuracy and logical rationality when generating answers.
[0250] (3) Preference Alignment Fine-tuning Module 73
[0251] The optimal sample candidate pair is also called the preference candidate pair, and the worst sample candidate pair is also called the low-quality candidate pair. Preference samples can be constructed based on the optimal and worst sample candidate pairs. In this embodiment, the preference alignment fine-tuning module 73 employs Direct Preference Optimization (DPO) technology to iteratively fine-tune the model parameters of the large visual language model. Specifically, by constructing preference samples, the reasoning ability of the large visual language model is gradually improved. In each iteration of training, the large visual language model generates N new sample candidate pairs, and the optimal / worst sample candidate pairs are selected through the multi-candidate scoring module 72 for the next round of preference alignment training. Through this iterative training process, the large visual language model can gradually improve its reasoning ability and interpretability. Specifically, the loss function ensures that the large visual language model is more inclined to generate high-quality "reason-answer" pairs by maximizing the preference difference between the optimal and worst sample candidate pairs.
[0252] The formula for the loss function L is as follows:
[0253]
[0254] Where, π t π represents the model parameters in the t-th (current) iteration. t-1 Let y represent the model parameters in the (t-1)th iteration (the previous iteration). w y represents the optimal sample candidate pair. l Let represent the worst sample candidate pair, x represent the multimodal input data, i.e., the image and the question, β be the scaling factor, and σ(·) represent the sigmoid function.
[0255] (4) Data preparation
[0256] refer to Figure 8In the reason fine-tuning stage of the reason fine-tuning module 71, and in the subsequent reason self-correction stage, to ensure that the large visual language model can effectively handle complex visual question-answering tasks, this embodiment employs multiple methods in the data preparation stage 70 to construct a high-quality sample dataset. Specifically, the data preparation stage uses the following three datasets:
[0257] (4.1) Perception and common sense datasets: These mainly include datasets such as LLaVA-150k, VQAv2, ShareGPT-4V, GQA, IDK, TallyQA, VizWiz, and OODVQA. These datasets cover a wide range of visual perception and common sense reasoning tasks, which can help large visual language models learn basic visual understanding and common sense reasoning abilities.
[0258] (4.2) Chart understanding datasets: These mainly include datasets such as ChartQA and DocVQA. These datasets focus on chart and document understanding tasks and can help large visual language models learn complex visual reasoning abilities, especially when processing charts, tables and documents.
[0259] (4.3) Mathematics and Science Datasets: These mainly include datasets such as MathVision and AI2D. These datasets cover visual reasoning tasks in the fields of mathematics and science, and can help large visual language models learn high-level logical reasoning and scientific knowledge.
[0260] Through this multi-domain data integration, this embodiment ensures that the large visual language model possesses good generalization ability when handling different tasks, while avoiding overfitting issues caused by limited data. To ensure the quality of the sample dataset, this embodiment also introduces a multi-round manual review mechanism during the data preparation stage. Specifically, the generated sample reasons and sample answers undergo multiple rounds of manual review to ensure their accuracy and rationality. Furthermore, this embodiment also utilizes an automated verification tool based on the large language model to verify the data's format, content, and logic, ensuring data integrity and consistency.
[0261] (5) System Architecture
[0262] refer to Figure 8The system architecture corresponding to the method in this embodiment can be deployed in a Linux GPU server environment. It leverages the HuggingFace transformers framework and vLLM to accelerate inference of the large visual language model, and combines LoRA fine-tuning technology to complete efficient model training and calibration, exhibiting modularity and strong scalability. During training, the core consists of two parts: a "reason fine-tuning module" and "self-calibrated preference alignment training." The reason fine-tuning module 71, through reason enhancement sampling and lightweight LoRA fine-tuning technology, instructs the large visual language model to generate reasons corresponding to the answers, using the fine-tuned large visual language model as a seed model to provide a foundation for subsequent preference alignment training. The self-calibrated preference alignment training, through the multi-candidate scoring module 72, achieves candidate pair generation, bidirectional scoring, and confidence weighting. The preference alignment fine-tuning module 73 constructs preference samples, performs preference optimization training, and updates model parameters, gradually improving the inference ability and interpretability of the large visual language model. Through the above system architecture design, efficient collaboration between training and calibration of the large visual language model is achieved in a high-performance computing environment, enhancing the inference ability and interpretability of the large visual language model in complex tasks.
[0263] In summary, the beneficial effects of this embodiment include at least the following aspects:
[0264] 1. Enhancing the Reasoning and Calibration Capabilities of Large Visual Language Models: By introducing a self-calibration mechanism, this embodiment effectively enhances the reasoning capabilities of large visual language models in complex visual language tasks. Especially in multimodal scenarios, the large visual language model can more accurately understand and generate semantic descriptions related to image content. Through the self-calibration mechanism, the accuracy of the large visual language model's parsing of image semantic information is significantly improved, ensuring the logical consistency and semantic accuracy of the output results.
[0265] 2. Addressing Output Bias and Instability Issues in Large Visual Language Models: This embodiment employs a self-calibration mechanism to automatically detect and correct potential biases and instabilities in the large visual language model during inference. Through multiple rounds of self-calibration, this mechanism ensures high accuracy and stability in generating semantic descriptions, effectively avoiding output errors caused by insufficient model training or data bias in related technologies.
[0266] 3. Reduced reliance on manually labeled data: This embodiment utilizes a self-calibration mechanism to automatically optimize the large-scale visual language model during the post-training phase, reducing reliance on large-scale manually labeled data. Compared to related technologies that require extensive manually labeled data for fine-tuning, the self-calibration mechanism significantly reduces data labeling costs, making it more suitable for resource-constrained real-world applications.
[0267] 4. Accelerate the optimization and deployment efficiency of large-scale visual language models: By incorporating a self-calibration mechanism, this embodiment can quickly optimize the performance of large-scale visual language models, shortening the time cycle from training to deployment. Through multiple rounds of iterative optimization via the self-calibration mechanism, the large-scale visual language model can maintain high performance while reducing training time and computational resource consumption, further improving its practicality and scalability.
[0268] 5. Enhance the generalization ability of the large visual language model in complex multimodal scenarios: This embodiment effectively improves the content understanding generalization ability of the large visual model in complex multimodal scenarios through a self-calibration mechanism. Through multi-dimensional optimization of the self-calibration mechanism, the large visual language model can better adapt to visual question-answering tasks in different scenarios, significantly improving its performance and robustness in practical applications.
[0269] Figure 9 This is a block diagram of a training apparatus for a large visual language model provided in an exemplary embodiment. The training apparatus 800 for the large visual language model includes at least a portion of the following modules: an acquisition module 820, a determination module 840, and a training module 860.
[0270] The acquisition module 820 is used to acquire N sample candidate pairs corresponding to the sample input data. The sample input data includes paired sample questions and sample images. Each of the N sample candidate pairs includes a sample reason and a sample answer that match the sample input data. The sample candidate pairs are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1.
[0271] The determination module 840 is used to determine the first sample candidate pair and the second sample candidate pair that meet the screening conditions among the N sample candidate pairs. The first sample candidate pair and the second sample candidate pair are candidate pairs with preference differences. The preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training.
[0272] Training module 860 is used to adjust the model parameters of the large visual language model after the (t-1)th round of training with the training objective of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, so as to obtain the large visual language model after the tth round of training.
[0273] In some embodiments, the training module 860 is used for:
[0274] Based on the first sample candidate pair and the second sample candidate pair, determine the loss function;
[0275] With minimizing the loss function as the training objective, the model parameters of the large visual language model after the (t-1)th round of training are adjusted to obtain the large visual language model after the tth round of training.
[0276] In some embodiments, the training module 860 is used for:
[0277] Given the sample input data, the large visual language model trained in the t-th round and the large visual language model trained in the (t-1)-th round respectively output a first probability ratio corresponding to the probability of the first sample candidate pair and a second probability ratio corresponding to the probability of the second sample candidate pair.
[0278] The first probability ratio is logarithmically taken and scaled using a scaling factor to obtain a first logarithmic ratio; the second probability ratio is logarithmically taken and scaled using the scaling factor to obtain a second logarithmic ratio.
[0279] Subtract the second logarithmic ratio from the first logarithmic ratio to obtain the logarithmic ratio difference;
[0280] The logarithmic ratio difference is mapped using an activation function, and the logarithm is taken to obtain the mapped difference.
[0281] The loss function is determined based on the negative value of the expected value corresponding to the mapping difference.
[0282] In some embodiments, the determining module 840 is configured to:
[0283] Scoring is performed on each of the N candidate sample pairs to obtain the final winning score for each candidate sample pair;
[0284] The sample candidate pair with the highest final winning score is determined as the first sample candidate pair, and the sample candidate pair with the lowest final winning score is determined as the second sample candidate pair.
[0285] In some embodiments, the determining module 840 is configured to:
[0286] For each pair of N candidate samples, a two-way scoring is performed to obtain a winning score for each candidate sample pair, which is used to indicate the relative superiority of each candidate sample pair relative to other candidate sample pairs.
[0287] Determine the confidence level of each candidate sample pair;
[0288] A weighted summation is performed based on the obtained score and the confidence level of each sample candidate pair to obtain the final winning score of each sample candidate pair.
[0289] In some embodiments, for the i-th sample candidate pair among the N sample candidate pairs, where i is greater than 0, the determining module 840 is configured to:
[0290] Based on the scoring model, the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair to obtain a first score; and the j-th sample candidate pair is taken as the main candidate pair and the i-th sample candidate pair is taken as the comparison candidate pair to obtain a second score; the j-th sample candidate pair is any sample candidate pair among the N sample candidate pairs, and j is greater than 0;
[0291] Subtract the second score from the first score to obtain the score difference;
[0292] The winning score of the i-th sample candidate pair is obtained by summing the j score differences corresponding to the i-th sample candidate pair.
[0293] In some embodiments, the scoring rules of the scoring model include at least one of the following:
[0294] The sample answers in the sample candidate pairs are aligned with the preset reference answers;
[0295] The sample reasoning in the sample candidate pair does not include content that does not exist in the sample image;
[0296] The semantic support of the sample reasons in the sample candidate pairs generates the sample answer;
[0297] Specifically, when the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair, if the sample answer in the i-th sample candidate pair is aligned with the preset reference answer, and the sample reason in the i-th sample candidate pair does not contain content that does not exist in the sample question, and the semantics of the sample reason in the i-th sample candidate pair supports the sample answer, then the i-th sample candidate pair is determined to be superior to the j-th sample candidate pair, and the first score is positive; otherwise, the first score is negative.
[0298] In some embodiments, for the i-th sample candidate pair among the N sample candidate pairs, where i is greater than 0, the determining module 840 is configured to:
[0299] Determine the number of sentences and each sentence in the i-th sample candidate pair;
[0300] The confidence level of the i-th sample candidate pair is obtained by multiplying the conditional probabilities corresponding to each sentence in the i-th sample candidate pair.
[0301] Wherein, the conditional probability corresponding to the m-th sentence in the i-th sample candidate pair is the probability of generating the m-th sentence given the sample input data and the first m-1 sentences, where m is greater than or equal to 1.
[0302] In some embodiments, for the i-th sample candidate pair among the N sample candidate pairs, where i is greater than 0, the determining module 840 is configured to:
[0303] The winning score of the i-th sample candidate pair is transformed to obtain the mapped winning score;
[0304] The confidence scores of the i-th candidate sample pair are transformed to obtain the mapped confidence scores.
[0305] Using a preset weighting factor, the mapping winning score and the mapping confidence of the i-th sample candidate pair are weighted and summed to obtain the final winning score of the i-th sample candidate pair.
[0306] In some embodiments, the determining module 840 is configured to:
[0307] Determine a winning score sequence composed of the winning scores of each of the N sample candidate pairs, and sort the winning score sequence in descending order of the winning scores;
[0308] Divide the ordinal position of the winning score of the i-th sample candidate pair in the winning score sequence by N to obtain the mapped winning score of the i-th sample candidate pair.
[0309] In some embodiments, the determining module 840 is configured to:
[0310] Determine a confidence sequence consisting of the confidence scores of each of the N candidate sample pairs, and sort the confidence sequences in descending order of the confidence scores;
[0311] Divide the ordinal position of the confidence score of the i-th candidate sample pair in the confidence score sequence by N to obtain the mapped confidence score of the i-th candidate sample pair.
[0312] In some embodiments, the determining module 840 is configured to:
[0313] Multiply the weight factor by the mapping winning score of the i-th sample candidate pair to obtain the first product result; multiply the difference between the preset value and the weight factor by the mapping confidence of the i-th sample candidate pair to obtain the second product result.
[0314] The first product result and the second product result are added together to obtain the final winning score of the i-th sample candidate pair.
[0315] In some embodiments, when t equals 2, the large visual language model after the first round of training is obtained by fine-tuning the model parameters of the original large visual language model.
[0316] The acquisition module 820 is used to perform sampling from the visual question answering dataset to construct sample fine-tuning data; the sample fine-tuning data includes sample input data and sample output data, the sample input data includes paired sample images and sample questions, and the sample output data includes sample reasons and sample answers that match the sample input data;
[0317] The training module 860 is used to fine-tune the model parameters of the original large visual language model based on the sample fine-tuning data to obtain the large visual language model after the first round of training.
[0318] The visual question answering dataset includes at least one of the following: a perception and common sense dataset, a graph understanding dataset, and a mathematics and science dataset. The perception and common sense dataset is a dataset that covers visual perception tasks and common sense reasoning tasks. The graph understanding dataset is a dataset that covers at least one processing task among graphs, tables, and documents. The mathematics and science dataset is a dataset that covers visual reasoning tasks in the fields of mathematics and science.
[0319] In some embodiments, the acquisition module 820 is used for:
[0320] The sample input data is input into the large visual language model after the (t-1)th round of training, and 2N candidate output data corresponding to the sample input data are determined based on the sentence-level bundle search strategy.
[0321] Based on the sentence embedding features corresponding to the 2N candidate output data, the N sample candidate pairs whose representativeness of the sentence embedding features is among the top N are determined from the multiple candidate output data.
[0322] In some embodiments, the training module 860 is used for:
[0323] Under the condition that the training ends, the trained large visual language model is obtained;
[0324] The training termination condition includes at least one of the following: reaching the maximum number of iterations or reaching the maximum model accuracy.
[0325] In some embodiments, a deployment module is also included; the deployment module is configured to:
[0326] The trained large visual language model is deployed in a server environment.
[0327] In some embodiments, the acquisition module 820 is further configured to:
[0328] Acquire input data, which includes pairs of questions and images;
[0329] Module 840 is also used for:
[0330] The input data is fed into the trained large visual language model to generate output data, which includes reasons and answers that match the input data.
[0331] In some embodiments, the trained large visual language model is applied to content moderation application scenarios.
[0332] The acquisition module is also used for:
[0333] Obtain the audit input data, which includes pairs of audit questions and audit images;
[0334] Module 840 is also used for:
[0335] The audit input data is input into the trained large visual language model to generate audit output data, which includes audit reasons and audit conclusions that match the audit input data.
[0336] It should be noted that the specific limitations of the one or more large visual language model training devices 800 provided above can be found in the limitations of the training method for large visual language models above, and will not be repeated here. Each module of the above device can be implemented entirely or partially by software, hardware, or a combination thereof. Each module can be embedded in the processor of the computer device in hardware form or independent of the processor, or it can be stored in the memory of the computer device in software form, so that the processor can call and execute the corresponding operations of each module.
[0337] This application also provides a computer device, which includes: a processor and a memory, wherein the memory stores a computer program; the processor is used to execute the computer program in the memory to implement the training method of the large visual language model provided in the above method embodiments.
[0338] For example, Figure 10 This is a structural block diagram of a computer device provided in an exemplary embodiment. Optionally, the computer device is a server 1000.
[0339] Typically, server 1000 includes a processor 1001 and memory 1002.
[0340] Processor 1001 may include one or more processing cores, such as a quad-core processor, an octa-core processor, etc. Processor 1001 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). Processor 1001 may also include a main processor and a coprocessor. The main processor, also known as a central processing unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, processor 1001 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, processor 1001 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0341] The memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In some embodiments, the non-transitory computer-readable storage media in the memory 1002 are used to store at least one instruction, which is executed by the processor 1001 to implement the training method for the large visual language model provided in the above-described method embodiments.
[0342] In some embodiments, the server 1000 may optionally include an input interface 1003 and an output interface 1004. The processor 1001, memory 1002, and input interfaces 1003 and 1004 can be connected via a bus or signal lines. Various peripheral devices can be connected to the input interfaces 1003 and 1004 via a bus, signal lines, or a circuit board. The input interfaces 1003 and 1004 can be used to connect at least one input / output (I / O) related peripheral device to the processor 1001 and memory 1002. In some embodiments, the processor 1001, memory 1002, and input interfaces 1003 and 1004 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1001, memory 1002, and input interfaces 1003 and 1004 can be implemented on separate chips or circuit boards, and this application does not limit this.
[0343] Those skilled in the art will understand that Figure 10 The structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or use different component arrangements.
[0344] In an exemplary embodiment, this application also provides a chip, which includes programmable logic circuits and / or computer instructions, and when the chip is run on a computer device, it is used to implement the training method of the large visual language model provided in the above-described method embodiments.
[0345] This application also provides a computer-readable storage medium storing a computer program, which is loaded and executed by a processor to implement the training method for the large visual language model provided in the above-described method embodiments.
[0346] This application also provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the processor of the computer device to load and execute the training method for the large visual language model provided in the above-described method embodiments.
[0347] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0348] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0349] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0350] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A training method for a large visual language model, characterized in that, The method includes: Obtain N candidate pairs of samples corresponding to the sample input data. The sample input data includes pairs of sample questions and sample images. Each of the N candidate pairs of samples includes a sample reason and a sample answer that match the sample input data. The candidate pairs of samples are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1. Determine the first and second candidate sample pairs that meet the screening criteria among the N candidate sample pairs. The first and second candidate sample pairs are candidate pairs with preference differences, and the preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training. With the goal of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, the model parameters of the large visual language model after the (t-1)th round of training are adjusted to obtain the large visual language model after the tth round of training.
2. The method according to claim 1, characterized in that, The step of adjusting the model parameters of the large visual language model after the (t-1)th round of training, with the training objective of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, to obtain the large visual language model after the tth round of training, includes: Based on the first sample candidate pair and the second sample candidate pair, determine the loss function; With minimizing the loss function as the training objective, the model parameters of the large visual language model after the (t-1)th round of training are adjusted to obtain the large visual language model after the tth round of training.
3. The method according to claim 2, characterized in that, The step of determining the loss function based on the first sample candidate pair and the second sample candidate pair includes: Given the sample input data, the large visual language model trained in the t-th round and the large visual language model trained in the (t-1)-th round respectively output a first probability ratio corresponding to the probability of the first sample candidate pair and a second probability ratio corresponding to the probability of the second sample candidate pair. The first probability ratio is logarithmically taken and scaled using a scaling factor to obtain a first logarithmic ratio; the second probability ratio is logarithmically taken and scaled using the scaling factor to obtain a second logarithmic ratio. Subtracting the second logarithmic ratio from the first logarithmic ratio yields the logarithmic ratio difference. The logarithmic ratio difference is mapped using an activation function, and the logarithm is taken to obtain the mapped difference. The loss function is determined based on the negative value of the expected value corresponding to the mapping difference.
4. The method according to any one of claims 1 to 3, characterized in that, The step of determining the first and second candidate sample pairs that meet the screening criteria among the N candidate sample pairs includes: Scoring is performed on each of the N candidate sample pairs to obtain the final winning score for each candidate sample pair; The sample candidate pair with the highest final winning score is determined as the first sample candidate pair, and the sample candidate pair with the lowest final winning score is determined as the second sample candidate pair.
5. The method according to claim 4, characterized in that, The scoring of each of the N candidate sample pairs to obtain the final winning score for each candidate sample pair includes: For each pair of N candidate samples, a two-way scoring is performed to obtain a winning score for each candidate sample pair, which is used to indicate the relative superiority of each candidate sample pair relative to other candidate sample pairs. Determine the confidence level of each candidate sample pair; A weighted summation is performed based on the obtained score and the confidence level of each sample candidate pair to obtain the final winning score of each sample candidate pair.
6. The method according to claim 5, characterized in that, For the i-th candidate sample pair among the N candidate sample pairs, where i is greater than 0, a bidirectional scoring is performed on every two candidate sample pairs among the N candidate sample pairs to obtain a winning score for each candidate sample pair, including: Based on the scoring model, the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair to obtain a first score; and the j-th sample candidate pair is taken as the main candidate pair and the i-th sample candidate pair is taken as the comparison candidate pair to obtain a second score; the j-th sample candidate pair is any sample candidate pair among the N sample candidate pairs, and j is greater than 0; Subtract the second score from the first score to obtain the score difference; The winning score of the i-th sample candidate pair is obtained by summing the j score differences corresponding to the i-th sample candidate pair.
7. The method according to claim 6, characterized in that, The scoring rules of the scoring model include at least one of the following: The sample answers in the sample candidate pairs are aligned with the preset reference answers; The sample reasoning in the sample candidate pair does not include content that does not exist in the sample image; The semantic support of the sample reasons in the sample candidate pairs generates the sample answer; Specifically, when the i-th sample candidate pair is taken as the main candidate pair and the j-th sample candidate pair is taken as the comparison candidate pair, if the sample answer in the i-th sample candidate pair is aligned with the preset reference answer, and the sample reason in the i-th sample candidate pair does not contain content that does not exist in the sample question, and the semantics of the sample reason in the i-th sample candidate pair supports the sample answer, then the i-th sample candidate pair is determined to be superior to the j-th sample candidate pair, and the first score is positive; otherwise, the first score is negative.
8. The method according to claim 5, characterized in that, For the i-th candidate sample pair among the N candidate sample pairs, where i is greater than 0, determining the confidence level of each candidate sample pair includes: Determine the number of sentences and each sentence in the i-th sample candidate pair; The confidence level of the i-th sample candidate pair is obtained by multiplying the conditional probabilities corresponding to each sentence in the i-th sample candidate pair. Wherein, the conditional probability corresponding to the m-th sentence in the i-th sample candidate pair is the probability of generating the m-th sentence given the sample input data and the first m-1 sentences, where m is greater than or equal to 1.
9. The method according to claim 5, characterized in that, For the i-th candidate sample pair among the N candidate sample pairs, where i is greater than 0, the final winning score for each candidate sample pair is obtained by performing a weighted summation based on the acquired score and the confidence level, including: The winning score of the i-th sample candidate pair is transformed to obtain the mapped winning score; The confidence scores of the i-th candidate sample pair are transformed to obtain the mapped confidence scores. Using a preset weighting factor, the mapping winning score and the mapping confidence of the i-th sample candidate pair are weighted and summed to obtain the final winning score of the i-th sample candidate pair.
10. The method according to claim 9, characterized in that, The step of transforming the winning score of the i-th sample candidate pair to obtain the mapped winning score includes: Determine a winning score sequence composed of the winning scores of each of the N sample candidate pairs, and sort the winning score sequence in descending order of the winning scores; Divide the ordinal position of the winning score of the i-th sample candidate pair in the winning score sequence by N to obtain the mapped winning score of the i-th sample candidate pair.
11. The method according to claim 9, characterized in that, The step of transforming the confidence score of the i-th candidate sample pair to obtain the mapped confidence score includes: Determine a confidence sequence consisting of the confidence scores of each of the N candidate sample pairs, and sort the confidence sequences in descending order of the confidence scores; Divide the ordinal position of the confidence score of the i-th sample candidate pair in the confidence score sequence by N to obtain the mapped confidence score of the i-th sample candidate pair.
12. The method according to claim 9, characterized in that, The step of using a preset weighting factor to perform a weighted summation of the mapping winning score and the mapping confidence of the i-th sample candidate pair to obtain the final winning score of the i-th sample candidate pair includes: Multiply the weight factor by the mapping winning score of the i-th sample candidate pair to obtain the first product result; multiply the difference between the preset value and the weight factor by the mapping confidence of the i-th sample candidate pair to obtain the second product result. The first product result and the second product result are added together to obtain the final winning score of the i-th sample candidate pair.
13. The method according to any one of claims 1 to 12, characterized in that, When t equals 2, the large visual language model after the first round of training is obtained by fine-tuning the model parameters of the original large visual language model; the method also includes: Sampling is performed from the visual question answering dataset to construct sample fine-tuning data; the sample fine-tuning data includes sample input data and sample output data, the sample input data includes pairs of sample images and sample questions, and the sample output data includes sample reasons and sample answers that match the sample input data; The model parameters of the original large visual language model are fine-tuned based on the sample fine-tuning data to obtain the large visual language model after the first round of training. The visual question answering dataset includes at least one of the following: a perception and common sense dataset, a graph understanding dataset, and a mathematics and science dataset. The perception and common sense dataset is a dataset that covers visual perception tasks and common sense reasoning tasks. The graph understanding dataset is a dataset that covers at least one processing task among graphs, tables, and documents. The mathematics and science dataset is a dataset that covers visual reasoning tasks in the fields of mathematics and science.
14. The method according to any one of claims 1 to 13, characterized in that, The acquisition of N candidate sample pairs corresponding to the sample input data includes: The sample input data is input into the large visual language model after the (t-1)th round of training, and 2N candidate output data corresponding to the sample input data are determined based on the sentence-level bundle search strategy. Based on the sentence embedding features corresponding to the 2N candidate output data, the N sample candidate pairs whose representativeness of the sentence embedding features is among the top N are determined from the multiple candidate output data.
15. The method according to any one of claims 1 to 14, characterized in that, The method further includes: Under the condition that the training ends, the trained large visual language model is obtained; The trained large visual language model is deployed in a server environment; The training termination condition includes at least one of the following: reaching the maximum number of iterations or reaching the maximum model accuracy.
16. The method according to any one of claims 1 to 15, characterized in that, The method further includes: Acquire input data, which includes pairs of questions and images; The input data is fed into the trained large visual language model to generate output data, which includes reasons and answers that match the input data.
17. A training device for a large visual language model, characterized in that, The device includes: The acquisition module is used to acquire N sample candidate pairs corresponding to the sample input data. The sample input data includes paired sample questions and sample images. Each of the N sample candidate pairs includes a sample reason and a sample answer that match the sample input data. The sample candidate pairs are generated by the large visual language model after training for the (t-1)th round based on the sample input data. N is greater than 1 and t is greater than 1. The determination module is used to determine the first and second sample candidate pairs among the N sample candidate pairs that meet the screening conditions. The first and second sample candidate pairs are candidate pairs with preference differences, and the preference is used to indicate the data generation tendency of the large visual language model after the t-th round of training. The training module is used to adjust the model parameters of the large visual language model after the (t-1)th round of training with the training objective of maximizing the preference difference between the first sample candidate pair and the second sample candidate pair, so as to obtain the large visual language model after the tth round of training.
18. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the training method for a large visual language model as described in any one of claims 1 to 16.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is loaded and executed by a processor to implement the training method for the large visual language model as described in any one of claims 1 to 16.
20. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium, from which a processor retrieves the computer instructions, causing the processor to load and execute them to implement the training method for a large visual language model as described in any one of claims 1 to 16.
