A gradient conflict resolution and parameter generation method and device in multi-task learning, electronic equipment and storage medium

By generating task-specific low-rank adapter matrices and correcting gradient projections, the problem of shared parameter instability caused by gradient conflicts in multi-task learning models is solved, improving the stability of model training and task adaptability, and reducing parameter storage overhead.

CN122797670BActive Publication Date: 2026-11-06JIANGSU PRODUCTIVITY PROMOTION CENT
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202611241021.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-17
Publication Date
2026-11-06
Estimated Expiration
2046-08-17

AI Technical Summary

Technical Problem

In existing multi-task learning models, inconsistent gradient directions among tasks lead to unstable updates of shared parameters, negative transfer occurs in some tasks, and training convergence speed is reduced. Existing methods struggle to adjust task-specific parameters in real time to adapt to gradient conflict states.

Method used

By generating task-specific low-rank adapter matrices during training iterations, modulating the basic embedding using task gradient vector similarity, dynamically adjusting task adaptation parameters, and combining gradient projection correction, a continuous multi-task model training closed loop is formed, reducing interference between tasks.

Benefits of technology

It improves the stability and task adaptability of multi-task model training, reduces parameter storage overhead, and improves the convergence speed and performance of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122797670B_ABST
    Figure CN122797670B_ABST
Patent Text Reader

Abstract

The application discloses a gradient conflict resolution and parameter generation method and device in multitask learning, electronic equipment and a storage medium, the method modulates the basic embedding according to the task conflict metric value determined in the last training iteration and generates the task-specific low-rank adaptive parameter of the current training iteration, and calculates each task loss and gradient based on the adaptive parameter; the conflict metric value used for the next training iteration is determined according to the current task gradient, and the weighted projection correction is performed on the task gradient meeting the conflict condition; the conflict-aware task embedding is input into the super-network parameter generation module, the task-specific low-rank adapter matrix is generated and combined with the shared parameter; the weighted projection correction is performed on the conflict gradient according to the similarity relationship between the basic embedding vectors, and the shared parameter is updated with the corrected gradient. The application can dynamically perceive the task gradient conflict state, reduce the negative transfer in multitask training, improve the model training stability, and reduce the storage overhead of the task-specific parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence and computer model training technology, specifically relating to a method, apparatus, electronic device and storage medium for gradient conflict resolution and parameter generation in multi-task learning. Background Technology

[0002] Multi-task learning refers to a model training method that uses the same neural network model to simultaneously complete multiple related learning tasks. Existing multi-task learning models typically include a shared parameter network and task prediction heads corresponding to different tasks. The shared parameter network is used to extract feature representations from the input data that can be used by multiple tasks, and each task prediction head outputs the prediction result for its corresponding task based on the feature representations. By reusing shared parameters and intermediate features among multiple tasks, multi-task learning can reduce the number of model parameters and redundant computations, and can improve the model's overall processing capability by utilizing the correlation information between different tasks.

[0003] However, during the joint training of multi-task learning models, each task backpropagates the shared parameters according to its corresponding loss function, and the gradient directions generated by different tasks may be inconsistent. When the gradient vectors of two tasks are opposite in direction or have a large angle, the parameter update component generated by one task may cancel out the parameter update component generated by the other task, making it difficult for the shared parameters to adapt to multiple tasks simultaneously. This can lead to negative transfer problems such as model training oscillations, reduced convergence speed, or performance degradation in some tasks. As the number of tasks increases, the gradient relationships between tasks become more complex, making it even more difficult to ensure that each task obtains an appropriate optimization direction using a training method that simply weights and sums the losses of each task.

[0004] Patent CN113420787A discloses a method, apparatus, and storage medium for mitigating task conflicts in multi-task learning. The method acquires the gradient values ​​of each learning task in a multi-task learning model, and determines one by one whether a task conflict exists between the selected learning task and the other learning tasks. When a task conflict is determined, the gradient value of the selected learning task is pruned, and the gradient value update for each learning task is repeated. Subsequently, the average value of the updated gradient values ​​for each task is calculated, and the network parameters of the multi-task learning model are updated based on the obtained average gradient. This scheme can reduce the interference of conflicting gradients on the update of shared parameters without directly adjusting the loss weights of each task.

[0005] However, the aforementioned existing technologies primarily prune conflicting gradients during the gradient update phase. The results are only used for updating shared network parameters in the current training iteration, without generating task-specific parameters tailored to different tasks based on changes in gradient conflict states during training. Since multiple tasks still mainly rely on the same set of shared network parameters for feature processing, when strong conflicts exist between tasks over a long period, simply pruning gradients may delete or weaken some of the effective optimization components needed by each task, making it difficult to provide differentiated feature transformation capabilities for different tasks at the parameter structure level.

[0006] Furthermore, existing gradient pruning methods typically determine whether to perform gradient correction based on whether conflicts occur between current task gradients. They fail to further encode task gradient conflict states into dynamic task information that characterizes task relationships, nor do they utilize this dynamic task information to control the generation of task-specific parameters. For gradient conflict relationships that continuously change during training, existing methods struggle to simultaneously address both gradient update direction and task parameter adaptation.

[0007] Another way to improve the adaptability of multi-task models is to set task-specific parameters or low-rank adaptation parameters in a shared parameter network, enabling different tasks to form differentiated parameter transformations on top of shared basic parameters. While this approach reduces the parameter storage overhead of configuring a complete network for each task, its task-specific parameters are usually determined by pre-set task identifiers, fixed task embeddings, or independently learnable parameters. The parameter generation process lacks a direct link to the task gradient conflict states generated in real-time during training. Therefore, when the conflict relationships between tasks change with the training phase, training samples, or network layers, the generated task-specific parameters cannot be adjusted accordingly to the current conflict state.

[0008] Therefore, existing multi-task learning techniques struggle to establish a unified training mechanism for real-time detection of task gradient conflict states, dynamic generation of task-specific parameters, and adaptive correction of conflict gradients. This often leads to problems such as unstable shared parameter updates, insufficient task-specific adaptation capabilities, and difficulty in sustaining negative transference. How to dynamically generate task representations reflecting task conflict relationships based on the gradient conflict states of shared parameters for each task, and thereby generate task-specific low-rank adaptation parameters and determine the correction method for conflict gradients, thus improving the training stability and adaptability of multi-task models while controlling parameter storage overhead, has become a technical problem that needs further resolution in this field. Summary of the Invention

[0009] This invention aims to solve the problem that in the joint training process of existing multi-task learning models, the gradient directions generated by different tasks on shared parameters conflict with each other, resulting in unstable update direction of shared parameters, negative transfer of some tasks, and reduced training convergence speed.

[0010] This invention provides a method for gradient conflict resolution and parameter generation in multi-task learning, comprising the following steps:

[0011] At the start of the training iteration, based on the conflict metric values ​​of each task determined in the previous training iteration, the corresponding basic embedding vectors are modulated to obtain the conflict-aware task embedding for this training iteration. The conflict-aware task embedding is then input into the hypernetwork parameter generation module to generate a low-rank adapter matrix that matches the corresponding target shared parameter matrix. The low-rank adapter matrix is ​​then superimposed with the target shared parameter matrix to obtain the adaptation parameters specific to each task.

[0012] Forward propagation is performed based on the adaptation parameters specific to each task, and the loss function of each task and its gradient vector relative to the target shared parameter matrix are calculated.

[0013] The conflict metric of each task in this training iteration is determined based on the similarity between the gradient vectors of each task, and it is used as the basis for modulation of the basic embedding vector in the next training iteration.

