Training method, device, equipment and storage medium for multimodal pre-training model

Through the multi-modal pre-training model training method, the visual encoder, multi-language encoder and English decoder are used for comparative learning, which solves the problem of low visual feature utilization in the multi-language text-image pre-training method and achieves better Cross-modal feature extraction and downstream task performance.

CN118133241BActive Publication Date: 2024-09-13INST OF AUTOMATION CHINESE ACAD OF SCI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410552190.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-05-07
Publication Date
2024-09-13
Estimated Expiration
2044-05-07

AI Technical Summary

Technical Problem

Existing multilingual text-image pre-training methods rely on multilingual text-image aligned data, resulting in low visual feature utilization and complex transfer, which limits cross-modal feature processing and the performance of downstream tasks.

Method used

Use a multi-modal pre-training model, including a visual encoder, a multi-language encoder and an English decoder, and conduct comparative learning through image-English text data, multi-language text-English text data and target text-image data to obtain a similarity matrix and strong negative sample data, using the autoregressive pre-training method to align under the English encoding space, reducing the dependence on multi-language-image data and directly utilizing visual features.

Benefits of technology

It effectively alleviates the dependence on multi-language-image data, improves the robustness of the model and the performance of downstream tasks, enables more direct utilization of visual features, and enhances cross-modal feature extraction capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118133241B
    Figure CN118133241B
Patent Text Reader

Abstract

The present invention relates to the field of multimodal technology, and provides a training method, device, equipment and storage medium for a multimodal pre-training model, including: constructing a multimodal pre-training model, including a visual encoder, a multilingual encoder and an English decoder; obtaining a first loss function based on image-English text data; obtaining a second loss function based on multilingual text-English text data; obtaining a third loss function based on target text-image data applied to a visual encoder and a multilingual encoder for comparative learning; obtaining strong negative sample data based on a similarity matrix of target text-image data, and obtaining a fourth loss function based on strong negative sample data and positive sample data applied to an English decoder; obtaining a trained multimodal pre-training model based on the first loss function, the second loss function, the third loss function and the fourth loss function. The present invention not only effectively alleviates the dependence on multilingual-image data, but also directly and effectively utilizes visual features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of multimodal technology, and in particular to a training method, device, equipment and storage medium for a multimodal pre-training model. Background Art

[0002] Cross-modality is a unified representation method for multimodal information such as vision and language. By aligning multimodal information in latent space, the model can extract cross-modal features, which are highly versatile and robust. Information processing in a multilingual environment is also a major focus at present. By achieving alignment between multilingual and multimodal information, reasoning, question answering, retrieval and other tasks in a multilingual environment can be achieved in downstream tasks. However, the differences between different languages ​​and different modalities increase the difficulty of information processing, and a better multilingual and multimodal information representation and processing method is needed.

[0003] However, current multilingual text-image pre-training methods still rely on multilingual text-image aligned data, which is extremely scarce, especially for minority languages. It also has the characteristics of low utilization of visual features and complex migration, which will limit the model's cross-modal feature processing and downstream task performance. Summary of the invention

[0004] The present invention provides a training method, device, equipment and storage medium for a multimodal pre-training model, which are used to solve the defects of the prior art multi-language text-image pre-training method that still relies on multi-language text-image aligned data, has low visual feature utilization and complex migration.

[0005] The present invention provides a training method for a multimodal pre-training model, the method comprising:

[0006] Constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0007] Based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function;

[0008] Based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function;

[0009] Based on target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0010] Based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data;

[0011] Based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function;

[0012] Based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained.

[0013] According to a training method for a multimodal pre-training model provided by the present invention, the image-English text data includes first image data and first English text data corresponding to the first image data; the image-English text data is applied to the visual encoder and the English decoder to obtain a corresponding first loss function, including:

[0014] Inputting the first image data into the visual encoder to obtain a first image feature output by the visual encoder;

[0015] splicing the first image feature and the first guide feature and inputting the resultant feature into the English decoder to obtain second English text data output by the English decoder;

[0016] Based on the second English text data and the first English text data, a corresponding first loss function is obtained.

[0017] According to a training method for a multimodal pre-training model provided by the present invention, the multilingual text-English text data includes first multilingual text data and third English text data corresponding to the first multilingual text data, and the multilingual text-English text data is applied to the multilingual encoder and the English decoder to obtain a corresponding second loss function, including:

[0018] Inputting the first multilingual text data into the multilingual encoder to obtain first multilingual text features output by the multilingual encoder;

[0019] splicing the first multilingual text feature and the second guide feature and inputting the resultant feature into the English decoder to obtain fourth English text data output by the English decoder;

[0020] Based on the third English text data and the fourth English text data, a corresponding second loss function is obtained.

