A modality expansion method for pre-trained multimodal language reasoning models based on continuous learning and transfer learning

By introducing the multi-modal adapter combination module and the freeze-activation strategy into the multi-modal language reasoning model, the problem of data dependence and computational burden in modal expansion is solved, and flexible modal expansion and efficient anti-forgetting effects are achieved.

CN118469025BActive Publication Date: 2024-09-10DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

Existing multimodal language reasoning models rely on large-scale multimodal data when expanding modalities, resulting in excessive computing and storage burdens and the problem of knowledge forgetting.

Method used

Using a pre-trained multi-modal language reasoning model based on continuous learning and transfer learning, modal expansion is achieved through multi-modal adapter combination modules, combined with adapter fine-tuning and freeze-activation strategies to reduce computational burden and prevent knowledge forgetting.

Benefits of technology

It achieves flexible modal expansion of multi-modal language reasoning models, reduces parameter resource requirements, improves generalization and anti-forgetfulness, saves 98% of the trainable parameter burden, and performs better than other methods in each data set. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118469025B
    Figure CN118469025B
Patent Text Reader

Abstract

The present invention provides a modal expansion method for a pre-trained multimodal language reasoning model based on continuous learning and transfer learning, and belongs to the technical field of multimodal understanding and language interaction. The present invention mainly uses the constructed multimodal language reasoning model to perform language reasoning. Thereafter, in the modal expansion process of the multimodal language reasoning model, a flexibly expandable multimodal adapter combination module is used to solve the data dependency problem in modal expansion, and adapter fine-tuning in transfer learning and freeze-activation strategy in continuous learning are introduced to solve the computational burden and knowledge forgetting problems, and finally the modal expansion problem of the pre-trained multimodal language reasoning model is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of multimodal understanding and language interaction, and in particular, to a modal expansion method of a pre-trained multimodal language reasoning model based on continuous learning and transfer learning. Background Art

[0002] With the development of visual language models, through pre-training alignment and instruction adjustment of large-scale image-text data pairs, visual-language question-answering reasoning models have shown good generalization capabilities in downstream applications (such as text-based object detection, image caption generation, and text-based image generation, etc.).

[0003] The visual language reasoning framework and training process based on large language models have promoted the expansion of visual language models to other modalities, including video, audio, and point cloud. However, these methods are limited to language reasoning tasks with unimodal input, that is, the language model can only understand a single modal input data such as images, videos, audio, or point clouds. This unimodal language reasoning that injects unimodal data into a large language model is difficult to cope with the challenge of perceiving different modalities like us humans in real life.

[0004] Therefore, in order to solve this problem, current methods such as X-LLM (language reasoning model for image, video, and audio modality alignment), ChatBridge (conversational bridging multimodal language reasoning model), and OneLLM (unified multimodal language reasoning model) have explored language reasoning tasks for multimodal inputs, but these methods generally require modality-specific pre-training and unified instruction fine-tuning of joint multimodal data. This process is heavily dependent on large-scale multimodal data and has a forgetting problem in incremental pre-training. In addition, X-InstructBLIP (multimodal instruction fine-tuning language reasoning model) proposes a unified projection architecture for all modalities and constructs high-quality instruction adjustment data to simplify multi-step modality-specific pre-training and unified fine-tuning, but due to the huge computational and storage burden of training independent modality alignment modules (Q-Former) for each modality, its training parameters reach more than 189.9M each time. Summary of the invention

[0005] Although the above-mentioned existing multimodal language reasoning models have conducted many explorations in terms of structure and training data, there are still problems with modal expansion caused by serious reliance on large-scale multimodal data, as well as the computational and storage burdens generated during the multimodal expansion process. Therefore, the present invention aims to provide a modal expansion method for a pre-trained multimodal language reasoning model based on continuous learning and transfer learning. The present invention mainly utilizes the constructed multimodal language reasoning model for language reasoning. Thereafter, in the modal expansion process of the multimodal language reasoning model, a flexibly expandable multimodal adapter combination module is used to solve the data dependency problem in modal expansion, and adapter fine-tuning in transfer learning and the freeze-activation strategy in continuous learning are introduced to solve the computational burden and knowledge forgetting problems, ultimately solving the modal expansion problem of the pre-trained multimodal language reasoning model.