[0014] Task gradient pairs whose gradient vector inner product is less than zero and whose square of the L2 norm of the projection reference gradient is not less than a preset threshold are identified as candidate projection gradient pairs. The projection correction weights are determined based on the similarity between the basic embedding vectors of the corresponding tasks. Weighted projection correction is performed on the candidate projection gradient pairs to obtain the corrected gradients for each task.

[0015] The shared parameter network is updated based on the corrected gradients for each task, and the parameters of the supernetwork parameter generation module, the basic embedding vector, and the task prediction head are updated based on the loss function for each task, before proceeding to the next training iteration.

[0016] By repeatedly executing the above steps, the task conflict state formed in the previous training iteration is used to adjust the task-specific adaptation parameters of the current training iteration, while the gradients of tasks that actually conflict in the current training iteration are differentiated and corrected, thereby forming a continuous multi-task model training closed loop.

[0017] Furthermore, the basic embedding vector is a vector set for each task and learned through training. The conflict metric of the task is input into the gating network to obtain the corresponding modulation intensity. Based on the modulation intensity and a preset positive modulation amplitude coefficient, the basic embedding vector of the task is scaled and modulated to obtain the corresponding conflict-aware task embedding.

[0018] Furthermore, the gated network uses a sigmoid function to limit the modulation intensity between 0 and 1, and the learnable weights of the gated network are constrained to positive values ​​so that when the conflict metric of the task decreases, the corresponding modulation intensity decreases and the scaling of the basic embedding vector increases.

[0019] Furthermore, the scaling and modulation of the basic embedding vector is used to change the magnitude of the conflict-aware task embedding, and the magnitude change is mapped to the change in the magnitude of the corresponding low-rank adapter parameter by the supernetwork parameter generation module; the directional relationship between different task embeddings is formed by the basic embedding vector during the training and updating process, and is used to determine the projection correction weights of the candidate projection gradient pairs.

[0020] Furthermore, the hypernetwork parameter generation module includes a first factor generation matrix and a second factor generation matrix corresponding to the target shared parameter matrix. The conflict-aware task of the task is embedded into the first factor generation matrix and the second factor generation matrix respectively to generate the left and right factors of the corresponding low-rank adapter matrix. The low-rank adapter matrix of the corresponding task is formed by the matrix product of the left and right factors.

[0021] Furthermore, when multiple target shared parameter matrices are set in the shared parameter network, factor generation matrices matching their row and column dimensions are configured for different target shared parameter matrices, and corresponding low-rank adapter matrices are generated respectively.

[0022] Further, the target shared parameter matrix is ​​at least one two-dimensional parameter matrix used to perform feature transformation in the shared parameter network. When the shared parameter network is a Transformer network, the target shared parameter matrix includes at least one of the following: query projection matrix, key projection matrix, value projection matrix, attention output projection matrix, feedforward network input projection matrix, and feedforward network output projection matrix. When the shared parameter network is a convolutional neural network, the target shared parameter matrix includes at least one of the following: parameter matrix formed by unfolding convolutional kernels, channel projection matrix, and fully connected parameter matrix.

[0023] Furthermore, the rank of the low-rank adapter matrix is ​​less than the number of rows and columns of the corresponding target shared parameter matrix to reduce the generation and storage of task-specific adaptation parameters. The rank of the low-rank adapter matrix and the modulation amplitude coefficient are both configurable parameters. The rank of the low-rank adapter matrix can be configured according to the statistical dispersion of the cosine similarity of the gradient vectors between each pair of tasks (e.g., the standard deviation or range of the cosine similarity between each task): when the statistical dispersion is high, indicating a large difference in semantics or optimization direction between tasks, a larger rank is configured to improve the expressive power of the low-rank adapter; when the statistical dispersion is low, indicating a strong correlation between tasks, a smaller rank is configured to further reduce the storage overhead of the adaptation parameters.

[0024] Furthermore, the multiple tasks can be multiple regression tasks executed based on the same shared feature representation, with each task prediction head outputting the prediction value of the corresponding task.

[0025] Furthermore, the multiple tasks may include at least two of semantic segmentation, depth estimation, and surface normal estimation performed based on the same image feature representation; the shared parameter network performs feature encoding on the input image data, and each task prediction head outputs the image processing result of the corresponding task based on the feature representation formed by the corresponding task-specific adaptation parameters.

[0026] The present invention also provides a gradient conflict resolution and parameter generation device in multi-task learning, including a gradient acquisition module, a task embedding modulation module, a hypernetwork parameter generation module, a gradient projection correction module, and a parameter update module;

[0027] The gradient acquisition module is used to calculate the gradient of the loss function of each task relative to the preset target shared parameters during the training iteration of the shared parameter network.

[0028] The task embedding modulation module is used to determine the conflict metric value of the current training iteration based on the similarity between the gradient vectors of each task, and to modulate the corresponding basic embedding vector based on the conflict metric value determined in the previous training iteration to generate the conflict-aware task embedding of the current training iteration. At the same time, the conflict metric value determined in the current training iteration is saved as the modulation basis for the next training iteration.

[0029] The hypernetwork parameter generation module is used to generate a low-rank adapter matrix specific to each task based on the conflict-aware task embedding, and superimpose it with the corresponding target shared parameter matrix to obtain task-specific adaptation parameters.

[0030] The gradient projection correction module is used to determine candidate projection gradient pairs based on the inner product between task gradient vectors and the square of the L2 norm of the projection reference gradient, determine projection correction weights based on the similarity between the basic embedding vectors of the corresponding tasks, and perform weighted projection correction on the candidate projection gradient pairs.

[0031] The parameter update module is used to update the shared parameter network according to the corrected gradient of each task, and to update the parameters of the supernetwork parameter generation module, the basic embedding vector and the task prediction head according to the loss function of each task.

[0032] The present invention also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, it implements the gradient conflict resolution and parameter generation method in the above-mentioned multi-task learning.

[0033] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the gradient conflict resolution and parameter generation method in the above-mentioned multi-task learning.

[0034] Compared with the prior art, the present invention has at least the following beneficial effects:

[0035] 1. This invention determines the task conflict state based on the similarity between the gradient vectors of each task, and uses the conflict state to scale and modulate the task base embedding, so that the magnitude of the conflict-aware task embedding changes with the gradient relationship during the training process; inputting the conflict-aware task embedding into the hypernetwork parameter generation module enables the change of the task embedding amplitude to be mapped to the change of the low-rank adapter parameter amplitude through the factor generation matrix. Under the premise that the basic direction of each task-specific low-rank adapter (determined by the basic embedding vector of each task) remains relatively stable, the amplitude intensity of the adaptation parameters of different tasks is dynamically adjusted according to the real-time conflict state, thereby reducing the direct interference of different tasks on the shared parameters.

[0036] 2. This invention uses low-rank factor combinations to form a task-specific adapter matrix. Compared with setting up a complete parameter network for each task, it can reduce the amount of task-specific parameters generated and stored. When adding a new task, the corresponding basic task can be embedded and the corresponding low-rank adaptation parameters can be generated by the super network, without having to set up a complete shared parameter network for the new task.

[0037] 3. This invention first uses the inner product of task gradient vectors to identify actual task pairs that have gradient conflicts, and then determines the projection correction weights of the corresponding task gradient pairs based on the task embedding direction relationship formed through training, thus avoiding projection on task pairs that do not have gradient conflicts; by setting the generation of task-specific low-rank parameters and conflict gradient projection correction in continuous training iterations, the task-specific adaptation parameters of the next training iteration are first adjusted using the gradient conflict state, and then differential correction is performed on the conflict gradients that have been identified in the current training iteration, thereby improving the stability of shared parameter updates;