[0021] According to a training method for a multimodal pre-training model provided by the present invention, the target text-image data is English text-image data, the English text-image data includes fifth English text data and second image data, and the target text-image data is applied to the visual encoder and the multilingual encoder for comparative learning to obtain a corresponding third loss function, including:

[0022] Inputting the second image data into the visual encoder to obtain a first feature vector of the second image features output by the visual encoder;

[0023] Inputting the fifth English text data into the multi-language encoder to obtain a first feature vector in the English text features output by the multi-language encoder;

[0024] Determine a first similarity matrix between the fifth English text data and the second image data and a second similarity matrix thereof based on the similarity between the first feature vector in the second image feature and the first feature vector in the English text feature;

[0025] Based on the first similarity matrix and the second similarity matrix, a third loss function of the visual encoder and the multilingual encoder under contrastive learning is obtained.

[0026] According to a training method for a multimodal pre-training model provided by the present invention, the similarity matrix of the target text-image data under the contrastive learning is used to obtain strong negative sample data in the target text-image data, including:

[0027] Based on the first similarity matrix, English text-image data with the highest similarity except for the positive sample data is obtained from the fifth English text data and the second image data, and used as strong negative sample data.

[0028] According to a training method for a multimodal pre-training model provided by the present invention, the strong negative sample data and the corresponding positive sample data are applied to the English decoder to obtain the corresponding fourth loss function, including:

[0029] The second image feature of the second image data, the English text feature of the fifth English text data in the positive sample data, and the third guide feature are concatenated to obtain a first image-text pair feature;

[0030] The second image feature of the second image data, the English text feature of the fifth English text data in the strong negative sample data, and the third guide feature are concatenated to obtain a second image-text pair feature;

[0031] The first image-text pair feature and the second image-text pair feature are input into the English decoder to obtain a corresponding fourth loss function.

[0032] According to a training method for a multimodal pre-training model provided by the present invention, the method further includes:

[0033] Obtain multimodal training data corresponding to downstream tasks;

[0034] The model parameters of the multimodal pre-training model are updated based on the multimodal training data to obtain a target downstream task model corresponding to the downstream task.

[0035] The present invention also provides a training device for a multimodal pre-training model, the device comprising:

[0036] A first multimodal pre-training model training module, used to construct a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0037] A training module of a second multimodal pre-trained model, used for applying to the visual encoder and the English decoder based on image-English text data to obtain a corresponding first loss function;

[0038] A training module of a third multimodal pre-trained model, used for applying to the multilingual encoder and the English decoder based on the multilingual text-English text data to obtain a corresponding second loss function;

[0039] a training module of a fourth multimodal pre-trained model, configured to apply the visual encoder and the multilingual encoder to perform comparative learning based on target text-image data to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0040] a training module of a fifth multimodal pre-training model, configured to obtain strong negative sample data in the target text-image data based on a similarity matrix of the target text-image data under the contrastive learning;

[0041] A training module of a sixth multimodal pre-trained model, used for applying the strong negative sample data and the corresponding positive sample data to the English decoder to obtain a corresponding fourth loss function;

[0042] The training module of the seventh multimodal pre-trained model is used to obtain a trained multimodal pre-trained model based on the first loss function, the second loss function, the third loss function and the fourth loss function.

[0043] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a training method for a multimodal pre-training model as described above is implemented.

[0044] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a training method for a multimodal pre-training model as described in any one of the above.

[0045] The present invention also provides a computer program product, comprising a computer program, which, when executed by a processor, implements a training method for a multimodal pre-training model as described above.

[0046] The training method, device, equipment and storage medium of the multimodal pre-training model provided by the present invention construct a multimodal pre-training model, the multimodal pre-training model includes a visual encoder, a multilingual encoder and an English decoder; based on image-English text data, applied to the visual encoder and the English decoder to obtain a corresponding first loss function; based on multilingual text-English text data, applied to the multilingual encoder and the English decoder to obtain a corresponding second loss function; based on target text-image data, applied to the visual encoder and the multilingual encoder for comparative learning to obtain a corresponding third loss function, the target text-image data includes English text-image data or multilingual text-image data; based on the similarity matrix of the target text-image data under comparative learning, strong negative sample data in the target text-image data is obtained; based on the strong negative sample data and the corresponding positive sample data, applied to the English decoder to obtain a corresponding fourth loss function; based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained. The present invention decouples multilingual text-image data and unifies them through a unified generative task, uses a larger stock of image-English text data and multilingual text-English text data for training, and aligns them in the English encoding space, which can effectively alleviate the dependence on multilingual-image data. The unified pre-training framework will also help model learning to a certain extent. On the other hand, the autoregressive pre-training method can realize the image-based description generation task based on visual features. Compared with masked text recovery, this task reduces the use of contextual relationships in the text modality, but learns completely from the visual dimension, which can use visual features more directly and effectively. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0048] Figure 1 It is a flowchart of the training method of the multimodal pre-training model provided by the present invention;