[0006] The technical solution adopted by the present invention is:

[0007] A modality expansion method for a pre-trained multimodal language reasoning model based on continuous learning and transfer learning, the steps are as follows:

[0008] Step 1: Build a multimodal language reasoning model;

[0009] The multimodal language reasoning model includes a multimodal encoder, a regularization layer, a multimodal alignment module (Q-Former), a serialization module (tokenizer), a modality mapping module, and a large language model;

[0010] The multimodal alignment module includes a self-attention layer, a cross-attention layer, a multimodal adapter combination module, a feedforward layer 1, and a feedforward layer 2;

[0011] The modality mapping module includes a mapping layer and a multimodality adapter combination module (AnA, Adapter-in-Adapter);

[0012] The multi-modal adapter combination module includes uni-modal adapters, cross-modal adapters, and multi-expert routing (MoE-Gating);

[0013] Step 2: Modal expansion of the multimodal language reasoning model;

[0014] (2.1) Images, videos, audio, depth and point clouds are used as multimodal inputs of the multimodal language reasoning model. The multimodal encoder extracts features to obtain feature information of each modality. The feature information of each modality is sent to the regularization layer for feature regularization to obtain feature knowledge of each modality.

[0015] (2.2) After the question input is encoded through the serialization module, it is obtained as the question embedding, and the question embedding is cascaded with the learnable token to form the instruction embedding;

[0016] (2.3) The instruction embedding is fed into the self-attention layer of the multimodal alignment module; the multimodal adapter combination module is added to the Q, K, and V mapping matrices of the self-attention layer in parallel, and the self-attention layer is fine-tuned with a low-rank lightweight matrix to obtain a language embedding with a learnable query;

[0017] (2.4) The language embedding with the learnable query is injected into the cross-attention layer with the multimodal adapter combination module added. The mapping matrix of the multimodal adapter combination module and the cross-attention layer processes the language embedding with the learnable query respectively. After adding the processing results, the cross-attention operation is performed with the feature knowledge of each modality to obtain the output of the cross-attention.

[0018] (2.5) The output of the cross-attention is input into the feedforward layer 1, and the language embedding with the learnable query is input into the feedforward layer 2. The outputs of the feedforward layer 1 and the feedforward layer 2 are cascaded to obtain the cross-modal output;

[0019] (2.6) The cross-modal output is sent to the next multimodal alignment module for processing. After iteratively repeating steps (2.3) to (2.5), the final cross-modal output is obtained. The final cross-modal output is sent to the modal mapping module with the multimodal adapter combination module added. After the modal mapping module changes the dimension, it is sent to the large language model for inference output to generate the final text answer output.

[0020] Furthermore, the modality expansion of the multimodal language reasoning model is implemented through the multimodal adapter combination module, which can expand new modalities according to the dynamic changes of the modal order:

[0021] (2.1.1) When the modality of the initial multimodal language reasoning model is an image, it is a pre-trained multimodal language reasoning model and there is no need to use a multimodal adapter combination module.

[0022] (2.1.2) When the pre-trained multimodal language reasoning model needs to be extended to the video modality, add the unimodal adapter corresponding to the video modality to the self-attention layer, cross-attention layer, and modality mapping module.

[0023] Among them, the output of the Q mapping matrix of the Q, K, and V mapping matrices in the self-attention layer is added to the output of the single-modal adapter, and the formula is as follows:

[0024] (1)

