Multi-modal large language model training method and device, storage medium and electronic device
The multi-modal large-scale language model training method through adversarial distillation technology solves the problems of high multi-modal large-scale language model training costs and insufficient multi-modal data processing capabilities, and achieves efficient multi-modal instruction construction and student model ability improvement. .
Patent Information
- Application Number
- CN202410628558.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-20
- Publication Date
- 2024-09-24
AI Technical Summary
Existing multimodal large-scale language model training methods are costly and lack effective mechanisms to evaluate and improve the multimodal data processing capabilities of student models, especially in understanding and generating complex multimodal instructions.
A multi-modal large-scale language model training method based on adversarial distillation technology is adopted. Through the multi-modal pre-training module and the multi-modal adversarial distillation module, a two-way feedback loop is realized, the cost of multi-modal instruction construction is reduced, and through automated data filtering and new Instruction generation enhances the multimodal understanding and generation capabilities of student models.
It significantly reduces the cost and labor intensity of constructing multi-modal instructions, improves the performance of student models in processing complex multi-modal instructions, and enhances multi-modal understanding and generation capabilities.
Smart Images

Figure CN118690872A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer information technology, and in particular to a multimodal large-scale language model training, device, storage medium and electronic device. Background Art
[0002] In recent years, the parameter scale and pre-training data scale of large language models have grown steadily, leading to the continuous breakthrough of natural language understanding capabilities. In order to further enhance the capabilities of large language models, researchers focus on the development of open source multimodal large language. The most popular paradigm is called multimodal instruction fine-tuning, which is to align the responses of a language model with smaller parameters (student model) with the responses of a larger language model (teacher model) to a set of instructions.
[0003] Currently, multimodal instructions are usually generated through GPT-4 or based on manually constructed datasets. Using these methods to build multimodal instructions may be very expensive or require a lot of manpower. On the other hand, the knowledge transfer method based on instruction fine-tuning is one-way. Figure 1 As shown by the arrow on the left in the prior art, the instructions built based on the teacher model’s answers enable the student model to learn the ability to distinguish “is the scene in the current image day or night?” However, the student model still has difficulty answering difficult questions, such as “identify the specific cartoon character corresponding to the snowman in the image.” However, current model distillation methods do not take into account such student feedback, such as Figure 1 As shown by the right arrow in , feedback refers to identifying difficult instructions where the student model performs poorly. Incorporating feedback ensures that the teacher model can provide customized training focused on solving these difficult examples, thereby enhancing the capabilities of the student model. Existing knowledge transfer methods are mainly one-way and lack effective mechanisms to evaluate and improve the student model's ability to process multimodal data, especially in understanding and generating complex multimodal instructions.
[0004] Therefore, there is an urgent need to adopt a new training method to reduce the cost of constructing multimodal instructions, while introducing a two-way feedback loop to enhance the multimodal understanding and generation capabilities of student models. Summary of the invention
[0005] The exemplary embodiments of the present application provide a multimodal large-scale language model training, device, storage medium and electronic device to at least achieve the technical effect of reducing the cost of building multimodal instructions, while introducing a two-way feedback loop to enhance the multimodal understanding and generation capabilities of the student model.
[0006] Each exemplary embodiment of the present application proposes a multimodal large-scale language model training method, the method comprising the following steps:
[0007] S1. Construct a multimodal dataset and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal dataset is a large number of image and text data pairs collected;
[0008] S2. Using the filtered data pairs, pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text, and obtain a trained feature alignment layer;
[0009] S3, based on the trained feature alignment layer, fine-tuning the multimodal instructions so that the answer of the student model to the question is consistent with the multimodal answer given by the teacher model;
[0010] S4, fine-tuning the multimodal instructions so that the answers of the student model to the questions are consistent with the multimodal answers given by the teacher model;
[0011] S5. Conduct multimodal data quality assessment and evaluate and score multimodal instructions that are difficult for the assessment model to recognize;
[0012] S6. Generate multimodal data to generate more new instructions and combine them with the original images, build a new multimodal instruction dataset to train the student model, and iteratively enhance the multimodal capabilities of the student model.
[0013] In another aspect of the present application, a multimodal large-scale language model training device based on adversarial distillation technology is also proposed, the device comprising:
[0014] The multimodal pre-training module is configured to construct a multimodal data set and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal data set is a large number of image and text data pairs collected; and the filtered data pairs are used to pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text to obtain a trained feature alignment layer;
[0015] The multimodal adversarial distillation module is configured to perform multimodal instruction fine-tuning based on the trained feature alignment layer, so that the student model's answer to the posed question is consistent with the multimodal answer given by the teacher model; perform multimodal instruction fine-tuning, so that the student model's answer to the posed question is consistent with the multimodal answer given by the teacher model; perform multimodal data quality assessment, and evaluate and score the multimodal instructions that are difficult for the assessment model to recognize; generate multimodal data to generate more new instructions and combine them with the original image, construct a new multimodal instruction data set to train the student model, and iteratively enhance the multimodal capability of the student model.
[0016] In another aspect of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the storage medium, wherein the computer program is configured to execute the steps of any one of the above method embodiments when running.
[0017] In another aspect of the present application, an electronic device is proposed, comprising a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0018] Beneficial effects:
[0019] 1. The present invention proposes a multimodal large language model training method based on adversarial distillation technology. The method includes two main modules: a multimodal pre-training module and a multimodal adversarial distillation module. In the multimodal pre-training module, the multimodal features are aligned by a pre-trained feature alignment layer, and the visual encoder and the large language model are frozen to train the visual word segmentor to prepare the basic knowledge of the student model. Then, in the multimodal adversarial distillation module, through a three-stage cycle: multimodal instruction fine-tuning, multimodal data quality assessment, and multimodal data generation, the knowledge transfer from the teacher model to the student model is achieved, and the student model's ability to process multimodal data is evaluated and improved. This process includes filtering data using natural language processing tools, training feature alignment layers, and generating new multimodal instructions to continuously challenge the student model.
[0020] 2. The technical solution of the present invention has significant advantages and progress compared with the prior art. First, through the method of automated multimodal data filtering and generating new instructions, the cost and labor intensity of building multimodal instructions are significantly reduced, making the training of large multimodal language models more efficient and feasible. Secondly, the introduced multimodal adversarial distillation module effectively enhances the multimodal understanding and generation capabilities of the student model through a two-way feedback loop, especially in processing complex multimodal instructions. The performance has been significantly improved. Finally, the method of the present invention has a wide range of applicability. It is not only suitable for the currently popular open source multimodal large language models, but also can pave the way for further development in this field, and promote the improvement of the reasoning ability and versatility of multimodal large language models in a variety of application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram comparing the method of the present invention with other multimodal large-scale language model training methods in the prior art;
[0022] Figure 2 It is a schematic diagram of the process of the present invention;
[0023] Figure 3It is a schematic diagram of the architecture of a multimodal large-scale language model training method based on adversarial distillation technology of the present invention;
[0024] Figure 4 is a schematic diagram of the internal architecture of the multimodal student model of the present invention;
[0025] Figure 5 It is a visualization diagram of case analysis in Example 2 of the present invention;
[0026] Figure 6 This is a schematic diagram of an optional electronic device structure of the present application. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0028] In one embodiment, Figures 2 to 3 As shown, the present invention proposes a multimodal large language model training method based on adversarial distillation technology, the method comprising:
[0029] S1. Construct a multimodal dataset and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal dataset is a large number of image and text data pairs collected;
[0030] S2. Using the filtered data pairs, pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text, and obtain a trained feature alignment layer;
[0031] S3, based on the trained feature alignment layer, fine-tuning the multimodal instructions so that the answer of the student model to the question is consistent with the multimodal answer given by the teacher model;
[0032] S4, fine-tuning the multimodal instructions so that the answers of the student model to the questions are consistent with the multimodal answers given by the teacher model;
[0033] S5. Conduct multimodal data quality assessment and evaluate and score multimodal instructions that are difficult for the assessment model to recognize;
[0034] S6. Generate multimodal data to generate more new instructions and combine them with the original images, build a new multimodal instruction dataset to train the student model, and iteratively enhance the multimodal capabilities of the student model.
[0035] It should be noted that the multimodal pre-training process is based on a large number of collected image and text data pairs, which are strictly filtered to ensure that each pair of data is of high quality and that the image content is closely related to the text description. These screened data pairs are then used to train the feature alignment layer in the model to learn how to match the visual features of the image with the semantic features of the text. Through such training, the student model can understand and fuse information from different modalities in a unified representation space, laying the foundation for performing more complex multimodal tasks.
[0036] The multimodal adversarial distillation process performs multimodal adversarial distillation based on the feature alignment layer obtained after multimodal pre-training, which includes three stages. In essence, the multimodal adversarial distillation module establishes a two-way feedback loop to iteratively enhance the multimodal capabilities of the student model.
[0037] In one embodiment, the step S1 of constructing a multimodal data set and strictly filtering the data pairs therein to ensure that the content of the data pairs is closely related to the text description specifically includes the following:
[0038] The open source natural language processing tool Spacy is used to extract noun phrases from each title in the collected multimodal dataset and calculate the frequency of each phrase. Noun phrases with a frequency less than 3 are excluded because they usually represent rare concepts and attributes that are already covered by other pairs. Pairs containing these excluded noun phrases are sequentially added to the candidate pool, starting with the noun phrase with the lowest remaining frequency. If a noun phrase appears more than N times, we randomly select a subset of N pairs containing the noun phrase. By applying this filtering method, the multimodal dataset is filtered.
[0039] In one embodiment, the filtered multimodal data set of step S1 is defined as follows:
[0040]
[0041] Where D represents the entire multimodal dataset, which contains N multimodal dialogues X i Data, V i represents the image in the i-th multimodal instruction data, C i represents the i-th multimodal instruction dialogue data, Q represents the instruction question, A represents the corresponding answer, and each {(V i ,C i )} is merged into an image-text pair sequence, and the target answer is generated by calculating the following method The probability is as follows:
[0042]
[0043] Among them, θ represents the trainable parameters of the student model, refers to the question and answer tokens generated by the model in all previous rounds before the student model’s current predicted token, x t refers to the current predicted mark of the student model, V t Represents the current image data of the student model, V i ,Q t They refer to the current answer tag of the student model, the image data of the i-th round, and the current user question respectively.
[0044] In one embodiment, the specific steps of performing multimodal data quality assessment in step S5 and assessing and scoring multimodal instructions that are difficult for the assessment model to recognize are as follows:
[0045] Starting from the instruction cache data pool, the instruction fine-tuning data pool and the instruction cache data pool have the same initial state, but the instruction fine-tuning data pool is updated by replacing its current instructions with newly generated instructions, while the instruction cache data pool is updated by merging all newly generated instructions. Based on the data in the cache pool, the prompt evaluation model G is used to evaluate the difficulty of the multimodal instructions according to the answers of the teacher model T and the student model S. First, the scores of both parties are obtained by the prompt evaluation model G. The scoring rules are as follows:
[0046]
[0047]
[0048] The difficulty coefficient is calculated using the following formula:
[0049]
[0050] in, refers to the score evaluated by the student model for the kth question, Refers to the score evaluated by the teacher model for the kth question.
[0051] In one embodiment, generating multimodal data in step S6 specifically includes:
[0052] By prompting the generative model G to generate new instructions, the newly generated instructions must be consistent with the task type of the original instructions and have the same difficulty coefficient. The identified simple instruction sets are sampled so that the number of difficult instruction sets and simple instruction sets are equal. To ensure instruction diversity, each newly generated instruction is considered valid only if the length of its common subsequence with all other instructions of the corresponding image is less than 0.7.
[0053] The following is an example using a specific case.
[0054] Multimodal large language model training method based on adversarial distillation technology, such as Figure 3 As shown, it includes a multimodal pre-training module and a multimodal adversarial distillation module.
[0055] The multimodal pre-training module: Based on the collected open source multimodal image-text pair data, the open source natural language processing tool Spacy is used to extract noun phrases from each title in the collected multimodal dataset and calculate the frequency of each phrase. Noun phrases with a frequency less than 3 are excluded because they usually represent rare concepts and attributes that are already covered by other pairs. Pairs containing these excluded noun phrases are sequentially added to the candidate pool, starting with the noun phrase with the lowest remaining frequency. If a noun phrase appears more than 100 times, we randomly select a subset of 100 pairs containing the noun phrase. By applying this filtering method, the multimodal dataset is filtered.
[0056] The filtered multimodal dataset is as follows:
[0057]
[0058] Where D represents the entire multimodal dataset, which contains N multimodal dialogues X i Data, V i represents the image in the i-th multimodal instruction data, C i represents the i-th multimodal instruction dialogue data, Q represents the instruction question, A represents the corresponding answer, and each {(V i ,C i )} is merged into an image-text pair sequence, and the target answer is generated by calculating the following method The probability is as follows:
[0059]
[0060] where θ represents the trainable parameters of the student model. refers to the question and answer tokens generated by the model in all previous rounds before the student model’s current predicted token, x t refers to the current predicted mark of the student model, V t Represents the current image data of the student model, V i ,Q t They refer to the current answer tag of the student model, the image data of the i-th round, and the current user question. Model training and internal architecture are as follows Figure 4 As shown, through the above pre-training method, the feature alignment layer of the student model is obtained.
[0061] The multimodal adversarial distillation module: During the multimodal instruction fine-tuning phase, by prompting the teacher model And generate the corresponding answer For each multimodal instruction question in the instruction fine-tuning data pool, all single-turn dialogues Convert to a multi-round dialogue format to train the student model Fine-tune the instructions.
[0062] In the multimodal data quality assessment phase, this phase starts from the instruction cache data pool, where the instruction fine-tuning data pool and the instruction cache data pool have the same initial state, but the instruction fine-tuning data pool is updated by replacing its current instructions with newly generated instructions, while the instruction cache data pool is updated by merging all newly generated instructions. Based on the data in the cache pool, the prompt evaluation model G is used to evaluate the difficulty of the multimodal instructions according to the answers of the teacher model T and the student model S. First, the scores of both parties are obtained by the prompt evaluation model G, and the scoring rules are as follows:
[0063]
[0064]
[0065] Furthermore, the difficulty coefficient is calculated using the following formula:
[0066]
[0067] in, refers to the score evaluated by the student model for the kth question, Refers to the score evaluated by the teacher model for the kth question. In the multimodal data generation stage, the model G is generated by prompting to generate new instructions. The newly generated instructions must be consistent with the task type of the original instructions and have the same difficulty coefficient. The identified simple instruction sets are sampled so that the number of difficult instruction sets and simple instruction sets are equal. To ensure instruction diversity, each newly generated instruction is considered valid only if the length of its common subsequence with all other instructions of the corresponding image is less than 0.7. At this point, the adversarial distillation training of the multimodal large language model based on the data in the initial instruction fine-tuning data pool and the instruction cache data pool is completed.
[0068] Embodiment 2:
[0069] The student model trained by this method is used to make inference predictions on three multimodal reasoning data samples and compared with other mainstream open source multimodal large language models. The comparison results are as follows: Figure 5 shown.
[0070] In the first example, we can see that the student model trained by this method is better at analyzing fine-grained elements in the image. The task in the first example is to analyze four different objects in the image (stone, tinfoil, binder clip, ceramic cup) and infer their common characteristics. Although the other open source model analyzed these four objects, it failed to correctly infer their common characteristics. The student model trained by this method correctly inferred that "opaque objects do not let light through. All four objects are opaque."
[0071] In the second example, the multimodal reasoning task involves perceiving a complex motion state and then determining the color of an athlete's gloves. Other open source large models incorrectly took the color of an athlete's wristband (white) as the answer. However, the student model trained by this method correctly identified and distinguished the color of the gloves in the image (black), demonstrating a better understanding of complex images.
[0072] The third example requires a detailed description of the image content. It can be seen that although other models describe some of the main elements in the image (elephant, land), its answer is hallucinatory and includes a non-existent person as a key element. The student model trained by this method avoids this problem, accurately describes the main elements (elephant, land), and also identifies the "tire" element missing in the standard answer. This implementation case gives a method for adversarial distillation training based on the multimodal large model of the present invention in an actual multimodal reasoning task, and demonstrates the role and effect of the present invention in the implementation case.
[0073] According to another aspect of the embodiment of the present application, an electronic device for a multimodal large language model training method based on adversarial distillation technology is also provided, and the electronic device can be but is not limited to being applied in a server. Figure 6 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0074] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0075] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0076] S1. Construct a multimodal dataset and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal dataset is a large number of image and text data pairs collected;
[0077] S2. Using the filtered data pairs, pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text, and obtain a trained feature alignment layer;
[0078] S3, based on the trained feature alignment layer, fine-tuning the multimodal instructions so that the answer of the student model to the question is consistent with the multimodal answer given by the teacher model;
[0079] S4, fine-tuning the multimodal instructions so that the answers of the student model to the questions are consistent with the multimodal answers given by the teacher model;
[0080] S5. Conduct multimodal data quality assessment and evaluate and score multimodal instructions that are difficult for the assessment model to recognize;
[0081] S6. Generate multimodal data to generate more new instructions and combine them with the original images, build a new multimodal instruction dataset to train the student model, and iteratively enhance the multimodal capabilities of the student model.
[0082] Alternatively, a person skilled in the art may understand that: Figure 6 The structure shown is for illustration only, and the electronic device may also be a terminal device such as a mobile Internet device (MID) or a PAD. Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 6 Different configurations shown.
[0083] The memory 902 may include a high-speed random access memory and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. As an example, Figure 6 As shown, the above-mentioned memory 902 may include but is not limited to a model training module, etc., which will not be repeated in this example.
[0084] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0085] In addition, the electronic device further includes: a display 908 for displaying current simulation results; and a connection bus 910 for connecting various module components in the electronic device.
[0086] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.
[0087] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:
[0088] S1. Construct a multimodal dataset and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal dataset is a large number of image and text data pairs collected;
[0089] S2. Using the filtered data pairs, pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text, and obtain a trained feature alignment layer;
[0090] S3, based on the trained feature alignment layer, fine-tuning the multimodal instructions so that the answer of the student model to the question is consistent with the multimodal answer given by the teacher model;
[0091] S4, fine-tuning the multimodal instructions so that the answers of the student model to the questions are consistent with the multimodal answers given by the teacher model;
[0092] S5. Conduct multimodal data quality assessment and evaluate and score multimodal instructions that are difficult for the assessment model to recognize;
[0093] S6. Generate multimodal data to generate more new instructions and combine them with the original images, build a new multimodal instruction dataset to train the student model, and iteratively enhance the multimodal capabilities of the student model.
[0094] Optionally, the storage medium is also configured to store a computer program for executing the steps included in the method in the above embodiment, which will not be described in detail in this embodiment.
[0095] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0096] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0097] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
[0098] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0099] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0100] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0101] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0102] The above is only a preferred embodiment of the present application. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present application, and these improvements and modifications should also be regarded as the scope of protection of the present application.
[0103] Although the preferred embodiments of the present application have been described, those skilled in the art, once knowing the basic creative concept, can make other changes and modifications according to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.
[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
[0105] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A multimodal large-scale language model training method, characterized in that: The method comprises: S1. Construct a multimodal dataset and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal dataset is a large number of image and text data pairs collected; S2. Using the filtered data pairs, pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text, and obtain a trained feature alignment layer; S3, based on the trained feature alignment layer, fine-tuning the multimodal instructions so that the answer of the student model to the question is consistent with the multimodal answer given by the teacher model; S4, fine-tuning the multimodal instructions so that the answers of the student model to the questions are consistent with the multimodal answers given by the teacher model; S5. Conduct multimodal data quality assessment and evaluate and score multimodal instructions that are difficult for the assessment model to recognize; S6. Generate multimodal data to generate more new instructions and combine them with the original images, build a new multimodal instruction dataset to train the student model, and iteratively enhance the multimodal capabilities of the student model.
2. The multimodal large-scale language model training method according to claim 1, characterized in that: The step S1 of constructing a multimodal data set and strictly filtering the data pairs therein to ensure that the content of the data pairs is closely related to the text description specifically includes the following: The open source natural language processing tool Spacy is used to extract noun phrases from each title in the collected multimodal dataset and calculate the frequency of each phrase. Noun phrases with a frequency less than 3 are excluded. Pairs containing these excluded noun phrases are sequentially added to the candidate pool, starting with the noun phrase with the lowest remaining frequency. If a noun phrase appears more than N times, N subsets of pairs containing the noun phrase are randomly selected to filter the multimodal dataset.
3. The multimodal large-scale language model training method according to claim 2, characterized in that: The filtered multimodal dataset of step S1 is defined as follows: Where D represents the entire multimodal dataset, which contains N multimodal dialogues X i Data, V i represents the image in the i-th multimodal instruction data, C i represents the i-th multimodal instruction dialogue data, Q represents the instruction question, A represents the corresponding answer, and each {(V i , C i )} is merged into an image-text pair sequence, and the target answer is generated by calculating the following method The probability is as follows: Among them, θ represents the trainable parameters of the student model, refers to the question and answer tokens generated by the model in all previous rounds before the student model’s current predicted token, x t refers to the current predicted mark of the student model, V t Represents the current image data of the student model, V i , Q t They refer to the current answer tag of the student model, the image data of the i-th round, and the current user question respectively.
4. The multimodal large language model training method based on adversarial distillation technology according to claim 3, characterized in that: The specific steps of fine-tuning the multimodal instructions in step S3 so that the answers of the student model to the questions raised are consistent with the multimodal answers given by the teacher model are as follows: By prompting the teacher model T and generating the corresponding answer For each multimodal instruction question in the instruction fine-tuning data pool, all single-turn dialogues Convert to a multi-round dialogue format to train the student model Fine-tune the instructions.
5. The multimodal large-scale language model training method according to claim 4, characterized in that: The specific steps of performing multimodal data quality assessment in step S5 and assessing and scoring multimodal instructions that are difficult for the assessment model to recognize are as follows: Starting from the instruction cache data pool, the instruction fine-tuning data pool and the instruction cache data pool have the same initial state, but the instruction fine-tuning data pool is updated by replacing its current instructions with newly generated instructions, while the instruction cache data pool is updated by merging all newly generated instructions. Based on the data in the cache pool, the prompt evaluation model G is used to evaluate the difficulty of the multimodal instructions according to the answers of the teacher model T and the student model S. First, the scores of both parties are obtained by the prompt evaluation model G. The scoring rules are as follows: The difficulty coefficient is calculated using the following formula: in, refers to the score evaluated by the student model for the kth question, Refers to the score evaluated by the teacher model for the kth question.
6. The multimodal large-scale language model training method according to claim 5, characterized in that: The step S6 generates multimodal data, which specifically includes: By prompting the generative model G to generate new instructions, the newly generated instructions must be consistent with the task type of the original instructions and have the same difficulty coefficient. The identified simple instruction sets are sampled so that the number of difficult instruction sets and simple instruction sets are equal. To ensure instruction diversity, each newly generated instruction is considered valid only if the length of its common subsequence with all other instructions of the corresponding image is less than 0.
7.
7. A multimodal large-scale language model training device, characterized in that: The device comprises: The multimodal pre-training module is configured to construct a multimodal data set and strictly filter the data pairs therein to ensure that the content of the data pairs is closely related to the text description; wherein the multimodal data set is a large number of image and text data pairs collected; and the filtered data pairs are used to pre-train the feature alignment layer in the student model to learn how to match the visual features of the image and the semantic features of the text to obtain a trained feature alignment layer; The multimodal adversarial distillation module is configured to perform multimodal instruction fine-tuning based on the trained feature alignment layer, so that the student model's answer to the posed question is consistent with the multimodal answer given by the teacher model; perform multimodal instruction fine-tuning, so that the student model's answer to the posed question is consistent with the multimodal answer given by the teacher model; perform multimodal data quality assessment, and evaluate and score the multimodal instructions that are difficult for the assessment model to recognize; generate multimodal data to generate more new instructions and combine them with the original image, construct a new multimodal instruction data set to train the student model, and iteratively enhance the multimodal capability of the student model.
8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 6 when executed.
9. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Adversarial distillation method and device based on large language model and storage medium
CN117556887A
Multi-modal pre-training model acquisition method and apparatus, electrnonic device and storage medium
EP3940580A1
Cited By
Teaching auxiliary system based on large model Agent and database multi-technology fusion
CN119807355A