[0049] Figure 2 It is a structural schematic diagram of a training device for a multimodal pre-training model provided by the present invention;

[0050] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] In the related technologies, some methods have made great progress in multimodal or multilingual content understanding, and some methods use advanced feature fusion strategies to achieve alignment of multimodal content representation. The alignment of multilingual and multimodal requires not only the alignment of multiple languages ​​in latent space representation, but also the alignment of these languages ​​with the visual space. In comparison, the alignment requirements are more stringent. The initial attempt added multilingual and multimodal inputs through random substitution on the basis of monolingual multimodality and multilingual monomodality, and designed a language exchange task for training to enable the model to acquire multilingual capabilities; descriptions in two languages ​​were used as input together with visual modality data, and the targets detected by the offline network were introduced to associate masks with multilingual texts, effectively guiding the association between images and keyword information.

[0053] In related technologies, there are also structural pre-training strategies such as alignment first and then fusion based on monolingual models. For example, using images and annotations of two languages ​​as input, image-English and English-Chinese are regarded as two different perspectives of the model for input and training, including cross-modal visual-multilingual text dual-perspective input and cross-language multilingual-English dual-perspective input. The network model structure is a combination of a superimposed multi-layer self-attention, dual-perspective cross-attention and feedforward network. It was tested under multilingual multimodal test tasks, and its zero-shot results and fine-tuned results in multilingual logical reasoning, question-answering, retrieval and other tasks far exceeded many previous solutions, and even surpassed most English monolingual multimodal pre-training models that have been machine translated.

[0054] However, existing multilingual and multimodal pre-training is highly dependent on multilingual text-image datasets, which have abundant data for major languages ​​such as English, but are very scarce for other languages, resulting in poor training results for minor languages. At the same time, existing methods do not design pre-training tasks based on the characteristics of multimodality. The use of multimodal text mask recovery will partially focus on contextual information and does not directly use visual information to train the model.

[0055] Therefore, in response to the above problems, the present invention provides a training method for a multimodal pre-training model. The present invention proposes a method based on autoregressive pre-training and data decoupling to solve the above problems. Data decoupling can effectively reduce the dependence on multi-language-image data, and use autoregressive pre-training to achieve alignment of multi-language and image space through English. At the same time, autoregressive pre-training can also more directly use visual features for alignment, achieving a more robust feature extraction capability of the model and better downstream task performance.

[0056] Figure 1 is a flow chart of the training method of the multimodal pre-training model provided by the present invention, such as Figure 1 As shown, the method includes:

[0057] Step 110, constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0058] Here, the multimodal pre-trained model includes three main components: visual encoder, multilingual encoder, and English decoder.

[0059] Among them, the visual encoder is responsible for processing image data. It usually uses deep learning techniques (such as convolutional neural networks (CNNs)) to extract features from images and convert these features into numerical representations that the model can understand.

[0060] The multilingual encoder is used to process text data in multiple languages. It can convert text in different languages ​​into a unified numerical representation, allowing the model to understand and compare information from different languages.

[0061] The role of the English decoder is to convert the output of the visual encoder and the multilingual encoder into English text. It generates English descriptions or translations corresponding to the features and information extracted by the previous two encoders.

[0062] In this embodiment, a multimodal pre-training model is formed by combining the visual encoder, the multilingual encoder and the English decoder. This model can process image and text data at the same time and establish a connection between them. By pre-training this model with a large amount of training data, it can learn how to effectively extract and integrate information from multimodal data.

[0063] Step 120, based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function;

[0064] Here, the image-English text data consists of two parts: one part is the image data, and the other part is the English text data corresponding to the image data. These English text data are usually descriptions or labels of the image, such as image title data in English text, which are used to indicate the content in the image data.

[0065] The visual encoder is responsible for processing image data and extracting useful image features from it. The English decoder receives the image features output by the visual encoder and predicts or generates English text data based on the image features. Finally, the first loss function is obtained based on the difference between the English text data generated by the English decoder and the real English text data through cross entropy loss.

[0066] In one example, for visual input image data, data enhancement can be performed by random transformation, cropping, color transformation, etc., and the enhanced image data is processed in blocks. For example, each image data is divided into 16 16-dimensional fixed-scale image blocks. Each image block is then vectorized and input into the visual encoder. The visual encoder extracts a feature vector of 768 dimensions from the vectorized image block. The feature vector of 768 dimensions is input into the English decoder to obtain the English text data predicted by the English encoder.

[0067] Step 130, based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function;

[0068] Here, the multilingual text-English text data consists of two parts: one part is the multilingual text data, and the other part is the English text data corresponding to the multilingual text data. These English text data are usually translations or descriptions of the multilingual text, and are used to indicate the content in the multilingual text data.

