Multi-task adaptive learning method based on dynamic strategy switching
Through the multi-task adaptive learning method of dynamic strategy switching, combined with the fusion control tensor and policy scheduling controller, the static problem of shared strategies between tasks in multi-task learning is solved, adaptive learning between tasks is realized, and the fusion expression ability and task adaptability of multi-task neural networks are improved.
Patent Information
- Application Number
- CN202510699607.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-09-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing multi-task learning methods lack dynamic adjustment capabilities in the design of shared strategies between tasks, resulting in negative transfer, fusion failure or shared redundancy. In particular, they perform poorly in scenarios with significant task differences or feature conflicts, and nonlinear fusion structures are difficult to achieve end-to-end optimization.
A multi-task adaptive learning method based on dynamic policy switching is adopted. By constructing a fusion control tensor and a policy scheduling controller, combining the task state vector to generate the fusion weight matrix and path configuration, and introducing a nonlinear cross-fusion unit, adaptive learning between tasks is achieved.
It improves the fusion expression ability of multi-task neural networks and reduces task migration interference. It has strong structural adaptability and high fusion expression ability. It is suitable for multi-task collaborative modeling scenarios and reduces the risk of negative migration.
Smart Images

Figure CN120597945A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of neural network modeling, and in particular to a multi-task adaptive learning method based on dynamic strategy switching. Background Art
[0002] Multi-task learning, as an important branch of deep learning, achieves knowledge sharing and improved generalization capabilities between tasks by simultaneously processing multiple related tasks within a unified model architecture. It has been widely used in a variety of practical scenarios, including image recognition, natural language processing, medical diagnosis, and multimodal modeling. In multi-task neural network modeling, the design of sharing strategies between tasks is a key factor affecting overall performance. A reasonable sharing mechanism can significantly improve the generalization ability of the model and reduce model complexity. Currently, mainstream methods can be divided into two categories: hard sharing and soft sharing. The former achieves parameter sharing by sharing the first few layers of the network structure, while the latter achieves flexible sharing between tasks through feature fusion structures.
[0003] As a typical soft-sharing structure, Cross-stitch Networks establishes a cross-channel feature exchange mechanism between multiple task branches by introducing a fusion weight matrix, thereby achieving learnable adjustment of the degree of sharing. However, the original Cross-stitch structure only models the static fusion relationship between tasks, ignoring the dynamic synergistic relationship between tasks in different training stages and different sample spaces. In addition, the linear combination method of fusion weights is relatively simple, unable to capture the more complex nonlinear dependencies between task features, and lacks the ability to structurally control the fusion path. This defect is particularly evident in scenarios where there are significant task differences, feature conflicts, or semantic separation between multiple tasks, which can easily lead to negative transfer, fusion failure, or shared redundancy.
[0004] To improve the flexibility and expressiveness of fusion mechanisms, some studies have introduced attention mechanisms, gating modules, or residual connections to enhance the expressiveness of the fusion layer. However, a fusion policy control framework based on task state is still lacking. Existing technologies lack an adaptive mechanism that can dynamically generate fusion weights and fusion path configurations by combining task loss trends, gradient direction differences, and feature space distance information. Furthermore, the nonlinear fusion structures in existing methods are mostly not integrated with policy scheduling mechanisms, making it difficult to achieve end-to-end optimization of fusion modes at the network structure level.
[0005] Therefore, how to provide a multi-task adaptive learning method based on dynamic strategy switching is a problem that technicians in this field urgently need to solve. Summary of the Invention
[0006] One purpose of the present invention is to propose a multi-task adaptive learning method based on dynamic strategy switching. The present invention fully integrates task semantic correlation modeling, feature space interaction modeling and fusion strategy optimization, and describes in detail the mechanism of constructing a fusion control tensor based on the task state vector and performing multi-channel fusion operations. It has the advantages of strong structural adaptability, small task migration interference and high fusion expression ability.
[0007] A multi-task adaptive learning method based on dynamic strategy switching according to an embodiment of the present invention includes the following steps:
[0008] S1. Build a multi-task learning model and initialize the task encoder, feature extraction network and decoding module for each task;
[0009] S2. Input the input sample of each task into the corresponding task encoder to generate a task encoding vector;
[0010] S3. Input the task encoding vector into the corresponding feature extraction network to generate task feature representation;
[0011] S4, input all task feature representations into the improved Cross-stitch fusion structure and perform feature cross-fusion operation;
[0012] S5. Input the task feature representation into the policy scheduling controller, calculate the loss change value, gradient direction difference and feature space distance, and generate the fusion weight matrix and fusion path configuration;
[0013] S6, inputting the fusion weight matrix, fusion path configuration and task feature representation into the nonlinear cross fusion unit, performing nonlinear combination operation, and generating a shared feature representation;
[0014] S7, input the shared feature representation into the decoding module of each task respectively to generate the corresponding prediction results;
[0015] S8. Calculate the loss function value based on the predicted results and the true label, and use backpropagation to update the parameters of the feature extraction network, nonlinear cross fusion unit, and policy scheduling controller;
[0016] S9. Repeat steps S2 to S8 until the training termination condition is met.
[0017] Optionally, the improved Cross-stitch fusion structure includes:
[0018] The nonlinear cross-fusion unit adopts a multi-layer perceptron structure to perform nonlinear combination calculations of task features. The fusion structure includes a feature input gate, a fusion control gate, and an activation transformation network.
[0019] The policy scheduling controller includes a task state encoder and a policy generator. The task state encoder receives the loss sequence, gradient cosine similarity and feature Euclidean distance and generates an interaction trajectory vector.
[0020] The strategy generator generates fusion weights and path configurations based on the interaction trajectory vectors. The path configuration is used to control the activation mode of the cross-fusion connection structure, and the fusion weights are used to adjust the combination ratio.
[0021] Optionally, the S2 specifically includes:
[0022] S21. Represent the input sample of each task as a vector sequence X t =[x1,x2,…,x n ], input to the corresponding task encoder, the task encoder includes an input mapping layer, a sequence modeling layer and a compression mapping layer;
[0023] S22, through the input mapping layer vector sequence X t For each input vector x i Perform a linear transformation to generate an embedding vector:
[0024] h i =W e x i +b e ;
[0025] Among them, x i is the i-th input vector, h i is the corresponding embedding vector, W e is the weight matrix, b e is the bias vector;
[0026] S23, embed the vector h i Input to the sequence modeling layer to construct the state sequence s i ;
[0027] S24, the state sequence s i Input to the compression mapping layer, perform global pooling operation and nonlinear mapping, and generate the task encoding vector e t .
[0028] Optionally, the S3 specifically includes:
[0029] S31, input the task encoding vector into the corresponding feature extraction network, perform feature expansion operation, and construct an intermediate feature representation;
[0030] S32, inputting the intermediate feature representation into the convolutional mapping layer to extract local pattern features;
[0031] S33. Input the local pattern features into the fully connected mapping layer to generate task feature representation.
[0032] Optionally, the S4 specifically includes:
[0033] S41. Constructing task feature representation matrix The i-th row vector in the matrix represents the feature representation of the i-th task, n represents the number of tasks, and d represents the feature dimension;
[0034] S42. Set the three-dimensional fusion weight tensor The element A ijk ∈[0,1] indicates that the i-th task receives the initial fusion weight of the j-th task feature in the k-th channel;
[0035] S43. Obtain the correlation tensor by calculating the semantic similarity between tasks Each element satisfies:
[0036]
[0037] Among them, f i and f j are the feature representations of the i-th and j-th tasks respectively, represents the feature correlation projection matrix, d r represents the projection dimension, R ij represents the normalized cosine similarity;
[0038] S44. Constructing a fusion control tensor based on the fusion weight tensor and the semantic relevance tensor Each element is calculated as follows:
[0039]
[0040] Among them, M ijk A represents the normalized control coefficient of the ith task fusing the jth task feature in the kth channel, ijk ∈[0,1] indicates that the i-th fusion task in the initial fusion weight tensor receives the static weight of the j-th input task, R ij ∈[-1,1] represents the semantic similarity between the i-th task and the j-th task, ReLU(R ij ) represents the modified activation function that truncates the negative correlation to zero, exp(·) represents the exponential transformation applied to the fused modulation value to enhance the difference, and the summation symbol Indicates that in the kth fusion channel, the fusion task i traverses the modulation values of all input tasks j′ and performs softmax normalization, so that when i and k are fixed, all M ijk The sum of the weighting coefficients in the range of j=1 to n is equal to 1, thus forming a fusion weight distribution that can be weighted combined;
[0041] S45, fusion output tensor The fusion vector of the i-th task in the k-th channel satisfies:
[0042]
[0043] in, Represents the fused channel feature vector;
[0044] S46, the fused output tensor is passed through the nonlinear mapping module to generate the output matrix The i-th row vector represents the fused feature representation of the i-th task, and d′ represents the output dimension.
[0045] Optionally, the S5 specifically includes:
[0046] S51. Represent the task feature matrix Task loss sequence L = [l1,l2,…,l n ] and the task gradient matrix Input policy scheduling controller, where n represents the number of tasks and d represents the feature dimension, represents the feature vector of the i-th task, represents the loss change value of the i-th task, represents the gradient vector of the i-th task;
[0047] S52. Calculate feature space distance matrix Each element satisfies D ij =||f i -f j ||2, where D ij represents the Euclidean distance between the i-th task and the j-th task in the feature space, and ||·||2 represents the two-norm;
[0048] S53, calculate the gradient direction difference matrix Each element satisfies:
[0049]
[0050] Among them, C ij represents the gradient direction difference between the i-th task and the j-th task, and <·,·> represents the vector inner product;
[0051] S54. Connect the loss sequence, feature space distance matrix and gradient direction difference matrix into the task state representation tensor, input the policy generation network in the policy scheduling controller, and generate the fusion weight matrix and fusion path configuration tensors Where Wijk represents the fusion weight of the i-th task receiving the j-th task information in the k-th fusion channel, P ik Indicates whether the kth channel is enabled for the i-th task.
[0052] Optionally, the S6 specifically includes:
[0053] S61, fusion weight matrix Fusion Path Configuration Matrix and task feature representation matrix Input nonlinear cross fusion unit, where n represents the number of tasks, k represents the number of fusion channels, d represents the dimension of task feature representation, and element W ijk represents the fusion weight of the i-th task fusing the j-th task feature representation in the k-th channel, P ik Indicates the path activation status of the i-th task in the k-th channel, represents the task feature representation of the jth task;
[0054] S62, for each task index i and each activation channel index k, calculate the fusion intermediate vector according to the fusion weight matrix Among them, z ik represents the weighted fusion result of the i-th task in the k-th channel;
[0055] S63. Combine the fused intermediate vectors of the i-th task on all activation channels into a fused representation tensor Input the nonlinear combination module inside the nonlinear cross fusion unit, perform nonlinear transformation between channels, and generate the shared feature representation of the i-th task Where d′ represents the dimension of shared feature representation;
[0056] S64. Combine the shared feature representations of all tasks to form a shared feature representation matrix As the output of the nonlinear cross fusion unit.
[0057] Optionally, the S7 specifically includes:
[0058] S71, share the feature matrix Input task decoding module set, where n represents the number of tasks, d′ represents the dimension of shared feature representation, and the i-th row vector represents the shared feature representation of the i-th task;
[0059] S72. For the i-th task, the shared feature is represented as h i Input the corresponding decoding module, after two layers of nonlinear transformation and one layer of output mapping, to generate a prediction vector where c iRepresents the predicted output dimension of the i-th task;
[0060] S73. Combine all prediction vectors into a prediction result set As the final prediction result of all tasks.
[0061] Optionally, the S8 specifically includes:
[0062] S81. Collect the prediction results of all tasks and the corresponding true label set Y = [y1,y2,…,y n ] to match and calculate the total loss function value:
[0063]
[0064] in, represents the weighted total loss of all tasks, represents the single-task loss function of the i-th task, represents the loss weight of the i-th task, Represents the prediction result, represents the true label, c i represents the prediction dimension;
[0065] S82, based on the total loss function value Perform backpropagation calculations to generate parameter gradients;
[0066] S83, using parameter gradients to synchronously update the learnable parameters included in the feature extraction network, the nonlinear cross fusion unit, and the policy scheduling controller;
[0067] S84. After completing one update, the new parameters are used for the next round of task input processing and the process goes to step S2.
[0068] The beneficial effects of the present invention are:
[0069] This paper effectively enhances the expressive power of inter-task feature sharing in multi-task neural networks by designing an improved cross-stitch fusion architecture, introducing nonlinear cross-fusion units and multi-channel fusion paths. Compared to traditional static fusion methods, the proposed architecture allows for dynamic weighted combination across multiple fusion channels and incorporates semantic relevance between tasks as a control factor, creating a more flexible feature interaction mechanism at the structural level.
[0070] At the same time, the present invention introduces a policy scheduling controller into the fusion process. This controller constructs a task state vector based on state variables such as task loss changes, gradient direction differences, and feature space distances. This in turn generates a fusion weight matrix and fusion path configuration, enabling adaptive control of the fusion strategy. The fusion control tensor and the policy generation module work together to enable the model to adjust the shared structure based on task state changes during training, improving inter-task collaboration efficiency and suppressing the risk of negative transfer.
[0071] Overall, the present invention has made structural innovations in both the fusion structure and the fusion strategy, realizing dynamic linkage adjustment of fusion strength and fusion path. It has the advantages of strong fusion expression ability, high task adaptability, and good controllability of network structure, and is suitable for deep learning architecture optimization problems in multi-task collaborative modeling scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0073] Figure 1 This is a flowchart of a multi-task adaptive learning method based on dynamic strategy switching proposed by the present invention;
[0074] Figure 2 This is a schematic diagram of the fusion structure of a multi-task adaptive learning method based on dynamic strategy switching proposed by the present invention;
[0075] Figure 3 This is a structural diagram of a policy scheduling controller based on a multi-task adaptive learning method based on dynamic policy switching proposed by the present invention. DETAILED DESCRIPTION
[0076] The present invention will now be described in further detail with reference to the accompanying drawings, which are simplified schematic diagrams that illustrate the basic structure of the present invention in a schematic manner.
[0077] refer to Figure 1-3 , a multi-task adaptive learning method based on dynamic strategy switching, comprising the following steps:
[0078] S1. Build a multi-task learning model and initialize the task encoder, feature extraction network and decoding module for each task;
[0079] S2. Input the input sample of each task into the corresponding task encoder to generate a task encoding vector;
[0080] S3. Input the task encoding vector into the corresponding feature extraction network to generate task feature representation;
[0081] S4, input all task feature representations into the improved Cross-stitch fusion structure and perform feature cross-fusion operation;
[0082] S5. Input the task feature representation into the policy scheduling controller, calculate the loss change value, gradient direction difference and feature space distance, and generate the fusion weight matrix and fusion path configuration;
[0083] S6, inputting the fusion weight matrix, fusion path configuration and task feature representation into the nonlinear cross fusion unit, performing nonlinear combination operation, and generating a shared feature representation;
[0084] S7, input the shared feature representation into the decoding module of each task respectively to generate the corresponding prediction results;
[0085] S8. Calculate the loss function value based on the predicted results and the true label, and use backpropagation to update the parameters of the feature extraction network, nonlinear cross fusion unit, and policy scheduling controller;
[0086] S9. Repeat steps S2 to S8 until the training termination condition is met.
[0087] By constructing a multi-task model and introducing a complete process including encoding, feature extraction, fusion, scheduling, decoding and feedback update, the present invention forms a structurally closed-loop, strategy-driven collaborative learning architecture that can dynamically adapt to changes in task states and enhance the expressiveness and training stability of the multi-task model.
[0088] In this embodiment, the improved Cross-stitch fusion structure includes:
[0089] The nonlinear cross-fusion unit adopts a multi-layer perceptron structure to perform nonlinear combination calculations of task features. The fusion structure includes a feature input gate, a fusion control gate, and an activation transformation network.
[0090] The policy scheduling controller includes a task state encoder and a policy generator. The task state encoder receives the loss sequence, gradient cosine similarity and feature Euclidean distance and generates an interaction trajectory vector.
[0091] The strategy generator generates fusion weights and path configurations based on the interaction trajectory vectors. The path configuration is used to control the activation mode of the cross-fusion connection structure, and the fusion weights are used to adjust the combination ratio.
[0092] The present invention deeply integrates the nonlinear cross-fusion unit with the strategy scheduling controller to achieve the organic linkage between the fusion structure and the control strategy. It can effectively identify the collaborative relationship between tasks and adaptively adjust the fusion method, thereby improving the model's adaptability to complex task groups.
[0093] In this embodiment, S2 specifically includes:
[0094] S21. Represent the input sample of each task as a vector sequence X t =[x1,x2,…,x n ], input to the corresponding task encoder, the task encoder includes an input mapping layer, a sequence modeling layer and a compression mapping layer;
[0095] S22, through the input mapping layer vector sequence X t For each input vector x i Perform a linear transformation to generate an embedding vector:
[0096] h i =W e x i +b e ;
[0097] Among them, x i is the i-th input vector, h i is the corresponding embedding vector, W e is the weight matrix, b e is the bias vector;
[0098] S23, embed the vector h i Input to the sequence modeling layer to construct the state sequence s i ;
[0099] S24, the state sequence s i Input to the compression mapping layer, perform global pooling operation and nonlinear mapping, and generate the task encoding vector e t .
[0100] The present invention completes the efficient conversion from input samples to task encoding vectors by constructing a task encoder including input mapping, sequence modeling and compression mapping. It has the ability to comprehensively model sequence patterns and semantic features, which helps to improve the accuracy of subsequent feature extraction.
[0101] In this embodiment, S3 specifically includes:
[0102] S31, input the task encoding vector into the corresponding feature extraction network, perform feature expansion operation, and construct an intermediate feature representation;
[0103] S32, inputting the intermediate feature representation into the convolutional mapping layer to extract local pattern features;
[0104] S33. Input the local pattern features into the fully connected mapping layer to generate task feature representation.
[0105] The present invention introduces convolutional mapping and fully connected mapping to construct the task feature extraction process, thereby enhancing the model's ability to fuse local patterns with global semantics, making the generated task feature representation more refined and more discriminative, and providing high-quality feature input for subsequent fusion.
[0106] In this embodiment, the S4 specifically includes:
[0107] S41. Constructing task feature representation matrix The i-th row vector in the matrix represents the feature representation of the i-th task, n represents the number of tasks, and d represents the feature dimension;
[0108] S42. Set the three-dimensional fusion weight tensor The element A ijk ∈[0,1] indicates that the i-th task receives the initial fusion weight of the j-th task feature in the k-th channel;
[0109] S43. Obtain the correlation tensor by calculating the semantic similarity between tasks Each element satisfies:
[0110]
[0111] Among them, f i and f j are the feature representations of the i-th and j-th tasks respectively, represents the feature correlation projection matrix, d r represents the projection dimension, R ij represents the normalized cosine similarity;
[0112] S44. Constructing a fusion control tensor based on the fusion weight tensor and the semantic relevance tensor Each element is calculated as follows:
[0113]
[0114] Among them, M ijk A represents the normalized control coefficient of the ith task fusing the jth task feature in the kth channel, ijk ∈[0,1] indicates that the i-th fusion task in the initial fusion weight tensor receives the static weight of the j-th input task, R ij ∈[-1,1] represents the semantic similarity between the i-th task and the j-th task, ReLU(R ij ) represents the modified activation function that truncates the negative correlation to zero, exp(·) represents the exponential transformation applied to the fused modulation value to enhance the difference, and the summation symbol Indicates that in the kth fusion channel, the fusion task i traverses the modulation values of all input tasks j′ and performs softmax normalization, so that when i and k are fixed, all M ijk The sum of the weighting coefficients in the range of j=1 to n is equal to 1, thus forming a fusion weight distribution that can be weighted combined;
[0115] S45, fusion output tensor The fusion vector of the i-th task in the k-th channel satisfies:
[0116]
[0117] in, Represents the fused channel feature vector;
[0118] S46, the fused output tensor is passed through the nonlinear mapping module to generate the output matrix The i-th row vector represents the fused feature representation of the i-th task, and d′ represents the output dimension.
[0119] The present invention introduces fusion weight tensors, semantic relevance tensors and fusion control tensors in the process of inter-task fusion, and cooperates with the multi-channel feature aggregation mechanism to realize refined and directional cross-task fusion operations, effectively reducing the risks of feature interference and fusion conflicts.
[0120] In this embodiment, the S5 specifically includes:
[0121] S51. Represent the task feature matrix Task loss sequence L = [l1,l2,…,l n ] and the task gradient matrix Input policy scheduling controller, where n represents the number of tasks and d represents the feature dimension, represents the feature vector of the i-th task, represents the loss change value of the i-th task, represents the gradient vector of the i-th task;
[0122] S52. Calculate feature space distance matrix Each element satisfies D ij =||f i -f j ||2, where D ij represents the Euclidean distance between the i-th task and the j-th task in the feature space, and ||·||2 represents the two-norm;
[0123] S53, calculate the gradient direction difference matrix Each element satisfies:
[0124]
[0125] Among them, C ij represents the gradient direction difference between the i-th task and the j-th task, and <·,·> represents the vector inner product;
[0126] S54. Connect the loss sequence, feature space distance matrix and gradient direction difference matrix into the task state representation tensor, input the policy generation network in the policy scheduling controller, and generate the fusion weight matrix and fusion path configuration tensors Where W ijk represents the fusion weight of the i-th task receiving the j-th task information in the k-th fusion channel, P ik Indicates whether the kth channel is enabled for the i-th task.
[0127] The present invention uses task loss, gradient direction and feature space information to construct the task state vector, and dynamically generates a fusion strategy based on it, so that the model can accurately identify task dependencies and adjust the degree of sharing, thereby enhancing the contextual adaptability and practicality of the fusion decision.
[0128] In this embodiment, S6 specifically includes:
[0129] S61, fusion weight matrix Fusion Path Configuration Matrix and task feature representation matrix Input nonlinear cross fusion unit, where n represents the number of tasks, k represents the number of fusion channels, d represents the dimension of task feature representation, and element W ijk represents the fusion weight of the i-th task fusing the j-th task feature representation in the k-th channel, P ik Indicates the path activation status of the i-th task in the k-th channel, represents the task feature representation of the jth task;
[0130] S62, for each task index i and each activation channel index k, calculate the fusion intermediate vector according to the fusion weight matrix Among them, z ik represents the weighted fusion result of the i-th task in the k-th channel;
[0131] S63. Combine the fused intermediate vectors of the i-th task on all activation channels into a fused representation tensor Input the nonlinear combination module inside the nonlinear cross fusion unit, perform nonlinear transformation between channels, and generate the shared feature representation of the i-th task Where d′ represents the dimension of shared feature representation;
[0132] S64. Combine the shared feature representations of all tasks to form a shared feature representation matrix As the output of the nonlinear cross fusion unit.
[0133] The present invention jointly guides the nonlinear cross-fusion unit to perform channel combination and feature transformation operations through fusion path configuration and fusion weight control mechanism, so that the shared feature representation has both channel diversity and semantic consistency, thereby improving the expression flexibility and generalization ability of the shared module.
[0134] In this embodiment, the S7 specifically includes:
[0135] S71, share the feature matrix Input task decoding module set, where n represents the number of tasks, d′ represents the dimension of shared feature representation, and the i-th row vector represents the shared feature representation of the i-th task;
[0136] S72. For the i-th task, the shared feature is represented as h i Input the corresponding decoding module, after two layers of nonlinear transformation and one layer of output mapping, to generate a prediction vector where c i Represents the predicted output dimension of the i-th task;
[0137] S73. Combine all prediction vectors into a prediction result set As the final prediction result of all tasks.
[0138] The present invention inputs shared feature representation into the structured decoding process, realizes high-fidelity mapping from the shared space to the prediction results of each task, supports parallel prediction and personalized output between tasks, and improves the collaborative prediction efficiency of the model and the independence between tasks.
[0139] In this embodiment, S8 specifically includes:
[0140] S81. Collect the prediction results of all tasks and the corresponding true label set Y = [y1,y2,…,y n ] to match and calculate the total loss function value:
[0141]
[0142] in, represents the weighted total loss of all tasks, represents the single-task loss function of the i-th task, represents the loss weight of the i-th task, Represents the prediction result, represents the true label, c i represents the prediction dimension;
[0143] S82, based on the total loss function value Perform backpropagation calculations to generate parameter gradients;
[0144] S83, using parameter gradients to synchronously update the learnable parameters included in the feature extraction network, the nonlinear cross fusion unit, and the policy scheduling controller;
[0145] S84. After completing one update, the new parameters are used for the next round of task input processing and the process goes to step S2.
[0146] The present invention ensures the linkage learning ability of the fusion module and the controller by introducing task-weighted loss calculation and a back-propagation update mechanism involving the entire structure, so that the training process has global optimization characteristics and enhances the convergence and stability of the overall structure.
[0147] Example 1:
[0148] In order to verify the feasibility of the present invention in implementation, the present invention is applied to a typical urban intelligent transportation image analysis task. In this scenario, the system needs to simultaneously complete three tasks: image classification (identifying road scene types), target detection (identifying vehicles and pedestrians), and instance segmentation (marking lane lines and obstacle areas). Due to different task objectives, the feature emphasis of the input image is also different. If the traditional static feature sharing strategy is adopted, it is very easy to cause feature interference between tasks, affecting the overall performance of the model.
[0149] The experimental deployment platform is an edge GPU server in the smart transportation management platform of Nanshan District, Shenzhen. It is configured with NVIDIA RTX 3090, Intel Xeon Gold 6226R processor and 128GB memory. The operating environment is urban road monitoring image data collected from September to October 2024. After constructing a unified multi-task data set, the method of the present invention and the traditional Cross-stitch fusion method are used for training and testing under the same conditions. The traditional method uses static fusion weights to uniformly combine task features, while the present invention adopts an improved Cross-stitch fusion structure to construct a fusion control tensor and introduces a policy scheduling controller. The task state vector is constructed through task loss changes, gradient direction differences and feature space distances, thereby dynamically generating fusion weight matrices and path configurations to achieve synchronous adaptation of fusion strategies and structures.
[0150] By comparing the accuracy, model parameters, and inference efficiency in three subtasks, the experimental results show that the proposed method outperforms the traditional method in terms of task performance, and the model complexity and response time do not increase significantly. The specific experimental data are shown in Table 1:
[0151] Table 1 Comparison results of multi-task image recognition experiments
[0152]
[0153] As can be seen from Table 1, the top-1 accuracy of the proposed method in image classification tasks is improved by 2.6 percentage points, the mAP of the object detection task is improved by 5.3 percentage points, and the instance segmentation accuracy is improved by 4.1 percentage points. Although the fusion strategy is more flexible and complex, the number of model parameters remains consistent with the traditional method, and the inference time does not increase significantly, which proves that the proposed method has practical deployment capabilities in edge computing scenarios.
[0154] In summary, the present invention has made systematic improvements in the fusion structure and fusion strategy, realized the semantic adaptation and path control of inter-task fusion, significantly improved the accuracy of multi-task collaboration, reduced the risk of negative transfer caused by feature conflicts, and provided a more stable and efficient structural optimization method for multi-task neural networks. It has clear practical application value and promotion prospects.
[0155] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A multi-task adaptive learning method based on dynamic strategy switching, characterized in that: The steps include: S1. Build a multi-task learning model and initialize the task encoder, feature extraction network and decoding module for each task; S2. Input the input sample of each task into the corresponding task encoder to generate a task encoding vector; S3. Input the task encoding vector into the corresponding feature extraction network to generate task feature representation; S4, input all task feature representations into the improved Cross-stitch fusion structure and perform feature cross-fusion operation; S5. Input the task feature representation into the policy scheduling controller, calculate the loss change value, gradient direction difference and feature space distance, and generate the fusion weight matrix and fusion path configuration; S6, inputting the fusion weight matrix, fusion path configuration and task feature representation into the nonlinear cross fusion unit, performing nonlinear combination operation, and generating a shared feature representation; S7, input the shared feature representation into the decoding module of each task respectively to generate the corresponding prediction results; S8. Calculate the loss function value based on the predicted results and the true label, and use backpropagation to update the parameters of the feature extraction network, nonlinear cross fusion unit, and policy scheduling controller; S9. Repeat steps S2 to S8 until the training termination condition is met.
2. A multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The improved Cross-stitch fusion structure includes: The nonlinear cross-fusion unit adopts a multi-layer perceptron structure to perform nonlinear combination calculations of task features. The fusion structure includes a feature input gate, a fusion control gate, and an activation transformation network. The policy scheduling controller includes a task state encoder and a policy generator. The task state encoder receives the loss sequence, gradient cosine similarity and feature Euclidean distance and generates an interaction trajectory vector. The strategy generator generates fusion weights and path configurations based on the interaction trajectory vectors. The path configuration is used to control the activation mode of the cross-fusion connection structure, and the fusion weights are used to adjust the combination ratio.
3. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S2 specifically includes: S21. Represent the input sample of each task as a vector sequence X t =[x1,x2,…,x n ], input to the corresponding task encoder, the task encoder includes an input mapping layer, a sequence modeling layer and a compression mapping layer; S22, through the input mapping layer vector sequence X t For each input vector x i Perform a linear transformation to generate an embedding vector: h i =W e x i +b e ; Among them, x i is the i-th input vector, h i is the corresponding embedding vector, W e is the weight matrix, b e is the bias vector; S23, embed the vector h i Input to the sequence modeling layer to construct the state sequence s i ; S24, the state sequence s i Input to the compression mapping layer, perform global pooling operation and nonlinear mapping, and generate the task encoding vector e t .
4. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S3 specifically includes: S31, input the task encoding vector into the corresponding feature extraction network, perform feature expansion operation, and construct an intermediate feature representation; S32, inputting the intermediate feature representation into the convolutional mapping layer to extract local pattern features; S33. Input the local pattern features into the fully connected mapping layer to generate task feature representation.
5. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S4 specifically includes: S41. Constructing task feature representation matrix The i-th row vector in the matrix represents the feature representation of the i-th task, n represents the number of tasks, and d represents the feature dimension; S42. Set the three-dimensional fusion weight tensor The element A ijk ∈[0,1] indicates that the i-th task receives the initial fusion weight of the j-th task feature in the k-th channel; S43. Obtain the correlation tensor by calculating the semantic similarity between tasks Each element satisfies: Among them, f i and f j are the feature representations of the i-th and j-th tasks respectively, represents the feature correlation projection matrix, d r represents the projection dimension, R ij represents the normalized cosine similarity; S44. Constructing a fusion control tensor based on the fusion weight tensor and the semantic relevance tensor Each element is calculated as follows: Among them, M ijk A represents the normalized control coefficient of the ith task fusing the jth task feature in the kth channel, ijk ∈[0,1] indicates that the i-th fusion task in the initial fusion weight tensor receives the static weight of the j-th input task, R ij ∈[-1,1] represents the semantic similarity between the i-th task and the j-th task, ReLU(R ij ) represents the modified activation function that truncates the negative correlation to zero, exp(·) represents the exponential transformation applied to the fused modulation value to enhance the difference, and the summation symbol Indicates that in the kth fusion channel, fusion task i traverses all input tasks j ′ The modulation value is normalized by softmax, so that when i and k are fixed, all M ijk The sum of the weighting coefficients in the range of j=1 to n is equal to 1, thus forming a fusion weight distribution that can be weighted combined; S45, fusion output tensor The fusion vector of the i-th task in the k-th channel satisfies: in, Represents the fused channel feature vector; S46, the fused output tensor is passed through the nonlinear mapping module to generate the output matrix The i-th row vector represents the fusion feature representation of the i-th task, d ′ Indicates the output dimension.
6. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S5 specifically includes: S51. Represent the task feature matrix Task loss sequence L = [l1,l2,…,l n ] and the task gradient matrix Input policy scheduling controller, where n represents the number of tasks and d represents the feature dimension, represents the feature vector of the i-th task, represents the loss change value of the i-th task, represents the gradient vector of the i-th task; S52. Calculate feature space distance matrix Each element satisfies D ij =‖f i -f j ‖2, where D ij represents the Euclidean distance between the i-th task and the j-th task in the feature space, ‖·‖2 represents the second norm; S53, calculate the gradient direction difference matrix Each element satisfies: Among them, C ij represents the gradient direction difference between the i-th task and the j-th task, and <·,·> represents the vector inner product; S54. Connect the loss sequence, feature space distance matrix and gradient direction difference matrix into the task state representation tensor, input the policy generation network in the policy scheduling controller, and generate the fusion weight matrix and fusion path configuration tensors Where W ijk represents the fusion weight of the i-th task receiving the j-th task information in the k-th fusion channel, P ik Indicates whether the kth channel is enabled for the i-th task.
7. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S6 specifically includes: S61, fusion weight matrix Fusion Path Configuration Matrix and task feature representation matrix Input nonlinear cross fusion unit, where n represents the number of tasks, k represents the number of fusion channels, d represents the dimension of task feature representation, and element W ijk represents the fusion weight of the i-th task fusing the j-th task feature representation in the k-th channel, P ik Indicates the path activation status of the i-th task in the k-th channel, represents the task feature representation of the jth task; S62, for each task index i and each activation channel index k, calculate the fusion intermediate vector according to the fusion weight matrix Among them, z ik represents the weighted fusion result of the i-th task in the k-th channel; S63. Combine the fused intermediate vectors of the i-th task on all activation channels into a fused representation tensor Input the nonlinear combination module inside the nonlinear cross fusion unit, perform nonlinear transformation between channels, and generate the shared feature representation of the i-th task where d ′ represents the dimension of shared feature representation; S64. Combine the shared feature representations of all tasks to form a shared feature representation matrix As the output of the nonlinear cross fusion unit.
8. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S7 specifically includes: S71, share the feature matrix Input task decoding module set, where n represents the number of tasks, d ′ Represents the dimension of shared feature representation, the i-th row vector represents the shared feature representation of the i-th task; S72. For the i-th task, the shared feature is represented as h i Input the corresponding decoding module, after two layers of nonlinear transformation and one layer of output mapping, to generate a prediction vector where c i Represents the predicted output dimension of the i-th task; S73. Combine all prediction vectors into a prediction result set As the final prediction result of all tasks.
9. The multi-task adaptive learning method based on dynamic strategy switching according to claim 1, characterized in that: The S8 specifically includes: S81. Collect the prediction results of all tasks and the corresponding true label set Y = [y1,y2,…,y n ] to match and calculate the total loss function value: in, represents the weighted total loss of all tasks, represents the single-task loss function of the i-th task, represents the loss weight of the i-th task, Represents the prediction result, represents the true label, c i represents the prediction dimension; S82, based on the total loss function value Perform backpropagation calculations to generate parameter gradients; S83, using parameter gradients to synchronously update the learnable parameters included in the feature extraction network, the nonlinear cross fusion unit, and the policy scheduling controller; S84. After completing one update, the new parameters are used for the next round of task input processing and the process goes to step S2.
Citation Information
Cited By
Waste residue recovery silica sol production control method based on machine learning
CN121165659A
Machine Learning-Based Control Method for Waste Recycling and Silica Sol Production
CN121165659B