[0025] Where Q represents the Q mapping matrix in the attention module, The unimodal adapter corresponding to the video modality is composed of a low-rank mapping matrix (LoRA). Represents the video embedding fed into the unimodal adapter and the Q-mapping matrix in the self-attention layer. represents the combined output generated by the Q-mapping matrix after adding the single-mode adapter;

[0026] The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (1). We only need to replace Replace with the corresponding input.

[0027] In the process of extending to the video mode, the multimodal adapter combination module composed of single-modal adapters is denoted as multimodal adapter combination module 1, which serves as the basis of the multimodal adapter combination module of the next extension process.

[0028] (2.1.3) When the multimodal language reasoning model expanded in step (2.1.2) needs to be further expanded to the audio modality, the linear layer of the audio modality is added to the unimodal adapter corresponding to the video modality on the basis of the multimodal adapter combination module 1 in step (2.1.2) to form a video-audio cross-modal adapter (Cross-modal Adapters), and the unimodal adapter corresponding to the audio modality (Uni-modal Adapters) is added at the same time. Then, multi-expert routing (MoE-Gating) is added to dynamically weight the outputs of the video-audio cross-modal adapter and the unimodal adapter corresponding to the audio modality to form a multimodal adapter combination module 2. Among them, the output of the Q mapping matrix of the Q, K, V mapping matrix in the self-attention layer, the output of the video-audio cross-modal adapter, and the output of the unimodal adapter corresponding to the audio modality are summed up and calculated as follows:

[0029] (2)

[0030] Among them, Q represents the Q mapping matrix in the attention module, and represents the output weight of multi-expert routing, Video-audio cross-modal adapters that represent linear layers that join the audio modality, Indicates the uni-modal adapters corresponding to the audio mode. represents the combined output generated by the Q mapping matrix after adding the multimodal adapter combination module 2 consisting of a single-modal adapter corresponding to the audio modality, a video-audio cross-modal adapter, and a multi-expert router;

[0031] The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (2). We only need to replace Just replace it with the corresponding input.

[0032] In the process of expanding to the audio mode, the multimodal adapter combination module 2 serves as the basis for the multimodal adapter combination module of the next expansion process.

[0033] (2.1.4) The depth modality and point cloud modality are expanded in the same way as the audio modality was expanded in step (2.1.3).

[0034] Furthermore, in the process of modal expansion of the multimodal language reasoning model, a freeze-activate strategy needs to be referenced; the freeze-activate strategy refers to:

[0035] The pre-trained multimodal language inference model is used as the initial model. When it is expanded to the video modality, the pre-trained parameters of the original image modality are frozen, and only the newly added parameters in the multimodal adapter combination module are trained.

[0036] When expanding to the audio modality, it is necessary to freeze all parameters trained for the image and video modalities, and only fine-tune the linear layer added to the unimodal adapter corresponding to the video modality and the unimodal adapter corresponding to the audio modality and the parameters in the multi-expert routing.

[0037] When expanding to the deep modality, it is necessary to freeze all the trained parameters of the image, video, and audio modalities, and only fine-tune the linear layers added to the unimodal adapter corresponding to the deep modality, the unimodal adapter corresponding to the deep modality, and the parameters in the multi-expert routing.

[0038] When expanding to the point cloud modality, it is necessary to freeze all the trained parameters of the image, video, audio, and depth modalities, and only fine-tune the linear layer added to the single-modality adapter corresponding to the point cloud modality, the single-modality adapter corresponding to the point cloud modality, and the parameters in the multi-expert routing.

[0039] Furthermore, the learnable token refers to a randomly initialized learnable parameter.

[0040] Furthermore, the feedforward layer 1 and the feedforward layer 2 are fully connected layers.

[0041] Compared with the prior art, the present invention has the following advantages:

[0042] 1. The modal expansion method of the pre-trained multimodal language reasoning model based on continuous learning and transfer learning provided by the present invention, the multimodal adapter combination module constructed by it fully utilizes cross-modal knowledge through single-modal adapters, cross-modal adapters and multi-expert routing based on adapter fine-tuning design in transfer learning, realizes flexible modal expansion of the pre-trained multimodal language reasoning model, and finally completes the incremental learning of a multimodal language reasoning model for processing multimodal language reasoning tasks.

[0043] 2. The modal expansion method of the pre-trained multimodal language reasoning model based on continuous learning and transfer learning provided by the present invention realizes the anti-forgetting of each modal knowledge by means of the freeze-activation strategy in continuous learning while flexibly expanding. Compared with the modal expansion of the multimodal language reasoning model based on the existing continuous learning method, it has better generalization and stronger anti-forgetting. In addition, the parameter resources can be reduced by more than 98% in terms of parameter update requirements.

[0044] 3. Compared with X-InstructBLIP, this method saves 98% of the trainable parameter burden. In addition, in terms of parameter storage, this method only needs to store 2% of the parameters in X-InstructBLIP to handle multiple modal incremental language reasoning tasks, while it needs to open up 100% parameter storage space for each modality. Compared with X-InstructBLIP using the same parameters to expand training for all modalities, the average forgetting rate of this method in all modal data sets is nearly 59 points better than X-InstructBLIP.

[0045] 4. Compared with other anti-forgetting extension methods based on X-InstructBLIP, the average performance of the new modality extension of this method in each data set is higher than WiSE-FT (model distillation and parameter constraint method), L2 Reg& WE (regularization & weight integration constraint method), EProj (dynamic mapping method) by 34, 35.4 and 29.83 points respectively. At the same time, this method achieves better anti-forgetting effect.

[0046] 5. Compared with OneLLM (unified multimodal language reasoning model), this method does not need to perform modal incremental alignment training and fine-tune the instructions of all modal data separately like OneLLM. The present invention reduces the requirements for large-scale multimodal data and solves the violation of data privacy caused by the need for data playback when expanding the modality. Based on the above reasons, the present invention can be widely promoted in the field of multimodal understanding and language interaction technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 labor.

[0048] Figure 1 It is the overall framework diagram of the present invention.

[0049] Figure 2 This is a structural diagram of the incremental input sequence of each modality provided in an embodiment of the present invention.

[0050] Figure 3 Schematic diagram of a multimodal adapter combination module (AnA) provided in an embodiment of the present invention, wherein (a) is a multimodal adapter combination module for extending video modality, (b) is a multimodal adapter combination module for extending audio modality, (c) is a multimodal adapter combination module for extending depth modality, and (d) is a multimodal adapter combination module for extending point cloud modality. DETAILED DESCRIPTION

[0051] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0052] Example

[0053] In this embodiment, the framework of the present invention is built based on X-InstructBLIP, and the image modal language inference model pre-trained in image-text is used as the initial frozen pre-trained multimodal language inference model. The AdamW optimizer is used in the modal expansion training process, and the weight decay is 0.05. In order to verify the modal expansion performance and forgetting, this paper adopts the modal expansion sequential incremental learning of video, audio, depth and point cloud.

[0054] Following the configuration in X-InstructBLIP, the image input is preprocessed into a size of 224×224, the video input is preprocessed into a sequence of 5 frames of images, the audio input is preprocessed using a sequence of 2 frames of audio data, each sample in the point cloud input is sampled as 8192×3 3D point cloud data for preprocessing, and the depth input is preprocessed into a depth image of 224×224×1 size. During the training process, the specific modality data after incremental training is no longer replayed. Video, audio, depth, and point cloud are trained with batch iterations of 15K, 65K, 35K, and 65K, respectively, with 16, 16, 4, and 16 samples in each batch, respectively. All experiments were conducted on a 4 The results are performed on NVIDIA A800 Tensor Core GPUs.

[0055] A modality expansion method for pre-trained multimodal language reasoning models based on continuous learning and transfer learning, such as Figure 1 As shown, the steps are as follows:

[0056] Step 1: Build a multimodal language reasoning model;

[0057] The multimodal language reasoning model includes a multimodal encoder, a regularization layer, a multimodal alignment module (Q-Former), a serialization module (tokenizer), a modality mapping module, and a large language model;

[0058] Step 2: Modal expansion of the multimodal language reasoning model;

[0059] (2.1) Images, videos, audio, depth and point clouds are used as multimodal inputs of the multimodal language reasoning model. The multimodal encoder extracts features to obtain feature information of each modality. The feature information of each modality is sent to the regularization layer for feature regularization to obtain feature knowledge of each modality.

[0060] Among them, the image, video, audio, depth and point cloud encoders are EVA-CLIP-ViT-G / 14, EVA-CLIP-ViT-G / 14, BEATs, EVA-CLIP-ViT-G / 14 and ULIP2 respectively;

[0061] The corresponding dimensions of the regularization layer are 1408, 1408, 768, 1408, and 512;

[0062] (2.2) After the question input is encoded through the serialization module, it is obtained as the question embedding, and the question embedding is cascaded with the learnable token to form the instruction embedding;

[0063] Among them, the learnable token refers to a randomly initialized learnable parameter. In this embodiment, the learnable token is randomly initialized to 32 tokens, and the dimension of each token is 768; the serialization module is initialized using the serialization module of Bert (language model); the feature mapping dimension of the modality mapping module is mapped from the 768 dimension embedded in the instruction to the 4096 dimension of the language model;

[0064] (2.3) The instruction embedding is fed into the self-attention layer of the multimodal alignment module; the multimodal adapter combination module is added to the Q, K, and V mapping matrices of the self-attention layer in parallel, and the self-attention layer is fine-tuned with a lightweight low-rank matrix (LoRA) to obtain a language embedding with learnable queries;

[0065] Among them, the lightweight low-rank matrix (LoRA) maps high-dimensional to low-dimensional The size is downsampled by a linear layer and the low-dimensional image is mapped back to a high-dimensional image. The multimodal alignment module consists of a self-attention layer, a cross-attention layer, a multimodal adapter combination module, a feedforward layer 1, and a feedforward layer 2; the multimodal adapter combination module includes uni-modal adapters, cross-modal adapters, and multi-expert routing (MoE-Gating);

[0066] Among them, multi-expert routing includes 768 The linear layer parameters of size, Indicates the degree of expansion mode.

[0067] (2.4) The language embedding with the learnable query is injected into the cross-attention layer with the multimodal adapter combination module added. The mapping matrix of the multimodal adapter combination module and the cross-attention layer processes the language embedding with the learnable query respectively. After adding the processing results, the cross-attention operation is performed with the feature knowledge of each modality to obtain the output of the cross-attention.

[0068] (2.5) Inputting the output of the cross attention into the feedforward layer 1, inputting the language embedding with the learnable query into the feedforward layer 2, and performing a cascade operation on the outputs of the feedforward layer 1 and the feedforward layer 2 to obtain a cross-modal output, wherein the feedforward layer 1 and the feedforward layer 2 are fully connected layers;

[0069] (2.6) The cross-modal output is sent to the next multimodal alignment module for processing. Steps (2.3) to (2.5) are repeated iteratively to obtain the final cross-modal output. The final cross-modal output is sent to the modal mapping module with the multimodal adapter combination module added. After the modal mapping module changes the dimension, it is sent to the large language model for reasoning output to generate the final text answer output.

[0070] Among them, the modal mapping module includes a mapping layer and a multimodal adapter combination module (AnA, Adapter-in-Adapter); the large language model adopts the pre-trained large language model Vicuna 7B.

[0071] Furthermore, the modality expansion of the multimodal language reasoning model is implemented through the multimodal adapter combination module, which can expand new modalities according to the dynamic changes of the modal order:

[0072] (2.1.1) If Figure 2 As shown, when the modality of the initial multimodal language reasoning model is an image, it is a pre-trained multimodal language reasoning model, and there is no need to use a multimodal adapter combination module.

[0073] (2.1.2) When the pre-trained multimodal language inference model needs to be extended to the video modality, such as Figure 3 As shown in (a) (video modality training) in the figure, a unimodal adapter corresponding to the video modality is added to the self-attention layer, cross-attention layer, and modality mapping module.

[0074] Among them, the output of the Q mapping matrix of the Q, K, and V mapping matrices in the self-attention layer is added to the output of the single-modal adapter, and the formula is as follows:

[0075] (1)

[0076] Where Q represents the Q mapping matrix in the attention module, The unimodal adapter corresponding to the video modality is composed of a low-rank mapping matrix (LoRA). Represents the video embedding fed into the unimodal adapter and the Q-mapping matrix in the self-attention layer. represents the combined output generated by the Q-mapping matrix after adding the single-mode adapter;

[0077] The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (1). We only need to replace Replace with the corresponding input.

[0078] In the process of extending to the video mode, the multimodal adapter combination module composed of single-modal adapters is denoted as multimodal adapter combination module 1, which serves as the basis of the multimodal adapter combination module of the next extension process.

[0079] (2.1.3) When the multimodal language inference model expanded in step (2.1.2) needs to be further expanded to the audio modality, such as Figure 3 As shown in (b), the audio mode is added to the multi-modal adapter combination module 1 in step (2.1.2). The linear layer of size is added to the unimodal adapter corresponding to the video modality to form the video-audio cross-modal adapter (Cross-modal Adapters), and the unimodal adapter corresponding to the audio modality (Uni-modal Adapters) is added at the same time. Then, multi-expert routing (MoE-Gating) is added to dynamically weight the outputs of the video-audio cross-modal adapter and the unimodal adapter corresponding to the audio modality to form a multimodal adapter combination module 2. Among them, the output of the Q mapping matrix of the Q, K, V mapping matrix in the self-attention layer, the output of the video-audio cross-modal adapter, and the output of the unimodal adapter corresponding to the audio modality are summed up and calculated as follows:

[0080] (2)

[0081] Among them, Q represents the Q mapping matrix in the attention module, and represents the output weight of multi-expert routing, Video-audio cross-modal adapters that represent linear layers that join the audio modality, Indicates the uni-modal adapters corresponding to the audio mode. represents the combined output generated by the Q mapping matrix after adding the multimodal adapter combination module 2 consisting of a single-modal adapter corresponding to the audio modality, a video-audio cross-modal adapter, and a multi-expert router;

[0082] The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (2). We only need to replace Just replace it with the corresponding input.

[0083] In the process of expanding to the audio mode, the multimodal adapter combination module 2 serves as the basis for the multimodal adapter combination module of the next expansion process.

[0084] (2.1.4) The method of expanding the depth modality and point cloud modality is the same as the method of expanding the audio modality in step (2.1.3), such as Figure 3 As shown in (c) and (d).

[0085] Furthermore, in the process of modal expansion of the multimodal language reasoning model, a freeze-activate strategy needs to be referenced; the freeze-activate strategy refers to:

[0086] The pre-trained multimodal language inference model is used as the initial model. When it is expanded to the video modality, the pre-trained parameters of the original image modality are frozen, and only the newly added parameters in the multimodal adapter combination module are trained.

[0087] When expanding to the audio modality, it is necessary to freeze all parameters trained for the image and video modalities, and only fine-tune the linear layer added to the unimodal adapter corresponding to the video modality and the unimodal adapter corresponding to the audio modality and the parameters in the multi-expert routing.

[0088] When expanding to the deep modality, it is necessary to freeze all the trained parameters of the image, video, and audio modalities, and only fine-tune the linear layers added to the unimodal adapter corresponding to the deep modality, the unimodal adapter corresponding to the deep modality, and the parameters in the multi-expert routing.