[0069] The multilingual encoder is responsible for processing multilingual text data and extracting useful multilingual text features from it. The English decoder receives the multilingual text features output by the multilingual encoder and predicts or generates the corresponding English text based on the multilingual text features. Finally, the second loss function is obtained based on the difference between the English text data generated by the English decoder and the real English text data through cross entropy loss.

[0070] In one example, for the input multilingual text data, an unsupervised text segmentation tool, such as a SentencePiece encoder, can be used to segment the multilingual text data according to the subwords in the dictionary. After segmentation by the SentencePiece encoder, each subword will be mapped to a unique number in the dictionary. Through the numbering, the multilingual encoder can identify and process different subwords and use them as part of the input. Then, the text encoding layer is used for alignment vectorization. After alignment vectorization by the text encoding layer, the vector representation of each subword will be sent to the multilingual encoder, and each subword will be extracted by the multilingual encoder to obtain a feature vector with a dimension of 768. The feature vector with a dimension of 768 is input into the English decoder to obtain the English text data predicted by the English encoder.

[0071] Step 140, based on the target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0072] In this step, the target text-image data is applied to the visual encoder and the multilingual encoder for comparative learning to strengthen the alignment relationship between the visual encoder and the multilingual encoder.

[0073] The target text-image data here may be paired English text-image data, or may be paired multilingual text-image data. In this embodiment, paired English text-image data is used as a representative for explanation, wherein the data processing process of the multilingual text-image data is consistent with the data processing process of the English text-image data, and will not be described in detail here.

[0074] First, feature extraction is performed from the paired English text data and image data through a visual encoder and a multilingual encoder respectively. The visual encoder is responsible for processing the image data and extracting image features therefrom, and the multilingual encoder is responsible for processing the English text data and extracting English text features therefrom.

[0075] Next, the extracted image features are compared with the English text features for learning. It should be noted here that contrastive learning is a special training method that optimizes the model by comparing the similarities between different samples. In this embodiment, in the contrastive learning of English text-image data, the matching English text and image features are brought closer together, while the unmatched English text and image features are pushed away through the similarity between the features.

[0076] Finally, by comparing several image data with English text data, we get a third loss function that measures the performance of the model in contrastive learning. The third loss function takes into account the similarity between English text features and image features. For matching English text-image data, we hope that their feature similarity is as high as possible; for mismatched English text-image data, we hope that their feature similarity is as low as possible. By adjusting the parameters of the visual encoder and the multilingual encoder to optimize the third loss function, the visual encoder and the multilingual encoder can learn how to better align English text features and image features, thereby strengthening the alignment relationship between the two encoders.

[0077] Step 150, based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data;

[0078] In this step, the data processing process of the English text-image data described above is continued as a representative for explanation.

[0079] It should be noted that, in the framework of contrastive learning, when the target text-image data is used to train the visual encoder and the multilingual encoder, a similarity matrix of English text-image data will be obtained.

[0080] First, the similarity matrix is ​​a two-dimensional matrix whose rows and columns represent English text data and image data respectively. Each element in the matrix represents the similarity between the corresponding English text feature and the image feature. This similarity score is usually obtained by calculating the dot product, cosine similarity or other metrics between the English text feature and the image feature.

[0081] Positive sample data refers to the input English text data and image data that are indeed matched. In other words, each batch of data used for training has one-to-one corresponding image data and English text data. These one-to-one corresponding image data and English text data are considered positive sample data. Positive sample data usually have a relatively high similarity in the similarity matrix because their contents are related or consistent. Strong negative sample data refers to those English text data and image data that do not match but are semantically similar to the positive sample data. Here they can be sorted according to the similarity in the similarity matrix. Generally, those English text data and image data pairs that have a high similarity but do not belong to the positive sample data are considered strong negative sample data.

[0082] Step 160, based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function;

[0083] In this step, the English decoder is trained based on the strong negative sample data obtained in the above steps in combination with the positive sample data. The English decoder is optimized by comparing the positive sample data and the strong negative sample data obtained by learning, so that it can more accurately distinguish the detailed features between samples of different modalities.

[0084] Specifically, during the training process, the English decoder receives these positive sample data and strong negative sample data inputs and tries to generate a text description that matches the image content (or generate an image representation that matches the text content). For each generated text description (or image representation), we compare it with the corresponding true value. In order to measure the difference between the generated result and the true value, a corresponding fourth loss function of the cross entropy loss can be generated.

[0085] Step 170: obtain a trained multimodal pre-training model based on the first loss function, the second loss function, the third loss function and the fourth loss function.

[0086] In this embodiment, the four loss functions obtained through the above steps can obtain a comprehensive and multi-dimensional training mechanism, thereby obtaining a trained multimodal pre-training model.

[0087] Among them, the above four loss functions can be optimized and learned separately in their corresponding self-supervised learning tasks, or can be optimized and learned together in one self-supervised learning task, without restriction.

