Multi-task scene-oriented model reasoning method, device, equipment, medium and product
By explicitly separating the extraction of task-sharing features and task-specific features, combined with the LoRA and MoE framework, the problems of inaccurate feature extraction and high inference cost in the multi-task learning model are solved, and efficient and high-precision multi-task collaborative inference are achieved.
Patent Information
- Application Number
- CN202510513700.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-07-29
AI Technical Summary
The existing multi-task learning model fails to effectively decouple the extraction process of task-sharing features and task-specific features, resulting in inaccurate inference results, negative migration problems and high inference costs.
By explicitly separating the extraction of task-sharing features and task-specific features, the LoRA and MoE framework is adopted, and the task-sharing module and task-specific module are used to process shared and specific features separately, and the feature extraction is optimized through domain and task routers to reduce duplicate calculations.
It improves the accuracy and inference speed of feature extraction, reduces the calculation cost, and realizes efficient and high-precision multi-task collaborative inference.
Smart Images

Figure CN120387520A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular, to a model inference method, device, equipment, medium and product for multi-task scenarios. Background Art
[0002] In today's technology application fields, the demand for multi-task processing is increasing day by day. Whether it is the parallel processing of text classification, sentiment analysis and named entity recognition in natural language processing, or the coordination of object detection, image segmentation and scene classification in computer vision, it requires the model to be able to efficiently process multiple related tasks. Traditional single-task models can no longer meet such complex requirements, so multi-task learning models have emerged as the times require. Multi-task learning aims to process multiple tasks simultaneously through one model, hoping to improve the generalization ability and overall performance of the model by means of the correlation between tasks.
[0003] In the design of multi-task learning model architectures, a unified feature module is usually adopted to process the input data of all tasks. Although this method realizes the sharing of model parameters to a certain extent and reduces the consumption of computing resources, it ignores the differences between different tasks. For shared feature extraction, it attempts to extract general features applicable to all tasks from the input data. However, due to the different data features concerned by different tasks, such general features often cannot accurately meet the specific requirements of each task. For example, in natural language processing, the sentiment analysis task pays more attention to sentiment tendency words and expressions in the text, while the named entity recognition task focuses on identifying specific entities such as person names, place names, and organization names in the text. Using a unified feature extraction module may result in the extracted features performing well on some tasks but poorly on other tasks.
[0004] At the same time, task-specific features are easily interfered by the shared feature extraction process because they are not separated from the shared features. When the model is trained to optimize the shared features, it may have a negative impact on the learning of task-specific features, resulting in the loss or distortion of task-specific information. This makes the model unable to fully utilize the unique data features of a specific task when processing the task, thus limiting the performance of the model on each task.
[0005] Therefore, the multi-task learning model with uncoupled feature extraction cannot fully exert its due efficacy, resulting in inaccurate model inference results. Summary of the Invention
[0006] The present invention provides a model inference method, device, equipment, medium and product for multi-task scenarios, so as to solve the problem in the prior art that the extraction process of task-shared features and task-specific features is not decoupled, resulting in inaccurate inference results of multi-task learning models.
[0007] In a first aspect, the present invention provides a model inference method for multi-task scenarios, including: Obtain multi-domain data; the multi-domain data refers to data of the same modality from different domains; Input the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any of the dimensional model inference results is the inference result of the multi-task learning model performing a corresponding specific task; Among them, the multi-task learning model includes multiple fine-tuning model layers, and any of the fine-tuning model layers includes a task-sharing module and a task-specific module; The task-sharing module is used to extract the task-sharing features of the current fine-tuning model layer only based on the task-sharing features of the previous fine-tuning model layer, and cache the task-sharing features of the current fine-tuning model layer; The task-specific module is used to obtain the task-sharing features of the previous fine-tuning model layer from the cache when performing any specific task, and extract the task-specific features of the current fine-tuning model layer based on the task-sharing features and task-specific features of the previous fine-tuning model layer.
[0008] In one embodiment, the task-sharing features of the current fine-tuning model layer are determined by the following method: Perform a linear transformation on the task-sharing features of the previous fine-tuning model layer through the weight matrix of the multi-task learning model to obtain a linear transformation result; Perform a multiplication calculation on the task-sharing features of the previous fine-tuning model layer through the upper projection matrix and the lower projection matrix of the shared low-rank adaptation LoRA to obtain a multiplication calculation result; Fuse the linear transformation result and the multiplication calculation result to obtain the task-sharing features of the current fine-tuning model layer.
[0009] In one embodiment, when performing any specific task, the task-specific features of the current fine-tuning model layer are determined by the following method: Each expert in the LoRA expert set extracts feature data based on the task-sharing features and task-specific features of the previous fine-tuning model layer; Determine the probability corresponding to each expert in the LoRA expert set; the probability is used to reflect the contribution of the expert to processing the input sample; Based on the feature data extracted by each expert and its corresponding probability, determine the task-specific features of the current fine-tuning model layer.
[0010] In one embodiment, the feature data extracted by each expert is determined by the following method: Fuse the task - shared features and task - specific features of the previous fine - tuned model layer to obtain fused features; For each expert in the LoRA expert set, perform a multiplication operation based on the LoRA upper projection matrix, lower projection matrix, and the fused features to obtain the feature data extracted by each expert.
[0011] In one embodiment, the probability corresponding to each expert is determined as follows: Fuse the task - shared features and task - specific features of the previous fine - tuned model layer to obtain fused features; Determine the first probability corresponding to each expert in the LoRA expert set; the first probability is used to reflect the contribution of the expert to the field to which the fused features belong; Determine the second probability corresponding to each expert in the LoRA expert set; the second probability is used to reflect the contribution of the expert to the specific task being processed; Based on the first probability corresponding to each expert and the second probability corresponding to each expert, determine the probability corresponding to each expert.
[0012] In one embodiment, the first probability corresponding to each expert is determined as follows: Through the domain router, generate the first probability of each expert in the LoRA expert set based on the fused features; the domain router is used to route the LoRA expert set according to the domain differences between input samples.
[0013] In one embodiment, the second probability corresponding to each expert is determined as follows: Through the task router, generate the second probability of each expert in the LoRA expert set based on the task embedding corresponding to the specific task currently being executed; the task router is used to route the LoRA expert set according to the task differences between different tasks.
[0014] In a second aspect, the present invention also provides a model inference device for a multi - task scenario, including: An acquisition module for acquiring multi - domain data; the multi - domain data refers to data of the same modality from different domains; A model inference module for inputting the multi - domain data into a multi - task learning model to obtain multi - dimensional model inference results output by the multi - task learning model; any one of the dimensional model inference results is the inference result of the multi - task learning model performing the corresponding specific task; Wherein, the multi - task learning model includes multiple fine - tuned model layers, and any one of the fine - tuned model layers includes a task - sharing module and a task - specific module; The task sharing module is used to extract the task sharing features of the current fine-tuning model layer only based on the task sharing features of the previous fine-tuning model layer, and cache the task sharing features of the current fine-tuning model layer; The task specific module is used to, when performing any specific task, obtain the task sharing features of the previous fine-tuning model layer from the cache, and extract the task specific features of the current fine-tuning model layer based on the task sharing features of the previous fine-tuning model layer and the task specific features.
[0015] In a third aspect, the present invention provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the model inference method for a multi-task scenario as described in any one of the above are implemented.
[0016] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the model inference method for a multi-task scenario as described in any one of the above are implemented.
[0017] In a fifth aspect, the present invention further provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by the processor, the steps of the model inference method for a multi-task scenario as described in any one of the above are implemented.
[0018] The model inference method, device, equipment, medium, and product for a multi-task scenario provided by the present invention explicitly separate into two branches of task sharing feature extraction and task specific feature extraction at the feature level. The task sharing module only depends on the task sharing features of the previous fine-tuning model layer to extract the task sharing features of the current fine-tuning model layer and caches them. When the task specific module executes a specific task, it only needs to read the task sharing features of the previous fine-tuning model layer from the cache, and combine with the task specific features of the previous layer to extract the task specific features of the current fine-tuning model layer, effectively isolating the extraction of task specific features from task sharing features. This decoupling mechanism effectively improves the accuracy of feature extraction. Moreover, reading task sharing features from the cache to implement task specific feature extraction enables the task sharing features to be efficiently reused among multiple tasks, greatly reducing the situation of repeated calculations, reducing the computational cost, and accelerating the inference speed. Therefore, the improved multi-task learning model can achieve efficient and high-precision multi-task collaborative inference on multi-domain data. Description of the Drawings
[0019] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0020] Figure 1 It is a schematic flowchart of the model inference method for multi-task scenarios provided by the present invention.
[0021] Figure 2 It is a schematic diagram of the CLIPMoLE model structure of the LoRA-based MoE multi-task learning method provided by the present invention.
[0022] Figure 3 It is a schematic diagram of feeding the task-shared features and task-specific features into the next-layer module provided by the present invention.
[0023] Figure 4 It is a schematic diagram of an image with domain differences provided by the present invention.
[0024] Figure 5 It is a schematic diagram of an image with task differences provided by the present invention.
[0025] Figure 6 It is a schematic diagram of the LoRA-based MoE multi-task learning model structure provided by the present invention.
[0026] Figure 7 It is a schematic diagram of the structure of the model inference device for multi-task scenarios provided by the present invention.
[0027] Figure 8 It is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed implementation manners
[0028] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.
[0029] The terms "first", "second", etc. in the present invention are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present invention can be implemented in an order different from those illustrated or described herein.
[0030] The following will be combined withFigures 1-8 Describe the provided model inference method, device, equipment, medium and product for multi-task scenarios of the present invention.
[0031] It should be noted that the model inference method for multi-task scenarios provided in the embodiments of the present invention is implemented based on the model inference device for multi-task scenarios.
[0032] The embodiments of the present invention use the model inference device for multi-task scenarios as the execution subject to describe the model inference method for multi-task scenarios.
[0033] Combined with Figure 1 , Figure 1 is a schematic flow diagram of the model inference method for multi-task scenarios provided by the present invention.
[0034] As Figure 1 shown, the model inference method for multi-task scenarios includes the following steps: Step 101, obtain multi-domain data; Step 102, input the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model.
[0035] Specifically, obtain multi-domain data, where multi-domain data refers to data of the same modality from different domains. <>
[0036] Specifically, multi-task scenarios are often used in technical fields such as natural language processing and computer vision. Therefore, for modal data in this example, it is mainly text data, image data, audio data, video data, etc. Of course, it is not limited to these modal data.
[0037] And multi-domain data is data of the same modality from different domains. For example, text data can be texts covering different domains such as politics, economy, culture, and technology, image data can be images covering different domains such as medical, satellite, agriculture, and industrial products, audio data can be audio covering different domains such as voice interaction, security, and environmental monitoring, and video data can be videos covering different domains such as education, security, and industry. Of course, the domains corresponding to each modal data are not limited to this, and only common domains are listed here.
[0038] For data of the same modality, it can be applied to multi-task scenarios. For example, text data can be applied to different task scenarios such as text classification, sentiment analysis, named entity recognition, and question answering systems. Image data can be applied to different task scenarios such as object detection, instance segmentation, depth estimation, and scene classification. Image data can be applied to different task scenarios such as speech recognition, speech classification, and abnormal sound detection. Video data can be applied to different task scenarios such as action recognition, object tracking, and pose estimation. Of course, the multi-task scenarios corresponding to each modality data are not limited to this, and only common task scenarios are listed here.
[0039] Input the obtained multi-domain data into the multi-task learning model, and perform inference on multiple tasks in parallel through the multi-task learning model, and then output the inference results corresponding to each specific task as the multi-dimensional model inference results output by the model.
[0040] This application method of the multi-task learning model is conventional in the prior art. However, in this application, at the feature extraction level, by improving the multi-task learning model, the improved multi-task learning model can achieve efficient and high-precision multi-task collaborative inference on multi-domain data. The following will describe the improvement method of the multi-task learning model.
[0041] For model inference in multi-task scenarios, the prior art combines three techniques: multi-task learning, mixture of experts framework, and parameter-efficient fine-tuning.
[0042] Multi-Task Learning (MTL) is a method of training a model to perform well on multiple tasks simultaneously, and is commonly used in fields such as natural language processing and computer vision. The core of multi-task learning is to enable each task to benefit from each other by sharing some model parameters. For example, in Natural Language Processing (NLP), different tasks (such as named entity recognition, sentiment analysis, and question answering systems) can share the same language understanding module, so as to obtain more effective feature expressions based on knowledge sharing. At the same time, through this sharing mechanism, MTL can achieve transfer learning between tasks, that is, the knowledge of some tasks can help the learning of other tasks, and this transfer is particularly important in data-scarce tasks. Compared with single-task learning, the model of MTL is exposed to a more diverse data distribution for each task, which helps to reduce the overfitting of the model to a certain task, thereby improving the generalization ability and robustness of the model. In practical applications, this improvement can significantly enhance the performance of the model on new data or slightly shifted data distributions. Define the multi-task dataset , where T represents the number of tasks, represents the dataset of the i-th task. The dataset of each task can be further represented as a set of input-output pairs: where is the j-th sample of the i-th task, is the corresponding label. is the sample size of task i. The multi-task model processes T tasks simultaneously, where represents the parameters of the model. The goal of multi-task learning is to find a set of shared parameters such that the model performs well on each task.
[0043] Define the loss function for each task: The above represents the error or loss of the model on task i; The total multi-task loss function is the weighted sum of all task losses: where is the weight of task i, used to balance the losses of different tasks.
[0044] To address the problem of knowledge sharing and differential learning between tasks, the Mixture of Experts (MoE) framework is widely used. Given an input sample , the goal of the MoE model is to process by selecting a suitable combination of experts to improve the performance of the model. The MoE contains multiple independent sub-networks as experts, and the set of experts is defined as: where K is the number of experts, and each is a neural network module with independent parameters, representing the i-th expert.
[0045] The MoE also includes a trainable gating function as a router, which outputs a probability distribution: where represents the probability of selecting expert . The gating function is responsible for the input sample Determine the appropriate combination of experts. The MoE framework makes each expert learn more efficiently on specific tasks or data segments by introducing multiple "expert" sub-models, and dynamically selects the most suitable expert through a gating mechanism to achieve balanced performance among multiple tasks.
[0046] With the rapid development of deep learning models, especially large-scale pre-trained models, parameter-efficient fine-tuning (PEFT) methods have gradually become an important optimization means. In traditional pre-training-fine-tuning frameworks, it is usually necessary to train the entire model on each new task. Especially for ultra-large-scale pre-trained models, such fine-tuning methods bring extremely high computational and storage overheads. This not only increases the cost of model deployment but also makes it difficult to apply efficiently on resource-constrained devices (such as edge devices or mobile devices). In addition, when frequent switching or expansion is required between different tasks, traditional fine-tuning methods often lack an effective mechanism for parameter sharing and are difficult to achieve efficient transfer among multiple tasks. The goal of PEFT is to achieve efficient adaptation and optimization of large models without significantly increasing the number of parameters, so as to meet the requirements of various downstream tasks. The LoRA (Low-Rank Adaptation) technique is a parameter-efficient adaptation method. Suppose in a pre-trained model, there is a weight matrix , LoRA represents the updated weight by using low-rank factorization: where , and the low rank r is much smaller than min(d, k). By decomposing the specific weight matrix in the model into low-rank matrices A and B, LoRA only adjusts these low-rank components, greatly reducing the number of fine-tuning parameters while maintaining the performance of the model. Therefore, it is widely used in the low-cost adaptation of large-scale pre-trained models.
[0047] Combining these three technical means, there is still a major difficulty in multi-task learning, which is prone to negative transfer (NT), that is, the problem of model performance degradation caused by the transfer of incompatible or conflicting knowledge between tasks. Negative transfer may be caused by factors such as differences in task characteristics and inconsistent data distributions.
[0048] To alleviate the negative transfer problem, existing LoRA-based multi-task learning methods introduce the MoE framework. By introducing MoE, while each task data shares the common features of all LoRA experts, it selects its own appropriate expert through a gating function, avoiding feature conflicts for certain tasks.
[0049] Figure 2It is a schematic diagram of the CLIPMoLE model structure of the LoRA-based MoE multi-task learning method provided by the present invention. In each fine-tuning model layer: Among them, is the pre-trained model weight, is the low-rank matrix of the task-shared LoRA, is the low-rank matrix of the task-specific LoRA, is a gating function. During training, the pre-trained model weights are frozen and the remaining parts are open for training. The CLIPMoLE model explicitly separates the LoRA parameters, and LoRA is explicitly divided into two parts, task-shared LoRA and task-specific LoRA. Among them, samples of all tasks are fed into the task-shared LoRA to facilitate the task-shared LoRA to extract common features of all tasks. In the task-specific LoRA part, by introducing the MoE mechanism, a suitable combination of LoRA experts is selected for different samples to extract the characteristic features of the samples.
[0050] In the asymmetric LoRA architecture (HydraLoRA), the A matrices in the LoRAs independently trained on different tasks have a high degree of similarity. Based on this, HydraLoRA designs an asymmetric LoRA MoE module, which uses one A matrix and multiple B matrices, and the MoE framework routes between the matrix Bs. HydraLoRA extracts task commonalities through matrix A and extracts the characteristics of different tasks through matrix B. The LoRA design team (TeamLoRA) designs a cooperation and competition module between LoRA experts, shares task features through the cooperation module, and the competition module encourages the differentiation of task-specific features by adjusting the gating network. The decoder-centered low-rank expert mixture multi-task learning framework (Mixed Low-Rank Expert, MLoRE) encourages the extraction of corresponding task-specific features by learning a gating function separately for each task when extracting task-specific features.
[0051] Although the prior art adopts an explicit division of LoRA and improves the MoE gating mechanism to decouple task-shared features and task-specific features, thereby mitigating the negative transfer problem. However, the prior art still has the following three disadvantages: 1. Task-specific features damage the subsequent extraction of task-shared features: Figure 3 It is a schematic diagram of the task-shared features and task-specific features provided by the present invention fed into the next-layer module. As Figure 3As shown, the extracted task - shared features and task - specific features are merged and sent to the next - layer task - shared module. Although the prior art decouples the task - shared features by explicitly separating LoRA parameters or improving the gating network when extracting features and task - specific features , due to LoRA being applied to the multi - layer structure of the pre - trained model, the two are independently extracted in the current layer, but will be re - merged and input into the task - shared module in the next layer for re - extracting task - shared features. However, task - specific features are not helpful for the extraction of task - shared features and may even interfere with the extraction of task - shared features. Therefore, the prior art has problems of incompleteness and inaccuracy in the extraction of task - shared features, resulting in the degradation of the quality of shared features.
[0052] 2. Different sources of task - specific features: The prior art uses the MoE framework to extract task - specific features, but simply classifies all task - specific features into one category and processes them using a unified architecture. This approach easily leads to insufficient extraction of task - specific features.
[0053] Combined Figure 4 and Figure 5 , Figure 4 is a schematic diagram of an image with domain differences provided by the present invention, Figure 5 is a schematic diagram of an image with task differences provided by the present invention. Taking images as an example, there are usually domain differences and task differences between different tasks in multi - task learning. As Figure 4 shown, Figure 4 on the left is an artistic drawing of a schoolbag, in the middle is a cut - out drawing of the schoolbag, and on the right is a commercial picture of the schoolbag. There are domain differences between the artistic drawing, the cut - out drawing, and the commercial picture. Domain differences refer to significant differences in image features caused by different sources of image data, which may cause feature conflicts. As Figure 5 shown, Figure 5 on the left is the original image of an office, in the middle is the depth - estimated image of the office, and on the right is the instance - segmented image of the office. There are task differences between the original image, the depth - estimated image, and the instance - segmented image. Task differences mean that even for the same image, due to different tasks performed (such as instance segmentation, depth estimation, etc.), the required features are different, which will cause conflicts between features. For these differences from different sources, using a unified architecture easily leads to some differences not being fully processed, thus triggering the problem of negative transfer.
[0054] 3. High inference cost: Although the existing technology reduces the training parameters through LoRA and lowers the cost of multi-task training, there are still problems during the inference process. Since the specific information of different tasks is reused during inference to extract shared features, it is difficult for the features extracted by the task-sharing module to be shared among tasks. Therefore, the existing technology needs to repeatedly run the task-sharing module for each task. Because the pre-trained model is used to extract shared features, this means that high-computation pre-trained model inference needs to be repeated for each task, resulting in no advantage in inference speed compared to single-task models.
[0055] This example focuses on LoRA-based multi-task learning and proposes a reasonable solution to problems such as the interference of task-specific features on task-shared feature extraction, unclear division of task-specific features, and high inference costs in the existing technology. Specifically, at the feature level, task-shared features and task-specific features are explicitly separated, and task-specific features are isolated from the subsequent task-shared feature extraction process. This explicit feature isolation enables task-shared features to be reused in multi-tasks, thus significantly accelerating the multi-task inference speed of the model. In addition, to address task differences from different sources, a dedicated routing strategy is designed to effectively mitigate the negative transfer problem.
[0056] Figure 6 It is a schematic diagram of the LoRA-based MoE multi-task learning model structure provided by the present invention. The following content combines Figure 6 to specifically describe the improvement of the multi-task learning model in this example.
[0057] First, initialize a pre-trained multi-task learning model. There are no restrictions on the type of the pre-trained multi-task learning model, which can be applied to natural language processing models or computer vision models. There are no restrictions on the number of model layers in the pre-trained multi-task learning model, the number of model layers participating in LoRA adjustment, the rank of LoRA, or the number of multi-tasks, which can be set according to actual needs, with high flexibility and generality.
[0058] In terms of the model structure, two independent branches are set up, namely the task - sharing branch and the task - specific branch. The task - sharing branch is used to implement task - sharing feature extraction, and the task - specific branch is used to implement task - specific feature extraction. In each model layer participating in LoRA tuning (hereinafter referred to as the fine - tuning model layer), a task - sharing module and a task - specific module are set up. The task - sharing module is used to implement task - sharing feature extraction of the current fine - tuning model layer, and the task - specific module is used to implement task - specific feature extraction of the current fine - tuning model layer. To achieve decoupling between task - sharing features and task - specific features, the task - sharing module only depends on the task - sharing features of the previous fine - tuning model layer to extract the task - sharing features of the current fine - tuning model layer, while the task - specific module fuses the task - sharing features, task - specific features of the previous fine - tuning model layer, and the task embedding of the current task being executed to generate the task - specific features of the current fine - tuning model layer. It can be understood that there is a one - way flow between task - sharing features and task - specific features, that is, task - sharing features can be used for the extraction of task - specific features, while conversely, task - specific features cannot be used for the extraction of task - sharing features.
[0059] It should be noted that during the model fine - tuning process, the feature extraction processes of different tasks are not parallel. When executing a certain task, the task - sharing branch and the task - specific branch can be used to jointly implement the feature extraction of the input sample, and the process of feature extraction for each task is the same.
[0060] Since the task - sharing module only depends on task - sharing features and does not depend on specific tasks, task - sharing features can be reused for inference acceleration during multi - task execution. Specifically, for the task set executed on the same input sample x, first, the input sample x only needs to pass through the task - sharing branch to extract and cache the task - sharing features of each layer. When executing each specific task , only read the task - sharing features from the cache and then process them through the task - specific branch. This method effectively reduces repeated calculations, enables efficient reuse of task - sharing features among multi - tasks, thereby reducing the computational cost and accelerating the inference speed.
[0061] The task - sharing module contains a LoRA expert set, and task - specific feature extraction is achieved through the LoRA expert set. In addition, the task - specific module also includes two routers, namely the domain router and the task router. The domain router and the task router route the expert set according to the domain differences and task differences between different tasks respectively, so as to mitigate the negative transfer problems brought about by these two differences.
[0062] The model inference method for multi-task scenarios provided by the present invention explicitly separates into two branches at the feature level: task-shared feature extraction and task-specific feature extraction. The task-shared module only depends on the task-shared features of the previous fine-tuned model layer to extract the task-shared features of the current fine-tuned model layer and caches them. When the task-specific module executes a specific task, it only needs to read the task-shared features of the previous fine-tuned model layer from the cache and combine them with the task-specific features of the previous layer to extract the task-specific features of the current fine-tuned model layer, effectively isolating the extraction of task-specific features from task-shared features. This decoupling mechanism effectively improves the accuracy of feature extraction. Moreover, reading task-shared features from the cache to achieve task-specific feature extraction enables the efficient reuse of task-shared features among multiple tasks, greatly reducing the situation of repeated calculations, lowering the computational cost, and accelerating the inference speed. Therefore, the improved multi-task learning model can achieve efficient and high-precision multi-task collaborative inference on multi-domain data.
[0063] In some embodiments, the task-shared module generates the task-shared features of the current fine-tuned model layer in the following manner: Perform a linear transformation on the task-shared features of the previous fine-tuned model layer through the weight matrix of the multi-task learning model to obtain a linear transformation result; Perform a multiplication calculation on the task-shared features of the previous fine-tuned model layer through the upper projection matrix and lower projection matrix of the shared low-rank adaptation LoRA to obtain a multiplication calculation result; Fuse the linear transformation result and the multiplication calculation result to obtain the task-shared features of the current fine-tuned model layer.
[0064] Specifically, define the dense layer weight matrix of the pre-trained multi-task learning model as , where d and k are the feature input dimension and output dimension of the current fine-tuned model layer. The lower projection matrix and upper projection matrix of LoRA are denoted as respectively, and the shared lower projection matrix and upper projection matrix of LoRA are denoted as respectively, where r is the rank of LoRA.
[0065] For the task-shared module of each layer, it includes a dense layer weight matrix of a pre-trained multi-task learning model as , and a shared LoRA. For the task-shared module of the i-th layer, it receives the task-shared features of the (i - 1)-th layer and outputs the task-shared features of the i-th layer .
[0066] Specifically, through the dense layer weight matrix, a linear transformation is performed on the task - shared features of the (i - 1) - th layer to obtain a linear transformation result. At the same time, through the shared up - projection matrix and down - projection matrix of LoRA, a multiplication calculation is performed on the task - shared features of the (i - 1) - th layer to obtain a multiplication calculation result.
[0067] Then, the linear transformation result and the multiplication calculation result are fused, which can be by adding the two to obtain the task - shared features of the i - th layer.
[0068] It is represented by the following formula: Where, represents the dense layer weight matrix, represents the transpose of the up - projection matrix of the shared LoRA, represents the down - projection matrix of the shared LoRA.
[0069] It should be noted that when i = 2, i - 1 = 1, then the task - shared features of the first layer are the model input samples.
[0070] In the embodiments of the present invention, a linear transformation is performed through the weight matrix of the multi - task learning model, a multiplication calculation is performed through the up and down projection matrices of the shared LoRA, and the results of the two are fused, effectively combining the stability of the traditional linear transformation and the flexibility of LoRA low - rank adaptation. It not only utilizes the transfer ability of the general features in multi - task learning but also can quickly adapt to specific tasks through low - rank matrices, achieving accurate extraction of task - shared features and helping to improve the multi - task inference ability of the model.
[0071] In some embodiments, when performing a specific task, the task - specific module generates the task - specific features of the current fine - tuned model layer in the following way: Each expert in the LoRA expert set extracts feature data based on the task - shared features and task - specific features of the previous fine - tuned model layer; Determine the probability corresponding to each expert in the LoRA expert set; the probability is used to reflect the contribution of the expert to processing the input sample; Based on the feature data extracted by each expert and its corresponding probability, determine the task - specific features of the current fine - tuned model layer.
[0072] Specifically, the task - specific module for each layer contains a LoRA expert set : where K is the number of experts.
[0073] Each expert in the LoRA expert set extracts feature data based on the task-shared features and task-specific features of the previous fine-tuning model layer.
[0074] It should be noted that when the current layer is the second layer, the previous layer is the first layer, and the task-specific features of the first layer are also the model input samples.
[0075] Moreover, the probability corresponding to each expert in the LoRA expert set is determined. The probability is used to reflect the contribution of the expert to processing the input sample, that is, the contribution to the features after fusing the task-shared features and task-specific features.
[0076] Then, a weighted sum is performed based on the feature data extracted by each expert and its corresponding probability to obtain the task-specific features of the i-th layer.
[0077] It is represented by the following formula: Among them, represents the probability corresponding to the j-th expert, represents the feature data extracted by the j-th expert.
[0078] In the embodiment of the present invention, the LoRA expert set extracts feature representations based on task-shared features and task-specific features, determines the probability distribution of the LoRA expert set, and through the weighted sum of feature data and probability, can adaptively allocate expert weights according to the characteristics of the input sample, select the most suitable expert, and achieve accurate extraction of task-specific features, which helps to improve the multi-task inference ability of the model.
[0079] According to the above content, the feature data extracted by each expert in the LoRA expert set is achieved through the following method: Fuse the task-shared features and task-specific features of the previous fine-tuning model layer to obtain fused features; Each expert in the LoRA expert set performs a multiplication calculation based on the upper projection matrix and lower projection matrix of LoRA and the fused features to obtain the feature data extracted by each expert.
[0080] Specifically, fuse the task-shared features and task-specific features of the i-1 layer to obtain fused features, and then each expert in the LoRA expert set performs a multiplication calculation based on the upper projection matrix and lower projection matrix of LoRA and the fused features to obtain the feature data extracted by each expert.
[0081] It is represented by the following formula: Among them, Represents the feature data extracted by the j-th expert, Represents the fused feature, Represents the transpose of the LoRA lower projection matrix applied by the j-th expert, Represents the LoRA upper projection matrix applied by the j-th expert.
[0082] Based on the features after fusing the task-sharing features and task-specific features of the previous layer and the upper and lower projection matrices of LoRA, the present invention embodiment determines the feature data extracted by each expert, enabling each expert to focus on different feature patterns, enhancing the adaptability of the model to multi-task scenarios and the diversity of feature extraction, and thus improving the performance of the model in complex multi-tasks.
[0083] According to the above content, generating the probability of each expert in the LoRA expert set is achieved by the following means: Fuse the task-sharing features and task-specific features of the previous fine-tuning model layer to obtain the fused feature; Determine the first probability corresponding to each expert in the LoRA expert set; the first probability is used to reflect the contribution of the expert to the field to which the fused feature belongs; Determine the second probability corresponding to each expert in the LoRA expert set; the second probability is used to reflect the contribution of the expert to the processing of the specific task; Based on the first probability corresponding to each expert and the second probability corresponding to each expert, determine the probability corresponding to each expert.
[0084] Specifically, fuse the task-sharing features and task-specific features of the i-1-th layer to obtain the fused feature.
[0085] Based on the fused feature, determine the first probability vector of the LoRA expert set, which includes the first probability corresponding to each expert, and the first probability is used to reflect the contribution of the expert to the field to which the fused feature belongs.
[0086] Based on the specific task currently being executed, determine the second probability vector of the LoRA expert set, which includes the second probability corresponding to each expert, and the second probability is used to reflect the contribution of the expert to the processing of the specific task.
[0087] Then, calculate the mean of the first probability vector and the second probability vector to obtain the probability vector of the LoRA expert set, which includes the probability corresponding to each expert. It can also be understood that calculate the mean of the first probability and the second probability corresponding to each expert to obtain the probability corresponding to each expert.
[0088] The calculation formula of the probability vector of the LoRA expert set is expressed as follows: Where, A probability vector representing the set of LoRA experts, A first probability vector representing the set of LoRA experts, A second probability vector representing the set of LoRA experts.
[0089] In the embodiments of the present invention, the task-specific features are further decoupled. By analyzing the sources of task differences, the differences are divided into domain differences and task differences, and different levels of routing are used to specifically address the negative transfer problems brought about by different differences, dealing more comprehensively with the negative transfer problems of task keys.
[0090] According to the above content, determining the first probability corresponding to each expert is achieved through the following means: Through the domain router, based on the fusion feature, generate the first probability of each expert in the LoRA expert set; the domain router is used to route the LoRA expert set according to the domain differences between input samples.
[0091] Specifically, each layer of the task-specific module further includes a domain router . The domain router Selects a suitable expert combination for each sample in the input samples according to the domain differences. Since the source of the domain differences is the distribution deviation of the data, the samples themselves can reflect the domain differences.
[0092] Therefore, through the domain router, based on the fusion feature, a first probability vector of the LoRA expert set can be generated, including the first probability corresponding to each expert.
[0093] The calculation formula for the first probability vector of the LoRA expert set is expressed as follows: Wherein, Represents the first probability vector of the LoRA expert set, Represents the fusion feature, Represents the routing calculation of the domain router, Represents the normalization calculation.
[0094] In the embodiments of the present invention, the domain router outputs the first probability of each LoRA expert based on the domain differences in the input samples, enabling the intelligent selection of the most relevant expert combination according to the domain characteristics of the input samples, and being able to specifically address the negative transfer problems brought about by domain differences through routing at the domain difference level, ultimately achieving efficient and high-precision multi-task collaborative reasoning on multi-domain data.
[0095] According to the above content, determining the second probability corresponding to each expert is achieved through the following means: Based on the task embedding corresponding to the specific task currently being executed, the task router generates the second probability for each expert in the LoRA expert set; the task router is used to route the LoRA expert set according to the task differences between different tasks.
[0096] Specifically, each layer of the task-specific module also includes a task router . The task router selects a suitable expert combination for the input sample according to the task differences. The task differences come from the differences in the tasks executed by the data. Considering that the same sample data may be executed for multiple types of data, therefore, the task router needs to receive an input independent of the input sample features. In this example, a learnable task embedding is designed for each task i during training .
[0097] Therefore, through the task router, a second probability vector of the LoRA expert set can be generated based on the task embedding corresponding to the specific task currently being executed, including the second probability corresponding to each expert.
[0098] The calculation formula for the second probability vector of the LoRA expert set is expressed as follows: Where, represents the second probability vector of the LoRA expert set, represents the task embedding corresponding to the currently executed task i, represents the routing calculation of the task router, represents the normalization calculation.
[0099] In the embodiment of the present invention, the task router outputs the second probability of each LoRA expert based on the task differences between different specific tasks, enabling the intelligent selection of the most relevant expert combination according to the characteristics of the specific task currently being executed, and being able to specifically address the negative transfer problem caused by task differences through routing at the task difference level. Finally, efficient and high-precision multi-task collaborative reasoning can be achieved in complex multi-task scenarios.
[0100] Next, the model inference device for multi-task scenarios provided by the present invention will be described. The model inference device for multi-task scenarios described below can be correspondingly referred to the model inference method for multi-task scenarios described above.
[0101] Referring to Figure 7 , Figure 7 is the structural schematic diagram of the model inference device for multi-task scenarios provided by the present invention.
[0102] The model inference device for multi-task scenarios includes: An acquisition module 710, configured to acquire multi-domain data; the multi-domain data refers to data of the same modality from different domains.
[0103] A model inference module 720, configured to input the multi-domain data into a multi-task learning model to obtain a multi-dimensional model inference result output by the multi-task learning model; any one of the dimensional model inference results is an inference result obtained by the multi-task learning model performing a corresponding specific task. Wherein, the multi-task learning model includes a plurality of fine-tuning model layers, and any one of the fine-tuning model layers includes a task-sharing module and a task-specific module. The task-sharing module is configured to extract the task-sharing features of the current fine-tuning model layer only based on the task-sharing features of the previous fine-tuning model layer, and cache the task-sharing features of the current fine-tuning model layer. The task-specific module is configured to, when performing any specific task, obtain the task-sharing features of the previous fine-tuning model layer from the cache, and extract the task-specific features of the current fine-tuning model layer based on the task-sharing features of the previous fine-tuning model layer and the task-specific features.
[0104] The model inference device for multi-task scenarios provided by the present invention explicitly separates into two branches of task-sharing feature extraction and task-specific feature extraction at the feature level. The task-sharing module only depends on the task-sharing features of the previous fine-tuning model layer to extract the task-sharing features of the current fine-tuning model layer and caches them. When the task-specific module performs a certain specific task, it only needs to read the task-sharing features of the previous fine-tuning model layer from the cache and combine them with the task-specific features of the previous layer to extract the task-specific features of the current fine-tuning model layer, effectively isolating the extraction of task-specific features from task-sharing features. This decoupling mechanism effectively improves the accuracy of feature extraction. Moreover, reading task-sharing features from the cache to implement task-specific feature extraction enables the task-sharing features to be efficiently reused among multiple tasks, greatly reducing the situation of repeated calculations, reducing the computational cost and accelerating the inference speed. Therefore, the improved multi-task learning model can achieve efficient and high-precision multi-task collaborative inference on multi-domain data.
[0105] Further, the model inference device for multi-task scenarios is further configured to: Perform a linear transformation on the task-sharing features of the previous fine-tuning model layer through the weight matrix of the multi-task learning model to obtain a linear transformation result. Perform a multiplication calculation on the task-sharing features of the previous fine-tuning model layer through the upper projection matrix and the lower projection matrix of the shared low-rank adaptation LoRA to obtain a multiplication calculation result. Fuse the linear transformation result and the multiplication calculation result to obtain the task-sharing features of the current fine-tuning model layer.
[0106] Further, the model inference device for multi-task scenarios is further configured to: Extract features through each expert in the LoRA expert set based on the task-shared features and task-specific features of the previous fine-tuned model layer to obtain the feature data extracted by each expert; Determine the probability corresponding to each expert in the LoRA expert set; the probability is used to reflect the contribution of the expert to processing the input sample; Determine the task-specific features of the current fine-tuned model layer based on the feature data extracted by each expert and its corresponding probability.
[0107] Further, the model inference device for multi-task scenarios is further configured to: Fuse the task-shared features and task-specific features of the previous fine-tuned model layer to obtain fused features; Through each expert in the LoRA expert set, perform a multiplication calculation based on the upper projection matrix, lower projection matrix of LoRA and the fused features to obtain the feature data extracted by each expert.
[0108] Further, the model inference device for multi-task scenarios is further configured to: Fuse the task-shared features and task-specific features of the previous fine-tuned model layer to obtain fused features; Determine the first probability corresponding to each expert in the LoRA expert set; the first probability is used to reflect the contribution of the expert to the field to which the fused features belong; Determine the second probability corresponding to each expert in the LoRA expert set; the second probability is used to reflect the contribution of the expert to processing the specific task; Determine the probability corresponding to each expert based on the first probability corresponding to each expert and the second probability corresponding to each expert.
[0109] Further, the model inference device for multi-task scenarios is further configured to: Generate the first probability of each expert in the LoRA expert set through the domain router based on the fused features; the domain router is used to route the LoRA expert set according to the domain differences between input samples.
[0110] Further, the model inference device for multi-task scenarios is further configured to: Generate the second probability of each expert in the LoRA expert set through the task router based on the task embedding corresponding to the specific task currently being executed; the task router is used to route the LoRA expert set according to the task differences between different tasks.
[0111] It should be noted that the model inference device for multi-task scenarios provided by the present invention can execute the model inference method for multi-task scenarios described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.
[0112] Figure 8 is a schematic structural diagram of the electronic device provided by the present invention. As Figure 8 shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830, and a communication bus 840. Among them, the processor 810, the communication interface 820, and the memory 830 complete mutual communication through the communication bus 840. The processor 810 can call the logical instructions in the memory 830 to execute the model inference method for multi-task scenarios. The method includes: obtaining multi-domain data; the multi-domain data refers to data of the same modality from different domains; inputting the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any one of the dimension model inference results is the inference result of executing a corresponding specific task by the multi-task learning model; wherein, the multi-task learning model includes a plurality of fine-tuning model layers, and any one of the fine-tuning model layers includes a task sharing module and a task specific module; the task sharing module is used to extract the task sharing features of the current fine-tuning model layer only based on the task sharing features of the previous fine-tuning model layer, and cache the task sharing features of the current fine-tuning model layer; the task specific module is used to obtain the task sharing features of the previous fine-tuning model layer from the cache when executing any specific task, and extract the task specific features of the current fine-tuning model layer based on the task sharing features of the previous fine-tuning model layer and the task specific features.
[0113] In addition, when the logical instructions in the above-mentioned memory 830 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0114] On the other hand, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the model inference method for multi-task scenarios provided in the above embodiments. The method includes: obtaining multi-domain data; the multi-domain data refers to data of the same modality from different domains; inputting the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any one of the dimensional model inference results is the inference result of executing a corresponding specific task by the multi-task learning model; wherein, the multi-task learning model includes a plurality of fine-tuning model layers, and any one of the fine-tuning model layers includes a task sharing module and a task specific module; the task sharing module is used to extract the task sharing features of the current fine-tuning model layer only based on the task sharing features of the previous fine-tuning model layer and cache the task sharing features of the current fine-tuning model layer; the task specific module is used to obtain the task sharing features of the previous fine-tuning model layer from the cache when executing any specific task, and extract the task specific features of the current fine-tuning model layer based on the task sharing features of the previous fine-tuning model layer and the task specific features.
[0115] On another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the model inference method for multi-task scenarios provided in the above embodiments. The method includes: obtaining multi-domain data; the multi-domain data refers to data of the same modality from different domains; inputting the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any one of the dimensional model inference results is the inference result of executing a corresponding specific task by the multi-task learning model; wherein, the multi-task learning model includes a plurality of fine-tuning model layers, and any one of the fine-tuning model layers includes a task sharing module and a task specific module; the task sharing module is used to extract the task sharing features of the current fine-tuning model layer only based on the task sharing features of the previous fine-tuning model layer and cache the task sharing features of the current fine-tuning model layer; the task specific module is used to obtain the task sharing features of the previous fine-tuning model layer from the cache when executing any specific task, and extract the task specific features of the current fine-tuning model layer based on the task sharing features of the previous fine-tuning model layer and the task specific features.
[0116] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.
[0117] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing 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.
[0118] 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 them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the present invention.
Claims
1. A model inference method for multi-task scenarios, characterized in that, The model inference method for multi-task scenarios includes: Obtain multi-domain data; the multi-domain data refers to data of the same modality from different domains; Input the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any one of the dimensional model inference results is the inference result of the multi-task learning model performing a corresponding specific task; Among them, the multi-task learning model includes multiple fine-tuning model layers, and any one of the fine-tuning model layers includes a task-sharing module and a task-specific module; The task-sharing module is used to extract the task-sharing features of the current fine-tuning model layer only based on the task-sharing features of the previous fine-tuning model layer and cache the task-sharing features of the current fine-tuning model layer; The task-specific module is used to obtain the task-sharing features of the previous fine-tuning model layer from the cache when performing any specific task, and extract the task-specific features of the current fine-tuning model layer based on the task-sharing features and task-specific features of the previous fine-tuning model layer.
2. The model inference method for multi-task scenarios according to claim 1, wherein The task-sharing features of the current fine-tuning model layer are determined by the following method: Perform a linear transformation on the task-sharing features of the previous fine-tuning model layer through the weight matrix of the multi-task learning model to obtain a linear transformation result; Perform a multiplication calculation on the task-sharing features of the previous fine-tuning model layer through the upper projection matrix and lower projection matrix of the shared low-rank adaptation LoRA to obtain a multiplication calculation result; Fuse the linear transformation result and the multiplication calculation result to obtain the task-sharing features of the current fine-tuning model layer.
3. The model inference method for multi-task scenarios according to claim 1, wherein When performing any specific task, the task-specific features of the current fine-tuning model layer are determined by the following method: Each expert in the LoRA expert set performs feature extraction based on the task-sharing features and task-specific features of the previous fine-tuning model layer to obtain the feature data extracted by each expert; Determine the probability corresponding to each expert in the LoRA expert set; The probability is used to reflect the contribution of the expert to processing the input sample; Based on the feature data extracted by each expert and its corresponding probability, determine the task-specific features of the current fine-tuning model layer.
4. The model inference method for multi-task scenarios according to claim 3, characterized in that, The feature data extracted by each expert is determined by the following method: Fuse the task-sharing features and task-specific features of the previous fine-tuning model layer to obtain a fused feature; Each expert in the LoRA expert set performs a multiplication calculation based on the upper projection matrix, lower projection matrix of LoRA and the fused feature to obtain the feature data extracted by each expert.
5. The model inference method for multi-task scenarios according to claim 3, wherein The probability corresponding to each expert is determined by the following method: Fuse the task-sharing features and task-specific features of the previous fine-tuning model layer to obtain a fused feature; Determine the first probability corresponding to each expert in the LoRA expert set; the first probability is used to reflect the contribution of the expert to processing the domain to which the fused feature belongs; Determine the second probability corresponding to each expert in the LoRA expert set; the second probability is used to reflect the contribution of the expert to processing the specific task; Based on the first probability corresponding to each expert and the second probability corresponding to each expert, determine the probability corresponding to each expert.
6. The model inference method for multi-task scenarios according to claim 5, wherein The first probability corresponding to each expert is determined as follows: Through the domain router, based on the fusion features, generate the first probability of each expert in the LoRA expert set; the domain router is used to route the LoRA expert set according to the domain differences between input samples.
7. The model inference method for multi-task scenarios according to claim 5, characterized in that The second probability corresponding to each expert is determined as follows: Through the task router, based on the task embedding corresponding to the specific task currently being executed, generate the second probability of each expert in the LoRA expert set; the task router is used to route the LoRA expert set according to the task differences between different tasks.
8. A model inference device for multi-task scenarios, characterized in that, It includes: An acquisition module, used to acquire multi-domain data; The multi-domain data refers to data of the same modality from different domains; A model inference module, used to input the multi-domain data into a multi-task learning model to obtain multi-dimensional model inference results output by the multi-task learning model; any one of the dimension model inference results is the inference result of the multi-task learning model executing the corresponding specific task; Among them, the multi-task learning model includes multiple fine-tuning model layers, and any one of the fine-tuning model layers includes a task sharing module and a task specific module; The task sharing module is used to extract the task sharing features of the current fine-tuning model layer only based on the task sharing features of the previous fine-tuning model layer and cache the task sharing features of the current fine-tuning model layer; The task specific module is used to obtain the task sharing features of the previous fine-tuning model layer from the cache when executing any specific task, and extract the task specific features of the current fine-tuning model layer based on the task sharing features of the previous fine-tuning model layer and the task specific features.
9. An electronic device, the electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the model inference method for a multi-task scenario according to any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that, When the computer program is executed by the processor, it implements the steps of the model inference method for a multi-task scenario according to any one of claims 1 to 7.
11. A computer program product, the computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the model inference method for a multi-task scenario according to any one of claims 1 to 7.