IP Library Granted Patent US 12,277,401
Granted Patent B2
US 12,277,401 · App. 17/502,108 · Granted Apr 15, 2025

Method and apparatus for acquiring pre-trained model

Inventors: Guocheng Niu (Beijing, CN); Wei Li (Beijing, CN); Can Gao (Beijing, CN); Xinyan Xiao (Beijing, CN); Hua Wu (Beijing, CN)
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
G06F40/58G06F18/256G06F40/205G06F40/47G06N3/02
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,277,401
App. No.
17/502,108
Granted
Apr 15, 2025
Kind
B2
Abstract

The present disclosure discloses a method and apparatus for acquiring a pre-trained model, and relates to natural language processing and deep learning technologies in the field of artificial intelligence technologies. An implementation includes: acquiring training data, the training data including a single-modal language material and a multi-modal language material, and the multi-modal language material including a language material pair formed by a first-modal language material and a second-modal language material; and performing a multi-task training operation on a pre-trained model using the training data, the multi-task including at least one cross-modal contrastive learning task and at least one single-modal learning task; the pre-trained language model obtained in the present disclosure may learn from different forms of language materials, i.e., the single-modal language material and the multi-modal language material, such that the pre-trained language model may effectively process information in various modals.

Claims (46)

1. A method for training a pre-trained model, comprising:

acquiring training data, the training data comprising a single-modal language material comprising an image or a text and a multi-modal language material comprising an image-text pair which is semantically in pairs, and the multi-modal language material comprising a language material pair formed by a first-modal language material which is a text in a first language and a second-modal language material which is a text in a second language;

performing at least one of rewriting extension and retrieval extension on the multi-modal language material in the training data, and adding the extended multi-modal language material into the training data;

performing a multi-task training operation on a pre-trained model using the training data, the multi-task comprising at least one cross-modal contrastive learning task and at least one single-modal learning task;

wherein the cross-modal contrastive learning task which is trained utilizing the multi-modal language material comprises: determining similarity between the first-modal language material and the second-modal language material in the multi-modal language material utilizing a vector representation of the first-modal language material and a vector representation of the second-modal language material in the multi-modal language material by the pre-trained model, with a training target of maximizing the similarity between the first-modal language material and the second-modal language material in a positive multi-modal language material and minimizing the similarity between the first-modal language material and the second-modal language material in a negative multi-modal language material; and

the single-modal learning task which is trained utilizing the single-modal language material comprises: predicting a second part of content in the single-modal language material utilizing a vector representation of a first part of content in the single-modal language material by the pre-trained model, with a training target of minimizing a difference between the predicted second part of content and the second part of content in the single-modal language material,

wherein in the cross-modal contrastive learning task, the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the retrieval extension is determined by: calculating similarity between a vector representation of the first-modal language material obtained by the pre-trained model and a vector representation of the second-modal language material obtained by the pre-trained model; and

the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the rewriting extension is determined by: stitching the first-modal language material and the second-modal language material, and mapping a vector representation of the stitched language material obtained by the pre-trained model into a similarity value,

wherein parameters of the pre-trained model are updated using a constructed total loss function when the multi-task training operation is performed;

the total loss function is obtained by an arithmetic sum of the loss function of the at least one cross-modal contrastive learning task and the loss function of the at least one single-modal learning task, wherein the loss function of the at least one cross-modal contrastive learning task is constructed according to: a similarity value calculated by stitching the image and the text, and mapping a vector representation of the stitched language material obtained by the pre-trained model; or a similarity calculated by calculating cosine similarity between a vector representation of the image obtained by the pre-trained model and a vector representation of the text obtained by the pre-trained model, and the loss function of the at least one single-modal learning task comprises the loss function of a visual learning task and the loss function of a text learning task, and

adjusting finely the pre-trained model according to training data corresponding to a downstream task comprising a text classification task, an image classification task, a task of generating questions and answers for images, or a task of generating images for texts.

2. The method according to claim 1 , wherein the rewriting extension comprises:

translating the text in the first language of the positive multi-modal language material into a text in the second language and then translating the text in the second language back to a text in the first language using a translation model, and constructing a new positive multi-modal language material by the text in the first language obtained after translation and the second-modal language material in the positive multi-modal language material; or

parsing the first-modal language material in the positive multi-modal language material into a scenario graph, randomly replacing at least one of an entity, an attribute and a relationship in the scenario graph, converting the scenario graph obtained after replacement back into the first-modal language material, and constructing a new negative multi-modal language material by the first-modal language material obtained after conversion and the second-modal language material in the positive multi-modal language material.

3. The method according to claim 1 , wherein the retrieval extension comprises:

retrieving the first-modal language material of the positive multi-modal language material in a first-modal corpus, and constructing a new positive multi-modal language material using the retrieved language material and the second-modal language material in the positive multi-modal language material.

4. An electronic device, comprising:

at least one processor; and

a memory communicatively connected with the at least one processor;

wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a method for training a pre-trained model, wherein the method comprises:

acquiring training data, the training data comprising a single-modal language material comprising an image or a text and a multi-modal language material comprising an image-text pair which is semantically in pairs, and the multi-modal language material comprising a language material pair formed by a first-modal language material which is a text in a first language and a second-modal language material which is a text in a second language;

performing at least one of rewriting extension and retrieval extension on the multi-modal language material in the training data, and adding the extended multi-modal language material into the training data;

performing a multi-task training operation on a pre-trained model using the training data, the multi-task comprising at least one cross-modal contrastive learning task and at least one single-modal learning task;

wherein the cross-modal contrastive learning task which is trained utilizing the multi-modal language material comprises: determining similarity between the first-modal language material and the second-modal language material in the multi-modal language material utilizing a vector representation of the first-modal language material and a vector representation of the second-modal language material in the multi-modal language material by the pre-trained model, with a training target of maximizing the similarity between the first-modal language material and the second-modal language material in a positive multi-modal language material and minimizing the similarity between the first-modal language material and the second-modal language material in a negative multi-modal language material; and

the single-modal learning task which is trained utilizing the single-modal language material comprises: predicting a second part of content in the single-modal language material utilizing a vector representation of a first part of content in the single-modal language material by the pre-trained model, with a training target of minimizing a difference between the predicted second part of content and the second part of content in the single-modal language material,

wherein in the cross-modal contrastive learning task, the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the retrieval extension is determined by: calculating similarity between a vector representation of the first-modal language material obtained by the pre-trained model and a vector representation of the second-modal language material obtained by the pre-trained model; and

the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the rewriting extension is determined by: stitching the first-modal language material and the second-modal language material, and mapping a vector representation of the stitched language material obtained by the pre-trained model into a similarity value,

wherein parameters of the pre-trained model are updated using a constructed total loss function when the multi-task training operation is performed;

the total loss function is obtained by an arithmetic sum of the loss function of the at least one cross-modal contrastive learning task and the loss function of the at least one single-modal learning task, wherein the loss function of the at least one cross-modal contrastive learning task is constructed according to: a similarity value calculated by stitching the image and the text, and mapping a vector representation of the stitched language material obtained by the pre-trained model; or a similarity calculated by calculating cosine similarity between a vector representation of the image obtained by the pre-trained model and a vector representation of the text obtained by the pre-trained model, and the loss function of the at least one single-modal learning task comprises the loss function of a visual learning task and the loss function of a text learning task, and

adjusting finely the pre-trained model according to training data corresponding to a downstream task comprising a text classification task, an image classification task, a task of generating questions and answers for images, or a task of generating images for texts.

5. The electronic device according to claim 4 , wherein the rewriting extension comprises:

translating the text in the first language of the positive multi-modal language material into a text in the second language and then translate the text in the second language back to a text in the first language using a translation model, and constructing a new positive multi-modal language material by the text in the first language obtained after translation and the second-modal language material in the positive multi-modal language material; or

parsing the first-modal language material in the positive multi-modal language material into a scenario graph, randomly replace at least one of an entity, an attribute and a relationship in the scenario graph, converting the scenario graph obtained after replacement back into the first-modal language material, and constructing a new negative multi-modal language material by the first-modal language material obtained after conversion and the second-modal language material in the positive multi-modal language material.

6. The electronic device according to claim 4 , wherein the retrieval extension comprises:

retrieving the first-modal language material of the positive multi-modal language material in a first-modal corpus, and constructing a new positive multi-modal language material using the retrieved language material and the second-modal language material in the positive multi-modal language material.

7. A non-transitory computer readable storage medium with computer instructions stored thereon, wherein the computer instructions are used for causing a computer to perform a method for training a pre-trained model, wherein the method comprises:

acquiring training data, the training data comprising a single-modal language material comprising an image or a text and a multi-modal language material comprising an image-text pair which is semantically in pairs, and the multi-modal language material comprising a language material pair formed by a first-modal language material which is a text in a first language and a second-modal language material which is a text in a second language;

performing at least one of rewriting extension and retrieval extension on the multi-modal language material in the training data, and adding the extended multi-modal language material into the training data;

performing a multi-task training operation on a pre-trained model using the training data, the multi-task comprising at least one cross-modal contrastive learning task and at least one single-modal learning task;

wherein the cross-modal contrastive learning task which is trained utilizing the multi-modal language material comprises: determining similarity between the first-modal language material and the second-modal language material in the multi-modal language material utilizing a vector representation of the first-modal language material and a vector representation of the second-modal language material in the multi-modal language material by the pre-trained model, with a training target of maximizing the similarity between the first-modal language material and the second-modal language material in a positive multi-modal language material and minimizing the similarity between the first-modal language material and the second-modal language material in a negative multi-modal language material; and

the single-modal learning task which is trained utilizing the single-modal language material comprises: predicting a second part of content in the single-modal language material utilizing a vector representation of a first part of content in the single-modal language material by the pre-trained model, with a training target of minimizing a difference between the predicted second part of content and the second part of content in the single-modal language material,