[0088] In this embodiment, by decoupling the multilingual text-image data and unifying them through a unified generative task, using a larger stock of image-English text data and multilingual text-English text data for training, and aligning them in the English encoding space, the dependence on multilingual-image data can be effectively alleviated, and the unified pre-training framework will also bring certain help to model learning. On the other hand, the autoregressive pre-training method can realize the image-based description generation task in terms of visual features. Compared with masked text recovery, this task reduces the use of contextual relationships in the text modality, but learns completely from the visual dimension, which can make more direct and effective use of visual features.

[0089] In some embodiments, the image-English text data includes first image data and first English text data corresponding to the first image data; the image-English text data is applied to the visual encoder and the English decoder to obtain the corresponding first loss function, including:

[0090] Inputting the first image data into the visual encoder to obtain a first image feature output by the visual encoder;

[0091] splicing the first image feature and the first guide feature and inputting the resultant feature into the English decoder to obtain second English text data output by the English decoder;

[0092] Based on the second English text data and the first English text data, a corresponding first loss function is obtained.

[0093] In this step, for the input of image-English text data, the image title generation of English text is used as the task goal. That is, for the input image-English text data, the first image data in the image-English text data is used as input, and the first image feature data output after feature extraction by the visual encoder is A first guidance feature encoded by a decoder with guidance information identifying a mission target The first splicing feature obtained by splicing As the input of the English decoder, its goal is to be based on the input Generate the corresponding English text image caption, where the first concatenated feature It is obtained by splicing in the following way:

[0094] ;in, For splicing operation.

[0095] Finally, the cross entropy loss is used to calculate the gap between the predicted distribution of each generated feature vector in the vocabulary (i.e., the second English text data) and the true value (i.e., the first English text data). The loss is recorded as the first loss function .

[0096] In some embodiments, the multilingual text-English text data includes first multilingual text data and third English text data corresponding to the first multilingual text data, and the multilingual text-English text data is applied to the multilingual encoder and the English decoder to obtain the corresponding second loss function, including:

[0097] Inputting the first multilingual text data into the multilingual encoder to obtain first multilingual text features output by the multilingual encoder;

[0098] splicing the first multilingual text feature and the second guide feature and inputting the resultant feature into the English decoder to obtain fourth English text data output by the English decoder;

[0099] Based on the third English text data and the fourth English text data, a corresponding second loss function is obtained.

[0100] For the input of multilingual text-English text data, the translation generation of English text is used as the task goal. That is, for the input multilingual text-English text data, the first multilingual text data in the multilingual text-English text data is used as the input, and the first multilingual text feature is output after the feature extraction of the multilingual text encoder. A second guidance feature encoded with guidance information of a mission objective via a decoder The second splicing feature obtained by splicing As the input of the English decoder, its goal is to be based on the input Generate the corresponding English translation, where the second concatenation feature It is obtained by splicing in the following way:

[0101] ;in, For splicing operation.

[0102] Finally, the cross entropy loss is used to calculate the gap between the predicted distribution of each generated vector in the vocabulary (i.e., the fourth English text data) and the true value (i.e., the third English text data). The loss is recorded as the second loss function .

[0103] In some embodiments, the target text-image data is English text-image data, the English text-image data includes fifth English text data and second image data, and the target text-image data is applied to the visual encoder and the multilingual encoder for comparative learning to obtain the corresponding third loss function, including:

[0104] Inputting the second image data into the visual encoder to obtain a first feature vector of the second image features output by the visual encoder;

[0105] Inputting the fifth English text data into the multi-language encoder to obtain a first feature vector in the English text features output by the multi-language encoder;

[0106] Determine a first similarity matrix between the fifth English text data and the second image data and a second similarity matrix thereof based on the similarity between the first feature vector in the second image feature and the first feature vector in the English text feature;

[0107] Based on the first similarity matrix and the second similarity matrix, a third loss function of the visual encoder and the multilingual encoder under contrastive learning is obtained.

[0108] Specifically, for the fifth English text data and the second image data, there is a group of fifth English text data-second image data with paired images and texts, and several groups of fifth English text data-second image data with unpaired images and texts. In this step, the fifth English text data-second image data of each group is sequentially input into the visual encoder and the multilingual encoder, and the visual encoder can extract the second image features from the second image data, and the multilingual encoder can extract the English text features from the fifth English text data.

[0109] It can be understood that both the visual encoder and the multilingual encoder will output a feature vector sequence, and the first feature vector refers to the first vector in the feature vector sequence. and the first feature vector in the English text feature Perform contrastive learning within the same batch to obtain the corresponding third loss function.

[0110] Specifically, by taking the first feature vector in the second image feature To the first feature vector in the English text feature Perform similarity calculation to obtain the first similarity , and, by taking the first feature vector in the English text feature To the first feature vector in the second image feature Perform similarity calculation to obtain the second similarity of the duality Finally, normalize and construct the first similarity matrix and the second similarity matrix of the dual to obtain the third loss function to perform unsupervised contrastive learning training.

