A multi-task learning auxiliary task selection method based on task correlation degree
By calculating the similarity between the change in task loss and the gradient direction of the main task, Task Correlation (TCC) is introduced to automatically select auxiliary tasks, which solves the problem of low selection efficiency in traditional methods, and achieves high efficiency and reliability in multi-task learning, making it suitable for complex scenarios.
Patent Information
- Application Number
- CN202510368323.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2045-03-27
AI Technical Summary
Traditional auxiliary task selection methods struggle to select the optimal task combination in complex multi-task scenarios, leading to complex and inefficient model training, and are prone to negative transfer, thus failing to effectively improve the prediction accuracy of the main task.
By calculating the similarity between the change in task loss and the gradient direction of the main task, Task Correlation (TCC) is introduced to evaluate the correlation between the auxiliary task and the main task. The auxiliary task with the strongest synergy is automatically selected, and a multi-task learning model is constructed and optimized.
It improves the accuracy and efficiency of auxiliary task selection, reduces negative transfer, ensures the efficiency and reliability of multi-task learning, is suitable for complex multi-task scenarios, and demonstrates broad applicability and ease of use.
Smart Images

Figure CN119883576B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning and artificial intelligence technology, and in particular relates to a multi-task learning auxiliary task selection method based on task correlation. Background Technology
[0002] In industrial applications, the accuracy of machine learning models can often be improved by leveraging transfer learning from relevant auxiliary information. Particularly in manufacturing, the primary task of predicting equipment failure times can be optimized using auxiliary information such as historical sensor data, maintenance records, and operational status. A common approach to implementing this transfer learning is to transform this auxiliary information into auxiliary tasks (e.g., predicting machine temperature fluctuations or vibration anomalies) and jointly optimize them with the primary task (e.g., failure prediction) in a multi-task network. This multi-task network, by sharing an underlying structure, enables the transfer of knowledge from auxiliary tasks to the primary task, thereby improving the prediction accuracy of the primary task.
[0003] Improving the performance of the main task hinges on selecting highly relevant auxiliary tasks. However, traditional auxiliary task selection methods suffer from the following problems, making them unsuitable for complex multi-tasking scenarios:
[0004] 1. In traditional auxiliary task selection methods, the selection of auxiliary tasks often relies on expert experience or simple task combinations, lacking a scientific and systematic selection mechanism and failing to ensure the optimal task combination.
[0005] 2. Current research mainly improves multi-task learning performance by adjusting task weights or optimizing model structure. However, the weight adjustment process is complex and time-consuming, especially when dealing with large amounts of data or a large number of tasks, making it difficult to achieve an optimal balance.
[0006] 3. As the number of tasks and the complexity of data increase, traditional methods struggle to handle complex task relationships, leading to a decline in the accuracy of auxiliary task selection.
[0007] 4. Inappropriate task selection may cause conflicts between auxiliary tasks and main tasks, resulting in negative transfer. This not only fails to improve the performance of the main task, but also increases the difficulty and uncertainty of model training.
[0008] To address the above issues, this invention proposes a multi-task learning auxiliary task selection method based on task relevance. Summary of the Invention
[0009] The purpose of this invention is to provide a multi-task learning auxiliary task selection method based on task relevance, aiming to solve the problems mentioned in the background art.
[0010] To achieve the above objectives, the present invention provides the following technical solution:
[0011] A multi-task learning auxiliary task selection method based on task relevance includes the following steps:
[0012] Step S1, Dataset Preparation: In multi-task learning, first define the main task and several auxiliary tasks, and then construct a multi-task learning dataset containing the main task and multiple auxiliary tasks. The dataset contains the feature variables and target values of each task.
[0013] Step S2, TCC calculation: The correlation between tasks is dynamically evaluated by measuring the similarity between the loss change of each task and the gradient direction of the main task.
[0014] Step S3: Selecting auxiliary tasks: Based on the calculated TCC value, analyze the synergy or conflict between auxiliary tasks and the main task, and select the auxiliary task with the strongest synergy.
[0015] Step S4, Model Training and Optimization: Construct a multi-task learning model using the selected auxiliary and main tasks; during training, adopt standard training steps and optimize the model using the joint gradient of all tasks; periodically calculate and update the TCC value.
[0016] Furthermore, the TCC value ranges from -1 to 1, with a TCC value close to 1 indicating strong synergy and a value close to -1 indicating conflict.
[0017] Furthermore, the specific process of the TCC calculation step is as follows:
[0018] For each training batch At time step t Above, set This represents the shared parameters updated after applying the gradient step to the main task; assuming stochastic gradient descent, Represented as:
[0019] Formula 1: ;
[0020] in, Indicates the shared parameters before the update; Indicates the learning rate; This indicates that the main task is in batches. Below the parameters The gradient;
[0021] The updated shared parameters are used to calculate the loss changes for the main task and each auxiliary task, while maintaining the specific parameters for each task. and input batch constant;
[0022] auxiliary tasksi The change in loss is defined as:
[0023] Formula 2: ;
[0024] in, Indicates auxiliary task i The loss function;
[0025] The change in loss for the main task is defined as follows:
[0026] Formula 3: ;
[0027] in, This indicates a specific part of the parameters in the main task;
[0028] Collect the loss variation sequences of all batches and calculate TCC to quantify the degree of synergy or conflict between the auxiliary tasks and the optimization direction of the main task.
[0029] Formula 4: ;
[0030] in, Indicates the main task and auxiliary tasks TCC score; This represents the sequence of changes in the main task's loss. This represents the sequence of changes in auxiliary task losses; Represents the sequence of changes in the main task loss. and auxiliary task loss change sequence Covariance between them; and These represent the standard deviations of the changes in losses for the primary and secondary tasks, respectively.
[0031] At the end of each training cycle, the TCC is calculated and the results are averaged to obtain the overall TCC value for the entire training process. The overall TCC value is expressed as:
[0032] Formula 5: ;
[0033] in, n This indicates the nth training cycle; N This indicates the total number of training cycles.
[0034] Compared with the prior art, the beneficial effects of the present invention are:
[0035] 1. This invention introduces TCC (Task Selection Computation) to quantify the correlation between auxiliary tasks and the main task, thereby automatically selecting the most suitable auxiliary task for the main task. Compared to traditional selection methods that rely on expert experience and intuition, this invention improves the efficiency and accuracy of selection, effectively reduces the occurrence of negative transfer, and makes multi-task learning more efficient and reliable.
[0036] 2. The TCC introduced in this invention can effectively evaluate the correlation between tasks and automatically select the auxiliary task most relevant to the main task, avoiding the high computational cost of directly searching task combinations. In particular, it significantly reduces computational complexity when there are many tasks, and also ensures the effectiveness and efficiency of multi-task learning.
[0037] 3. The method proposed in this invention is not only unrestricted by model type, demonstrating broad applicability, but also requires no additional parameters; significant results can be achieved through simple settings, exhibiting strong applicability and ease of use. This makes this invention a reliable solution for model optimization in complex multi-task scenarios and has broad application prospects. Attached Figure Description
[0038] Figure 1 This is a flowchart of the method proposed in this invention.
[0039] Figure 2 A photograph of the actual NH3 emission data acquisition experimental platform.
[0040] Figure 3 This is a schematic diagram of gradient direction similarity.
[0041] Figure 4 The prediction performance of different auxiliary tasks in specific low-sample regions. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0043] like Figure 1 The diagram shows a flowchart of a multi-task learning auxiliary task selection method based on task relevance provided in an embodiment of the present invention. This method is implemented through a software system running on the Ubuntu 18.04 operating system and uses the PyTorch 2.1.0 framework to build the multi-task learning model. The entire auxiliary task selection algorithm model is built in the PyCharm development environment.
[0044] The method includes the following steps:
[0045] Dataset Preparation: In multi-task learning, we first define the main task and several auxiliary tasks, and then construct a multi-task learning dataset containing the main task and multiple auxiliary tasks. The dataset includes the feature variables and target values for each task. To ensure the independence and effectiveness of model training, validation, and testing, the dataset is divided into a training set, a validation set, and a test set. The training set is used for training model parameters, the validation set is used for tuning hyperparameters, and the test set is used to evaluate the final performance of the model.
[0046] Model Setup and Hyperparameter Optimization: During the model building phase, appropriate optimizers, learning rates, number of layers, number of neurons, training cycles, and batch sizes are set. The selection of these hyperparameters directly affects the model's training efficiency and final performance.
[0047] Task Correlation Coefficient (TCC) Calculation: The TCC value is introduced as a quantitative indicator to assess the synergistic effect or conflict between the auxiliary task and the main task. The correlation between tasks is dynamically evaluated by measuring the similarity between the change in loss of each task and the gradient direction of the main task. The TCC value ranges from -1 to 1, where a value closer to 1 indicates a stronger synergistic effect between the auxiliary and main tasks, while a value closer to -1 indicates a potential conflict.
[0048] Auxiliary task selection: Based on the calculated TCC value, the synergy or conflict between the auxiliary tasks and the main task is analyzed, and the auxiliary task that makes the most positive contribution to the learning of the main task (i.e., whose TCC value is closest to 1) is automatically selected from all auxiliary tasks. By selecting auxiliary tasks that are highly relevant to the main task, it is ensured that the model can effectively improve the learning performance of the main task.
[0049] Model Training and Optimization: A multi-task learning model is constructed using selected auxiliary and primary tasks. During training, standard training steps are employed, and the model is optimized using the joint gradients of all tasks. The TCC value is periodically calculated and updated to monitor changes in the correlation between tasks. Simultaneously, the model's hyperparameters are adjusted and optimized based on performance on the validation set. After training, the effectiveness of the proposed method is validated using a test set, ensuring that the selected auxiliary tasks significantly improve the performance of the primary task in multi-task learning.
[0050] The specific implementation of the present invention will be described in detail below with reference to specific embodiments.
[0051] 1. Multi-task learning dataset;
[0052] 1.1 Case Study of Real-Time Ammonia Emission Estimation for Commercial Vehicle SCR System Based on Multi-Task Selection;
[0053] This invention verifies the effectiveness and feasibility of a multi-task learning-assisted task selection method through a real-world industrial case study of real-time ammonia emission estimation in a Selective Catalytic Reduction (SCR) system for commercial vehicles. The SCR system in commercial vehicles is an emission control technology that reduces nitrogen oxides (NOx) into harmless nitrogen (N2) and water (H2O) by injecting urea solution (such as AdBlue) into the exhaust stream to meet stringent emission regulations.
[0054] Under ideal operating conditions, ammonia in the urea solution should react completely with NOx, reducing NOx to nitrogen and water. The standard SCR reaction can be expressed as:
[0055] ;
[0056] In this ideal reaction, all ammonia reacts with NOx, and no excess ammonia escapes. However, in actual operating conditions, changes in reaction conditions (such as excessive urea injection, excessively low reaction temperature, or insufficient NOx concentration) can lead to incomplete reactions, causing some NH3 to be emitted directly without reacting with NOx. This phenomenon is called ammonia slip.
[0057] ;
[0058] Therefore, most data points show zero emissions, while non-zero NH3 emission values are scarce and fluctuate significantly, making accurate prediction of ammonia emissions difficult.
[0059] To improve the real-time estimation accuracy of ammonia emissions from SCR systems, this invention introduces auxiliary tasks to optimize model performance. Four auxiliary tasks were selected: Aux1 (cross-sensitivity coefficient), Aux2 (actual NOx concentration), Aux3 (pseudo-NOx conversion rate), and Aux4 (true NOx conversion rate). The most suitable auxiliary task was determined using the multi-task learning auxiliary task selection method proposed in this invention.
[0060] 1.2 Experimental Design and Data Acquisition;
[0061] The NH3 emission data acquisition experiment was conducted on a calibrated engine test bench, such as... Figure 2 As shown, the test bench is equipped with a CuZeolite catalytic converter-based SCR system and uses a commercially available diesel engine that meets current emission standards. The test bench is equipped with a SHENCK HD460 dynamometer, which can precisely control the engine load and speed to simulate real-world driving conditions. The engine control unit (ECU) continuously provides key input parameters, including exhaust flow rate, urea injection rate, SCR system temperature, and inlet / outlet NOx concentrations, which are used to estimate NH3 emissions in real time.
[0062] NH3 concentration was measured using a high-precision gas analyzer (HORIBA MEXA7100EGR), with a measurement accuracy of ±1 ppm, ensuring data reliability. Experiments were conducted under controlled conditions, following standard procedures, and covering various operating conditions including low load, high load, and transient scenarios, collecting comprehensive NH3 emission data. This data provides a foundation for subsequent model training and validation.
[0063] 2. Calculation of TCC;
[0064] In multi-task learning, tasks exchange information through continuous gradient updates of shared parameters, which helps mitigate bias in imbalanced regression tasks by utilizing data from auxiliary tasks. However, if the correlation between the auxiliary and primary tasks is weak or conflicting, the model may struggle to learn beneficial features, leading to potential performance degradation.
[0065] The TCC proposed in this invention is an index that quantifies the cooperation or conflict between auxiliary tasks and the main task in the direction of main task optimization. By calculating the TCC of all auxiliary tasks during the training process in a single multi-task network, the most effective auxiliary task can be selected to enhance the main task.
[0066] For each training batch At time step t Above, set This represents the shared parameters updated after applying the gradient step to the main task. Under the assumption of stochastic gradient descent, this update can be expressed as:
[0067] Formula 1: ;
[0068] in, Indicates the shared parameters before the update; Indicates the learning rate; This indicates that the main task is in batches. Below the parameters The gradient;
[0069] The updated shared parameters are used to calculate the loss changes for the main task and each auxiliary task, while maintaining the specific parameters for each task. and input batch constant.
[0070] auxiliary tasks i The change in loss is defined as:
[0071] Formula 2: ;
[0072] in, Indicates auxiliary taski The loss function;
[0073] Similarly, the change in loss for the primary task is defined as:
[0074] Formula 3: ;
[0075] in, This indicates a specific part of the parameters in the main task;
[0076] After each batch, the temporary updates are reverted, restoring the original parameters. Then, the standard training steps continue using the joint gradients from all tasks. To evaluate the synergy or conflict between the primary task and each auxiliary task throughout the training cycle, the loss change sequences for all batches are collected, and the TCC is calculated to quantify the degree of synergy or conflict between the auxiliary tasks and the optimization direction of the primary task.
[0077] Formula 4: ;
[0078] in, Indicates the main task and auxiliary tasks TCC score; This represents the sequence of changes in the main task's loss. This represents the sequence of changes in auxiliary task losses; Represents the sequence of changes in the main task loss. and auxiliary task loss change sequence Covariance between them; and These represent the standard deviations of the losses in the primary and secondary tasks, respectively.
[0079] The TCC value ranges from -1 to 1. A TCC value close to 1 indicates that the gradient directions of the auxiliary task and the primary task are highly consistent, suggesting a strong correlation between the tasks. This consistency allows the model to focus on shared gradient directions, thus promoting better generalization in both high-density and low-density data regions. Conversely, a TCC value close to -1 indicates that the gradient directions are opposite, suggesting conflicting updates, which may negatively impact the performance of the primary task. It is recommended to calculate the TCC at the end of each training epoch and average the results to obtain the comprehensive TCC value over the entire training process. The comprehensive TCC value is expressed as:
[0080] Formula 5: ;
[0081] in, n This indicates the nth training cycle; N This represents the total number of training cycles. This method captures the dynamic relationships between tasks throughout the entire training process.
[0082] 3. Theoretical analysis of TCC;
[0083] To conduct a theoretical analysis of TCC, the goal is to establish a relationship between TCC and the gradient direction similarity of the primary and auxiliary tasks, such as... Figure 3 As shown in the figure above, the more similar the gradient directions of two tasks are, the stronger the synergistic effect; the figure below shows that when the gradient directions are not so similar or even opposite, training two tasks together will cause conflicts.
[0084] Assuming loss function and In shared parameters Since the loss is continuously differentiable, the change in loss can be expressed using a Taylor expansion as follows:
[0085]
[0086] in, This indicates the loss incurred by the main task after the batch update; This indicates the losses incurred by the main task before the batch update; Indicates auxiliary task i The losses after the update; Indicates auxiliary task i Losses before the update;
[0087] Updated shared parameters:
[0088]
[0089] Substituting Equation 1 into Equations 6 and 7, the loss can be approximated as:
[0090]
[0091] Therefore, primary task and secondary task i The changes in loss are as follows:
[0092]
[0093] To calculate TCC, the first step is to calculate the covariance of the loss changes for the primary and secondary tasks:
[0094]
[0095] in, The covariance represents the variation in loss of the primary task and the variation in loss of the auxiliary task; This represents the corresponding mathematical expectation;
[0096] By substituting the main task and auxiliary tasks i The change in loss can be simplified to:
[0097]
[0098] The variances of the primary task and the auxiliary task are as follows:
[0099]
[0100] in, Indicates the variance of the main task; Indicates the variance of the auxiliary task;
[0101] Ultimately, TCC can be represented as:
[0102]
[0103] This indicates that TCC is determined by the expected cosine similarity of the gradient directions and its squared expectation. Higher consistency in the gradient directions makes TCC approach 1, while gradients in the opposite direction make TCC approach -1.
[0104] 4. The impact of experimental design and the selection of auxiliary tasks;
[0105] In the experiment, the multi-task learning auxiliary task selection method proposed in this invention was adopted. Relevant auxiliary tasks were trained simultaneously in a single multi-task learning network, and the most suitable auxiliary task was determined by TCC scoring. The model used LSTM (Long Short-Term Memory) as the backbone network due to its low computational requirements and real-time processing capabilities, making it suitable for this application scenario. To ensure fairness in the comparison, all models (including multi-task and single-task models) used the same hyperparameter settings, which were determined through a comprehensive search process to ensure comparability of results. The performance of all models was evaluated using commonly used regression evaluation metrics, including mean squared error (MSE), mean absolute error (MAE), coefficient of determination (R²), and root mean square error (RMSE).
[0106]
[0107] The collected ammonia emission dataset from commercial vehicle SCR systems was divided into a complete test set and a test set for specific low-sample regions. The latter mainly focuses on non-zero emission data, where the data is sparser and more complexly distributed, making prediction difficult. Table 1 shows the comparison results of TCC scores for different auxiliary tasks with the test set performance.
[0108]
[0109] As can be seen from the experimental results in Table 1, Aux1 achieved the highest TCC score, indicating that it has the strongest synergistic effect with the gradient direction of the main task. When trained simultaneously with the main task, Aux1 outperforms other auxiliary tasks on the test set.
[0110] To further illustrate the impact of auxiliary task selection Figure 4 This study demonstrates the comparison between the model's predicted values and actual measurements on the test set when different auxiliary tasks are jointly trained with the main task in specific low-sample regions. Compared to other auxiliary tasks, the Aux1 model, with the highest TCC score, exhibits the highest consistency between its predicted values and the true values on the test set. The results show that selecting Aux1 can significantly improve the prediction accuracy in these regions. This analysis validates the effectiveness of selecting auxiliary tasks based on TCC scores, with Aux1 demonstrating the strongest synergistic effect and significantly improving the performance of the main task in sparse data regions.
[0111] Therefore, the multi-task learning auxiliary task selection method based on task relevance proposed in this invention can automatically select the most suitable auxiliary task for the main task within a multi-task learning framework. A suitable auxiliary task can significantly improve the prediction accuracy of the main task and the robustness of the model.
[0112] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these should also be considered within the scope of protection of the present invention. These modifications and improvements will not affect the effectiveness of the implementation of the present invention or the practicality of the patent.
Claims
1. A multi-task learning auxiliary task selection method based on task relevance, characterized in that, Includes the following steps: Step S1, Dataset Preparation: In multi-task learning, first define the main task and several auxiliary tasks, and then construct a multi-task learning dataset containing the main task and multiple auxiliary tasks. The dataset contains the feature variables and target values of each task. Step S2, TCC calculation: The correlation between tasks is dynamically evaluated by measuring the similarity between the loss change of each task and the gradient direction of the main task. Step S3: Selecting auxiliary tasks: Based on the calculated TCC value, analyze the synergy or conflict between auxiliary tasks and the main task, and select the auxiliary task with the strongest synergy. Step S4, Model Training and Optimization: Construct a multi-task learning model using the selected auxiliary and primary tasks; during training, adopt standard training steps and optimize the model using the joint gradient of all tasks; periodically calculate and update the TCC value; The TCC value ranges from -1 to 1. A TCC value close to 1 indicates strong synergy, while a value close to -1 indicates the presence of conflict. The specific process of the TCC calculation steps is as follows: For each training batch At time step t, let This represents the shared parameters updated after applying the gradient step to the main task; assuming stochastic gradient descent, Represented as: Formula 1: ; in, Indicates the shared parameters before the update; Indicates the learning rate; This indicates that the main task is in batches. Below the parameters The gradient; The updated shared parameters are used to calculate the loss changes for the main task and each auxiliary task, while maintaining the specific parameters for each task. and input batch constant; The loss change for auxiliary task i is defined as: Formula 2: ; in, Let i represent the loss function for auxiliary task i; The change in loss for the primary task is defined as follows: Formula 3: ; in, This indicates a specific part of the parameters in the main task; After each batch, the temporary update is reverted to its original state; then, the standard training steps continue using the joint gradients of all tasks; to evaluate the synergy or conflict between the main task and each auxiliary task throughout the training cycle, the loss change sequence of all batches is collected, and the TCC is calculated to quantify the degree of synergy or conflict between the auxiliary tasks and the optimization direction of the main task. Formula 4: ; in, Indicates the main task and auxiliary tasks TCC score; This represents the sequence of changes in the main task's loss. This represents the sequence of changes in auxiliary task losses; Represents the sequence of changes in the main task loss. and auxiliary task loss change sequence Covariance between them; and These represent the standard deviations of the changes in losses for the primary and secondary tasks, respectively. At the end of each training cycle, the TCC is calculated and the results are averaged to obtain the overall TCC value for the entire training process. The overall TCC value is expressed as: Formula 5: ; Where n represents the nth training cycle; N represents the total number of training cycles.
Citation Information
Patent Citations
Target identification method and device, electronic equipment and readable storage medium
CN117315445A