Training method and device of multitask model
By employing a multi-task model training method, gradient vector mapping and weighting are used to eliminate gradient conflicts, optimize multi-task prediction performance, solve the problem of negative transfer in existing technologies, and improve user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ALIPAY (HANGZHOU) INFORMATION TECH CO LTD
- Filing Date
- 2022-08-12
- Publication Date
- 2026-05-08
AI Technical Summary
Existing multi-task prediction methods have limited effectiveness and are insufficient to meet the higher requirements of practical applications, and there is a negative transfer problem between different prediction tasks.
A multi-task model training method is adopted, which combines the backbone network and the head network, uses gradient vector mapping to subspace, determines weights and performs weighted processing, eliminates gradient conflicts, updates only the shared parameters, and avoids negative transfer.
The performance of multiple prediction tasks has been optimized, negative migration between different prediction tasks has been avoided, and the user experience has been improved.
Smart Images

Figure CN115345296B_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of machine learning technology, and more particularly to a training method and apparatus for a multi-task model. Background Technology
[0002] With social development and technological advancements, an increasing number of service platforms are offering users a wide variety of services to meet their diverse needs in work and life. To achieve personalized experiences, these platforms employ machine learning techniques to predict various aspects of user behavior, such as whether a user will like, save, or share an article. Multitask learning, a machine learning approach based on shared representation, combines multiple related tasks for learning, enabling the sharing of training data between different tasks. Therefore, this paper proposes constructing a multitask model for multitask prediction tailored to users.
[0003] However, current multi-task prediction methods have limited predictive performance and struggle to meet the higher demands of real-world applications. Therefore, a solution is needed to optimize multi-task prediction performance for users, thereby effectively improving the user experience. Summary of the Invention
[0004] This specification describes a training method and apparatus for a multi-task model, which can avoid negative transfer between different prediction tasks and thus simultaneously optimize the performance of multiple prediction tasks.
[0005] According to a first aspect, a training method for a multi-task model is provided. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine user representations, and the k head networks are used to perform k user prediction tasks based on the user representations. The method includes: determining k sets of original gradient vectors for the k user prediction tasks on the backbone network based on m user samples, wherein each user sample includes user features and k user labels corresponding to the k user prediction tasks; mapping the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors; determining r weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace, and using the r weights to weight the r dimensional components of each mapped gradient vector to obtain k sets of weighted gradient vectors; mapping the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors; and updating the network parameters of the backbone network using the k sets of processed gradient vectors.
[0006] In one embodiment, determining k sets of original gradient vectors for the k user prediction tasks on the backbone network based on m user samples includes: determining k original gradient vectors for the k user prediction tasks on the backbone network based on each user sample; and determining the k sets of original gradient vectors based on the k original gradient vectors.
[0007] In a specific embodiment, based on each user sample, k original gradient vectors for the k user prediction tasks are determined for the backbone network; user features from each user sample are input into the multi-task model to obtain k prediction results; based on the k prediction results and the corresponding k user category labels, k training losses for the k user prediction tasks are determined; based on the k training losses and the network parameters of the k head networks, the k original gradient vectors are determined.
[0008] In a specific embodiment, determining the k groups of original gradient vectors based on the k original gradient vectors includes: assigning the k original gradient vectors to the k groups of original gradient vectors; wherein each group of original gradient vectors determined includes m original gradient vectors corresponding to the m user samples.
[0009] In a specific embodiment, determining the k sets of original gradient vectors based on the k original gradient vectors includes: for each user prediction task, calculating the average gradient vector based on the m original gradient vectors corresponding to the task determined from the m user samples, and using it as a set of original gradient vectors corresponding to the task.
[0010] In one embodiment, mapping the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors includes: generating a set of orthogonal bases based on the k sets of original gradient vectors to form the subspace; and determining the coordinate values of the k sets of original gradient vectors on the set of orthogonal bases to form the k sets of mapped gradient vectors.
[0011] In a specific embodiment, an orthogonal basis is generated based on the k sets of original gradient vectors, including: performing singular value decomposition (SVD) on the matrix formed by the k sets of original gradient vectors, and using the multiple non-zero row vectors included in the right singular matrix obtained by decomposition as the orthogonal basis.
[0012] In one embodiment, determining the corresponding r weights based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace includes: for each spatial dimension, determining the weights corresponding to that spatial dimension based on the number of positive and negative signs of multiple components of the k sets of mapping gradient vectors in that dimension.
[0013] In a specific embodiment, the weight corresponding to the spatial dimension is determined based on the number of positive and negative signs of the multiple sub-vectors of the k sets of mapping gradient vectors in that dimension, including: setting the weight to 1 if the number of positive signs is 0 or the number of negative signs is 0, otherwise setting it to 0; or, calculating the absolute difference between the number of positive signs and the number of negative signs, and using the ratio between the absolute difference and the number of components of the multiple components as the weight.
[0014] In one embodiment, updating the network parameters of the backbone network using the k sets of processed gradient vectors includes: calculating an average gradient vector based on the k sets of processed gradient vectors; and updating the current network parameters of the backbone network to the difference between the preset learning rate and the product of the average gradient vector.
[0015] In one embodiment, the k user prediction tasks include user click-through rate prediction and user conversion rate prediction.
[0016] According to the second aspect, another training method for a multi-task model is provided. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine object representations for business objects, and the k head networks are used to perform k object prediction tasks based on the object representations. The method includes: determining k sets of original gradient vectors for the k object prediction tasks on the backbone network based on m object samples, wherein each object sample includes object features and k object labels corresponding to the k object prediction tasks; mapping the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors; determining r weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace, and using the r weights to weight the r dimensional components of each mapped gradient vector to obtain k sets of weighted gradient vectors; mapping the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors; and updating the network parameters of the backbone network using the k sets of processed gradient vectors.
[0017] According to a third aspect, a training apparatus for a multi-task model is provided. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine user representations, and the k head networks are used to perform k user prediction tasks based on the user representations. The apparatus includes: a raw gradient determination unit configured to determine k sets of raw gradient vectors for the k user prediction tasks on the backbone network based on m user samples, wherein each user sample includes user features and k user labels corresponding to the k user prediction tasks; and a first gradient mapping unit configured to map the k sets of raw gradient vectors to their respective bases. In a subspace of the original space, k sets of mapped gradient vectors are obtained; a dimension weight determination unit is configured to determine r weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace; a gradient weighting unit is configured to use the r weights to weight the r dimensional components of each mapped gradient vector to obtain k sets of weighted gradient vectors; a second gradient mapping unit is configured to map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors; and a parameter update unit is configured to use the k sets of processed gradient vectors to update the network parameters of the backbone network.
[0018] According to the fourth aspect, a training device for a multi-task model is provided. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine object representations for business objects, and the k head networks are used to perform k object prediction tasks based on the object representations. The device includes: a raw gradient determination unit configured to determine k sets of raw gradient vectors for the k object prediction tasks on the backbone network based on m object samples, wherein each object sample includes object features and k object labels corresponding to the k object prediction tasks; and a first gradient mapping unit configured to map the k sets of raw gradient vectors. The system first determines k sets of mapped gradient vectors in the subspace of the original space. A dimension weight determination unit is configured to determine r corresponding weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace. A gradient weighting unit is configured to use the r weights to weight the r dimensional components of each mapped gradient vector, obtaining k sets of weighted gradient vectors. A second gradient mapping unit is configured to map the k sets of weighted gradient vectors back to the original space, obtaining k sets of processed gradient vectors. A parameter update unit is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
[0019] According to a fifth aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of the first or second aspect.
[0020] According to a sixth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of the first aspect or the second aspect.
[0021] Using the methods and apparatus provided in the embodiments of this specification, in each training round, the original gradient of the training loss of different prediction tasks on the shared parameters of the multi-task model is strengthened for the part that has a positive effect on all prediction tasks, while weakening or omitting the part that conflicts in different prediction tasks. Then, the shared parameters are updated using the corresponding processed gradient, thereby avoiding negative transfer between different prediction tasks and thus optimizing the performance of multiple prediction tasks at the same time. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A schematic diagram illustrating the basic structure of a multi-task learning model is shown.
[0024] Figure 2 This diagram illustrates an implementation architecture of a training scheme for a multi-task model according to one embodiment.
[0025] Figure 3 A schematic diagram illustrating a training method for a multi-task model according to one embodiment is shown.
[0026] Figure 4 A schematic diagram of a training method for a multi-task model according to another embodiment is shown;
[0027] Figure 5 A schematic diagram of a training device for a multi-task model according to one embodiment is shown.
[0028] Figure 6 A schematic diagram of a training device structure for a multi-task model according to another embodiment is shown. Detailed Implementation
[0029] The solution provided in this specification will now be described with reference to the accompanying drawings.
[0030] As mentioned earlier, multi-task learning is a machine learning approach that combines multiple related tasks for learning based on shared representations. For example, in recommendation platforms, the two user prediction tasks of Click-Through Rate (CTR) and Conversion Rate (CVR) are learned and predicted together.
[0031] Figure 1 This diagram illustrates the basic structure of the multi-task model, such as... Figure 1 As shown, the multi-task model includes a backbone network and multiple (denoted as k) head networks. For k user prediction tasks, the parameters in the backbone network are shared, while the network parameters in the k head networks are independent of each other. The i-th head network is used to execute the i-th user prediction task.
[0032] The training objective of a multi-task model is to minimize the sum of the k training losses corresponding to the k prediction tasks:
[0033] (1)
[0034] in, These represent the network parameters of the backbone network, also known as shared parameters. This represents the network parameters of the i-th head network. Let represent the training loss for the i-th prediction task.
[0035] As can be seen from formula (1), during the regular training process, each user prediction task competes to update the parameters of the backbone network. To minimize the loss for its own task, while the training loss for different tasks is based on shared parameters. The update direction is inconsistent, which leads to gradient conflict and negative transfer. That is, the performance of some tasks improves while the performance of others decreases.
[0036] Based on the above observations and analysis, the inventors propose a solution to resolve gradient conflicts, which can distinguish and eliminate conflicting gradients, thereby minimizing the negative gradients between different tasks and maximizing the benefits of all tasks. Figure 2 This diagram illustrates an implementation architecture diagram of a training scheme for a multi-task model according to one embodiment. Figure 2 As shown, for any user sample x, a multi-task model can be used to determine k training losses based on its output of k user predictions and their corresponding k user labels. Then, based on these k training losses, k original gradient vectors for the backbone network are determined, thereby transforming each original gradient vector... Decomposed into task-sharing parts Conflicting parts of the task The former has a positive effect on all tasks, while the latter conflicts with other tasks. Furthermore, only the gradient of the shared portion is used. This is used to update the model's parameters, thereby eliminating gradient conflicts and maximizing the benefits of all tasks.
[0037] The implementation steps of the above solution will be described in more detail below with reference to more embodiments. Figure 3 This diagram illustrates a training method flow for a multi-task model according to one embodiment, wherein the multi-task model includes... Figure 1 or Figure 2 The diagram shows the backbone network and k head networks. The execution entity of the method can be any device, platform, server, or device cluster with computing and processing capabilities. For example... Figure 3 As shown, the method includes the following steps:
[0038] Step S310: Based on m user samples, determine k sets of original gradient vectors for the backbone network for k user prediction tasks, where each user sample includes user features and k user labels corresponding to the k user prediction tasks; Step S320: Map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors; Step S330: Based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace, determine the corresponding r weights; Step S340: Use the r weights to weight the r dimensional components of each mapped gradient vector to obtain k sets of weighted gradient vectors; Step S350: Map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors; Step S360: Update the network parameters of the backbone network using the k sets of processed gradient vectors.
[0039] The steps above are explained in detail below:
[0040] First, in step S310, based on m user samples, determine k sets of original gradient vectors for the backbone network for k user prediction tasks.
[0041] To facilitate understanding, we will first introduce the k user prediction tasks and m user samples. Here, k is an integer greater than or equal to 2, and each user prediction task can be either a user classification task or a user regression task. Furthermore, there is a certain correlation between the k user prediction tasks, the specifics of which can be set by the staff. The m user samples are a batch of training samples used in this round of iterative training, where m is a positive integer. Each user sample's features include at least user features, and the design of the sample feature terms is adapted to the k user prediction tasks. In addition, each user sample also includes k user labels corresponding to the k user prediction tasks. These user labels can be classification labels (or discrete value labels) or regression labels (or continuous value labels).
[0042] According to one embodiment, the k user prediction tasks include sentiment prediction and user intent prediction for user sessions. For example, the user session can be a customer service scenario or a social networking scenario. In this case, user characteristics can include user session content, the time when the user session was sent, the IP address of the sending terminal, etc.; the k user tags can include sentiment category tags, such as angry, upset, happy, excited, indifferent, or neutral, and user intent tags, such as standard questions like "how to activate the payment function", "how to change the linked mobile phone number", "how to file a complaint", etc.
[0043] According to another embodiment, the k user prediction tasks include predicting whether a user will perform k preset behaviors on a target business object. In this case, user features may include user behavior characteristics related to historical objects, such as the time and location of historical behaviors. Additionally, sample features may include object features of the target business object. In one specific embodiment, the target business object is an advertisement, and the k preset behaviors include clicking and conversion. Further, user behavior features may include the historical time the user clicked on the advertisement, the browsing duration, and whether the user used the recommended products or services in the advertisement. Object features may include the advertisement format (e.g., video, image, text), advertisement content, and push method (e.g., system message or in-app message). In another specific embodiment, the target business object is a product, and the k preset behaviors include browsing product information, adding to cart, sharing, favorites, placing an order, and payment. Further, user behavior features may include historical objects on which the user has performed one of the k preset behaviors. Object features may include the product category, sales volume, place of origin, cost, selling price, and shelf life.
[0044] On the other hand, in the above embodiments, user characteristics may also include basic user attributes, such as gender, age, occupation, place of residence, and hobbies.
[0045] The above section first introduced the k prediction tasks and the m user samples.
[0046] Furthermore, in this step, based on each user sample among the m user samples, k original gradient vectors for the backbone network are determined for the k user prediction tasks.
[0047] Specifically, for each user sample, a multi-task model is used to process its sample features, resulting in k prediction results for the corresponding k prediction tasks. See also Figure 2 First, the backbone network is used to process sample features, or user samples x, to obtain user representation v. x Then, k head networks are used to process the user representation v respectively. x k prediction results were obtained. It should be noted that the multi-task model in the embodiments of this specification can adopt any existing structure. It is understood that regardless of the model structure used, the parameters of the backbone network are shared for the k user prediction tasks; furthermore, Figure 2 The diagram illustrates the backbone network outputting the same user representation v to k head networks. x In reality, the user representations output to the k head networks can be different. For example, when the model structure used is MOE (Mixture of Experts) or MMOE (Multi-gate Mixture-of-Experts), the backbone network includes a gating network, which may result in different user representations output to the k head networks.
[0048] After obtaining the above k prediction results, and combining them with the corresponding k user category labels, k training losses are determined for the corresponding k user prediction tasks. In other words, for any i-th user prediction task, the corresponding prediction results are used... and user category tags Determine the corresponding training loss. .
[0049] Then, based on the k training losses, k original gradient vectors can be determined. Specifically, based on any i-th training loss... , or simply as The i-th head network can be calculated sequentially using the backpropagation method. parameter gradient and backbone network parameter gradient , That is, the i-th original gradient vector.
[0050] Based on this, on the one hand, the i-th head network can be utilized. parameter gradient Update parameters See the following formula:
[0051] (2)
[0052] In equation (2), This represents the learning rate, a hyperparameter whose value can be manually set.
[0053] On the other hand, k sets of original gradient vectors can be determined using k original gradient vectors determined based on each user sample. In one embodiment, the original gradient vector corresponding to the i-th task among the k original gradient vectors can be assigned to the i-th set of original gradient vectors. Thus, k sets of original gradient vectors corresponding to the k prediction tasks can be obtained, and each set of original gradient vectors includes m original gradient vectors corresponding to m user samples. In another embodiment, for the m original gradient vectors corresponding to the i-th prediction task, an averaging operation can be performed on any number of the original gradient vectors, and one or more averaged gradient vectors obtained can be assigned to the i-th set of original gradient vectors. For example, the average vector of the m original gradient vectors corresponding to the i-th prediction task is used as the i-th set of original gradient vectors. In this case, the i-th set of original gradient vectors includes only one gradient vector.
[0054] It is important to understand that the number of user samples is m, and the number of original gradient vectors determined based on each user sample is k. That is, the total number of original gradient vectors is m*k. Let N be the total number of vectors included in the k sets of original gradient vectors. If N < m*k, the number of original gradient vectors is reduced, which can help reduce the amount of computation in subsequent calculations.
[0055] The above can be used to determine the backbone network based on m user samples. There are k sets of original gradient vectors, with the number of vectors in each set ranging from 1 to m. For simplicity and clarity, the k sets of original gradient vectors may be referred to as N original gradient vectors below.
[0056] Based on the above N original gradient vectors, steps S320 to S340 are executed to strengthen the positively affected portion and weaken or eliminate the negatively affected portion.
[0057] Specifically, in step S320, the N original gradient vectors are mapped to subspaces of their original spaces, resulting in N mapped gradient vectors. For a more intuitive description, the backbone network is... The number of parameters in the equation is denoted as D. Therefore, the original space containing the N original gradient vectors can be denoted as... .
[0058] In this step, we first determine the subspace that includes the above N original gradient vectors. , ,in It is understandable that there are multiple ways to determine the subspace. The right endpoint of the interval of values for r is N-1, and the left endpoint is the rank of the matrix M formed by concatenating the N original gradient vectors. It needs to be understood. The smaller the value of , the more beneficial it is for subsequent decomposition of gradient sharing and conflicting parts.
[0059] Specifically, an orthogonal basis can be generated based on the N original gradient vectors. , constitute subspace .in, Indicates the first There are orthogonal bases, and they are dimensional vector, It is an interval This is an abbreviation. In one embodiment, for the above matrix... Perform Singular Value Decomposition (SVD) to use the non-zero row vectors in the resulting right singular matrix as an orthogonal basis. In other embodiments, this can be achieved by manipulating the matrix. Perform Schmidt decomposition or randomized approximate matrix decomposition to obtain orthogonal basis. .
[0060] The subspace is determined above. Then, the N original gradient vectors are mapped to the subspace. This yields N mapped gradient vectors. Specifically, for each original gradient vector, its position on the orthogonal basis is determined. The coordinate values on the coordinate plane constitute the corresponding mapped gradient vector. For example, the mapped gradient vector can be obtained by calculating the following equation (3):
[0061] (3)
[0062] in, This represents the j-th original gradient vector among N original gradient vectors. ; Let the j-th mapping gradient vector be represented. ; For orthogonal basis The matrix formed by splicing together .
[0063] Thus, the original gradient vectors in the original space are... Mapping to subspace This can effectively improve the usability of subsequent gradient decomposition results, and the dimension of the vectors in the subspace S is reduced to r dimensions, which can effectively reduce the amount of subsequent computation.
[0064] The above shows the mapping to the subspace. N mapping gradient vectors ,in It is an interval This is an abbreviation for . Then, in step S330, based on the component distribution of the N mapped gradient vectors in the r spatial dimensions of the subspace, the r weights corresponding to the r spatial dimensions are determined. It can be understood that the mapped gradient vector is an r-dimensional vector, and its i-th vector element is its component in the i-th spatial dimension.
[0065] It's important to note that for any two mapped gradient vectors, if both components in the j-th spatial dimension are either positive or both are negative, it indicates that the gradient's effect is consistent in that direction. This means that for N mapped gradient vectors with N components in the j-th spatial dimension, the more components with the same sign, the smaller the gradient conflict in that dimension. If all N components have the same sign (either all positive or all negative), it means that all N components in that direction have a positive effect on the K prediction tasks. Typically, the N mapped gradient vectors are the k mapped gradient vectors corresponding to k user prediction tasks. In this case, for the k components of the k mapped gradient vectors in the j-th spatial dimension, the more components with the same sign, the smaller the gradient conflict between different tasks in that dimension. If all k components have the same sign, it means that the update direction of the shared parameters by the k tasks in that dimension is consistent.
[0066] Based on this, in one embodiment, for each of the r spatial dimensions, the weight corresponding to that dimension can be determined based on the number of positive and negative signs of the N components of the N mapped gradient vectors in that dimension. Further, in a specific embodiment, if the number of positive signs or negative signs in the aforementioned number of positive and negative signs is 0, the weight of that dimension is set to 1; otherwise, it is set to 0. That is, the gradient in that dimension is only used for parameter updates if all components of the mapped gradient vectors in that dimension are either positive or negative; otherwise, it is discarded. In another specific embodiment, the difference between the number of positive and negative signs in the aforementioned number of positive and negative signs can be calculated, and the ratio of the absolute value of this difference to the number of components is used as the weight corresponding to that dimension. In this way, reasonable weights can be assigned to the gradient components in that dimension.
[0067] In another embodiment, for each of the r spatial dimensions, a first sum of the N components of the N mapped gradient vectors in that dimension is determined, and a second sum of the absolute values of each of the N components is determined, thereby determining the ratio of the first sum to the second sum as the weight corresponding to that dimension.
[0068] From the above, we can obtain the r weights corresponding to the r spatial dimensions. Therefore, in step S340, the r weights are used to weight the r dimensional components of each of the N mapped gradient vectors, resulting in N weighted gradient vectors. For example, for each mapped gradient vector... A weight vector consisting of r weights can be used. Perform positional multiplication to obtain the corresponding weighted gradient vector. For this, please refer to the following formula (4):
[0069] (4)
[0070] Thus, N weighted gradient vectors can be obtained. Then, in step S350, the N weighted gradient vectors are mapped back to the original space to obtain N processed gradient vectors. It should be understood that the N weighted gradient vectors can be mapped back to the original space using a set of orthogonal bases constituting the subspace. For example, the processed gradient vectors can be obtained by calculating the following equation (5):
[0071] (5)
[0072] in, This represents the j-th gradient vector among N processing gradient vectors. ; This represents the j-th weighted gradient vector. ; For the above orthogonal basis The matrix formed by splicing together ; This indicates the transpose operation.
[0073] Thus, we can obtain N processed gradient vectors corresponding to the N original gradient vectors mentioned above. It can be understood that, compared with the original gradient vectors, the parts of the processed gradient vectors that have a positive effect on all prediction tasks are retained and enhanced, while the parts that conflict with different prediction tasks are weakened or removed.
[0074] Then, in step S360, the network parameters of the backbone network are updated using N processing gradient vectors. In one embodiment, the average gradient vector of the N processed gradient vectors is calculated first, and then the network parameters are... The updated value is the difference between the preset learning rate and the average gradient vector. In this way, updating the backbone network based on N processed gradient vectors can effectively improve the performance on all tasks.
[0075] To facilitate understanding, an execution example of the above method is presented below. In this example, in step S310, based on each user sample out of m user samples, k original gradient vectors for the backbone network are determined for each of the k user prediction tasks. This yields m*k original gradient vectors. Then, the average of the m original gradient vectors corresponding to each prediction task is calculated to obtain the corresponding task gradient vector. Therefore, k task gradient vectors corresponding to k prediction tasks can be obtained. Next, in step S320, the k task gradient vectors are mapped to subspaces of their original spaces, resulting in k mapped gradient vectors. Then, in step S330, for each of the r spatial dimensions of the subspace, the weights of that dimension are determined based on the k components of the k mapped gradient vectors in that dimension. Specifically, if all k components are non-positive or non-negative, meaning the k tasks have a consistent effect on the backbone network parameters in that dimension and there is no conflict, the weight value is 1; otherwise, a conflict is determined, and the weight value is 0. Thus, r weights are obtained, and the weight values are either 1 or 0. Next, in step S340, the r weights are used to weight the r dimensional components of each of the k mapped gradient vectors, resulting in k weighted gradient vectors. It should be understood that for each mapped gradient vector... By using weighted processing, the shared portion can be extracted; that is to say, The weighted gradient vector that does not conflict with other tasks The gradients were extracted. Then, in step S350, the k weighted gradient vectors were mapped back to the original space to obtain the k processed gradient vectors corresponding to the aforementioned k task gradient vectors. It is important to understand that for each task gradient vector... The processed gradient vector obtained in this step is its shared portion in the original space and does not conflict with other tasks; that is, The shared part It was extracted. Then, in step S360, the backbone network was updated using k processing gradient vectors. .
[0076] In this way, conflicting parts in the gradient vectors of the k tasks are completely removed, and only the shared parts are used to update the backbone network. This ensures that the updated backbone network has a positive effect on all tasks, thereby maximizing the benefits of all tasks. In other words, the propagation gradients of different user prediction tasks for the shared parameters of the model are first decomposed into shared and conflicting parts, and then the shared parts are used to update the shared parameters. This avoids negative transfer between user prediction tasks, thus achieving simultaneous optimization of the performance of multiple user prediction tasks.
[0077] It is important to understand that in the above example, the k task gradient vectors are equivalent to the k sets of original gradient vectors, and also to the N original gradient vectors; the k mapped gradient vectors are equivalent to the k sets of mapped gradient vectors, and also to the N mapped gradient vectors; the k weighted gradient vectors are equivalent to the k sets of weighted gradient vectors, and also to the N mapped gradient vectors; and the k processed gradient vectors are equivalent to the k sets of processed gradient vectors, and also to the N processed gradient vectors.
[0078] In summary, by adopting the training method of the multi-task model disclosed in the embodiments of this specification, in each round of training, the original gradient of the training loss of different user prediction tasks on the shared parameters of the multi-task model is strengthened for the parts that have a positive effect on all user prediction tasks, while weakening or omitting the parts that conflict in different user prediction tasks. Then, the shared parameters are updated using the corresponding processed gradients, thereby avoiding negative transfer between different user prediction tasks and thus simultaneously optimizing the performance of multiple user prediction tasks.
[0079] The above mainly introduces the training method for a multi-task model used to perform multiple user prediction tasks. In fact, this method can also be extended to scenarios that perform other prediction tasks. Figure 4 The diagram illustrates a training method flow for a multi-task model according to another embodiment, wherein the multi-task model includes a backbone network and k head networks. The backbone network is used to determine object representations for business objects, and the k head networks are used to perform k object prediction tasks based on the object representations.
[0080] In one embodiment, the business object is an event, such as a transaction event, an access event, a login event, etc. The k event prediction tasks may include risk prediction and intervention method prediction, etc. The event sample includes risk labels and intervention method labels, where the risk label is risky, no risk, or high risk, medium risk, low risk, etc., and the intervention method label may include requiring users to authenticate their identity, customer service personnel to dissuade via telephone, and terminating the event process, etc. The sample characteristics of the event sample may include the time of occurrence, the location of occurrence, the terminal device model, etc.
[0081] In another embodiment, the business object is a product, and the k product prediction tasks may include target audience prediction and sales prediction, etc.; the product sample includes target audience tags and sales tags, wherein the target audience tags are students, office workers, retirees, etc., and the sales tag can be the sales value; the sample characteristics of the product sample may include category, place of origin, shelf life, cost, manufacturer, etc.
[0082] The above provides an introduction to business objects, object samples, and the k-item object prediction task.
[0083] like Figure 4 As shown, the method includes the following steps:
[0084] Step S410: Based on m object samples, determine k sets of original gradient vectors for the k object prediction tasks on the backbone network; wherein each object sample includes object features and k object labels corresponding to the k object prediction tasks; Step S420: Map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors; Step S430: Based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace, determine the corresponding r weights; Step S440: Use the r weights to weight the r dimensional components of each mapped gradient vector to obtain k sets of weighted gradient vectors; Step S450: Map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors; Step S460: Update the network parameters of the backbone network using the k sets of processed gradient vectors.
[0085] It needs to be explained that, for Figure 4 For a description of the method steps shown, please refer to the aforementioned section. Figure 3 The steps described in the Chinese method are not repeated here.
[0086] In summary, by adopting the training method of the multi-task model disclosed in the embodiments of this specification, in each round of training, the original gradient of the shared parameters of the multi-task model is used for the training loss of different prediction tasks. The part that has a positive effect on all prediction tasks is strengthened, while the part that conflicts in different prediction tasks is weakened or omitted. Then, the shared parameters are updated using the corresponding processed gradient, thereby avoiding negative transfer between different prediction tasks and thus optimizing the performance of multiple prediction tasks at the same time.
[0087] Corresponding to the training methods described above, this specification also discloses a training device. Figure 5 The diagram illustrates a training apparatus structure for a multi-task model according to one embodiment. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine user representations, and the k head networks are used to perform k user prediction tasks based on the user representations. Figure 5 As shown, the device 500 includes:
[0088] The original gradient determination unit 510 is configured to determine k sets of original gradient vectors for the k user prediction tasks on the backbone network based on m user samples; wherein each user sample includes user features and k user labels corresponding to the k user prediction tasks. The first gradient mapping unit 520 is configured to map the k sets of original gradient vectors to a subspace of their original space, obtaining k sets of mapped gradient vectors. The dimension weight determination unit 530 is configured to determine r corresponding weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace. The gradient weighting unit 540 is configured to use the r weights to weight the r dimensional components of each mapped gradient vector, obtaining k sets of weighted gradient vectors. The second gradient mapping unit 550 is configured to map the k sets of weighted gradient vectors back to the original space, obtaining k sets of processed gradient vectors. The parameter update unit 560 is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
[0089] In one embodiment, the original gradient determination unit 510 is specifically configured to: determine k original gradient vectors for the k user prediction tasks on the backbone network based on each user sample; and determine k sets of original gradient vectors based on the k original gradient vectors.
[0090] In a specific embodiment, the original gradient determination unit 510 is further configured to: input the user features in each user sample into the multi-task model to obtain k prediction results; determine k training losses corresponding to the k user prediction tasks based on the k prediction results and the corresponding k user category labels; and determine the k original gradient vectors based on the k training losses and the network parameters of the k head networks.
[0091] In another specific embodiment, the original gradient determination unit 510 is further configured to: assign the k original gradient vectors to the k groups of original gradient vectors; wherein, each group of original gradient vectors includes m original gradient vectors corresponding to the m user samples.
[0092] In another specific embodiment, the original gradient determination unit 510 is further configured to: for each user prediction task, calculate the average gradient vector based on the m original gradient vectors corresponding to the task determined by the m user samples, and use it as a set of original gradient vectors corresponding to the task.
[0093] In one embodiment, the first gradient mapping unit 520 is configured to: generate a set of orthogonal bases based on the k sets of original gradient vectors to form the subspace; and determine the coordinate values of the k sets of original gradient vectors on the set of orthogonal bases to form the k sets of mapped gradient vectors.
[0094] In a specific embodiment, the first gradient mapping unit 520 is further configured to: perform singular value decomposition (SVD) on the matrix composed of the k sets of original gradient vectors, and use the multiple non-zero row vectors included in the right singular matrix obtained by decomposition as the set of orthogonal bases.
[0095] In one embodiment, the dimension weight determination unit 530 is specifically configured to: for each spatial dimension, determine the weight corresponding to that spatial dimension based on the number of positive and negative signs of multiple components of the k sets of mapping gradient vectors in that dimension.
[0096] In one specific embodiment, the dimension weight determination unit 530 is further configured to set the weight to 1 if the number of positive signs or the number of negative signs in the number of positive and negative signs is 0, otherwise set it to 0.
[0097] In another specific embodiment, the dimension weight determination unit 530 is further configured to: calculate the absolute difference between the number of positive signs and the number of negative signs, and use the ratio between the absolute difference and the number of components of the plurality of components as the weight.
[0098] In one embodiment, the parameter update unit 560 is specifically configured to: calculate the average gradient vector based on the k groups of processed gradient vectors; and update the current network parameters of the backbone network to the difference between the preset learning rate and the product of the average gradient vector.
[0099] In one embodiment, the k user prediction tasks include user click-through rate prediction and user conversion rate prediction.
[0100] Figure 6 A schematic diagram of a training apparatus for a multi-task model according to another embodiment is shown. The multi-task model includes a backbone network and k head networks. The backbone network is used to determine object representations for business objects, and the k head networks are used to perform k object prediction tasks based on the object representations. Figure 6 As shown, the device 600 includes:
[0101] The original gradient determination unit 610 is configured to determine k sets of original gradient vectors for the k object prediction tasks on the backbone network based on m object samples; wherein each object sample includes object features and k object labels corresponding to the k object prediction tasks. The first gradient mapping unit 620 is configured to map the k sets of original gradient vectors to a subspace of their original space, obtaining k sets of mapped gradient vectors. The dimension weight determination unit 630 is configured to determine r corresponding weights based on the component distribution of the k sets of mapped gradient vectors in the r spatial dimensions of the subspace. The gradient weighting unit 640 is configured to use the r weights to weight the r dimensional components of each mapped gradient vector, obtaining k sets of weighted gradient vectors. The second gradient mapping unit 650 is configured to map the k sets of weighted gradient vectors back to the original space, obtaining k sets of processed gradient vectors. The parameter update unit 660 is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
[0102] In one embodiment, the original gradient determination unit 610 is specifically configured to: determine k original gradient vectors for the k object prediction tasks on the backbone network based on each object sample; and determine k sets of original gradient vectors based on the k original gradient vectors.
[0103] In a specific embodiment, the original gradient determination unit 610 is further configured to: input the object features in each object sample into the multi-task model to obtain k prediction results; determine k training losses corresponding to the k object prediction tasks based on the k prediction results and the corresponding k object category labels; and determine the k original gradient vectors based on the k training losses and the network parameters of the k head networks.
[0104] In another specific embodiment, the original gradient determination unit 610 is further configured to: assign the k original gradient vectors to the k groups of original gradient vectors; wherein, each group of original gradient vectors includes m original gradient vectors corresponding to the m object samples.
[0105] In another specific embodiment, the original gradient determination unit 610 is further configured to: for each object prediction task, calculate the average gradient vector based on the m original gradient vectors corresponding to the task determined by the m object samples, and use it as a set of original gradient vectors corresponding to the task.
[0106] In one embodiment, the first gradient mapping unit 620 is configured to: generate a set of orthogonal bases based on the k sets of original gradient vectors to form the subspace; and determine the coordinate values of the k sets of original gradient vectors on the set of orthogonal bases to form the k sets of mapped gradient vectors.
[0107] In a specific embodiment, the first gradient mapping unit 620 is further configured to: perform singular value decomposition (SVD) on the matrix composed of the k sets of original gradient vectors, and use the multiple non-zero row vectors included in the right singular matrix obtained by decomposition as the set of orthogonal bases.
[0108] In one embodiment, the dimension weight determination unit 630 is specifically configured to: for each spatial dimension, determine the weight corresponding to that spatial dimension based on the number of positive and negative signs of multiple components of the k sets of mapping gradient vectors in that dimension.
[0109] In a specific embodiment, the dimension weight determination unit 630 is further configured to set the weight to 1 if the number of positive signs or the number of negative signs in the number of positive and negative signs is 0, otherwise set it to 0.
[0110] In another specific embodiment, the dimension weight determination unit 630 is further configured to: calculate the absolute difference between the number of positive signs and the number of negative signs, and use the ratio between the absolute difference and the number of components of the plurality of components as the weight.
[0111] In one embodiment, the parameter update unit 660 is specifically configured to: calculate the average gradient vector based on the k groups of processed gradient vectors; and update the current network parameters of the backbone network to the difference between the preset learning rate and the product of the average gradient vector.
[0112] In one embodiment, the k-item object prediction task includes object click-through rate prediction and object conversion rate prediction.
[0113] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 3 or Figure 4 The method described.
[0114] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 3 or Figure 4 The methods described herein. Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.
[0115] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.
Claims
1. A training method for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine user representations, the k head networks being used to perform k user prediction tasks based on the user representations, the k user prediction tasks including predicting whether a user will perform k preset behaviors in response to a target advertisement, the k preset behaviors including clicks and conversions, the method comprising: Based on m user samples, determine k sets of original gradient vectors for the backbone network for the k user prediction tasks; Each user sample includes user features and k user tags corresponding to the k user prediction tasks, as well as the advertising features of the target advertisement. The advertising features include the advertisement format, which may include video, image, or text. The user features include user behavior characteristics in response to historical advertisements. The k sets of original gradient vectors are mapped to subspaces of their original spaces to obtain the k sets of mapped gradient vectors. Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, and the r weights are used to weight the r dimensional components of each mapping gradient vector to obtain the k sets of weighted gradient vectors. Mapping the k sets of weighted gradient vectors back to the original space yields the k sets of processed gradient vectors. The network parameters of the backbone network are updated using the k sets of processing gradient vectors.
2. The method according to claim 1, wherein, Based on m user samples, determine k sets of original gradient vectors for the k user prediction tasks on the backbone network, including: Based on the user samples, determine the k original gradient vectors of the k user prediction tasks for the backbone network; Based on the k original gradient vectors, the k sets of original gradient vectors are determined.
3. The method according to claim 2, wherein, Based on the user samples, determine the k original gradient vectors for the backbone network for the k user prediction tasks, including: The user features from each user sample are input into the multi-task model to obtain k prediction results; Based on the k prediction results and the corresponding k user category labels, determine the k training losses for the k user prediction tasks. Based on the k training losses and the network parameters of the k head networks, the k original gradient vectors are determined.
4. The method according to claim 2, wherein, Based on the k original gradient vectors, the k sets of original gradient vectors are determined, including: The k original gradient vectors are assigned to the k groups of original gradient vectors; wherein each group of original gradient vectors includes m original gradient vectors corresponding to the m user samples.
5. The method according to claim 2, wherein, Based on the k original gradient vectors, the k sets of original gradient vectors are determined, including: For each user prediction task, the average gradient vector is calculated based on the m original gradient vectors corresponding to the task determined from the m user samples, and this average gradient vector is used as a set of original gradient vectors corresponding to the task.
6. The method according to claim 1, wherein, Mapping the k sets of original gradient vectors to subspaces of their original spaces yields k sets of mapped gradient vectors, including: Based on the k sets of original gradient vectors, an orthogonal basis is generated to form the subspace; Determine the coordinate values of k sets of original gradient vectors on the set of orthogonal bases to form the k sets of mapped gradient vectors.
7. The method according to claim 6, wherein, Based on the k sets of original gradient vectors, an orthogonal basis is generated, including: Perform singular value decomposition (SVD) on the matrix formed by the k sets of original gradient vectors, and use the multiple non-zero row vectors included in the right singular matrix obtained by decomposition as the set of orthogonal bases.
8. The method according to claim 1, wherein, Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, including: For each spatial dimension, the weights corresponding to that spatial dimension are determined based on the number of positive and negative signs of multiple components of the k sets of mapping gradient vectors in that dimension.
9. The method according to claim 8, wherein, Based on the number of positive and negative signs of the multiple subvectors of the k sets of mapping gradient vectors in this dimension, the weights corresponding to this spatial dimension are determined, including: If the number of positive signs or the number of negative signs in the number of positive and negative signs is 0, the weight is set to 1; otherwise, it is set to 0; or, Calculate the absolute difference between the number of positive signs and the number of negative signs, and use the ratio between the absolute difference and the number of components of the plurality of components as the weight.
10. The method according to claim 1, wherein, Updating the network parameters of the backbone network using the k sets of processing gradient vectors includes: Based on the k groups of processed gradient vectors, calculate the average gradient vector; The current network parameters of the backbone network are updated to the difference between the preset learning rate and the product of the average gradient vector.
11. The method according to claim 1, wherein, The k user prediction tasks include user click-through rate prediction and user conversion rate prediction.
12. A training method for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine user representations, and the k head networks being used to perform k user prediction tasks based on the user representations, the k user prediction tasks including sentiment prediction and user intent prediction for a user session, the method comprising: Based on m user samples, determine k sets of original gradient vectors for the backbone network for the k user prediction tasks; Each user sample includes user features and k user tags corresponding to the k user prediction tasks; the user features include user conversation content, and the k user tags include sentiment category tags and user intent tags; The k sets of original gradient vectors are mapped to subspaces of their original spaces to obtain the k sets of mapped gradient vectors. Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, and the r weights are used to weight the r dimensional components of each mapping gradient vector to obtain the k sets of weighted gradient vectors. Mapping the k sets of weighted gradient vectors back to the original space yields the k sets of processed gradient vectors. The network parameters of the backbone network are updated using the k sets of processing gradient vectors.
13. A training method for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine an event representation for an event, and the k head networks being used to perform k event prediction tasks based on the event representation, the k event prediction tasks including risk prediction and intervention method prediction; The method includes: Based on m event samples, determine k sets of original gradient vectors for the backbone network for the k event prediction tasks; Each event sample includes event features and k event labels corresponding to the k event prediction tasks; the event features include at least one of the following: time of occurrence, location of occurrence, and terminal device model; the k event labels include risk labels and intervention method labels; The k sets of original gradient vectors are mapped to subspaces of their original spaces to obtain the k sets of mapped gradient vectors. Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, and the r weights are used to weight the r dimensional components of each mapping gradient vector to obtain the k sets of weighted gradient vectors. Mapping the k sets of weighted gradient vectors back to the original space yields the k sets of processed gradient vectors. The network parameters of the backbone network are updated using the k sets of processing gradient vectors.
14. A training method for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine product representations for a product, and the k head networks being used to perform k product prediction tasks based on the product representations, the k product prediction tasks including target audience prediction and sales volume prediction; the method comprising: Based on m product samples, determine k sets of original gradient vectors for the backbone network for the k product prediction tasks; Each product sample includes product features and k product tags corresponding to the k product prediction tasks; the product features include at least one of the following: category, place of origin, shelf life, cost, and manufacturer; the k product tags include target audience tags and sales volume tags. The k sets of original gradient vectors are mapped to subspaces of their original spaces to obtain the k sets of mapped gradient vectors. Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, and the r weights are used to weight the r dimensional components of each mapping gradient vector to obtain the k sets of weighted gradient vectors. Mapping the k sets of weighted gradient vectors back to the original space yields the k sets of processed gradient vectors. The network parameters of the backbone network are updated using the k sets of processing gradient vectors.
15. A training method for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine user representations, and the k head networks being used to perform k user prediction tasks based on the user representations, the k user prediction tasks including predicting whether a user will perform k preset behaviors on a target product, the k preset behaviors including at least two of the following: browsing product information, adding to cart, sharing, favorite, placing an order, and paying, the method comprising: Based on m user samples, determine k sets of original gradient vectors for the backbone network for the k user prediction tasks; Each user sample includes user features and k user tags corresponding to the k user prediction tasks, as well as product features of the target product; the user features include user behavior features for historical products; the product features include at least one of the following: category, sales volume, place of origin, cost, selling price, and shelf life of the target product; The k sets of original gradient vectors are mapped to subspaces of their original spaces to obtain the k sets of mapped gradient vectors. Based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, the corresponding r weights are determined, and the r weights are used to weight the r dimensional components of each mapping gradient vector to obtain the k sets of weighted gradient vectors. Mapping the k sets of weighted gradient vectors back to the original space yields the k sets of processed gradient vectors. The network parameters of the backbone network are updated using the k sets of processing gradient vectors.
16. A training apparatus for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine user representations, the k head networks being used to perform k user prediction tasks based on the user representations, the k user prediction tasks including predicting whether a user will perform k preset behaviors in response to a target advertisement, the k preset behaviors including clicking and converting, the apparatus comprising: The original gradient determination unit is configured to determine k sets of original gradient vectors for the backbone network based on m user samples for the k user prediction tasks; wherein each user sample includes user features and k user labels corresponding to the k user prediction tasks, as well as the advertising features of the target advertisement, wherein the advertising features include the advertisement format, which may include video, image or text; and the user features include user behavior features in response to historical advertisements. The first gradient mapping unit is configured to map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors. The dimension weight determination unit is configured to determine the corresponding r weights based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace. The gradient weighting unit is configured to use the r weights to weight the r dimensional components of each mapped gradient vector respectively, so as to obtain k sets of weighted gradient vectors. The second gradient mapping unit is configured to map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors. The parameter update unit is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
17. A training apparatus for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine user representations, and the k head networks being used to perform k user prediction tasks based on the user representations, the k user prediction tasks including sentiment prediction and user intent prediction for a user session, the training apparatus comprising: The original gradient determination unit is configured to determine k sets of original gradient vectors for the backbone network based on m user samples for the k user prediction tasks; wherein each user sample includes user features and k user labels corresponding to the k user prediction tasks; the user features include user session content, and the k user labels include sentiment category labels and user intent labels; The first gradient mapping unit is configured to map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors. The dimension weight determination unit is configured to determine r weights based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace, and to use the r weights to weight the r dimensional components of each mapping gradient vector to obtain k sets of weighted gradient vectors. The second gradient mapping unit is configured as a gradient weighting unit, configured to map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors. The parameter update unit is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
18. A training device for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine an event representation for an event, and the k head networks being used to perform k event prediction tasks based on the event representation, the k event prediction tasks including risk prediction and intervention method prediction; The device includes: The original gradient determination unit is configured to determine k sets of original gradient vectors for the backbone network based on m event samples; wherein each event sample includes event features and k event labels corresponding to the k event prediction tasks; the event features include at least one of the following: occurrence time, occurrence location, and terminal device model; the k event labels include risk labels and intervention method labels; The first gradient mapping unit is configured to map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors. The dimension weight determination unit is configured to determine the corresponding r weights based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace. The gradient weighting unit is configured to use the r weights to weight the r dimensional components of each mapped gradient vector respectively, so as to obtain k sets of weighted gradient vectors. The second gradient mapping unit is configured to map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors. The parameter update unit is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
19. A training device for a multi-task model, the multi-task model comprising a backbone network and k head networks, the backbone network being used to determine a product representation for a product, and the k head networks being used to perform k product prediction tasks based on the product representation, the k product prediction tasks including risk prediction and intervention method prediction; The device includes: The original gradient determination unit is configured to determine k sets of original gradient vectors for the backbone network based on m product samples for the k product prediction tasks; wherein each product sample includes product features and k product labels corresponding to the k product prediction tasks; the product features include at least one of the following: category, place of origin, shelf life, cost, and manufacturer; and the k product labels include target audience labels and sales volume labels. The first gradient mapping unit is configured to map the k sets of original gradient vectors to a subspace of their original space to obtain k sets of mapped gradient vectors. The dimension weight determination unit is configured to determine the corresponding r weights based on the component distribution of the k sets of mapping gradient vectors in the r spatial dimensions of the subspace. The gradient weighting unit is configured to use the r weights to weight the r dimensional components of each mapped gradient vector respectively, so as to obtain k sets of weighted gradient vectors. The second gradient mapping unit is configured to map the k sets of weighted gradient vectors back to the original space to obtain k sets of processed gradient vectors. The parameter update unit is configured to update the network parameters of the backbone network using the k sets of processed gradient vectors.
20. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed in the computer, it causes the computer to perform the method according to any one of claims 1-15.
21. A computing device comprising a memory and a processor, wherein, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-15.
Citation Information
Patent Citations
Multi-task model training method and device and electronic equipment
CN112561077A
Network training method and device, image processing method and device, equipment and storage medium
CN113159275A