[0111] Among them, the third loss function It is obtained by:

[0112] ;

[0113] in, Represents the first similarity The corresponding loss part of the first similarity matrix is, Represents the loss part obtained according to the second similarity matrix of the dual.

[0114] Here, the loss part obtained by the first similarity matrix corresponding to the first similarity is used as a representative for explanation. In this embodiment, It is obtained by:

[0115] ;

[0116] in, is the size of a batch of data, subscript Representative Data, subscript Representative data, is the similarity function, is a learnable temperature coefficient.

[0117] In some embodiments, the obtaining of strong negative sample data in the target text-image data based on the similarity matrix of the target text-image data under the contrastive learning includes:

[0118] Based on the first similarity matrix, English text-image data with the highest similarity except for the positive sample data is obtained from the fifth English text data and the second image data, and used as strong negative sample data.

[0119] In this embodiment, based on the above contrastive learning, a similarity matrix of English text-image data can be obtained. The similarity matrix is ​​a two-dimensional matrix, whose rows and columns represent English text data and image data respectively. Each element in the matrix represents the similarity score between the corresponding English text feature and the image feature.

[0120] In this embodiment, the English text-image data with the highest similarity other than the positive sample data is selected from the similarities in the similarity matrix as the strong negative sample data.

[0121] In this embodiment, contrastive learning can provide shallow supervision on the one hand, which can directly align the multilingual encoder with the visual encoder at the encoder level, and on the other hand, can filter out strong negative sample data for subsequent use.

[0122] In some embodiments, the strong negative sample data and the corresponding positive sample data are applied to the English decoder to obtain the corresponding fourth loss function, including:

[0123] The second image feature of the second image data, the English text feature of the fifth English text data in the positive sample data, and the third guide feature are concatenated to obtain a first image-text pair feature;

[0124] The second image feature of the second image data, the English text feature of the fifth English text data in the strong negative sample data, and the third guide feature are concatenated to obtain a second image-text pair feature;

[0125] The first image-text pair feature and the second image-text pair feature are input into the English decoder to obtain a corresponding fourth loss function.

[0126] In this embodiment, for each strong negative sample data other than the positive sample data in the English text-image data, the second image feature of the second image data is , English text features of the fifth English text data in the positive sample data And a third guidance feature encoded by the decoder via guidance information of a mission target Splice to get the first image-text pair feature , specifically, refer to the following formula:

[0127] ;

[0128] Similarly, the second image feature of the second image data , English text features of the fifth English text data in the strong negative sample data And the third guide feature Splice to get the second image-text pair feature , specifically, refer to the following formula:

[0129] ;

[0130] Finally, the first image-text pair feature Features with the second picture and text Input to the English decoder, the English decoder needs to make a judgment on the correctness of the image-text matching result, and use the cross entropy loss to calculate the difference between the judgment result and the actual result. The loss is recorded as the fourth loss function .

[0131] In some embodiments, the method further comprises:

[0132] Obtain multimodal training data corresponding to downstream tasks;

[0133] The model parameters of the multimodal pre-training model are updated based on the multimodal training data to obtain a target downstream task model corresponding to the downstream task.

[0134] Among them, downstream tasks usually refer to tasks that optimize specific tasks based on the trained multimodal pre-trained model, such as image classification, image caption generation, visual question answering, etc. In order to train these downstream tasks, it is necessary to collect multimodal data related to the downstream tasks. These multimodal data usually include different types of modal information such as images, text, audio, etc., and have been annotated or processed for supervised learning.

[0135] For example, for an image caption generation task, multimodal training data may include a series of images and the correct caption for each image. For a visual question answering task, multimodal training data may include images, questions, and the corresponding answers.

[0136] In this embodiment, through the pre-training process in the above steps, the multimodal pre-training model has obtained the latent space of multi-language multi-modal alignment. The visual encoder and the multi-language encoder can be used as encoders for multi-language multi-modal input. The extracted features can be directly applied to downstream tasks, and the English decoder plays a role in feature interaction. For downstream tasks such as graph-text reasoning and question-answering, migration can be performed based on the features output by the English decoder to realize downstream task applications.

[0137] Based on any of the above embodiments, the present invention also provides a training device for a multimodal pre-training model, Figure 2 is a structural schematic diagram of a training device for a multimodal pre-training model provided by the present invention, such as Figure 2 As shown, the device comprises:

[0138] A first multimodal pre-training model training module 210, used to construct a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0139] A training module 220 of a second multimodal pre-trained model is used to apply the visual encoder and the English decoder to obtain a corresponding first loss function based on image-English text data;

