Multi-task model training method and device, computer equipment and storage medium
By determining the importance indicators of model parameters in single-task model training and performing update and discarding operations, combined with model parameter fusion processing, the parameter conflict problem in multi-task model training is solved, and the model's adaptability and generalization ability are improved.
Patent Information
- Application Number
- CN202411709515.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-27
- Publication Date
- 2025-03-11
AI Technical Summary
When the existing multi-task model training method integrates model parameters trained by different tasks, there is a parameter conflict problem, which seriously affects the scalability of the method.
In the single-task model training process, the importance indicators of each model parameter are determined based on the model parameter set and the value of the target loss function, and the parameter update and discard operation is performed to obtain the parameter update result of the single-task model. Then, based on these results, the model parameters are fused to obtain a multi-task model.
By accurately filtering key parameters, optimize the parameter update results of the single-task model, reduce computational resources, and enhance the pertinence and effectiveness of the model. At the same time, by integrating the advantages of different single-task models, the adaptability and generalization capabilities of multi-task models are improved.
Smart Images

Figure CN119599093A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a multi-task model training method, apparatus, computer equipment and storage medium. Background Art
[0002] With the development of artificial intelligence, deep learning technology is applied in many scenarios. When the model learns new tasks, it may cause problems such as catastrophic forgetting of old tasks.
[0003] In order to solve related problems. The currently proposed continuous learning framework includes: conditional generator network, discriminator network, and classifier network, which effectively alleviates the catastrophic forgetting of old tasks in the continuous learning process, improves the continuous learning ability, and realizes model capability integration by integrating model parameters trained by different tasks. However, the conflict between different task parameters seriously affects the scalability of the method. Summary of the invention
[0004] Based on this, it is necessary to provide a multi-task model training method, device, computer equipment and storage medium to address the above technical problems.
[0005] In a first aspect, the present application provides a multi-task model training method, comprising:
[0006] In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function;
[0007] Based on the importance index corresponding to each model parameter, a parameter update discarding operation is performed to obtain a parameter update result of the single-task model;
[0008] Based on the parameter update results of each single-task model, model parameter fusion processing is performed to obtain a multi-task model.
[0009] In a second aspect, the present application also provides a multi-task model training device, comprising:
[0010] The indicator determination module is used to determine the importance indicator corresponding to each model parameter according to the model parameter set involved and the value of the target loss function in the single-task model training process;
[0011] A parameter update discarding module, used to perform a parameter update discarding operation based on the importance index corresponding to each model parameter to obtain a parameter update result of the single-task model;
[0012] The fusion processing module is used to perform model parameter fusion processing based on the parameter update results of each single-task model to obtain a multi-task model.
[0013] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in the first aspect is implemented.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method described in the first aspect.
[0015] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in the first aspect.
[0016] The above multi-task model training method, in the process of single-task model training, determines the importance index corresponding to each model parameter according to the model parameter set involved and the value of the target loss function; based on the importance index corresponding to each model parameter, performs parameter update and discarding operation to obtain the parameter update result of the single-task model; based on the parameter update results of each single-task model, performs model parameter fusion processing to obtain a multi-task model. Through this scheme, the multi-task model training method can accurately screen out key parameters and provide a scientific basis for subsequent operations by determining the importance index of each model parameter according to the model parameter set and the value of the target loss function in the process of single-task training. Based on this, the parameter update and discarding operation can effectively remove redundant or interfering parameters, optimize the single-task model parameter update results, reduce unnecessary waste of computing resources and enhance the pertinence and effectiveness of the single-task model. Finally, with the help of the parameter update results of each single-task model, the model parameter fusion processing is carried out to obtain a multi-task model, so that the advantages of different single tasks can be integrated, the adaptability and generalization ability of the multi-task model can be improved, and it can be operated more flexibly and efficiently in multi-task scenarios, thereby improving the overall model training effect and application value. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0018] Figure 1 A schematic diagram of a flow chart of a multi-task model training method in an embodiment;
[0019] Figure 2 A schematic diagram of a training process of a single-task model in one embodiment;
[0020] Figure 3 A schematic diagram of model splicing and fusion in one embodiment;
[0021] Figure 4 It is a structural block diagram of a multi-task model training device in another embodiment;
[0022] Figure 5 The figure is a diagram of the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0024] In the multi-task model training method provided in the embodiment of the present application, in the process of fusing the model parameters of different task training to achieve model capability integration, the conflict problem between different task parameters has seriously hindered the scalability of the method. In view of this, the embodiment of the present application proposes a multi-task model training method for continuous learning of a large model based on multi-task knowledge neuron parameter grafting. This method performs redundancy removal, grafting and fusion operations on the model parameters obtained from single task learning. In this way, the model can continue to acquire the processing power of new tasks while maintaining the performance of old tasks, effectively improving the model's continuous learning and expansion capabilities in multi-task scenarios.
[0025] The above multi-task model training method can be applied to the following specific scenarios including but not limited to:
[0026] Natural Language Processing:
[0027] Machine translation scenario: Suppose there is a translation system that needs to complete translation tasks from multiple source languages (such as English, French, and German) to target languages (such as Chinese) at the same time. Using this multi-task model training method, each source language-target language translation task (single task) can be trained separately during the single-task model training phase. When each single-task model is trained, the model parameters determine the importance index based on the loss function of the corresponding translation task. For example, in the English-Chinese translation task, the parameter for vocabulary alignment may be very important, while in the French-Chinese translation task, the parameter for grammatical structure conversion is more critical. By fusing the parameters of these different single-task models, a multi-task model is obtained that can more effectively handle multiple language translation tasks and improve the accuracy and efficiency of translation.
[0028] Text classification scenario: If you want to classify news articles by topic (such as politics, economy, sports, etc.) and sentiment (positive, negative, neutral) at the same time. You can treat topic classification and sentiment classification as two single tasks, and determine the importance of each model parameter for each task during the single-task model training process. For example, for topic classification tasks, parameters related to industry keywords are of high importance; for sentiment classification tasks, parameters related to sentiment vocabulary are more important. The multi-task model obtained after parameter update, discarding, fusion, and other operations can complete two text classification tasks at the same time, providing a more comprehensive perspective for text analysis.
[0029] Computer Vision Field:
[0030] Target detection and image segmentation scenarios: In an autonomous driving system, the vehicle needs to perform target detection (identifying pedestrians, vehicles, traffic signs and other objects on the road) and image segmentation (distinguishing between different objects and backgrounds) at the same time. Use single-task models to train target detection and image segmentation separately to determine the importance of each model parameter. In the target detection task, parameters related to the positioning of the object bounding box are important; in the image segmentation task, parameters related to pixel classification are more critical. The fused multi-task model can better utilize the useful information in the two tasks, provide more accurate visual support for autonomous driving, and improve driving safety.
[0031] Face recognition and expression recognition scenarios: In security systems, face recognition (confirming the identity of a person) and expression recognition (judging the emotional state of a person) need to be performed simultaneously. When training a single-task model, for face recognition tasks, the importance of parameters such as facial feature point positioning will be highlighted; for expression recognition tasks, facial feature parameters related to muscle movement are more important. After being processed by this multi-task model training method, the resulting model can more efficiently perform face recognition and expression recognition tasks simultaneously in security scenarios, enhancing the functionality of the security system.
[0032] In an exemplary embodiment, Figure 1 As shown, a flow chart of a multi-task model training method is provided, and the method includes the following steps 101 to 104.
[0033] 101. In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function.
[0034] During the training process, the importance index corresponding to each model parameter is determined by calculating the cumulative contribution of each parameter change to the decrease in the value of the target loss function.
[0035] In an embodiment of the present application, the partial derivative of the target loss function with respect to the parameters can be used in combination with Taylor's first-order expansion to approximately calculate the update amount of the target loss function, and then the total contribution of the cumulative update amount of the parameters to the decrease in the loss function value during the entire training process can be obtained, which can be used as an importance indicator.
[0036] In some embodiments, the L1 regularization constraint term can be determined based on the initial model parameter set and the parameter set to be trained before single-task model training; then, the target loss function is constructed based on the L1 regularization constraint term and the original loss function of the single-task model, and then in the single-task model training process, the importance index corresponding to each model parameter is determined based on the model parameter set involved and the value of the target loss function.
[0037] Exemplarily, based on the initial model parameter set and the parameter set to be trained before the single-task model training, the L1 regularization constraint term is determined. Specifically, the model parameters before training can be recorded as , the parameters to be trained are recorded as , then the L1 regularization constraint of the determined model parameters can be expressed as the following formula (1):
[0038] (1)
[0039] Among them, the above L1 regularization constraint term can be used to maintain the sparsity of model parameter updates to alleviate the grafting conflicts between subsequent multi-task parameters.
[0040] After obtaining the above L1 regularization constraint, the above target loss function can be constructed based on the L1 regularization constraint and the original loss function of the single-task model. As one of the goals of model training, the target loss function aims to minimize the L1 norm of the model parameter change as much as possible, so that some model parameters Keep original value .
[0041] In the single-task model training process, the approximate update amount of the target loss function at each iteration step can be determined based on the model parameters and the target loss function at each iteration step. Represents the iteration step When the target loss function Parameters The partial derivative of can be expressed as the following formula (2):
[0042] (2)
[0043] When performing one iteration, the update amount of the objective loss function can be approximated by Taylor's first-order expansion as shown in the following formula (3):
[0044] (3)
[0045] Based on the approximate update amount of the target loss function in each iteration step, a loop is traversed and accumulated to obtain the cumulative decrease of the target loss function of each parameter during the training process. During the entire training process, after all parameters are updated for multiple steps, the cumulative decrease of the loss function can be approximated as shown in the following formula (4):
[0046]
[0047] (4)
[0048] in, The parameters obtained after the current task training is completed ,and Model parameters before training for this task .
[0049] Based on the cumulative decrease of the target loss function of each parameter in the training process, the partial derivative of the target loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step, the importance index corresponding to each model parameter is determined. Cumulative update volume Total contribution to the decrease in the loss function value, as an importance indicator , the importance index can be expressed as the following formula (5):
[0050] .
[0051] In the above embodiment, in the single-task training stage, the regularization constraint term of the model parameter is introduced into the original loss function to alleviate the grafting conflict between the subsequent multi-task parameters. In order to locate the knowledge neurons of the task, the cumulative contribution of the change amount of each model parameter to the decrease of the loss function value during the training process is used as the importance indicator of the cumulative update amount of the model parameter.
[0052] 102. Based on the importance index corresponding to each model parameter, a parameter update discarding operation is performed to obtain a parameter update result of the single-task model.
[0053] In some embodiments, importance indicators corresponding to various model parameters that are less than an importance threshold may be subjected to a parameter update discarding operation with a preset parameter update discarding probability to obtain a parameter update result of a single-task model;
[0054] Among them, the importance threshold is used to distinguish the importance of parameters for the current task.
[0055] In some embodiments, the importance indicators corresponding to the various model parameters can first be selected from the importance indicators that are less than the importance threshold, and a parameter update discarding operation can be performed with a preset parameter update discarding probability to obtain an initial update result of the single-task model; then, the initial update result of the single-task model can be scaled by a parameter update amount operation to obtain a parameter update result of the single-task model.
[0056] From the importance indicators corresponding to each model parameter, the importance indicators that are less than the importance threshold are discarded with the preset parameter update discard probability to obtain the initial update result of the single-task model. The product of the update amount and the parameter implements the discard operation.
[0057] Among them, the random mask Bernoulli sampling of all model parameters with probability p can be expressed as the following formula (6):
[0058] (6)
[0059] The above importance mask Mark the location of important parameters above the importance mask It can be expressed as the following formula (7):
[0060] (7)
[0061] and By performing an OR operation to ensure that important parameter updates are not discarded, the parameter update result after the parameter update discard operation can be obtained, which is the initial update result of the above single-task model, which can be expressed as the following formula (8):
[0062] (8)
[0063] In order to reduce the impact of parameter update discarding on the output result amplitude, the initial update result of the single-task model is scaled by the parameter update amount to obtain the parameter update result of the single-task model. Let q represent the proportion of important parameters to all parameters, then Represents the proportion of parameter updates that are finally retained. The final parameter update result can be expressed as the following formula (9):
[0064] (9)
[0065] The above formula (9) shows the parameter update result of the single-task model.
[0066] For example, Figure 2 This is a schematic diagram of the training process of a single-task model. Figure 2 As shown, the training process of the single-task model mainly includes but is not limited to three stages:
[0067] Stage 1: Apply sparse constraints. Figure 2 As shown in , in this stage, for any single-task model, the model parameters before training can be , supervised training is performed based on the above L1 regularization constraint to maintain the sparsity of model parameter updates and alleviate the grafting conflicts between subsequent multi-task parameters.
[0068] Stage 2: Knowledge neuron location. Figure 2 As shown, the model parameters obtained by training , through the gradient (objective loss function Parameters The partial derivative of ) and the parameter change (that is, the update amount of the above-mentioned objective loss function) are used to determine the above-mentioned importance indicators and locate the knowledge neurons.
[0069] Phase 3: Parameter update discard. Figure 2 As shown, in this stage, the parameter update and discarding operation can be performed based on the importance index, and then the discarding result can be scaled to finally obtain the parameter update result of the single-task model.
[0070] 103. Based on the parameter update results of each single-task model, model parameter fusion processing is performed to obtain a multi-task model.
[0071] In some embodiments, the important parameter update values of each single-task model can be determined based on the parameter update results of each single-task model and the importance indicators corresponding to each model parameter; the important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain the model parameter fusion result; based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
[0072] Based on the parameter update results of each single-task model and the importance index corresponding to each model parameter, the important parameter update values of each single-task model are determined. After the training of the current task t is completed, the parameters after multiple rounds of gradient update are obtained. , and the difference between it and the pre-trained model parameters before training is recorded as After the above parameter importance estimation and parameter update discarding operation, the sparse parameter update value is obtained. , which is the updated value of the knowledge neuron parameter of task t.
[0073] Based on the model parameter fusion result and the initial pre-trained model, the model parameters of the multi-task model are obtained. The model parameters of the multi-task model can be expressed as the following formula (10):
[0074] (10)
[0075] like Figure 3 The figure shows a schematic diagram of model splicing and fusion. Figure 3 In the above example, we can use the pre-trained model parameters , and the parameter update results of each single-task model are concatenated and fused to obtain a multi-task model.
[0076] The above method in the embodiment of the present application, in the process of multi-task model training, first introduces the regularization constraint term of the model parameters in the single-task training stage and adds the original loss function, so as to effectively alleviate the grafting conflicts between the subsequent multi-task parameters. Then, in order to accurately locate the knowledge neurons of the task, the cumulative contribution of the change amount of each parameter to the decrease in the loss function value during the training process is set as the importance index of the cumulative update amount of the parameter. Subsequently, by calculating the importance score of the model parameters to the task, the parameter update random discarding operation is carried out based on this, so as to further alleviate the conflict problem during the fusion of multi-task parameters. Finally, the knowledge neuron parameter update values corresponding to all tasks are grafted into the pre-trained model to obtain the model parameters that can finally be used for multiple tasks.
[0077] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0078] Based on the same inventive concept, the embodiment of the present application also provides a multi-task model training device for implementing the multi-task model training method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more multi-task model training device embodiments provided below can refer to the limitations of the multi-task model training method above, and will not be repeated here.
[0079] In an exemplary embodiment, Figure 4 As shown, a structural block diagram of a multi-task model training device is provided, including:
[0080] The indicator determination module 401 is used to determine the importance indicator corresponding to each model parameter according to the model parameter set involved and the value of the target loss function in the single-task model training process;
[0081] A parameter updating and discarding module 402 is used to perform a parameter updating and discarding operation based on the importance index corresponding to each model parameter to obtain a parameter updating result of the single-task model;
[0082] The fusion processing module 403 is used to perform model parameter fusion processing based on the parameter update results of each single-task model to obtain a multi-task model.
[0083] In some embodiments, the indicator determination module 401 is further used to:
[0084] Determining an L1 regularization constraint term based on an initial model parameter set and a parameter set to be trained before training the single-task model;
[0085] The target loss function is constructed according to the L1 regularization constraint term and the original loss function of the single-task model.
[0086] In some embodiments, the indicator determination module 401 is specifically used to:
[0087] In the single-task model training process, according to the model parameters of each iteration step and the target loss function, an approximate update amount of the target loss function at each iteration step is determined;
[0088] Based on the approximate update amount of the objective loss function in each iteration step, loop traversal and accumulation are performed to obtain the cumulative decrease amount of the objective loss function of each parameter in the training process;
[0089] The importance index corresponding to each model parameter is determined based on the cumulative decrease of the objective loss function of each parameter in the training process, the partial derivative of the objective loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step.
[0090] In some embodiments, the parameter update discarding module 402 is specifically used to: perform a parameter update discarding operation based on the importance indicators corresponding to each model parameter to obtain the parameter update result of the single-task model; from the importance indicators corresponding to each model parameter, perform a parameter update discarding operation on the importance indicators that are less than the importance threshold with a preset parameter update discarding probability to obtain the parameter update result of the single-task model;
[0091] The importance threshold is used to distinguish the importance of the parameter to the current task.
[0092] In some embodiments, the parameter update discarding module 402 is specifically used to: from the importance indicators corresponding to the various model parameters, the importance indicators that are less than the importance threshold are subjected to parameter update discarding operation with a preset parameter update discarding probability to obtain the initial update result of the single-task model;
[0093] A parameter update amount scaling operation is performed on the initial update result of the single-task model to obtain a parameter update result of the single-task model.
[0094] In some embodiments, the fusion processing module 403 is used to:
[0095] Determine the important parameter update value of each single task model based on the parameter update result of each single task model and the importance index corresponding to each model parameter;
[0096] The important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain a model parameter fusion result;
[0097] Based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
[0098] Each module in the above multi-task model training device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0099] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 5 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. Among them, the processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a multi-task model training method is implemented.
[0100] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0101] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0102] In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function;
[0103] Based on the importance index corresponding to each model parameter, a parameter update and discarding operation is performed to obtain a parameter update result of the single-task model;
[0104] Based on the parameter update results of each single-task model, model parameter fusion processing is performed to obtain a multi-task model.
[0105] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0106] In the single-task model training process, before determining the importance index corresponding to each model parameter according to the model parameter set involved and the value of the target loss function, determine the L1 regularization constraint term based on the initial model parameter set before the single-task model training and the parameter set to be trained;
[0107] The target loss function is constructed according to the L1 regularization constraint term and the original loss function of the single-task model.
[0108] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0109] In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function, including:
[0110] In the single-task model training process, according to the model parameters of each iteration step and the target loss function, an approximate update amount of the target loss function at each iteration step is determined;
[0111] Based on the approximate update amount of the objective loss function in each iteration step, loop traversal and accumulation are performed to obtain the cumulative decrease amount of the objective loss function of each parameter in the training process;
[0112] The importance index corresponding to each model parameter is determined based on the cumulative decrease of the objective loss function of each parameter in the training process, the partial derivative of the objective loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step.
[0113] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0114] The parameter updating and discarding operation is performed based on the importance index corresponding to each model parameter to obtain the parameter updating result of the single-task model, including:
[0115] From the importance indicators corresponding to the various model parameters, the importance indicators that are less than the importance threshold are subjected to parameter update discarding operation with a preset parameter update discarding probability to obtain the parameter update result of the single-task model;
[0116] The importance threshold is used to distinguish the importance of the parameter to the current task.
[0117] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0118] The importance indicators corresponding to the various model parameters are selected to perform a parameter update discarding operation on the importance indicators that are less than the importance threshold with a preset parameter update discarding probability to obtain a parameter update result of the single-task model, including:
[0119] The importance indicators corresponding to the various model parameters are selected to be smaller than the importance threshold, and the importance indicators are subjected to parameter update discarding operation with a preset parameter update discarding probability, so as to obtain the initial update result of the single-task model;
[0120] A parameter update amount scaling operation is performed on the initial update result of the single-task model to obtain a parameter update result of the single-task model.
[0121] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0122] The parameter updating results of each single-task model are used to perform model parameter fusion processing to generate a multi-task model, including:
[0123] Determine the important parameter update value of each single task model based on the parameter update result of each single task model and the importance index corresponding to each model parameter;
[0124] The important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain a model parameter fusion result;
[0125] Based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
[0126] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0127] In the single-task model training process, before determining the importance index corresponding to each model parameter according to the model parameter set involved and the value of the target loss function, determine the L1 regularization constraint term based on the initial model parameter set before the single-task model training and the parameter set to be trained;
[0128] The target loss function is constructed according to the L1 regularization constraint term and the original loss function of the single-task model.
[0129] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0130] In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function, including:
[0131] In the single-task model training process, according to the model parameters of each iteration step and the target loss function, an approximate update amount of the target loss function at each iteration step is determined;
[0132] Based on the approximate update amount of the objective loss function in each iteration step, loop traversal and accumulation are performed to obtain the cumulative decrease amount of the objective loss function of each parameter in the training process;
[0133] The importance index corresponding to each model parameter is determined based on the cumulative decrease of the objective loss function of each parameter in the training process, the partial derivative of the objective loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step.
[0134] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0135] The parameter updating and discarding operation is performed based on the importance index corresponding to each model parameter to obtain the parameter updating result of the single-task model, including:
[0136] From the importance indicators corresponding to the various model parameters, the importance indicators that are less than the importance threshold are subjected to parameter update discarding operation with a preset parameter update discarding probability to obtain the parameter update result of the single-task model;
[0137] The importance threshold is used to distinguish the importance of the parameter to the current task.
[0138] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0139] The importance indicators corresponding to the various model parameters are selected to perform a parameter update discarding operation on the importance indicators that are less than the importance threshold with a preset parameter update discarding probability to obtain a parameter update result of the single-task model, including:
[0140] The importance indicators corresponding to the various model parameters are selected to be smaller than the importance threshold, and the importance indicators are subjected to parameter update discarding operation with a preset parameter update discarding probability, so as to obtain the initial update result of the single-task model;
[0141] A parameter update amount scaling operation is performed on the initial update result of the single-task model to obtain a parameter update result of the single-task model.
[0142] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0143] The parameter updating results of each single-task model are used to perform model parameter fusion processing to generate a multi-task model, including:
[0144] Determine the important parameter update value of each single task model based on the parameter update result of each single task model and the importance index corresponding to each model parameter;
[0145] The important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain a model parameter fusion result;
[0146] Based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
[0147] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0148] In the single-task model training process, before determining the importance index corresponding to each model parameter according to the model parameter set involved and the value of the target loss function, determine the L1 regularization constraint term based on the initial model parameter set before the single-task model training and the parameter set to be trained;
[0149] The target loss function is constructed according to the L1 regularization constraint term and the original loss function of the single-task model.
[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0151] In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function, including:
[0152] In the single-task model training process, according to the model parameters of each iteration step and the target loss function, an approximate update amount of the target loss function at each iteration step is determined;
[0153] Based on the approximate update amount of the objective loss function in each iteration step, loop traversal and accumulation are performed to obtain the cumulative decrease amount of the objective loss function of each parameter in the training process;
[0154] The importance index corresponding to each model parameter is determined based on the cumulative decrease of the objective loss function of each parameter in the training process, the partial derivative of the objective loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step.
[0155] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0156] The parameter updating and discarding operation is performed based on the importance index corresponding to each model parameter to obtain the parameter updating result of the single-task model, including:
[0157] From the importance indicators corresponding to the various model parameters, the importance indicators that are less than the importance threshold are subjected to parameter update discarding operation with a preset parameter update discarding probability to obtain the parameter update result of the single-task model;
[0158] The importance threshold is used to distinguish the importance of the parameter to the current task.
[0159] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0160] The importance indicators corresponding to the various model parameters are selected to perform a parameter update discarding operation on the importance indicators that are less than the importance threshold with a preset parameter update discarding probability to obtain a parameter update result of the single-task model, including:
[0161] The importance indicators corresponding to the various model parameters are selected to be smaller than the importance threshold, and the importance indicators are subjected to parameter update discarding operation with a preset parameter update discarding probability, so as to obtain the initial update result of the single-task model;
[0162] A parameter update amount scaling operation is performed on the initial update result of the single-task model to obtain a parameter update result of the single-task model.
[0163] In one embodiment, when the processor executes the computer program, the following steps are also implemented:
[0164] The parameter updating results of each single-task model are used to perform model parameter fusion processing to generate a multi-task model, including:
[0165] Determine the important parameter update value of each single task model based on the parameter update result of each single task model and the importance index corresponding to each model parameter;
[0166] The important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain a model parameter fusion result;
[0167] Based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
[0168] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0169] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0170] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A multi-task model training method, characterized in that: The method comprises: In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function; Based on the importance index corresponding to each model parameter, a parameter update and discarding operation is performed to obtain a parameter update result of the single-task model; Based on the parameter update results of each single-task model, model parameter fusion processing is performed to obtain a multi-task model.
2. The method according to claim 1, characterized in that In the single-task model training process, before determining the importance index corresponding to each model parameter according to the model parameter set involved and the value of the target loss function, the method further includes: Determining an L1 regularization constraint term based on an initial model parameter set and a parameter set to be trained before training the single-task model; The target loss function is constructed according to the L1 regularization constraint term and the original loss function of the single-task model.
3. The method according to claim 1, characterized in that In the single-task model training process, the importance index corresponding to each model parameter is determined according to the model parameter set involved and the value of the target loss function, including: In the single-task model training process, according to the model parameters of each iteration step and the target loss function, an approximate update amount of the target loss function at each iteration step is determined; Based on the approximate update amount of the objective loss function in each iteration step, loop traversal and accumulation are performed to obtain the cumulative decrease amount of the objective loss function of each parameter in the training process; The importance index corresponding to each model parameter is determined based on the cumulative decrease of the objective loss function of each parameter in the training process, the partial derivative of the objective loss function with respect to each model parameter at each iteration step, and the change of each model parameter in each iteration step.
4. The method according to claim 1, characterized in that: The parameter updating and discarding operation is performed based on the importance index corresponding to each model parameter to obtain the parameter updating result of the single-task model, including: From the importance indicators corresponding to the various model parameters, the importance indicators that are less than the importance threshold are subjected to parameter update discarding operation with a preset parameter update discarding probability to obtain the parameter update result of the single-task model; The importance threshold is used to distinguish the importance of the parameter to the current task.
5. The method according to claim 4, characterized in that The importance indicators corresponding to the various model parameters are selected to perform a parameter update discard operation on the importance indicators that are less than an importance threshold with a preset parameter update discard probability to obtain a parameter update result of the single-task model, including: The importance indicators corresponding to the various model parameters are selected to be smaller than the importance threshold, and the importance indicators are subjected to parameter update discarding operation with a preset parameter update discarding probability, so as to obtain the initial update result of the single-task model; A parameter update amount scaling operation is performed on the initial update result of the single-task model to obtain a parameter update result of the single-task model.
6. The method according to claim 5, characterized in that The parameter updating results of each single-task model are used to perform model parameter fusion processing to generate a multi-task model, including: Determine the important parameter update values of each single-task model based on the parameter update results of each single-task model and the importance index corresponding to each model parameter; The important parameter update values of each single-task model are weighted and summed according to the fusion coefficient to obtain a model parameter fusion result; Based on the model parameter fusion result and the initial pre-trained model, a multi-task model is obtained.
7. A multi-task model training device, characterized in that: The device comprises: The indicator determination module is used to determine the importance indicator corresponding to each model parameter according to the model parameter set involved and the value of the target loss function in the single-task model training process; A parameter update discarding module, used to perform a parameter update discarding operation based on the importance index corresponding to each model parameter to obtain a parameter update result of the single-task model; The fusion processing module is used to perform model parameter fusion processing based on the parameter update results of each single-task model to obtain a multi-task model.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.