[0038] 4. This invention can be applied to the joint training of multiple regression tasks, as well as to multi-task visual processing scenarios based on the same image feature representation, such as semantic segmentation, depth estimation, and surface normal estimation. It has good model structure adaptability and application versatility. Attached Figure Description

[0039] Figure 1 This is an overall flowchart of the gradient conflict resolution and parameter generation method in multi-task learning of the present invention;

[0040] Figure 2 This is a block diagram of the functional modules of the gradient conflict resolution and parameter generation device in multi-task learning of the present invention.

[0041] Figure 3 This is a performance comparison chart of the present invention with different multi-task learning methods;

[0042] Figure 4 This is a comparison chart of the task verification loss variation curves under different training rounds of the present invention;

[0043] Figure 5 This is a comparison chart of experimental results for the complete scheme of this invention and different ablation variants;

[0044] Figure 6 This is a comparison chart of the average performance improvement indicators of different multi-task learning methods of the present invention.

[0045] Figure 7 This is a comparison chart of ablation experiment results for the complete scheme under different gating methods of the present invention. Detailed Implementation

[0046] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. The application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0047] like Figure 1 As shown, this invention sequentially performs task gradient acquisition, gradient conflict measurement and dynamic task embedding modulation, dynamic generation of task-specific low-rank adapters by the supernetwork, weighted projection correction of conflicting task gradient pairs, and parameter updates during the training process of the shared parameter network. The task-specific low-rank adapter generated in the t-th training iteration is used in the t+1-th training iteration, and the updated shared parameters, supernetwork parameters, basic embedding vectors, and task prediction head parameters are used in subsequent training iterations.

[0048] The following uses a multi-dimensional assessment scenario of enterprise innovation capability as an example to describe the specific implementation of the present invention in detail. The method provided by the present invention is applicable to multi-task joint training scenarios of any shared parameter network. After reading the following embodiments, those skilled in the art can transfer and apply the technical solution of the present invention to other multi-task learning scenarios.

[0049] In the scenario of multi-dimensional assessment of enterprise innovation capabilities, the underlying feature representation of the same batch of enterprise samples needs to support the prediction of multiple sub-tasks, each sub-task corresponding to different dimensions of innovation capabilities.

[0050] This embodiment specifically sets up four sub-tasks:

[0051] Task 1 is the prediction of the R&D investment intensity subset, which is a regression task with a value range of 0 to 100.

[0052] Task 2 is the prediction of patent quality subsets, which is a regression task with values ​​ranging from 0 to 100.

[0053] Task 3 is the prediction of the efficiency of results transformation, which is a regression task with a value range of 0 to 100.

[0054] Task 4 is the prediction of the stability sub-component of the innovation team, which is a regression task with values ​​ranging from 0 to 100.

[0055] The four subtasks share the same 768-dimensional feature representation output by the same underlying feature encoder, and are respectively connected to four independent task prediction heads. Each prediction head is a two-layer fully connected network with a hidden layer dimension of 128 and an output layer dimension of 1.

[0056] In traditional joint training methods, the gradients of the loss functions of the four sub-tasks are prone to conflict on the shared encoder parameters. For example, the cosine similarity of the gradient directions of the R&D investment intensity of Task 1 and the results transformation efficiency of Task 3 is assumed to drop to around -0.35 in the early stage of training, indicating that the optimization directions of the two are opposite in some shared parameter dimensions. If no processing is done and joint training is carried out directly by loss summation, the validation set loss of Task 3 will rebound around the 40th round of training, i.e., negative transfer phenomenon.

[0057] The shared feature encoder uses a 6-layer Transformer structure with 768 hidden layers and 12 attention heads. The output layer does not perform pooling and directly takes the [CLS] position vector as the shared feature representation of the sample. That is, shared parameters These are all the learnable parameters of the Transformer encoder.

[0058] In the implementation of the preset target shared parameters, the target shared parameters are at least one two-dimensional parameter matrix used to perform feature transformation in the shared parameter network. The gradients corresponding to each target shared parameter matrix are flattened into one-dimensional gradient sub-vectors and concatenated according to the preset order of the target shared parameter matrices in the network to obtain the gradient vector of the corresponding task. For the Transformer network, the target shared parameters can be selected from the query projection matrix, key projection matrix, value projection matrix, attention output projection matrix, feedforward network input projection matrix, and feedforward network output projection matrix. For each selected target shared parameter matrix, a first factor generation matrix and a second factor generation matrix matching its row and column dimensions are set, and equations (4) to (6) are executed respectively; different network layers or different types of target shared parameter matrices generate corresponding low-rank adapter matrices. In the embodiment, the 768×768 low-rank adapter corresponds only to a target shared parameter matrix with a row and column dimension of 768, and does not represent the superposition of a single adapter matrix onto all learnable parameters of the Transformer encoder.

[0059] Task base embedded table This is a learnable parameter matrix, with four rows corresponding to the four subtasks mentioned above, and each row containing a 64-dimensional basic embedding vector. The initialization uses a standard normal distribution for random initialization.

[0060] The factor generation matrix of the hypernetwork parameter generation module is set as follows: , That is, the rank of the low-rank decomposition Therefore, each task has its own low-rank adapter matrix. The complete shape is ,Depend on left factor and right factor Multiply and restore. and All data were initialized using a truncated normal distribution with a mean of 0 and a standard deviation of 0.02. During training, the data was updated normally with the backpropagation of the loss function for each task, without additional freezing or the use of a special learning rate. and Essentially, it embeds a 64-dimensional task into a linear layer that maps to a low-rank factor. The parameter size is limited, and no obvious gradient vanishing or gradient explosion phenomena have been observed in practice. If necessary, it can be combined with conventional methods such as gradient clipping to further ensure training stability.

[0061] In the gradient conflict measurement module, the gated network is a single-layer fully connected network with an input dimension of 1, corresponding to the conflict measurement value calculated by equation (1). The output dimension is 1, the activation function is Sigmoid, and the weights and biases are learnable scalar parameters. The modulation amplitude coefficient is taken as 0.5 in this embodiment. During training, the learnable weights of the gated network are... The constraint is set to a positive value, and the modulation amplitude coefficient is set to... Setting it to a positive value ensures that as the conflict metric decreases, the modulation strength decreases accordingly, and the task embedding scaling increases accordingly. In this embodiment, the positive value constraint is specifically applied to an unconstrained learnable scalar. The softplus function transformation is implemented, that is, let This transformation outputs a value greater than zero for any real input and is differentiable everywhere with respect to ŵβ, facilitating joint updates during backpropagation. In other embodiments, the positive constraint can also be implemented after each parameter update. Non-negative truncation implementation.

[0062] In one embodiment, Figure 1 Steps S1 to S4 correspond to the following tasks: gradient acquisition, gradient conflict measurement and task embedding dynamic modulation, task-specific low-rank adapter generation, and gradient projection correction process.

[0063] Step S1: Task gradient acquisition;

[0064] In the At the start of the training iteration, read the... The conflict metrics of each task are saved in the training iteration; based on the conflict metrics and the current base embedding vector, gating network parameters, and hypernetwork parameters, the first task is generated. The conflict-aware task embedding and low-rank adapter matrix used in the training iteration; the first iteration is performed using the low-rank adapter matrix. The forward and backward propagation of each training iteration. The conflict metric obtained in the training iteration is saved and used as the first iteration. The adaptation parameters are generated at the start of the first training iteration; during this gradient acquisition process, the parameters are not updated, only the gradient vectors of the four tasks are recorded. The first training iteration uses an initial low-rank adapter matrix generated from the base embedding vectors, or sets the initial low-rank adapter matrix to zero. Therefore, the... The gradient of the training iteration is used to generate the first... The task-specific low-rank adapter used in each training iteration avoids calculating the gradients required for generation with the adapted parameters that have not yet been generated within the same training iteration.