[0140] A training module 230 of a third multimodal pre-trained model is used to apply to the multilingual encoder and the English decoder based on the multilingual text-English text data to obtain a corresponding second loss function;

[0141] A training module 240 of a fourth multimodal pre-trained model, for performing comparative learning on the visual encoder and the multilingual encoder based on target text-image data to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0142] A training module 250 of a fifth multimodal pre-training model, configured to obtain strong negative sample data in the target text-image data based on a similarity matrix of the target text-image data under the contrastive learning;

[0143] A training module 260 of a sixth multimodal pre-trained model, for applying the strong negative sample data and the corresponding positive sample data to the English decoder to obtain a corresponding fourth loss function;

[0144] The seventh multimodal pre-trained model training module 270 is used to obtain a trained multimodal pre-trained model based on the first loss function, the second loss function, the third loss function and the fourth loss function.

[0145] The device provided by the embodiment of the present invention constructs a multimodal pre-training model, which includes a visual encoder, a multilingual encoder and an English decoder; based on image-English text data, it is applied to the visual encoder and the English decoder to obtain a corresponding first loss function; based on multilingual text-English text data, it is applied to the multilingual encoder and the English decoder to obtain a corresponding second loss function; based on target text-image data, it is applied to the visual encoder and the multilingual encoder for comparative learning to obtain a corresponding third loss function, and the target text-image data includes English text-image data or multilingual text-image data; based on the similarity matrix of the target text-image data under comparative learning, strong negative sample data in the target text-image data is obtained; based on the strong negative sample data and the corresponding positive sample data, it is applied to the English decoder to obtain a corresponding fourth loss function; based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained. The present invention decouples multilingual text-image data and unifies them through a unified generative task, uses a larger stock of image-English text data and multilingual text-English text data for training, and aligns them in the English encoding space, which can effectively alleviate the dependence on multilingual-image data. The unified pre-training framework will also help model learning to a certain extent. On the other hand, the autoregressive pre-training method can realize the image-based description generation task based on visual features. Compared with masked text recovery, this task reduces the use of contextual relationships in the text modality, but learns completely from the visual dimension, which can use visual features more directly and effectively.

[0146] The training device of the multimodal pre-training model described in this embodiment and the training method of the multimodal pre-training model provided by the present invention described above can be referred to each other, and will not be described in detail here.

[0147] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 310, a communication interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communication interface 320, and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the training method of the multimodal pre-training model, and the method includes:

[0148] Constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0149] Based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function;

[0150] Based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function;

[0151] Based on target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0152] Based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data;

[0153] Based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function;

[0154] Based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained.

[0155] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0156] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the training method of the multimodal pre-training model provided by the above methods, the method comprising:

[0157] Constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0158] Based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function;

[0159] Based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function;

[0160] Based on target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0161] Based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data;

[0162] Based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function;

[0163] Based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained.

[0164] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the training method of the multimodal pre-training model provided by the above methods, the method comprising:

[0165] Constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder;

[0166] Based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function;

[0167] Based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function;

[0168] Based on target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data;

[0169] Based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data;

[0170] Based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function;

[0171] Based on the first loss function, the second loss function, the third loss function and the fourth loss function, a trained multimodal pre-training model is obtained.

[0172] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.

[0173] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention 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 described 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 invention.

Claims

1. A training method for a multimodal pre-training model, characterized in that: The method comprises: Constructing a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder; Based on the image-English text data, applying to the visual encoder and the English decoder to obtain a corresponding first loss function; Based on the multilingual text-English text data, applying to the multilingual encoder and the English decoder to obtain a corresponding second loss function; Based on target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data; Based on the similarity matrix of the target text-image data under the contrastive learning, obtaining strong negative sample data in the target text-image data; Based on the strong negative sample data and the corresponding positive sample data, applying to the English decoder to obtain a corresponding fourth loss function; Based on the first loss function, the second loss function, the third loss function and the fourth loss function, obtaining a trained multimodal pre-training model; The target text-image data is English text-image data, the English text-image data includes fifth English text data and second image data, and the method based on the target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, includes: Inputting the second image data into the visual encoder to obtain a first feature vector of the second image features output by the visual encoder; Inputting the fifth English text data into the multilingual encoder to obtain a first feature vector in the English text features output by the multilingual encoder, wherein the multilingual encoder is used to process text data in multiple languages ​​and can convert texts in different languages ​​into a unified numerical representation; Determine a first similarity matrix between the fifth English text data and the second image data and a second similarity matrix thereof based on the similarity between the first feature vector in the second image feature and the first feature vector in the English text feature; Based on the first similarity matrix and the second similarity matrix, obtaining a third loss function of the visual encoder and the multilingual encoder under contrastive learning; The method based on the strong negative sample data and the corresponding positive sample data is applied to the English decoder to obtain the corresponding fourth loss function, including: The second image feature of the second image data, the English text feature of the fifth English text data in the positive sample data, and the third guide feature are concatenated to obtain a first image-text pair feature; The second image feature of the second image data, the English text feature of the fifth English text data in the strong negative sample data, and the third guide feature are concatenated to obtain a second image-text pair feature; The first image-text pair feature and the second image-text pair feature are input into the English decoder to obtain a corresponding fourth loss function.