[0089] When expanding to the point cloud modality, it is necessary to freeze all the trained parameters of the image, video, audio, and depth modalities, and only fine-tune the linear layer added to the single-modality adapter corresponding to the point cloud modality, the single-modality adapter corresponding to the point cloud modality, and the parameters in the multi-expert routing.

[0090] The modality expansion method of the pre-trained multimodal language reasoning model based on continuous learning and transfer learning saves more than 98% of training parameters compared to X-InstructBLIP in terms of parameter quantity indicators, and exceeds other anti-forgetting methods WiSE-FT and EProj by more than 29.8 and 3.0 points in terms of anti-forgetting and modality expansion learning. In addition, this method does not require all modal data to uniformly train the multimodal language reasoning model, but only needs to obtain data with a specific distribution when training a specific modality, which provides strong flexibility and robustness for modality expansion learning.

[0091] 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 replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A modality expansion method for a pre-trained multimodal language reasoning model based on continuous learning and transfer learning, characterized in that: Here are the steps: Step 1: Build a multimodal language reasoning model; The multimodal language reasoning model includes a multimodal encoder, a regularization layer, a multimodal alignment module, a serialization module, a modality mapping module, and a large language model; The multimodal alignment module includes a self-attention layer, a cross-attention layer, a multimodal adapter combination module, a feedforward layer 1, and a feedforward layer 2; The modality mapping module includes a mapping layer and a multi-modality adapter combination module; The multimodal adapter combination module includes single-modal adapter, cross-modal adapter and multi-expert routing; Step 2: Modal expansion of the multimodal language reasoning model; (2.1) Images, videos, audio, depth and point clouds are used as multimodal inputs of the multimodal language reasoning model. The multimodal encoder extracts features to obtain feature information of each modality. The feature information of each modality is sent to the regularization layer for feature regularization to obtain feature knowledge of each modality. (2.2) After the question input is encoded through the serialization module, it is obtained as the question embedding, and the question embedding is cascaded with the learnable token to form the instruction embedding; (2.3) The instruction embedding is fed into the self-attention layer of the multimodal alignment module; The multimodal adapter combination module is added in parallel to the Q, K, and V mapping matrices of the self-attention layer, and the self-attention layer is fine-tuned with a low-rank lightweight matrix to obtain a language embedding with learnable queries; (2.4) The language embedding with the learnable query is injected into the cross-attention layer with the multimodal adapter combination module added. The mapping matrix of the multimodal adapter combination module and the cross-attention layer processes the language embedding with the learnable query respectively. After adding the processing results, the cross-attention operation is performed with the feature knowledge of each modality to obtain the output of the cross-attention. (2.5) The output of the cross-attention is input into the feedforward layer 1, and the language embedding with the learnable query is input into the feedforward layer 2. The outputs of the feedforward layer 1 and the feedforward layer 2 are cascaded to obtain the cross-modal output; (2.6) The cross-modal output is sent to the next multimodal alignment module for processing. Steps (2.3) to (2.5) are repeated iteratively to obtain the final cross-modal output. The final cross-modal output is sent to the modal mapping module with the multimodal adapter combination module added. After the modal mapping module changes the dimension, it is sent to the large language model for reasoning output to generate the final answer output. The modality expansion of the multimodal language reasoning model is achieved through the multimodal adapter combination module, which can expand new modalities according to the dynamic changes of the modal order: (2.1.1) When the modality of the initial multimodal language reasoning model is an image, it is a pre-trained multimodal language reasoning model and there is no need to use a multimodal adapter combination module; (2.1.2) When the pre-trained multimodal language reasoning model needs to be extended to the video modality, add the unimodal adapter corresponding to the video modality to the self-attention layer, cross-attention layer, and modality mapping module; Among them, the output of the Q mapping matrix of the Q, K, and V mapping matrices in the self-attention layer is added to the output of the single-modal adapter, and the formula is as follows: (1) Where Q represents the Q mapping matrix in the attention module, The unimodal adapter corresponding to the video modality is composed of a low-rank mapping matrix (LoRA); represents the video embedding fed into the unimodal adapter and the Q-mapping matrix in the self-attention layer; represents the combined output generated by the Q-mapping matrix after adding the single-mode adapter; The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (1). We only need to replace Replace with the corresponding input; In the process of extending to the video mode, the multimodal adapter combination module composed of the single-modal adapters is denoted as multimodal adapter combination module 1, which serves as the basis of the multimodal adapter combination module of the next extension process; (2.1.3) When the multimodal language reasoning model expanded in step (2.1.2) needs to be further expanded to the audio modality, the linear layer of the audio modality is added to the single modality adapter corresponding to the video modality on the basis of the multimodal adapter combination module 1 in step (2.1.2) to form a video-audio cross-modal adapter, and the single modality adapter corresponding to the audio modality is added at the same time; then multi-expert routing is added to dynamically weight the outputs of the video-audio cross-modal adapter and the single modality adapter corresponding to the audio modality to form a multimodal adapter combination module 2; wherein, the output of the Q mapping matrix of the Q, K, V mapping matrix in the self-attention layer, the output of the video-audio cross-modal adapter, and the output of the single modality adapter corresponding to the audio modality are summed up and calculated as follows: (2) Among them, Q represents the Q mapping matrix in the attention module, and represents the output weight of multi-expert routing, A video-audio cross-modality adapter representing a linear layer that joins the audio modality. Represents the unimodal adapter corresponding to the audio mode; represents the combined output generated by the Q mapping matrix after adding the multimodal adapter combination module 2 consisting of a single-modal adapter corresponding to the audio modality, a video-audio cross-modal adapter, and a multi-expert router; The calculation methods of K, V in the self-attention layer, Q, K, V in the cross-attention layer, and the corresponding calculation methods in the modality mapping module are the same as the calculation method of Q in equation (2). We only need to replace Just replace it with the corresponding input; In the process of expanding to the audio mode, the multimodal adapter combination module 2 serves as the basis for the multimodal adapter combination module of the next expansion process; (2.1.4) The depth modality and point cloud modality are expanded in the same way as the audio modality in step (2.1.3); In the process of modal expansion of the multimodal language reasoning model, a freeze-activate strategy needs to be referenced; the freeze-activate strategy refers to: The pre-trained multimodal language inference model is used as the initial model. When expanding to the video modality, the pre-trained parameters of the original image modality are frozen, and only the newly added parameters in the multimodal adapter combination module are trained. When expanding to the audio modality, it is necessary to freeze all the parameters trained in the image and video modalities, and only fine-tune the parameters added to the linear layer of the unimodal adapter corresponding to the video modality and the unimodal adapter and multi-expert routing corresponding to the audio modality; When expanding to the deep modality, it is necessary to freeze all the trained parameters of the image, video, and audio modalities, and only fine-tune the linear layer added to the unimodal adapter corresponding to the deep modality, the unimodal adapter corresponding to the deep modality, and the parameters in the multi-expert routing; When expanding to the point cloud modality, it is necessary to freeze all the trained parameters of the image, video, audio, and depth modalities, and only fine-tune the linear layer added to the single-modality adapter corresponding to the point cloud modality, the single-modality adapter corresponding to the point cloud modality, and the parameters in the multi-expert routing.

2. According to the modal expansion method of a pre-trained multimodal language reasoning model based on continuous learning and transfer learning according to claim 1, the learnable token refers to a randomly initialized learnable parameter.

3. According to the modal expansion method of a pre-trained multimodal language reasoning model based on continuous learning and transfer learning according to claim 1, the feedforward layer 1 and the feedforward layer 2 are fully connected layers.