[0065] The gradient vector is disconnected from the backpropagation computation graph of the current task loss before being input into the gating network and the supernetwork parameter generation module. It is used only as control information for conflict state calculation and the generation of adaptation parameters for the next training iteration, so that it is not required to continue to obtain higher-order gradients through the gradient vector calculation process.

[0066] To illustrate the calculation process of equations (1) to (3), assume that the gradient cosine similarity between task 1 and task 3 in a certain batch is . The gradient cosine similarity between Task 1 and Task 2 is The gradient cosine similarity between Task 1 and Task 4 is The gradient cosine similarity between Task 2 and Task 3 is The similarity of the remaining pairs is between to For example, there are obvious gradient conflicts between tasks 1 and 3, as well as between tasks 2 and 3, while tasks 1 and 2 have good coordination.

[0067] Step S2: Gradient conflict measurement and task embedding dynamic modulation;

[0068] Calculate the task according to the aforementioned formula (1). Conflict metrics Then, the modulation intensity is obtained sequentially through the aforementioned equations (2) and (3). Embedded with conflict-aware task .

[0069] (1);

[0070] In equation (1), Total number of tasks; For the index of the current task, To remove the task Indexes of other tasks besides; , Tasks ,Task The loss function is the gradient vector of the shared parameters of the target; cos(·,·) represents the cosine similarity between two gradient vectors; For the task Conflict metrics Smaller indicates a smaller task The higher the degree of conflict with the average gradient of the other tasks.

[0071] (2);

[0072] In equation (2), For the task The modulation intensity; For the Sigmoid function; , , respectively, are the learnable weights and learnable biases of the gating network, where wᵦ is constrained to a positive value during training to ensure a positive monotonic relationship between the conflict metric and the modulation intensity.

[0073] (3);

[0074] In equation (3), Embed the conflict-aware task for task k; The basic embedding vectors are pre-defined for task k and learned through training; The preset positive modulation amplitude coefficient; The smaller, Compared to The larger the scaling amplitude, the greater the scaling amplitude. The scaling modulation in Equation (3) is used to change the modulus of the task embedding and to change the amplitude of the low-rank adapter parameters through the factor generation process in Equations (4) to (6); the directional relationship between task embeddings is formed by the basic embedding vector during the training update process and is used to determine the projection weights of the confirmed conflicting task gradient pairs in Equation (7).