wherein in the cross-modal contrastive learning task, the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the retrieval extension is determined by: calculating similarity between a vector representation of the first-modal language material obtained by the pre-trained model and a vector representation of the second-modal language material obtained by the pre-trained model; and

the similarity between the first-modal language material and the second-modal language material in the multi-modal language material obtained by the rewriting extension is determined by: stitching the first-modal language material and the second-modal language material, and mapping a vector representation of the stitched language material obtained by the pre-trained model into a similarity value,

wherein parameters of the pre-trained model are updated using a constructed total loss function when the multi-task training operation is performed;

the total loss function is obtained by an arithmetic sum of the loss function of the at least one cross-modal contrastive learning task and the loss function of the at least one single-modal learning task, wherein the loss function of the at least one cross-modal contrastive learning task is constructed according to: a similarity value calculated by stitching the image and the text, and mapping a vector representation of the stitched language material obtained by the pre-trained model; or a similarity calculated by calculating cosine similarity between a vector representation of the image obtained by the pre-trained model and a vector representation of the text obtained by the pre-trained model, and the loss function of the at least one single-modal learning task comprises the loss function of a visual learning task and the loss function of a text learning task, and

adjusting finely the pre-trained model according to training data corresponding to a downstream task comprising a text classification task, an image classification task, a task of generating questions and answers for images, or a task of generating images for texts.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Mar 10, 2025
From: NIU, GUOCHENG; LI, WEI; GAO, CAN; XIAO, XINYAN; WU, HUA
To: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Reel/Frame 070458/0834 →
Priority Claims (1)
CN 202110274515.0 · Mar 15, 2021 · national
Continuity (1)
Related Publication 20220292269A1 · Sep 15, 2022
References Cited (33)
US 11423072B1 · Chen · 2022 [cited by examiner]
US 11797530B1 · Bouyarmane · 2023 [cited by examiner]
US 20190035431A1 · Attorre · 2019 [cited by examiner]
US 20190266262A1 · He · 2019 [cited by examiner]
US 20190370616A1 · Eser et al. · 2019 [cited by applicant]
US 20200349529A1 · Wang · 2020 [cited by examiner]
US 20200380298A1 · Aggarwal · 2020 [cited by examiner]
US 20210073479A1 · Yamada · 2021 [cited by examiner]
US 20220147838A1 · Gu · 2022 [cited by examiner]
US 20220198276A1 · Wang · 2022 [cited by examiner]
US 20220284321A1 · Yuan · 2022 [cited by examiner]
US 20240054767A1 · Li · 2024 [cited by examiner]
US 20240185602A1 · Liu · 2024 [cited by examiner]
CN 102521368A · 2012 [cited by applicant]
CN 105740888A · 2016 [cited by applicant]
CN 107562812A · 2018 [cited by applicant]
CN 108664999A · 2018 [cited by applicant]
CN 111461203A · 2020 [cited by applicant]
CN 111507111A · 2020 [cited by applicant]
CN 111680145A · 2020 [cited by applicant]
CN 112100332A · 2020 [cited by applicant]
CN 112257445A · 2021 [cited by applicant]
CN 112257465A · 2021 [cited by applicant]
JP 2020149685A · 2020 [cited by applicant]
Huo, Y., Zhang, M., Liu, G., Lu, H., Gao, Y., Yang, G., . . . & Wen, J. R. (2021). WenLan: Bridging vision and language by large-scale multi-modal pre-training. arXiv preprint arXiv:2103.06561. [cited by examiner]
Qi, D., Su, L., Song, J., Cui, E., Bharti, T., & Sacheti, A. (2020). Imagebert: Cross-modal pre-training with large-scale weak-supervised image-text data. arXiv preprint arXiv:2001.07966. [cited by examiner]
Extended European Search Report of European application No. 21197865.5 dated Mar. 16, 2022, 11 pages. [cited by applicant]
Wei et al., “UNIMO: Towards Unified-Modal Understanding and Generation via Cross-Modal Contrastive Learning”, arxiv.org, Cornell University Library, Dec. 31, 2020, XP081849329, 11 pages. [cited by applicant]
Komarovsky, “Deep Multi-Task Learning—3 Lessons Learned”, Jun. 6, 2019, pp. 1-7, XP055897896, Taboola Blog retrieved from the Internet: URL: <https://blog.taboola.com/deep-multi-task-learning-3-lessons-learned/>, retrie… [cited by applicant]
Search Report of Chinese Application No. 2021102745150 dated Apr. 19, 2021, 3 pages. [cited by applicant]
Search Report of Chinese Application No. 2021102745150 dated May 11, 2021, 2 pages. [cited by applicant]
Search Report of Chinese Application No. 2021102745150 dated Aug. 25, 2021, 2 pages. [cited by applicant]
Li et al., “UNIMO: Towards Unified-Modal Understanding and Generation via Cross-Modal Contrative Learning”, https://mi.mbd.baidu.com/r/mm08EpUMPm?f=cp&u=b7d196cbe6f85c6d, Dec. 31, 2020, 10 pages. [cited by applicant]