2. The training method of the multimodal pre-training model according to claim 1, characterized in that: The image-English text data includes first image data and first English text data corresponding to the first image data; the image-English text data is applied to the visual encoder and the English decoder to obtain the corresponding first loss function, including: Inputting the first image data into the visual encoder to obtain a first image feature output by the visual encoder; splicing the first image feature and the first guide feature and inputting the resultant feature into the English decoder to obtain second English text data output by the English decoder; Based on the second English text data and the first English text data, a corresponding first loss function is obtained.

3. The training method of the multimodal pre-training model according to claim 1, characterized in that: The multilingual text-English text data includes first multilingual text data and third English text data corresponding to the first multilingual text data, and the multilingual text-English text data is applied to the multilingual encoder and the English decoder to obtain the corresponding second loss function, including: Inputting the first multilingual text data into the multilingual encoder to obtain first multilingual text features output by the multilingual encoder; splicing the first multilingual text feature and the second guide feature and inputting the resultant feature into the English decoder to obtain fourth English text data output by the English decoder; Based on the third English text data and the fourth English text data, a corresponding second loss function is obtained.

4. The training method of the multimodal pre-training model according to claim 1, characterized in that: The obtaining of strong negative sample data in the target text-image data based on the similarity matrix of the target text-image data under the contrastive learning includes: Based on the first similarity matrix, English text-image data with the highest similarity except for the positive sample data is obtained from the fifth English text data and the second image data, and used as strong negative sample data.

5. The training method of the multimodal pre-training model according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtain multimodal training data corresponding to downstream tasks; The model parameters of the multimodal pre-training model are updated based on the multimodal training data to obtain a target downstream task model corresponding to the downstream task.

6. A training device for a multimodal pre-training model, characterized in that: The device comprises: A first multimodal pre-training model training module, used to construct a multimodal pre-training model, wherein the multimodal pre-training model includes a visual encoder, a multilingual encoder, and an English decoder; A training module of a second multimodal pre-trained model, used for applying to the visual encoder and the English decoder based on image-English text data to obtain a corresponding first loss function; A training module of a third multimodal pre-trained model, used for applying to the multilingual encoder and the English decoder based on the multilingual text-English text data to obtain a corresponding second loss function; a training module of a fourth multimodal pre-trained model, configured to apply the visual encoder and the multilingual encoder to perform comparative learning based on target text-image data to obtain a corresponding third loss function, wherein the target text-image data includes English text-image data or multilingual text-image data; a training module of a fifth multimodal pre-training model, configured to obtain strong negative sample data in the target text-image data based on a similarity matrix of the target text-image data under the contrastive learning; A training module of a sixth multimodal pre-trained model, used for applying the strong negative sample data and the corresponding positive sample data to the English decoder to obtain a corresponding fourth loss function; a seventh multimodal pre-trained model training module, configured to obtain a trained multimodal pre-trained model based on the first loss function, the second loss function, the third loss function, and the fourth loss function; The target text-image data is English text-image data, the English text-image data includes fifth English text data and second image data, and the method based on the target text-image data, applying the visual encoder and the multilingual encoder to perform comparative learning to obtain a corresponding third loss function, includes: Inputting the second image data into the visual encoder to obtain a first feature vector of the second image features output by the visual encoder; Inputting the fifth English text data into the multilingual encoder to obtain a first feature vector in the English text features output by the multilingual encoder, wherein the multilingual encoder is used to process text data in multiple languages ​​and can convert texts in different languages ​​into a unified numerical representation; Determine a first similarity matrix between the fifth English text data and the second image data and a second similarity matrix thereof based on the similarity between the first feature vector in the second image feature and the first feature vector in the English text feature; Based on the first similarity matrix and the second similarity matrix, obtaining a third loss function of the visual encoder and the multilingual encoder under contrastive learning; The method based on the strong negative sample data and the corresponding positive sample data is applied to the English decoder to obtain the corresponding fourth loss function, including: The second image feature of the second image data, the English text feature of the fifth English text data in the positive sample data, and the third guide feature are concatenated to obtain a first image-text pair feature; The second image feature of the second image data, the English text feature of the fifth English text data in the strong negative sample data, and the third guide feature are concatenated to obtain a second image-text pair feature; The first image-text pair feature and the second image-text pair feature are input into the English decoder to obtain a corresponding fourth loss function.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the training method of the multimodal pre-training model as described in any one of claims 1 to 5 is implemented.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the training method of the multimodal pre-training model as described in any one of claims 1 to 5.