[0075] Substituting the above example data into equation (1) for calculation: Task 3 has negatively correlated gradients with both Tasks 1 and 2, and their conflict metric values ​​are... Substituting into equation (2), we get Substituting into equation (3), we get Conflict metrics for Task 1 Calculated , This example illustrates that tasks with a higher degree of conflict ( The smaller the value, the greater the amplification of its embedding vector, reflecting the "conflict perception" technical effect achieved by equations (2) and (3).

[0076] The low-rank adapter matrix specific to task k is generated according to the following formula:

[0077] (4);

[0078] (5);

[0079] In equations (4) and (5), , Tasks The corresponding left and right factors; , These are the learnable parameters of the two factor generation matrices, respectively; For the task Embedding of conflict-aware tasks; This indicates that the matrix product result is reconstructed into a low-rank factor shape that fits the target shared parameter matrix.

[0080] (6);

[0081] In equation (6), For the task A dedicated low-rank adapter matrix; when the dimension of the corresponding target shared parameter matrix is ​​m×n, The dimension is m×r, The dimension is r×n, where r is the rank of the low-rank adapter matrix and is less than the smaller of m and n.

[0082] Step S3: Dynamically generate a low-rank adapter specifically for the task in the hypernet;

[0083] The first Substituting the conflict-aware task embedding obtained from the training iterations into equations (4) and (5) above, we generate the left and right factors corresponding to the task. Substituting these factors into equation (6) yields the task-specific low-rank adapter matrix. The task-specific low-rank adapter matrix is ​​then superimposed with the corresponding target shared parameter matrix to form the first... The task-specific adaptation parameters used in the training iterations, and the prediction heads for each task in the __ training iterations. Prediction is performed based on the feature representation formed by the corresponding adaptation parameters in each training iteration.

[0084] In this step, for a target shared parameter matrix with dimensions of 768×768 and a low-rank decomposition rank of 8, the left and right factors generated by a single task contain a total of The low-rank adaptation factor generation results for the four tasks contain a total of 49,152 elements; if the corresponding full-rank 768×768 adaptation matrices are stored separately for each of the four tasks, the total number of elements is 2,359,296. Therefore, 49,152 represents the total number of low-rank adaptation factor elements for the four tasks, not the total number of newly learnable parameters for the supernetwork and all task modules. The number of learnable parameters for the supernetwork factor generation matrix, basic embedding table, gating network, and task prediction head are separately calculated based on the number of target shared parameter matrices, target matrix size, and task embedding dimension.

[0085] Before executing equation (7), calculate the task first. With the task The inner product of the gradient vectors, and the task is determined. Whether the squared norm of the gradient vector is not less than a preset gradient threshold. Only if the inner product is less than zero, and the task... When the square of the second norm of the gradient vector is not less than a preset gradient threshold, the task gradient pair is determined as a candidate projection gradient pair and included in the summation term of equation (7); for task pairs that do not meet the above conditions, the corresponding indicator function is zero and they do not participate in the projection calculation, so as to avoid projecting on task pairs that have not conflicted, and at the same time avoid the denominator being zero or too small. For candidate projection gradient pairs, weighted projection correction is performed according to the following formula: ;

[0086] In equation (7), For the task Corrected gradient; , Tasks ,Task The gradient vector; Tasks ,Task The basic embedding vector; Represents the cosine similarity between the basic embedding vectors of two tasks; This is an indicator function that takes the value 1 when the condition inside the parentheses is met, and 0 otherwise. Preset gradient threshold; For task k and task Projection correction weights between; This represents the inner product of two gradient vectors; Represents the gradient vector The square of the second norm; when When the value is not less than zero, the corresponding projection correction weight is zero; whether the task gradient pairs actually conflict is determined by the gradient vector inner product condition in the indicator function, rather than by the task embedding direction relationship.

[0087] Step S4: Soft-route gradient projection correction;

[0088] Weighted projection correction is performed on candidate projection gradient pairs that have met the preset conflict conditions according to the aforementioned equation (7). The cosine similarity of the basic embedding vectors in equation (7) is used to determine the projection correction weights of the candidate projection gradient pairs that have been confirmed by the indicator function. The determination of the actual conflict relationship is entirely determined by the gradient vector inner product and gradient norm conditions contained in the indicator function in equation (7), and is independent of the task embedding direction. The task embedding scaling formed by equations (1) to (3) is mainly adjusted by equations (4) to (6) to adjust the magnitude of the task-specific low-rank adaptation parameters. This scaling modulation does not change the direction of task embedding, so it does not affect the value of the projection correction weights in equation (7). The directional relationship of the basic embedding vectors used in equation (7) is gradually formed by the basic embedding vectors during the training process, and is independent of the conflict metric and modulation intensity of this training iteration.

[0089] The shared parameters are updated by summing the gradients corrected for each task, and the factor generation matrix, basic embedding vector, gating network, and prediction head parameters for each task are updated by normal backpropagation of the loss function for each task, thus completing the first step. The training iteration; the... The task-specific low-rank adapter generated in each training iteration is used in the (t+1)th training iteration.

[0090] Hardware platform: NVIDIA A100 GPU (80GB), Intel Xeon Gold 6330 processor, 256GB RAM; Software environment: Ubuntu 20.04, PyTorch 2.0.1, CUDA 11.8.

[0091] Dataset: A multi-dimensional evaluation dataset for enterprise innovation capabilities was constructed by collecting publicly available data from the credit information disclosure system, patent database, and enterprise annual reports. A total of 38,600 enterprise samples were collected. Each sample corresponds to labeled sub-scores for four sub-tasks. The sub-scores were generated by weighted fusion of industry expert scores and quantitative indicators and used as training and supervision signals. The training set, validation set, and test set were divided in an 8:1:1 ratio.

[0092] Training configuration: Batch size 128, optimizer AdamW, initial learning rate Cosine annealing scheduling, a total of 100 training rounds, and three independent repeated experiments with the average value taken.

[0093] In one embodiment, each comparison method is implemented based on the same shared feature encoder and task prediction head structure as the complete scheme of this invention. The enterprise innovation capability assessment scenario uses a 6-layer Transformer structure with 768 hidden dimensions and 12 attention heads. Each task prediction head is a two-layer fully connected network with a hidden layer dimension of 128. The NYUv2 scenario uses the encoder and task decoding head structure described in the corresponding embodiment. Except for the combination and correction methods of each task gradient, the dataset partitioning, batch size, optimizer, learning rate, training epochs, and random seed initialization conditions remain consistent across methods.

[0094] Joint training: Without employing any conflict resolution mechanism, the loss functions of the four tasks are directly added together with the same preset weights, and then backpropagation is performed to update the shared parameters. Where ℒ represents the total joint training loss corresponding to the current training batch; , , and These are the task losses corresponding to the sub-prediction of R&D investment intensity, patent quality, technology transfer efficiency, and innovation team stability, respectively. Each task loss is calculated from the deviation between the predicted value of the corresponding task prediction head and the true labeled value of the training samples. The loss weights for all four tasks are preset to 1, and these loss weights are not model parameters learned through training. When performing backpropagation on the total joint training loss, the gradients of each task loss relative to the shared parameters are directly added according to the linearity property of the problem.

[0095] PCGrad: Within each training batch, the task order is randomly shuffled, and the gradient of task k is compared with the gradients of the other tasks in the shuffled order one by one. If the dot product of the two is negative, that is, there is a gradient conflict, the gradient of task k is projected to the direction orthogonal to the gradient of the conflicting task. This method itself does not introduce any additional adjustable hyperparameters. This embodiment is implemented in accordance with the original literature without any modifications.

[0096] CAGrad: This method solves a constrained optimization problem on a simplex composed of task weights to obtain the common descent direction of the gradients for each task. The regularization coefficient c of this method does not have a uniform default value applicable to all task scenarios and needs to be determined based on the specific task scenario. In this embodiment, referring to the common reproducible values ​​of this method on public multi-task learning benchmark datasets such as NYUv2, the regularization coefficient c is set to 0.4. The number of gradient ascent iterations used to solve the above constrained optimization problem is the implementation parameter set by this embodiment for this scenario, and is not the fixed value specified in the original literature of this method.

[0097] PaLoRA: Generates a dedicated low-rank adapter for each task in the shared network, achieving task-specific parameter adaptation through parameterization of the task preference vector. In this embodiment, the specific values ​​of the task preference vector dimension, supernetwork structure, and rank of the low-rank adapter are implementation parameters set by this application to ensure a fair comparison with the complete solution of this invention, and are not the fixed default parameters specified in the original literature of this method. Specifically, the task preference vector dimension is set to 64, which is consistent with the basic embedding vector dimension of the solution of this invention. The supernetwork structure used to generate the low-rank adapter is the same as the supernetwork parameter generation module structure used in the solution of this invention, and the rank of the low-rank adapter is also set to 8. After the task preference vector is randomly initialized before the start of training, it is updated as an ordinary learnable parameter with backpropagation, without undergoing the dynamic modulation performed by the conflict-aware task embedding module in the solution of this invention. The gradients of each task are directly added together to update the shared parameters, without performing gradient projection correction.

[0098] HyperPALoRA: This method, based on PaLoRA, replaces the generation of task preference vectors with generation by an additional hypernetwork instead of directly learnable parameters;

[0099] In this embodiment, the specific values ​​of task embedding dimension, generating network structure, and the rank of the low-rank adapter are also implementation parameters set by this application to ensure fair comparison, and are not the fixed default parameters specified in the original literature of this method. Specifically, the task embedding dimension is set to 64, generated by a two-layer fully connected network with one-hot encoding of the task index as input and a hidden layer dimension of 32; the supernetwork structure and rank used to generate the low-rank adapter are set to rank 8, consistent with the scheme of this invention and the PaLoRA comparison method; the task embedding generation process does not receive real-time information on the conflict relationship between task gradients, but only relies on the task index itself. During training, the gradients of each task are directly added together to update the shared parameters, and gradient projection correction is not performed.

[0100] Each of the above comparison methods was independently repeated three times under the same random seed initialization conditions as the complete scheme of the present invention, and the average value was taken. The experimental conditions were completely consistent with the complete scheme of the present invention.

[0101] like Figure 3 As shown, Figure 3 The mean absolute error and negative transfer rate of different multi-task learning methods are compared, and the corresponding data are listed in Table 1.

[0102] Table 1 shows the comparison results of the average MAE and negative transfer rate of the complete scheme, existing gradient conflict resolution methods, and existing hypernetic task adaptation methods on the test set for four tasks. Among them, MAE is the mean absolute error, and the lower the value, the smaller the prediction error. In this embodiment, the round in which the validation loss of any task increases compared to the previous training round is recorded as the validation loss recovery round. The negative transfer rate is determined by the proportion of the validation loss recovery rounds of each task to the total number of rounds. The average value is taken after three independent experiments. The lower the negative transfer rate, the more stable the training process.

[0103] Table 1

[0104] method Task 1 MAE Task 2 MAE Task 3 MAE Task 4 MAE Average MAE Negative migration incidence Joint training (without processing) 6.82 5.94 8.71 6.15 6.91 34.0% PCGrad 6.15 5.72 7.02 5.88 6.19 18.5% CAGrad 6.03 5.65 6.85 5.79 6.08 16.2% PaLoRA (Static Task Preferences) 5.87 5.51 6.42 5.63 5.86 12.4% HyperPALoRA 5.79 5.48 6.31 5.60 5.80 11.1% Complete solution of the present invention 5.42 5.21 5.68 5.35 5.42 5.3%

[0105] The results show that, compared with Task 3, which has the most severe negative transfer, the MAE of the complete scheme of this invention is reduced from 8.71 at the joint training baseline to 5.68, a reduction of about 34.8%; compared with the currently published best method HyperPALoRA, the average MAE is reduced from 5.80 to 5.42, a reduction of about 6.6%, and the negative transfer rate is reduced from 11.1% to 5.3%, a reduction of about 52.3%.

[0106] like Figure 4 As shown, Figure 4 The changes in the verification loss of Task 3 under different training rounds were compared for joint training, PaLoRA, and the complete scheme of this invention. The corresponding data are listed in Table 2.

[0107] Table 2

[0108] round Joint training (without processing) PaLoRA Complete solution of the present invention 20 0.612 0.548 0.521 40 0.658 (rebound) 0.531 0.489 60 0.701 (rebound) 0.519 0.462 80 0.695 0.508 0.441 100 0.689 0.503 0.428

[0109] It is evident that the validation loss rebounds around round 40 during joint training, which is somewhat mitigated by the PaLoRA scheme. The validation loss of the complete scheme of this invention continues to decrease at the sampling points of rounds 20, 40, 60, 80, and 100 listed in Table 2, indicating that the training stability at the listed sampling rounds is superior to the comparative methods. This effect is jointly generated by the conflict state-driven task-specific parameter adaptation formed by equations (1) to (6) and the conflict gradient differential correction formed by equation (7).

[0110] In one embodiment, such as Figure 5 As shown, Figure 5 The complete scheme of the present invention and the ablation variants after removing different technical modules are compared, and the corresponding data are listed in Table 3.

[0111] To verify the independent contribution of each step, the following ablation variants were set up:

[0112] Variant 1: Remove conflict-aware modulation of equations (2) and (3), and fix the task embedding to the basic embedding, i.e. Only the hypernetic adapter generation and fixed intensity projection correction of equations (4)-(6) are retained;

[0113] Variant 2: Remove the soft-route gradient projection correction of equation (7), and only retain equations (2)-(6);

[0114] Variant 3: Remove the generation of the super network low-rank adapter in formulas (4)-(6), and only retain formulas (2), (3) and (7), sharing parameters without task-specific adaptation.

[0115] Table 3

[0116] plan Average MAE Negative migration incidence Total number of low-rank adaptation factor elements for the four tasks Complete solution 5.42 5.3% 49,152 Variant 1 (Conflict-Aware Modulation De-conflict) 5.71 9.8% 49,152 Variant 2 (Removal of gradient projection correction) 5.58 7.6% 49,152 Variant 3 (Removal of HyperNetwork Adapter) 6.02 13.1% 0 Joint training (without any modules) 6.91 34.0% 0

[0117] The ablation results show that removing conflict-aware modulation (Variant 1) increases the negative migration rate from 5.3% to 9.8%, indicating that the task embedding dynamic modulation mechanism implemented by equations (2) and (3) has an independent and significant contribution to suppressing negative migration, and cannot achieve the same effect as simply superimposing fixed intensity projection; removing gradient projection correction (Variant 2) results in relatively small performance loss, indicating that the hypernetic adapter can resolve most conflicts, and equation (7) plays an auxiliary role in resolving residual conflicts; removing the hypernetic adapter (Variant 3) results in the largest performance loss, indicating that the task-specific parameter adaptation implemented by equations (4)-(6) is the main contributing module for resolving conflicts. The three functions support each other and work together, and the absence of any one of them will lead to a significant decrease in technical effect.

[0118] To further illustrate the role of each technical module in the complete scheme, Table 3 compares the complete scheme, ablation variants with individual modules removed, and a joint training baseline without any modules. Table 3 shows that removing the conflict-aware modulation, gradient projection correction, or supernetwork low-rank adapter generation modules all resulted in varying degrees of increase in average MAE and negative transfer rate, indicating that each of the three modules contributes to the multi-task training results and collectively improves model performance in the complete scheme.

[0119] like Figure 7 As shown, Figure 7 The complete scheme using Sigmoid gating is compared with the variant scheme using unbounded linear mapping gating, and the corresponding data are listed in Table 4.

[0120] Furthermore, to verify the necessity of the specific structural design of the gated network using the Sigmoid activation function, this embodiment sets up a comparative variant based on the complete scheme: Variant 4, which replaces the gated function in equation (2) with a linear mapping without activation function constraints, i.e. ;

[0121] , The meaning is the same as that of equation (2), but it is no longer compressed to the (0,1) interval by the Sigmoid function. The remaining module structures (1), (3)-(7) remain unchanged. The training is completed and the results are statistically analyzed under the same experimental conditions, as shown in Table 4.

[0122] Table 4

[0123] As shown in Table 4, after replacing the Sigmoid gate with an unbounded linear mapping, the average MAE increased from 5.42 to 5.89, the negative transfer rate increased significantly from 5.3% to 15.7%, and the standard deviation of the validation loss increased from 0.008 to 0.043 in the later stages of training (rounds 80-100), indicating a significant decrease in training stability. At the same time, the range of modulation intensity values ​​during training was statistically analyzed, and it was found that in Variant 4, about 38.6% of the training batches had values ​​outside the range (some batches even had negative values), which caused the modulation coefficient in Equation (3) to be abnormally amplified or even reversed in sign, making the modulation direction embedded in the conflict perception task lose its physical interpretability.

[0124] The experimental results above demonstrate that the sigmoid activation function can be used to constrain the gated signal within a bounded interval; combined with the learnable weights of the gated network... The positive value constraint can reduce the modulation intensity when the conflict metric decreases, and increase the task embedding scaling amplitude of equation (3) accordingly, thereby maintaining the monotonic correspondence between the conflict metric and the adaptation parameter generation amplitude.

[0125] like Figure 6 As shown, Figure 6 The average performance improvement metrics of different multi-task learning methods on the NYUv2 dataset are compared, and the corresponding data are listed in Table 5.

[0126] To verify that the method of the present invention does not depend on specific business scenarios and has general multi-task learning technology effects, this embodiment is verified on the NYUv2 standard multi-task learning public dataset, which includes three sub-tasks: semantic segmentation, depth estimation, and surface normal estimation.

[0127] Network Structure and Parameter Configuration: The shared feature encoder uses a ResNet-50 backbone network combined with a feature pyramid structure. The input is an RGB image of size 288×384, and the encoder output is a feature map with a spatial resolution of 36×48 and a channel dimension of 256, i.e., shared parameters. These are all the learnable parameters of the encoder. The three tasks of semantic segmentation, depth estimation, and surface normal estimation are connected to independent decoding heads, all of which are 3-layer convolutional structures with a kernel size of 3×3 and channel dimensions of 256, 128, and 64 respectively. The semantic segmentation task outputs 13 channels, corresponding to the 13 semantic labels of the NYUv2 dataset, the depth estimation task outputs 1 channel, and the surface normal estimation task outputs 3 channels.

[0128] Task base embedded table The learnable parameter matrix has three rows corresponding to the three tasks mentioned above, and each row is a 64-dimensional basic embedding vector. The initialization method is the same as the aforementioned enterprise innovation capability assessment scenario example, using standard normal distribution random initialization.

[0129] The factor generation matrix of the hypernetwork parameter generation module is set as follows: , That is, the rank of the low-rank decomposition This value is higher than that in the enterprise assessment scenario example. The judgment that the semantic differences between tasks are greater is based on the following: the standard deviation or range of the cosine similarity of gradient vectors between each pair of tasks in this scenario can be used to measure this. The larger the standard deviation or range, the more dispersed the correlation between tasks and the higher the complexity. In this scenario, the three tasks of semantic segmentation, depth estimation, and surface normal estimation belong to different types of visual prediction tasks (pixel-level classification, continuous depth value regression, and unit direction vector regression). The differences in task nature among the three are usually greater than those among the four sub-tasks in the enterprise innovation capability assessment scenario, which belongs to the same scoring regression type. Based on this, it is judged that the complexity between tasks in this scenario is higher, and the expressive power of the low-rank adapter needs to be appropriately improved. The rank value is a configurable parameter that is adjusted according to the specific encoder structure and the statistical dispersion of the cosine similarity between the gradients of the tasks. Each task has its own low-rank adapter matrix. The complete shape is 256×256, which is restored by multiplying the left factor (256×16) and the right factor (16×256).

[0130] Gated network structure and modulation amplitude coefficients in the gradient conflict measurement module The method for determining the value is consistent with the aforementioned example of enterprise innovation capability assessment. In this embodiment, 0.5 is also used.

[0131] Training configuration: Batch size 16, optimizer AdamW, initial learning rate Cosine annealing scheduling was used, with a total of 200 training rounds. The training set and validation set were divided according to the official NYUv2 dataset, with 795 images in the training set and 654 images in the test set.

[0132] In this embodiment This is used to represent the average relative performance change of a multi-task model relative to individual training baselines for each task using the same backbone network and task decoder. During calculation, the relative rate of change of evaluation metrics for semantic segmentation, depth estimation, and surface normal estimation tasks relative to their corresponding single-task baselines is determined separately. For evaluation metrics where lower values ​​are better, the direction of the relative rate of change is reversed, and then the relative rates of change for the three tasks are averaged and converted to a percentage. The higher the value, the more significant the overall performance improvement of multi-task training compared to the single-task baseline.

[0133] The results are shown in Table 5:

[0134] Table 5

[0135] method ΔMTL(%) Joint training (without processing) -3.2 PCGrad 1.8 CAGrad 2.6 PaLoRA 3.4 Complete solution of the present invention 5.1

[0136] The results show that the complete solution of the present invention is applicable in this scenario. The index reached 5.1%, which is about 1.7 percentage points higher than the existing best comparison method PaLoRA (3.4%) and about 8.3 percentage points higher than the joint training without processing baseline (-3.2%). This verifies that the technical solution defined by equations (1)-(7) is also effective on the standard visual multi-task learning benchmark that is completely unrelated to the enterprise innovation capability assessment scenario, and has the general technical attribute that does not depend on specific business rules.

[0137] In one embodiment, such as Figure 2 As shown, this embodiment also provides a gradient conflict resolution and parameter generation device for multi-task learning, including a gradient acquisition module, a task embedding modulation module, a hypernetwork parameter generation module, a gradient projection correction module, and a parameter update module. Each module is configured according to... Figure 2 The data streams shown are sequentially coordinated, and the parameter update results are fed back to the next training iteration.

[0138] The gradient acquisition module receives the multi-task training input of the shared parameter network. During the training iteration of the shared parameter network, it calculates the gradient of the loss function of each task relative to the preset target shared parameters, obtains the gradient vector of each task, and transmits the gradient vector to the task embedding modulation module.

[0139] The task embedding modulation module determines the conflict metric of each task based on the similarity between the gradient vectors of each task, inputs the conflict metric into the gating network to obtain the modulation intensity, and modulates the basic embedding vector of the corresponding task according to the modulation intensity to generate the conflict-aware task embedding of each task.

[0140] The hypernetwork parameter generation module embeds the conflict-aware tasks of each task as input to the hypernetwork. It generates left and right factors using two factor generation matrices corresponding to the parameter matrices shared with each objective, and multiplies the left and right factors to obtain the task-specific low-rank adapter matrix. The task-specific low-rank adapter matrix generated in the training iteration is superimposed with the corresponding target shared parameter matrix to form the matrix for the training iteration. Each training iteration uses task-specific adaptation parameters.

[0141] The gradient projection correction module first determines whether the task gradient pairs meet the preset conflict conditions based on the inner product of the task gradient vectors and the square of the L2 norm of the projection reference gradient. Only for task gradient pairs whose inner product is less than zero and whose square of the L2 norm of the projection reference gradient is not less than a preset threshold, weighted projection correction is further performed according to the directional relationship between the basic embedding vectors in Equation (7). The parameter update module updates the shared parameters with the corrected task gradients. When updating the supernetwork parameter generation module, the gated network, the basic embedding vectors, and the task prediction head parameters, the shared parameters are frozen or the original gradients corresponding to the shared parameters are cleared, so that the shared parameters are updated only according to the corrected gradients. The supernetwork parameter generation module, the gated network, the basic embedding vectors, and the task prediction head parameters are updated with the loss functions of each task, and the update results are used for subsequent training iterations.

[0142] In one embodiment, this embodiment also provides an electronic device, the electronic device including a memory and a processor, wherein the memory stores a computer program. When the processor calls and executes the computer program, it sequentially completes... Figure 1 The steps shown include task gradient acquisition, conflict measurement and task embedding modulation, low-rank adapter generation, gradient projection correction, and parameter update. The electronic device can be a server, workstation, or computing node used for neural network training.

[0143] This embodiment also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the gradient conflict resolution and parameter generation method described above in multi-task learning. The computer-readable storage medium can be a magnetic storage medium, an optical storage medium, or a semiconductor storage medium.

[0144] In summary, this invention adjusts the scaling of task embedding based on the cosine similarity of gradients between tasks using equations (1) to (3), and maps the scaling to the magnitude change of task-specific low-rank adaptation parameters using equations (4) to (6). Simultaneously, after confirming the actual conflict between task gradient pairs through the inner product of gradient vectors, equation (7) is used to determine the projection correction weight based on the directional relationship of the basic embedding vectors formed during training. This process addresses the multi-task joint training process from two levels: parameter adaptation and gradient correction. It should be noted that the modulation mechanism implemented by equations (1) to (3) mainly changes the magnitude of task embedding and low-rank adaptation parameters. The directional relationship between task embedding and low-rank adapter is gradually formed by the basic embedding vectors during training. Functionally, they respectively play the roles of magnitude adjustment and directional differentiation, together constituting the parameter adaptation mechanism of this invention.

[0145] First, regarding task-specific adapter storage, for a 768×768 target shared parameter matrix with a rank of 8, the left and right low-rank factors of a single task contain a total of 12,288 elements, and the low-rank adaptation factor generation results of four tasks contain a total of 49,152 elements; storing the full-rank adaptation matrix separately for each of the four tasks would contain a total of 2,359,296 elements. This comparison reflects the element storage compression effect of low-rank adaptation factors relative to the full-rank task-specific adaptation matrix, excluding the learnable parameters of the supernetwork factor generation matrix, the basic embedding table, the gated network, and the task prediction head from being included in the 49,152 elements.

[0146] Second, regarding the stability of the training process, Table 2 shows that the joint training scheme experiences a rebound in the verification loss for Task 3 at sampling points 40 and 60, while the complete scheme of this invention shows a continuous decrease in verification loss at sampling points 20, 40, 60, 80, and 100 listed in Table 2. Table 4 shows that the complete scheme using Sigmoid gating and applying positive constraints to the gating weights has a lower standard deviation of verification loss and a lower modulation intensity out-of-bounds ratio compared to the unbounded linear mapping gating scheme. These results demonstrate that task-specific parameter adaptation and conflict gradient correction can jointly improve the stability of the training process.

[0147] Third, regarding parameter storage for task expansion, when adding a new task, a basic embedding vector can be added for that task, and the corresponding low-rank adaptation parameters can be generated from the existing supernetwork structure, without needing to reset the complete shared network for the new task; the storage capacity of the task's basic embedding and task-specific low-rank adaptation factors increases approximately linearly with the number of tasks. The pairwise conflict measurement between task gradients still requires task pair calculation, and this embodiment does not describe this computational overhead as increasing linearly with the number of tasks.

[0148] Fourth, as shown in Tables 3 and 4, the ablation experiments revealed that removing the conflict-aware modulation, gradient projection correction, or low-rank adapter generation module from the supernetwork all increased the average MAE and negative transfer rate to varying degrees. Replacing the Sigmoid gate with an unbounded linear mapping also decreased training stability. These results demonstrate that each technical module has its own function and can collectively improve multi-task training results in the complete scheme. They do not present the existing ablation data as the sole proof of the strictly mathematically nonlinear interaction effects between the three modules.

[0149] The above technical effects are illustrated by the comparative experiments and ablation experiments shown in Tables 1 to 5. The results of semantic segmentation, depth estimation and surface normal estimation on the NYUv2 standard multi-task learning dataset show that the method of the present invention can also obtain a positive ΔMTL index in image processing scenarios that are unrelated to enterprise evaluation business rules, indicating that the gradient conflict handling and low-rank parameter generation mechanism can be applied to technical data processing scenarios.

[0150] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various equivalent changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for gradient conflict resolution and parameter generation in multi-task learning, characterized in that, Includes the following steps: At the start of the training iteration, based on the conflict metric values ​​of each task determined in the previous training iteration, the corresponding basic embedding vectors are modulated to obtain the conflict-aware task embedding for this training iteration. The conflict-aware task embedding is then input into the hypernetwork parameter generation module to generate a low-rank adapter matrix that matches the corresponding target shared parameter matrix. The low-rank adapter matrix is ​​then superimposed with the target shared parameter matrix to obtain the adaptation parameters specific to each task. Forward propagation is performed based on the adaptation parameters specific to each task, and the loss function of each task and its gradient vector relative to the target shared parameter matrix are calculated. The conflict metric of each task in this training iteration is determined based on the similarity between the gradient vectors of each task, and it is used as the basis for modulation of the basic embedding vector in the next training iteration. Task gradient pairs whose gradient vector inner product is less than zero and whose square of the L2 norm of the projection reference gradient is not less than a preset threshold are identified as candidate projection gradient pairs. The projection correction weights are determined based on the similarity between the basic embedding vectors of the corresponding tasks. Weighted projection correction is performed on the candidate projection gradient pairs to obtain the corrected gradients for each task. The shared parameter network is updated based on the corrected gradients for each task, and the parameters of the supernetwork parameter generation module, the basic embedding vector, and the task prediction head are updated based on the loss function for each task, before proceeding to the next training iteration. The conflict metric and the conflict-aware task embedding are determined in the following manner: According to the task The cosine similarity between the gradient vector of task A and the gradient vectors of the other tasks is calculated. Conflict metrics: (1); in, Total number of tasks; For the index of the current task, To remove the task Indexes of other tasks besides; , Tasks ,Task The loss function is the gradient vector of the shared parameters of the target; cos(·,·) represents the cosine similarity between two gradient vectors; For the task Conflict metrics Smaller indicates a smaller task The higher the degree of conflict with the average gradient of other tasks; The conflict metric is input into the gating network to obtain the task. Modulation intensity: (2); in, For the task The modulation intensity; For the Sigmoid function; , These are the learnable weights and learnable biases of the gated network, respectively. The learnable weights are positive values, and the positive values ​​are obtained by applying an unconstrained learnable scalar. Obtained by performing the softplus function transformation, i.e. Or, after updating the parameters... Perform nonnegative truncation and hold; Based on the modulation intensity, the task The underlying embedding vector is scaled and modulated to obtain the task. Embedding of conflict-aware tasks: (3); in, For the task Embedding of conflict-aware tasks; For the task Pre-defined and learned base embedding vectors; The preset positive modulation amplitude coefficient; The smaller, Compared to The greater the modulation amplitude; The low-rank adapter matrix is ​​generated in the following manner: By embedding the conflict-aware task of task k into two factor generation matrices respectively, we obtain the left and right factors of the task-specific low-rank adapter matrix: (4); (5); in, , Tasks The corresponding left and right factors; , These are the learnable parameters of the two factor generation matrices, respectively; For the task Embedding of conflict-aware tasks; This indicates that the matrix product result is reconstructed into a low-rank factor shape that fits the target shared parameter matrix; Multiplying the left factor by the right factor yields the low-rank adapter matrix specific to task k: (6); in, For the task A dedicated low-rank adapter matrix; when the dimension of the corresponding target shared parameter matrix is ​​m×n, The dimension is m×r, The dimension is r×n, where r is the rank of the low-rank adapter matrix and is less than the smaller of m and n; Both the modulation amplitude coefficient and the rank of the low-rank adapter matrix are configurable parameters. The modulation amplitude coefficient is a positive value, and the rank of the low-rank adapter matrix is ​​configured according to the dimension of the target shared parameter matrix, the structure of the shared parameter network, or the complexity between multiple tasks. The complexity between multiple tasks is determined by the statistical dispersion of the cosine similarity of the gradient vectors between each pair of tasks. The higher the statistical dispersion, the larger the rank of the configured low-rank adapter matrix.

2. The gradient conflict resolution and parameter generation method in multi-task learning according to claim 1, characterized in that, For the task Calculate their gradient vectors respectively. Other tasks gradient vector The inner product; will satisfy ,and Gradient pairs whose L2 norm squared is not less than a preset gradient threshold are determined as candidate projected gradient pairs; According to the task and tasks The cosine similarity between the basic embedding vectors determines the projection correction weights, and the task is adjusted according to the following formula. Correct the gradient vector: (7); in, For the task Corrected gradient; , Tasks ,Task The gradient vector; Tasks ,Task The basic embedding vector; Represents the cosine similarity between the basic embedding vectors of two tasks; This is an indicator function that takes the value 1 when the condition inside the parentheses is met, and 0 otherwise. Preset gradient threshold; For task k and task Projection correction weights between; This represents the inner product of two gradient vectors; Represents the gradient vector The square of the second norm; when When the value is not less than zero, the corresponding projection correction weight is zero.

3. The gradient conflict resolution and parameter generation method in multi-task learning according to claim 1, characterized in that, The target shared parameter matrix is ​​at least one two-dimensional parameter matrix used to perform feature transformation in the shared parameter network; when the shared parameter network is a Transformer network, the target shared parameter matrix includes at least one of the following: query projection matrix, key projection matrix, value projection matrix, attention output projection matrix, feedforward network input projection matrix, and feedforward network output projection matrix; when the shared parameter network is a convolutional neural network, the target shared parameter matrix includes at least one of the following: parameter matrix formed by unfolding the convolutional kernel according to the output channel dimension and the input channel dimension, channel projection matrix, and fully connected parameter matrix.

4. The gradient conflict resolution and parameter generation method in multi-task learning according to claim 1, characterized in that, The multiple tasks include at least two of semantic segmentation, depth estimation, and surface normal estimation performed based on the same image feature representation; the shared parameter network is used to encode features of the input image data, and each task prediction head outputs the prediction result of the corresponding task based on the feature representation formed by the adaptation parameters specific to the corresponding task.

5. A gradient conflict resolution and parameter generation device for multi-task learning, characterized in that, As the operational carrier of the gradient conflict resolution and parameter generation method in multi-task learning according to any one of claims 1 to 4, it includes: a gradient acquisition module, used to calculate the gradient of the loss function of each task relative to the preset target shared parameters for multiple tasks during the training iteration of the shared parameter network; a task embedding modulation module, used to read the conflict metric value determined in the previous training iteration, generate the conflict-aware task embedding for the current training iteration based on the conflict metric value, and save the conflict metric value determined in the current training iteration as the modulation basis for the next training iteration; a supernetwork parameter generation module, used to generate a task-specific low-rank adapter matrix based on the conflict-aware task embedding, and superimpose it with the corresponding target shared parameter matrix to obtain task-specific adaptation parameters; a gradient projection correction module, used to perform weighted projection correction on the gradient pairs of tasks that meet the preset conflict conditions based on the similarity between the basic embedding vectors of each task; and a parameter update module, used to update the shared parameter network based on the corrected gradient, and update the parameters of the supernetwork parameter generation module, the basic embedding vector, and the task prediction head based on the loss function of each task.

6. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the gradient conflict resolution and parameter generation method in multi-task learning as described in any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the gradient conflict resolution and parameter generation method in multi-task learning as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and device for relieving task conflict in multi-task learning and storage medium

    CN113420787A

  • Multi-task-oriented variational self-encoding low-rank adapter optimization method

    CN121168578A

  • Multi-task learning framework training method and system of power system, electronic equipment and medium

    CN122112646A