Data processing method and device, equipment and storage medium
By generating probability distribution vectors and weighted combined basis vectors through a routing network, the performance loss caused by simple truncation in multi-task joint optimization learning is solved, adaptive weight updates are achieved, and the overall performance of the model and its ability to represent task features are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2026-01-05
- Publication Date
- 2026-04-10
AI Technical Summary
In existing multi-task joint optimization learning, simply truncating low-rank matrix modules leads to the loss of important structural information, affecting overall performance.
The probability distribution vector generated by the routing network is used to represent the weights of the expert network. The basis vectors in the subspace of the weight update of the adaptation network are weighted and combined. Combined with the data processing of the backbone network, the basis vector combination of the weight update is adaptively selected to avoid simple truncation.
It improves the overall performance of multi-task joint optimization, retains the ability to express key task-related features, dynamically adjusts parameter capacity, and enhances the model's generalization ability and efficiency.
Smart Images

Figure CN121834352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a data processing method, apparatus, device, and storage medium. Background Technology
[0002] Multi-task joint optimization learning (MTBL) significantly improves model inference efficiency and generalization ability, reduces deployment costs, and lessens the maintenance burden of multiple independent models through parameter sharing and joint training. Furthermore, the MTBL framework leverages inter-task correlations and knowledge transfer to enhance the performance of each task, especially in data-scarce scenarios where auxiliary tasks can provide implicit data augmentation and regularization effects to the primary task, making the model more practical and robust in real-world environments. Therefore, MTBL models, with their strong generalization ability, parameter efficiency, and knowledge sharing capabilities, have been widely applied in several key areas such as intelligent dialogue and autonomous driving.
[0003] The proposed technical solutions effectively achieve multi-task joint optimization learning and achieve leading performance on several commonly used evaluation benchmarks. These solutions introduce a gated routing mechanism to dynamically allocate appropriate parameter capacity based on task characteristics, adaptively configure the rank of the low-rank matrix for different tasks, and truncate the unified low-rank matrix module according to the selected rank, thus achieving adaptive control of parameter updates. However, because these solutions employ a simple truncation strategy for the low-rank matrix module, retaining only the subspace corresponding to the first k singular values and discarding the rest, they result in the loss of structural information important to some tasks. Therefore, how to further improve the overall performance of multi-task joint optimization learning is a problem that urgently needs to be solved. Summary of the Invention
[0004] This application provides a data processing method, apparatus, device, and storage medium that can improve the overall performance of multi-task joint optimization.
[0005] In a first aspect, embodiments of this application provide a data processing method, including: Obtain at least one training sample data corresponding to at least two tasks; the at least two tasks include a first task. The embedding representation vector corresponding to the first task is processed using a routing network to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks. The basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result. Based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data, the routing network and the weight update amount are updated.
[0006] Secondly, embodiments of this application provide a data processing method, including: Obtain the input data for the first task; The embedding representation vector corresponding to the first task is processed using a routing network to obtain a probability distribution vector. The probability distribution vector is used to represent the weights of the expert network corresponding to at least two tasks, including the first task. The basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The input data is processed using the backbone network, and a predicted sequence representation corresponding to the input data is output based on the weighted combination result.
[0007] Thirdly, embodiments of this application provide a data processing apparatus, including: An acquisition unit is used to acquire at least one training sample data corresponding to at least two tasks; the at least two tasks include a first task. A routing network is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector, wherein the probability distribution vector is used to represent the weights of the expert networks corresponding to the at least two tasks. The weighted combination unit is used to perform weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector, so as to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network is used to process the first training sample data corresponding to the first task, and output the predicted sequence representation corresponding to the first training sample data according to the weighted combination result. The parameter update unit is used to update the parameters of the routing network and the weight update amount according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
[0008] Fourthly, embodiments of this application provide a data processing apparatus, characterized in that it includes: The acquisition unit is used to acquire the input data for the first task; A routing network is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector, wherein the probability distribution vector is used to represent the weights of the expert network corresponding to at least two tasks, wherein the at least two tasks include the first task. The weighted combination unit is used to perform weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector, so as to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network is used to process the input data and output the predicted sequence representation corresponding to the input data based on the weighted combination result.
[0009] Fifthly, embodiments of this application provide an electronic device, including: a processor and a memory, the memory being used to store a computer program, and the processor being used to call and run the computer program stored in the memory to perform the methods as described in the first or second aspect.
[0010] In a sixth aspect, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the methods as described in the first or second aspect.
[0011] In a seventh aspect, embodiments of this application provide a computer program product including computer program instructions that cause a computer to perform the methods described in the first or second aspect.
[0012] Eighthly, embodiments of this application provide a computer program that causes a computer to perform the methods described in the first or second aspect.
[0013] This embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector representing the weights of the expert networks corresponding to at least two tasks. Then, based on this probability distribution vector, the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined to obtain a weighted combination result. The backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them, thereby preserving the expressive power of the key features related to the task as much as possible and improving the overall performance of multi-task joint optimization. Attached Figure Description
[0014] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this application; Figure 2 A schematic diagram of the multi-task learning framework provided in the embodiments of this application; Figure 3 A schematic flowchart illustrating a data processing method provided in an embodiment of this application; Figure 4 A schematic flowchart illustrating another data processing method provided in an embodiment of this application; Figure 5 A schematic diagram of a multi-task learning process provided in an embodiment of this application; Figure 6 A schematic flowchart illustrating a data processing method provided in an embodiment of this application; Figure 7 This is a schematic block diagram of a data processing apparatus according to an embodiment thereof; Figure 8 This is a schematic block diagram of a data processing apparatus according to an embodiment thereof; Figure 9 This is a schematic block diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0015] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0016] It should be understood that in the embodiments of this application, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0017] In the description of this application, unless otherwise stated, "at least one" means one or more, and "multiple" means two or more. Additionally, "and / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0018] It should also be understood that the descriptions of "first", "second", etc. appearing in the embodiments of this application are only for illustration and to distinguish the objects being described, and there is no order to them. They do not indicate any special limitation on the number of devices in the embodiments of this application, and cannot constitute any limitation on the embodiments of this application.
[0019] It should also be understood that specific features, structures, or characteristics relating to embodiments in the specification are included in at least one embodiment of this application. Furthermore, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0020] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion, such that a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.
[0021] First, the relevant terms used in the embodiments of this application will be introduced.
[0022] Multi-task Joint Learning (MTL) is a mainstream machine learning paradigm that aims to build a unified intelligent model capable of handling multiple tasks simultaneously. It is far more than a simple mechanical combination of multiple independent tasks; rather, it is a sophisticated collaborative training strategy. By designing a unified architecture, MTL encourages the model to actively explore and utilize the potential shared structures and complementary information among these tasks while simultaneously learning multiple related tasks, thus generating a powerful synergistic effect where "the whole is greater than the sum of its parts." Its core idea lies in applying a beneficial "inductive bias" by sharing some or all model parameters across different tasks. This forces the model to move beyond a narrow understanding of a single task and instead learn a deeper, more generalizable universal representation. This abstract representation significantly improves the model's generalization and transfer capabilities not only on a single held-in task but also on related, previously unseen tasks.
[0023] Mixture-of-Experts (MoE) systems represent a significant evolution of the MTL framework, moving from traditional hard parameter sharing to a more refined and adaptive knowledge-sharing mechanism. The core of this system lies in its lightweight expert modules, which achieve an intelligent trade-off across multiple tasks—preserving task-specific knowledge isolation while promoting effective cross-task knowledge sharing. Each expert module focuses on learning different features or task patterns, while a learnable router / gating network dynamically calculates weights based on the characteristics of the input data, adaptively selecting and combining the outputs of relevant experts. This structure not only significantly enhances the model's expressive power and flexibility, enabling it to handle massive amounts of tasks and even significantly different learning objectives simultaneously, but also improves model efficiency through conditional computation. Therefore, the MoE architecture provides a scalable and high-performance solution for multi-task learning in large-scale, diverse scenarios.
[0024] Parameter-Efficient Fine-Tuning (PEFT) refers to achieving efficient adaptation to downstream tasks by updating only a very small number of parameters on a pre-trained model, thereby significantly reducing computational and storage costs. Among this series of methods, LoRA (Low-Rank Adaptation) is a representative technique. Its core idea is to add a low-rank adapter to the weights of the pre-trained model, rather than directly fine-tuning all the original parameters. Specifically, LoRA decomposes the weight update ΔW into the product of two low-dimensional matrices (ΔW = B·A), where the ranks of B and A are much smaller than the rank of the original weight matrix. The rank essentially controls the "width" or capacity of the adapter: a larger rank means larger dimensions of matrices B and A, more trainable parameters, and stronger expressive power during model fine-tuning, but also increased computational and storage overhead; conversely, a smaller rank, while more efficient, may limit the model's ability to adapt to complex tasks. Therefore, the selection of the rank is actually a key hyperparameter that balances parameter efficiency and model performance.
[0025] The proposed technical solutions effectively achieve multi-task joint optimization learning and achieve leading performance on several commonly used evaluation benchmarks. These solutions introduce a gated routing mechanism to dynamically allocate appropriate parameter capacity based on task characteristics, adaptively configure the rank of the low-rank matrix for different tasks, and truncate the unified low-rank matrix module according to the selected rank, thus achieving adaptive control of parameter updates. However, because these solutions employ a simple truncation strategy for the low-rank matrix module, retaining only the subspace corresponding to the first k singular values and discarding the rest, they result in the loss of structural information important to some tasks. Therefore, how to further improve the overall performance of multi-task joint optimization learning is a problem that urgently needs to be solved.
[0026] To address the aforementioned technical problems, embodiments of this application provide a data processing method, apparatus, device, and storage medium that can improve the overall performance of multi-task joint optimization.
[0027] Specifically, in the data processing method, at least one training sample data corresponding to at least two tasks is acquired; the at least two tasks include a first task; the embedding representation vector corresponding to the first task is processed using a routing network to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks; the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result; the first training sample data corresponding to the first task is processed using a backbone network, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result; the routing network and the weight update amount are updated according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
[0028] Therefore, this embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector for representing the weights of the expert networks corresponding to at least two tasks. Then, it performs a weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network based on the probability distribution vector to obtain a weighted combination result. The backbone network processes the first training sample data corresponding to the first task, and outputs the predicted sequence representation corresponding to the first training sample data based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them, thereby preserving the expressive power of the key features related to the task as much as possible and improving the overall performance of multi-task joint optimization.
[0029] In some embodiments, in the data processing method, the input text of a first task is obtained; the embedding representation vector corresponding to the first task is processed using a routing network to obtain a probability distribution vector, the probability distribution vector being used to represent the weights of expert networks corresponding to at least two tasks, the at least two tasks including the first task; the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result; the input data is processed using a backbone network, and the predicted sequence representation corresponding to the input data is output according to the weighted combination result.
[0030] Therefore, this embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector representing the weights of the expert networks corresponding to at least two tasks. Then, it performs a weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network based on the probability distribution vector to obtain a weighted combination result. The backbone network processes the input data corresponding to the first task, and outputs the predicted sequence representation corresponding to the input data based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them. This allows for dynamic adjustment of parameter capacity according to different task characteristics, preserving the expressive power of key task-related features as much as possible, and improving the overall performance of multi-task joint optimization.
[0031] Figure 1 A schematic diagram illustrating an application scenario of an embodiment of this application is shown.
[0032] like Figure 1 As shown, the system architecture may include user equipment 101, data acquisition equipment 102, training equipment 103, execution equipment 104, database 105, and content library 106.
[0033] The data acquisition device 102 is used to read sample data from the content library 106 and store the read sample data in the database 105. The sample data involved in this embodiment includes various types of sample data, such as training sample data in the training set, validation sample data in the validation set, and test sample data in the test set, etc., and is not limited thereto. For example, the sample data may include at least one of text sample data, image sample data, and audio sample data.
[0034] Training device 103 trains a machine learning model based on sample data maintained in database 105. The machine learning model obtained by training device 103 can effectively perform model inference, such as intelligent dialogue, autonomous driving perception and decision-making, multimodal interaction, and personalized recommendation. For example, the machine learning module can be a multi-task model, i.e., a unified model capable of handling multiple tasks simultaneously; this application does not limit this. Optionally, the machine learning model obtained by training device 103 can be applied to different systems or devices.
[0035] Additionally, refer to Figure 1 The execution device 104 is equipped with an I / O interface 107 for data interaction with external devices. For example, it receives input from the user device 101 through the I / O interface. The computing module 109 in the execution device 104 processes the input data using a trained machine learning model, outputs inference results, and sends the corresponding results to the user device 101 through the I / O interface.
[0036] User equipment 101 may include mobile phones, computers, smart voice interaction devices, wearable devices, smart home appliances, in-vehicle equipment, aircraft, or other terminal devices.
[0037] The execution device 104 can be a server. For example, the server can be a rack server, blade server, tower server, or cabinet server, etc. The server can be a standalone server or a server cluster composed of multiple servers.
[0038] In this embodiment, the execution device 104 is connected to the user equipment 101 via a network. The network can be an intranet, the Internet, the Global System for Mobile Communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, voice communication network, or other wireless or wired networks.
[0039] Optionally, in some embodiments, the machine learning model can also be deployed on the user device 101. After acquiring input data, the user device 101 processes the input data using the trained machine learning model and outputs inference results.
[0040] In some embodiments, the machine learning model may include a multi-task model, including a routing network, a backbone network, and an adaptation network, wherein the backbone network freezes its parameters during training, and the adaptation network configured with it has learnable weight update amounts. In this embodiment, at least one training sample data corresponding to at least two tasks is obtained; the routing network processes the embedding representation vector corresponding to the first task to obtain a probability distribution vector, which represents the weights of the expert networks corresponding to the at least two tasks; the basis vectors in the subspace corresponding to the weight update amounts of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result; the backbone network processes the first training sample data corresponding to the first task, and outputs a predicted sequence representation corresponding to the first training sample data according to the weighted combination result; the routing network and the weight update amounts are updated according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
[0041] In some embodiments, the input text of the first task can be obtained, and the embedding representation vector corresponding to the first task can be processed using a routing network to obtain a probability distribution vector. This probability distribution vector is used to represent the weights of the expert networks corresponding to at least two tasks. The basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result. The input data is processed using a backbone network, and the predicted sequence representation corresponding to the input data is output according to the weighted combination result.
[0042] It should be noted that, Figure 1 This is merely a schematic diagram of a system architecture provided in this application embodiment, and the positional relationships between the devices, components, modules, etc. shown in the figure do not constitute any limitation. In some embodiments, the data acquisition device 102, user device 101, training device 103, and execution device 104 may be the same device. The database 105 may be distributed across one server or multiple servers, and the content library 106 may be distributed across one server or multiple servers.
[0043] For example, the embodiments of this application can be used in various application scenarios, including but not limited to: Intelligent customer service and dialogue system: It can simultaneously realize tasks such as object intent recognition, sentiment judgment, semantic parsing and multi-turn dialogue management in one model, effectively improving system response consistency and service efficiency, and reducing maintenance costs caused by multi-module coupling; The integrated perception and decision-making system for autonomous driving can process camera and LiDAR data in parallel, and simultaneously complete tasks such as target detection, drivable area segmentation, behavior prediction and local path planning, thereby enhancing the system's collaborative perception and real-time decision-making capabilities in complex scenarios. Multimodal interaction applications on edge devices: In mobile terminals or embedded devices with limited computing power, low-rank adaptation and dynamic routing mechanisms are used to achieve unified deployment and efficient execution of multimodal tasks such as voice wake-up, image recognition, and gesture understanding. Large-scale content moderation and security governance platform: Supports multi-task concurrent analysis of text, images, videos and other content, including sensitive information detection, specific content identification, deepfake detection and copyright protection, improving the coverage and response speed of the moderation system; Personalized recommendation and object profiling system: By using a unified model to simultaneously learn object click prediction, dwell time estimation, interest tag generation, and cross-modal preference alignment, more accurate and efficient multi-objective recommendations can be achieved.
[0044] For example, in the application scenario of intelligent customer service and dialogue system, at least one training sample data corresponding to at least two tasks can be obtained; the at least two tasks include a first task. For example, the at least two tasks may include an intent recognition task, a sentiment judgment task, a semantic parsing task, a dialogue generation task, etc., without limitation, and the first task can be any one of the at least two tasks. For example, the training sample data corresponding to each task may include at least one of text sample data, image sample data, and audio sample data. Then, the embedding representation vector corresponding to the first task is processed by the routing network to obtain a probability distribution vector, which is used to represent the weights of the expert network corresponding to the at least two tasks; the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result; and the first training sample data corresponding to the first task is processed by the backbone network, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result. For example, the predicted sequence representation can be a predicted text sequence representation. Then, based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data, the routing network and the weight update amount are updated to obtain a trained multi-task model, which includes the routing network, the backbone network, and the adaptation network. This multi-task model can be the customer service and dialogue system. During the model inference phase, input data for the first task can be obtained, such as at least one of input text data, image data, and audio data. The routing network is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector. This probability distribution vector is used to represent the weights of the expert networks corresponding to at least two tasks. The basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain a weighted combination result. The backbone network is used to process the input data, and the predicted sequence representation corresponding to the input data is output based on the weighted combination result. This predicted sequence representation can be a predicted text sequence representation. Therefore, by designing a unified architecture, this embodiment of the application allows the model to learn deeper and more generalized general feature representations by mining and utilizing the potential shared structures and complementary information between these tasks while simultaneously learning multiple related tasks. Furthermore, in this embodiment, the basis vectors in the subspace corresponding to the weight update amount of the adaptive network are weighted and combined according to the probability distribution vector output by the routing module. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them. This preserves the expressive power of key features related to the task as much as possible and improves the overall performance of multi-task joint optimization.
[0045] Figure 2A schematic diagram of a system architecture for multi-task collaborative learning according to an embodiment of this application is shown.
[0046] like Figure 2 As shown, the system architecture includes a backbone network 210, a routing network 220, and an adaptation network 230. The backbone network 210 can be pre-trained based on a general knowledge base, including basic parameters shared by multiple tasks. It can convert inputs into high-level semantic representations and can also be called a base model. For example, the backbone network 210 can be an encoder-decoder structure, such as the T5-3B model. The routing network 220 can generate the weights of the expert network corresponding to multiple tasks and can also be called a gating network. The adaptation network 230 is an adaptation network added to the weights of the pre-trained backbone network 210, thereby achieving efficient adaptation to downstream tasks by only updating the parameters of the adaptation network 230 on the basis of the pre-trained model, thus reducing computational and storage costs. For example, the adaptation network 230 can be a low-rank decomposition adapter, such as LoRA. Multi-task joint learning, through parameter sharing and joint training, significantly improves the model's inference performance and generalization ability, reduces deployment costs, and reduces the maintenance burden of multiple independent models.
[0047] In this embodiment, during the model training phase, the embedding representation vector corresponding to the first task can be input into the routing network 220. The routing network 220 processes the embedding representation vector of the first task to obtain a probability distribution vector, which represents the weights of the expert networks corresponding to at least two tasks. Then, the basis vectors in the subspace corresponding to the weight update amount of the adapter 230 can be weighted and combined according to the probability distribution vector to obtain a weighted combination result. Then, the training sample data of the first task is input into the backbone network 210. The backbone network 210 processes the training sample data and outputs the predicted sequence representation corresponding to the training sample data according to the weighted combination result. Then, the parameters of the routing network 220 and the adapter network 230 can be updated according to the predicted sequence representation and the target sequence representation corresponding to the training sample data to obtain a trained multi-task joint learning framework. During the model inference phase, all model parameters are frozen, and the embedding representation vector of the task corresponding to the input data is input into the routing network 220. The routing network 220 processes the embedding representation vector corresponding to the task to obtain a probability distribution vector. This probability distribution vector is used to represent the weights of the expert networks corresponding to at least two tasks. Based on this probability distribution vector, the basis vectors in the subspace corresponding to the weight update amount of the adaptation network 230 are weighted and combined to obtain the weighted combination result. Then, the input data is input into the backbone network 210, which processes the input data and outputs the predicted sequence representation corresponding to the input data based on the weighted combination result.
[0048] The technical solutions of the embodiments of this application will be described in detail below through some examples. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0049] Figure 3 This is a schematic flowchart illustrating a multi-task model training method 300 provided in an embodiment of this application. Method 300 can be executed by any electronic device with data processing capabilities; for example, the electronic device can be implemented as... Figure 1 The training device 103 in this application is not limited thereto. Figure 3 As shown, method 300 includes steps S310 to S350.
[0050] S310, acquire at least one training sample data corresponding to at least two tasks respectively; the at least two tasks include the first task. Specifically, the core objective of the multi-task model training method in this application is to enable the model to simultaneously master the processing capabilities of at least two (e.g., multiple tasks) by constructing a modular architecture for collaborative learning. To achieve this objective, at least two (e.g., multiple tasks) can be selected to construct a multi-task training set, for example, a training set of 13 tasks can be constructed. Each task can correspond to a training set, which may include at least one training sample data corresponding to that task.
[0051] Optionally, in some embodiments, the training sample data includes at least one of text sample data, image sample data, and audio sample data.
[0052] The first task can be any one of at least two tasks. For example, a task can be randomly selected from multiple tasks as the first task. This application does not limit this.
[0053] It should be understood that the embodiments of this application are described using the multi-task model training of the training sample data of the first task as an example. Similar operations are performed for other tasks, and the relevant description of the first task can be referred to.
[0054] For example, during the training data construction phase, highly discriminative cue word templates can be designed specifically for each task to ensure that the model can clearly identify the goals and output requirements of different tasks even in the early stages of training.
[0055] One feasible approach is to uniformly define the training sample data format as a structured sample containing three key fields: the instruction field explicitly describes the task objective, output format, and quality specifications; the input field provides structured input content; and the output field consists of standard gold labels. This standardized data construction method lays a high-quality semantic alignment foundation for multi-task joint learning. Some specific examples of prompt word templates are shown below: 'cola': "cola Grammatical Acceptability Judgment Task: Based on linguistic theory, determine whether the following sentence is grammatically [acceptable] or [unacceptable].\nSentence to be judged: {sentence}" 'mnli': "mnli Natural Language Reasoning Task: Please analyze the logical relationship between the hypothesis and the premise, and classify it as [implication], [neutral], or [contradiction].\nHypothesis: {hypothesis}\nPremise: {premise}" 'mnli_match': "mnli Natural Language Reasoning Task: Analyze the logical relationship between the hypothesis and the premise, classifying it as [implication], [neutral], or [contradiction].\nHypothesis: {hypothesis}\nPremise: {premise}" 'mnli_mismatch': "mnli cross-domain natural language reasoning task: Analyze the logical relationship between the hypothesis and premise, classifying them as [implication], [neutral], or [contradiction]. Note that this task tests cross-domain generalization ability.\nHypothesis: {hypothesis}\nPremise: {premise}" 'mrpc': "mrpc Semantic Equivalence Judgment Task: Determine whether two sentences are semantically equivalent, classifying them as [equivalent] or [inequivalent]. Focus on the meaning of the sentences rather than their surface wording.\nSentence 1: {sentence1}\nSentence 2: {sentence2}" 'qnli': "qnli Question-Answering Reasoning Task: Please determine whether the context sentence contains the answer to the question, and classify it as [implied] or [not implied].\nQuestion: {question}\nContext Sentence: {sentence}" 'qqp': "qqp Question Duplication Detection Task: Please determine whether two questions are semantically duplicated, classifying them as [duplicated] or [not duplicated]. Pay attention to the intent of the questions rather than their surface wording.\nQuestion 1: {question1}\nQuestion 2: {question2}" 'rte': "rte Text Entailment Recognition Task: Please determine whether sentence 1 logically implies sentence 2, and classify it as [implied] or [not implied].\nSentence 1: {sentence1}\nSentence 2: {sentence2}" 'sst2': "sst2 movie review sentiment analysis task: Please determine the sentiment tendency of the sentence and classify it as [positive] or [negative].\nSentence to be analyzed: {sentence}" 'stsb': "stsb semantic similarity prediction task: Please predict the semantic similarity between two sentences and output a score between 0.0 and 5.0, in increments of 0.2.\nSentence 1: {sentence1}\nSentence 2: {sentence2}" 'arc_c': "arc Reasoning Challenge: Please choose the best answer for the question.\nQuestion: {question}\nOptions: {choices}" 'arc_e': "Arc Basic Reasoning Task: Please choose the best answer for the question.\nQuestion: {question}\nOptions: {choices}" 'obqa': "obqa Open Book Q&A Task: Please choose the best answer for the question.\nQuestion: {question_stem}\nOptions: {choices}" 'boolq': "boolq Boolean Question and Answer Task: Please answer the following yes / no questions based solely on the provided passage content, outputting [yes] or [no].\nQuestion: {question}\nPassage: {passage}" 'piqa': "piqa Physics Common Sense Reasoning Task: Please select the most logical and common-sense solution to achieve the goal, and output [Solution 1] or [Solution 2].\nGoal: {goal}\nSolution 1: {sol1}\nSolution 2: {sol2}" S320, the embedding representation vector corresponding to the first task is processed using the routing network to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks.
[0056] Specifically, this embodiment obtains the weights of the expert networks corresponding to different tasks through a dynamic routing mechanism. These weights can be used to weighted combine the basis vectors in the subspace corresponding to the weight update amount of the adaptation network, indicating the combined weight of the current first task in the subspace, thereby achieving differentiated requirements for the parameter capacity of the adaptation network for different tasks. Specifically, the embedding representation vector corresponding to the first task can be input into the routing network, and the routing network can process the embedding representation vector corresponding to the first task to output a probability distribution vector. This probability distribution vector is used to represent the weights of the expert networks corresponding to at least two tasks.
[0057] For example, each task can correspond to an expert network, and the dimension of the probability distribution vector is equal to the number of at least two tasks, i.e. the number of expert networks. Each element in the probability distribution vector can correspond to the weight of the expert network for a task, representing the importance weight of the corresponding subspace.
[0058] It should be noted that the embodiments of this application do not limit the process by which the routing network processes the embedded representation corresponding to the first task to obtain the probability distribution vector.
[0059] In one implementation, each element in the output layer of the routing network can be independently activated using a sigmoid function, generating independent importance weights for each task. It's important to note that the probability distribution vector output by the routing network is not truncated to the first k (top-k) values; instead, it outputs probability distribution vectors for independent task weights, thus enabling the combination of multiple expert networks, rather than just the first k expert networks.
[0060] In some embodiments, each element in the probability distribution vector takes the value 0 or 1.
[0061] Specifically, for each element in the probability distribution vector output by the sigmoid function of the routing network, its value is between 0 and 1. In this embodiment, the value of each element in the probability distribution vector can be binary classified, where elements greater than or equal to 0.5 can be 1, and elements less than 0.5 can be 0. By constraining each element in the probability distribution vector to be 0 or 1, the sparsity of the subspace corresponding to the weight update can be selected.
[0062] In some embodiments, before step S320, the embedding representation vector corresponding to each task may also be obtained. It should be noted that this application does not limit the process of obtaining the embedding representation vector corresponding to each task.
[0063] The following describes one implementation process for obtaining the embedding representation vector of the first task, taking the first task as an example. Specifically, the embedding representation vector corresponding to the first task can be obtained by executing the following steps S321 to S323.
[0064] S321, obtain at least two embedding representation vectors corresponding to at least two training sample data corresponding to the first task.
[0065] For example, when the training sample data is text data, a pre-trained model (such as the T5 model) can be used to identify the i-th text corresponding to each training sample data. Mapped to embedded representation vector ,in , Embedded representation vector Dimensions.
[0066] One possible way is to process text. The text is obtained by performing word segmentation, forward propagation of the model, pooling, and normalization operations. Embedded representation vector Specifically, this can be done on the text. Tokenization is performed to obtain a token sequence. And generate the corresponding attention mask. (Used to distinguish between real tokens and padding tokens). Then, the token sequence... The input model undergoes forward propagation, and the model outputs text. The hidden state. One implementation method is as follows: the forward propagation process of the model can be represented by the following formula (1): (1) in, For model parameters, The sequence length is The hidden state matrix.
[0067] Next, retrieve the hidden state corresponding to the last valid token to obtain... Finally, regarding Perform normalization (such as L2 normalization) to obtain unit vectors. text Mapped to embedded representation vector .
[0068] It should be noted that the above description of obtaining the embedding vector representation of training sample data uses text data as an example. This application does not limit the implementation process of obtaining the embedding vector representation of training sample data. For example, when the training sample data is image data, a pre-trained model (such as a convolutional neural network model, a vision encoder (Vision Transformer, ViT), etc.) can be used to map the high-dimensional pixel space to a low-dimensional semantic space to obtain the embedding vector representation of the image data. When the training sample data is audio data, video features can be extracted, and a pre-trained model (such as an audio encoder) can be used to map the time-frequency signal to the semantic space to obtain the embedding vector representation of the audio data.
[0069] S322, cluster centers are obtained by clustering based on the at least two embedded representation vectors.
[0070] Specifically, for the training sample set of the first task, the set of embedding representation vectors... This allows us to find a cluster center (medoids). The goal is to minimize the sum of the distances (e.g., cosine distances) from all vectors in the set to the cluster center. Here, N represents the number of training samples.
[0071] For example, cluster centers can be obtained by clustering at least two embedding representation vectors using the K-Means clustering method. In some embodiments, other clustering methods, such as hierarchical clustering and density-based clustering, can also be used for clustering, and this application does not limit the scope of these methods.
[0072] S323, determine the embedding representation vector corresponding to the first task based on the embedding representation vector of the training sample data corresponding to the cluster center.
[0073] For example, the embedding representation vector of the training sample data corresponding to the cluster centers can be used. The embedding representation vector corresponding to the first task is determined. In some embodiments, the embedding representation vector corresponding to the first task is... It can be used as an initialization vector for the first task. During model training, the embedding representation vector for the first task can be optimized by continuously adjusting it, thus obtaining the optimal embedding representation vector for the first task.
[0074] In one embodiment, the embedding representation vectors of all sample data can be obtained through model forward propagation, pooling operations, and normalization. Then, the embedding representation vectors of sample data under the same task are clustered, and the embedding representation vector of the sample data corresponding to the cluster center is selected as the initial representation of that task. This embodiment effectively utilizes the distribution characteristics of the data itself, enabling the task representation to possess a certain semantic discriminative ability in the early stages of training. This alleviates the cold start problem caused by random initialization, provides a more reliable input basis for the routing mechanism, and thus realizes a cluster-based high-information task representation initialization strategy.
[0075] Therefore, this application embodiment clusters the embedding representation vectors of at least two training sample data for the same task, and selects the embedding representation vector of the training sample data corresponding to the cluster center as the embedding representation vector of the task. This can effectively utilize the distribution characteristics of the training sample data itself, so that the task representation has a certain semantic discrimination ability in the early stage of training, thereby alleviating the cold start problem caused by random initialization, providing a more reliable input basis for the routing network, and enhancing the reliability of routing decisions and training stability.
[0076] S330, the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain the weighted combination result.
[0077] Specifically, in step 320, after processing the embedding representation vector of the first task using the routing network to obtain the probability distribution vector, the basis vectors in the subspace corresponding to the weight update vector of the adaptation network can be weighted and combined according to the probability distribution vector to obtain the weighted combination result, i.e. the combined weight. This allows the model to dynamically adjust the contribution of each subspace according to the task characteristics, thereby realizing the differentiated requirements of the parameter capacity of the adaptation network for different tasks. This enables the model to capture task-related features more effectively and significantly enhances the flexibility and adaptability of the model expression.
[0078] For example, the adapter network is a parameter-adjustable module of the pre-trained backbone network. For instance, a low-rank adapter network is added to the weight bypass of the backbone network. This allows the backbone network to efficiently adapt to downstream tasks during model training by only updating the weights of the adapter network, without needing to adjust the relevant parameters of the backbone network. This effectively reduces the computational and storage costs of training. For example, the adapter network can be a low-rank decomposition adapter, such as LoRA.
[0079] It should be noted that the embodiments of this application do not limit the method of weighted combination of basis vectors in the subspace corresponding to the weight update amount of the adaptation network based on the probability distribution vector.
[0080] In some embodiments, the step of weighting and combining the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector to obtain the weighted combination result includes the following steps S331 to S333.
[0081] S331, convert the probability distribution vector into a diagonal matrix.
[0082] For example, the probability distribution vector output by the routing network It can be expressed as the following formula (2): (2) in, , .
[0083] in, The data representing the expert network is also the size of the rank of the low-rank subspace. Indicates the weight of the routing network. This represents the bias parameters of the routing network. This is the embedding representation vector for the task. The dimension of the embedded representation for the task.
[0084] The probability distribution vector Convert to a diagonal matrix It can be expressed as the following formula (3): (3) in, This represents diagonal matrix operations. These are the diagonal elements of the diagonal matrix D. . The corresponding dedicated network does not participate. When the corresponding expert network is fully activated, At that time, the corresponding expert network section is activated.
[0085] S332, decompose the first matrix and the second matrix into r subspaces along the rank dimension, where r is the rank of the diagonal matrix and r is a positive integer; the first matrix and the second matrix are obtained by performing low-rank decomposition on the weight update amount.
[0086] Specifically, the weight update can be decomposed into two low-dimensional matrices. The first and second matrices are decomposed along the rank dimension into r independent column vectors and row vectors, resulting in a rank-1 subspace. In a multi-task learning framework, each subspace can correspond to an expert network.
[0087] Taking LoRA as an example, the weight update amount ΔW can be decomposed into the product of two low-dimensional matrices, i.e., ΔW = B·A. The ranks of matrices B and A are much smaller than the rank of the original weight matrix of the backbone network. This rank essentially controls the parameter capacity of LoRA; the larger the rank value, the larger the dimension of matrices B and A, and the more trainable parameters. Conversely, a smaller rank corresponds to fewer trainable parameters.
[0088] For example, by decomposing matrices B and A by columns, we can obtain: ,
[0089] ,
[0090] in, , This represents a low-rank matrix in LoRA.
[0091] The weight update amount ΔW can then be expressed as the following formula (4): ΔW= = (4) For each component Each matrix is rank 1, corresponding to an expert network.
[0092] S333, the basis vectors of the r subspaces are weighted and combined using the diagonal matrix to obtain the weighted combination result.
[0093] Specifically, the diagonal matrix obtained from the probability distribution vector transformation in step S331 can be used to weight and combine the basis vectors of the r subspaces obtained from the decomposition in step S332, thereby achieving task-specific rank allocation. This allows the model to select and combine corresponding subspaces based on the weights of each expert network to handle different tasks, i.e., the model dynamically adjusts the contribution of each subspace according to the task characteristics. Therefore, the embodiments of this application can enhance the flexibility and adaptability of the model expression while maintaining parameter efficiency, enabling the low-rank adaptation process to more effectively capture the relevant features of the task.
[0094] Continuing with the example above, based on the diagonal matrix... The basis vectors of the r subspaces of the weight update amount ΔW are weighted and combined, and the diagonal matrix is embedded between the low-rank matrices B and A of the LoRA structure, i.e. B·D·A, so as to realize the refined weighted combination of the r subspaces through the weight coefficients in the diagonal matrix D.
[0095] S340, the backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result.
[0096] Specifically, the first training sample data corresponding to the first task can be input into the backbone network, and the diagonal matrix corresponding to the probability distribution vector of the task weights output by the routing network can be embedded into the low-rank matrix of the adaptation network. The task adaptive representation, i.e. the predicted sequence representation corresponding to the first training sample data, can be obtained through forward propagation.
[0097] For example, the predicted sequence representation can be shown in the following formula (5): (5) in, The parameter weights represent the backbone network parameters. This represents the input matrix, where b is the batch size. For the input feature dimension, Indicates the output matrix. This is the output feature dimension.
[0098] In one embodiment, the traditional softmax function in the routing network is replaced with a sigmoid function, and its output probability distribution vector is transformed into a diagonal matrix form. This enables fine-grained weighting and soft selection of different basis vectors for the weight update of the adaptation network. This allows each task to flexibly select the combination of basis vectors in the low-rank subspace according to its own needs, rather than simply truncating them. In this way, while maintaining parameter efficiency, the ability to express key features related to the task is preserved as much as possible, improving the overall performance of multi-task joint optimization and realizing the construction of a model architecture with hybrid low-rank subspace combinations.
[0099] S350, update the parameters of the routing network and the weight update amount according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data. Specifically, a loss function can be determined based on the predicted sequence representation of the first training sample data output by the model and the target sequence representation corresponding to the first training sample data. Backpropagation is then performed based on this loss function to update the parameters of the routing network and weight update amounts. In some embodiments, when the training stop condition is met, a trained multi-task model is output. This multi-task model includes the routing network, the backbone network, and the adaptation network, achieving end-to-end model parameter updating and optimization.
[0100] It should be understood that during model training, the parameters of the pre-trained backbone network are frozen, and the model is efficiently adapted to downstream tasks by updating the weights of the adaptation network. It should also be understood that in this embodiment, updating the weights is equivalent to updating the parameters of the adaptation network.
[0101] It should be noted that during the multi-task model training phase, steps S310 to S350 above can be performed on at least two tasks to update the parameters of the routing network and weight update amount based on the predicted sequence representation and template sequence representation corresponding to the training sample data of at least two tasks.
[0102] This embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector representing the weights of the expert networks corresponding to at least two tasks. Then, based on this probability distribution vector, the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined to obtain a weighted combination result. The backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them, thereby preserving the expressive power of the key features related to the task as much as possible and improving the overall performance of multi-task joint optimization.
[0103] It should be noted that, in this embodiment of the application, the method of updating the parameters of the routing network and the weight update amount based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data is not limited.
[0104] In some embodiments, updating the parameters of the routing network and the weight update amount based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data may include the following steps S351 and S352: S351, determine the first loss function based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
[0105] Specifically, based on the predicted sequence representation of the first training sample data and the target sequence representation corresponding to the first training sample data, the cross-entropy loss can be calculated to obtain the first loss function, which is used to measure the difference between the predicted sequence representation and the target sequence representation.
[0106] For example, the first loss function It can be represented by the following formula (6): (6) Where T represents the number of tasks. Let the target sequence of the t-th task be represented as follows: Let be the prediction sequence representation for the t-th task.
[0107] S352, update the parameters of the routing network and the weight update amount according to the first loss function.
[0108] In some embodiments, the following step S353 may also be performed: S353, a second loss function is obtained based on the embedding vector representation of the first training sample data, the embedding representation vector corresponding to the first task, and the embedding representation vector corresponding to the second task among the at least two tasks; wherein the first task is different from the second task.
[0109] Specifically, based on the embedding vector representation of the first training sample data, the embedding vector representation corresponding to the first task, and the embedding vector representation corresponding to the second task, the task contrast loss can be calculated to obtain the second loss function, which is used to make the embedding vector representation from a specific task closer to the embedding vector representation of that task in the representation space, and further away from the embedding vector representation of other tasks in the representation space, thereby achieving the learning and optimization of the embedding vector representation corresponding to the task.
[0110] For example, the second loss function It can be represented by the following formula (7): (7) The constraints are as follows: This is used to restrict comparisons to task representations only between different task types, thereby avoiding intra-task similarity calculations and enhancing the discriminativeness of task representations.
[0111] in, This represents the embedding representation vector of the first training sample data. This is the embedding vector representation corresponding to the first task. This is the embedding vector representation corresponding to the second task. Here, T represents the temperature hyperparameter, T represents the total number of tasks, and N represents the total number of training samples. This represents cosine similarity calculation, used to quantify the degree of alignment between vectors in a direction.
[0112] Specifically, step S352 can be implemented as follows: updating the parameters of the routing network, the weight update amount, and the embedding representation vector corresponding to the first task according to the first loss function and the second loss function.
[0113] Specifically, during the training process of the multi-task framework in this application, the overall loss may include a first loss function and a second loss function. For example, the overall loss function... It can be represented by the following formula (8): (8) in, It is a hyperparameter that can dynamically balance the weight ratio of the two loss functions.
[0114] This application's embodiments achieve a unified improvement in parameter efficiency and expressive power. At the model architecture level, this application's embodiments introduce a hybrid low-rank subspace combination mechanism. Specifically, the probability distribution vector output by the routing network, used to indicate the weights of the expert network, is used to weight and combine the low-rank subspace of the parameter update amount of the adaptation network. This endows the model with the ability to dynamically adjust parameter capacity according to different task characteristics, significantly enhancing the flexibility and completeness of the model representation. Furthermore, at the model training strategy level, a clustering-based high-information-content task representation initialization strategy is introduced. By clustering samples under the same task, the embedding representation vector of the sample corresponding to the cluster center is selected as the initial representation vector for that task. This enables the task representation to possess a certain semantic discriminative ability in the initial training stage, thereby alleviating the cold start problem caused by random initialization and providing a more reliable input basis for the routing mechanism.
[0115] In some embodiments, method 300 further includes the following steps S360 to S380.
[0116] S360, sample at least two training sample data corresponding to the first task according to the first sampling probability to obtain the first training sample data, wherein the first sampling probability is proportional to the number of training sample data corresponding to the first task.
[0117] Specifically, the embodiments of this application adopt a batch sampling strategy, that is, in each training batch, sampling is performed according to a preset sampling probability. (For example, the first sampling probability) randomly select a task The system then extracts samples of a corresponding batch size for training. In this mechanism, the sampling probability directly affects the learning opportunities and training balance for each task. Specifically, the sampling probability... Initialize to task Number of samples The sampling weights are proportional, meaning that the larger the sample size, the higher the sampling weight is assigned, thus making full use of the abundant samples in the early stages of training to achieve rapid convergence. This initialization strategy can be expressed as the following formula (9): (9) in, T represents the total number of tasks.
[0118] S370, determine the third loss function corresponding to the current verification sample data of the first task, and at least two fourth loss functions corresponding to the current verification sample data of the at least two tasks.
[0119] For example, after training each task in a batch, the trained model can be validated using validation sample data from the validation set corresponding to the task, and the loss function (i.e., the current validation loss) corresponding to the current validation sample data of each task can be obtained. For example, the third loss function corresponding to the current validation sample data of the first task, and at least two fourth loss functions corresponding to the current validation sample data of at least two other tasks.
[0120] One possible approach is that the third or fourth loss function can be obtained from the above formula (8).
[0121] Optionally, for each task, the loss function corresponding to the previous validation sample data can be retained, that is, the loss function corresponding to the historical validation sample data (i.e., historical validation loss). For example, for each task, the loss function corresponding to the validation sample data of a historical window (e.g., a size of 3) can be included, that is, the record of the loss function of the three most recent validations is retained.
[0122] S380, the first sampling probability is adjusted according to the third loss function and the at least two fourth loss functions, and at least two training samples corresponding to the first task are sampled according to the adjusted first sampling probability.
[0123] Specifically, based on the third loss function corresponding to the current validation sample data of the first task and the fourth loss function corresponding to the current validation sample data of other tasks, the initial sampling probability (i.e., the first sampling probability) of the first task is dynamically adjusted. For example, the sampling probability is dynamically updated according to the loss changes of each task after each round of validation, thereby optimizing the learning balance among multiple tasks.
[0124] It should be noted that the embodiments of this application do not limit the method of adjusting the first sampling probability according to the third loss function and the fourth loss function.
[0125] In some embodiments, adjusting the first sampling probability according to the third loss function and the at least two fourth loss functions, and sampling at least two training samples corresponding to the first task according to the adjusted first sampling probability, can be implemented by at least one of the following S381 to S383.
[0126] S381, if the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is lower than the average of the at least two fourth loss functions, then the first sampling probability is reduced by a first value to obtain a second sampling probability, and at least two training samples corresponding to the first task are sampled according to the second sampling probability.
[0127] Specifically, for tasks where the current validation loss does not show a continuous increase relative to the historical validation loss, its current loss can be compared with the average of the current validation losses of all tasks. If it is lower than the average of the current validation losses of all tasks, the sampling probability of the task can be appropriately reduced. For example, the first sampling probability can be reduced by a first value to obtain a second sampling probability. In subsequent batches of model training, this second sampling probability can be used to sample at least two training samples corresponding to the first task to obtain the sample set for the next batch of model training.
[0128] S382, if the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is higher than the average of the at least two fourth loss functions, then the first sampling probability is increased by a second value to obtain a third sampling probability, and at least two training samples corresponding to the first task are sampled according to the third sampling probability.
[0129] Specifically, for tasks where the current validation loss does not show a continuous increase relative to the historical validation loss, its current loss can be compared with the average of the current validation losses of all tasks. If it is higher than the average of the current validation losses of all tasks, the sampling probability of that task can be appropriately increased. For example, the first sampling probability can be increased by a second value to obtain a third sampling probability. This third sampling probability can then be used to sample at least two training samples corresponding to the first task in subsequent batches of model training to obtain the sample set for the next batch of model training.
[0130] S383, if the third loss function shows an upward trend relative to the loss function corresponding to the historical validation sample data, and is lower than the average of the at least two fourth loss functions, then the third value is reduced from the first sampling probability to obtain the fourth sampling probability, and at least two training samples corresponding to the first task are sampled according to the fourth sampling probability; wherein, the third value is greater than the first value.
[0131] Specifically, for tasks where the current validation loss is continuously increasing relative to historical validation losses, and where multiple validation losses corresponding to historical windows are continuously increasing (e.g., ... The current loss can be compared to the average of the current validation losses for all tasks. If it is lower than the average of the current validation losses for all tasks, the sampling probability for that task can be significantly increased. This means the system applies a stronger penalty to significantly reduce its sampling probability; for example, the first sampling probability can be reduced by a third value to obtain a fourth sampling probability, thus suppressing potential overfitting of that task. In subsequent batches of model training, this fourth sampling probability can be used to sample at least two training samples corresponding to the first task, obtaining the sample set for the next batch of model training.
[0132] In one possible implementation, the sampling probability can be updated using the mathematical form shown in the following formula (10):
[0133] (10) in, The loss is defined as three consecutive historical verifications within the time window. The current verification loss for the first task. This is the average of the current validation loss for all tasks. The updated sampling frequency, This is the sampling frequency before the update.
[0134] in, Adjust the intensity based on the base. >1 is the penalty enhancement factor. This design ensures that the sampling weights can be adaptively balanced according to the task learning state during training.
[0135] In some embodiments, a fixed-size evaluation window is set to continuously record the loss changes of each task on the validation set within the window. For example, if the validation loss of a certain task continues to rise and the current loss is lower than the average loss of the task, its sampling probability is gradually reduced to increase the penalty for potential overfitting signals. For other tasks, differentiated adjustments are made based on the relative relationship between their loss and the average of the overall loss. Tasks with losses below the average have their sampling weights appropriately reduced, while tasks with losses above the average have their sampling opportunities increased. This achieves dynamic balance and collaborative optimization among tasks during training, realizing a dynamic task sampling probability design mechanism.
[0136] Therefore, by using the third loss function corresponding to the validation sample data of the first task and at least two fourth loss functions corresponding to the validation sample data of at least two tasks, the adoption probability of each task can be dynamically adjusted based on the relationship between the validation loss functions of the tasks, thereby alleviating the imbalance and overfitting problems in the training of multi-task frameworks.
[0137] Figure 4This is a schematic flowchart illustrating another data processing method 400 provided in an embodiment of this application. Method 400 can be executed by any electronic device with data processing capabilities. For example, the electronic device can be implemented as... Figure 1 The training device 103 in this application is not limited thereto. Figure 4 As shown, method 400 includes steps S401 to S412.
[0138] S401, Obtain at least one training sample data corresponding to at least two tasks respectively.
[0139] For example, see Figure 5 In the task collection and data preparation process, at least one training sample data corresponding to each of at least two tasks can be obtained. Optionally, training sets, validation sets, and test sets can be obtained separately, where the training and validation sets can be used for multi-task joint optimization processes, and the test set can be used for multi-task inference generation processes. For example, multiple task sets can be obtained, such as tasks 1 to T. Each task can correspond to at least one training sample data.
[0140] Specifically, step S401 can be referred to Figure 3 Description of step S310.
[0141] S402, sample at least two training sample data corresponding to the first task according to the first sampling probability to obtain the first training sample data.
[0142] For example, see [link to example]. Figure 5 In a multi-task joint optimization process, the data from at least two training samples corresponding to each task set can first be sampled with an initial sampling probability (e.g., the first sampling probability) to obtain a batch of samples for each task. The batch samples are then used as input for one round of iterative training. For example, a batch of samples for task t (an example of the first task) may include the first training sample data.
[0143] Specifically, step S402 can be referred to Figure 3 The relevant description in step S360.
[0144] S403, obtain at least two embedding representation vectors corresponding to at least two training sample data corresponding to the first task; perform clustering based on the at least two embedding representation vectors to obtain cluster centers; determine the embedding representation vector corresponding to the first task based on the embedding representation vectors of the training sample data corresponding to the cluster centers.
[0145] For example, see [link to example]. Figure 5In the offline clustering and initialization process, step S403 can be executed to cluster the embedding vector representations corresponding to all training data samples for each task, and use the embedding representation vectors of the samples at the cluster centers as the initial embedding representation vectors for the corresponding tasks to obtain the embedding representation set corresponding to all tasks.
[0146] Specifically, step S403 can be referred to Figure 3 Descriptions of S321 to S323.
[0147] S404, the embedding representation vector corresponding to the first task is processed using the routing network to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks.
[0148] S405, convert the probability distribution vector into a diagonal matrix; decompose the first matrix and the second matrix into r subspaces along the rank dimension; the first matrix and the second matrix are obtained by performing low-rank decomposition on the weight update amount; use the diagonal matrix to perform a weighted combination of the basis vectors of the r subspaces to obtain the weighted combination result.
[0149] For example, see [link to example]. Figure 5 The embedded representation vector corresponding to the task can be input into the routing network to obtain the probability distribution vector, and then the probability distribution vector can be converted into a diagonal matrix D (i.e., the expert assignment matrix). The r subspaces obtained by decomposing matrices A and B through the diagonal matrix are weighted and combined to achieve task-specific rank allocation. This allows the model to select and combine the corresponding subspaces according to the weights of each expert network to handle different tasks. In other words, the model dynamically adjusts the contribution of each subspace according to the characteristics of the task.
[0150] Specifically, steps S404 and S405 can be referred to Figure 3 Description of steps S320 and S330.
[0151] S406, the backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result.
[0152] Specifically, step S406 can be referred to Figure 3 Description of step S340.
[0153] S407, determine a first loss function based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data, and obtain a second loss function based on the embedding vector representation of the first training sample data, the embedding representation vector corresponding to the first task, and the embedding representation vector corresponding to the second task among the at least two tasks.
[0154] S408, update the parameters of the routing network, the weight update amount, and the embedding representation vector corresponding to the first task according to the first loss function and the second loss function.
[0155] Optionally, a trained multi-task model can be obtained by updating the parameters of the routing network, the weight update amount, and the embedding representation vector corresponding to the first task.
[0156] Specifically, steps S407 and S408 can be referred to Figure 3 Description of step S350.
[0157] S409, determine the third loss function corresponding to the current verification sample data of the first task, and at least two fourth loss functions corresponding to the current verification sample data of the at least two tasks.
[0158] S410, if the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is lower than the average of the at least two fourth loss functions, then the first sampling probability is reduced by a first value to obtain a second sampling probability, and at least two training samples corresponding to the first task are sampled according to the second sampling probability.
[0159] S411, if the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is higher than the average of the at least two fourth loss functions, then the first sampling probability is increased by a second value to obtain a third sampling probability, and at least two training samples corresponding to the first task are sampled according to the third sampling probability.
[0160] S412, if the third loss function shows an upward trend relative to the loss function corresponding to the historical verification sample data, and is lower than the average of the at least two fourth loss functions, then the third value of the first sampling probability is reduced to obtain the fourth sampling probability, and at least two training samples corresponding to the first task are sampled according to the fourth sampling probability.
[0161] Specifically, steps S409 to S412 can be referred to Figure 3 Description of steps S370 and S380.
[0162] Therefore, this embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector for representing the weights of the expert networks corresponding to at least two tasks. Then, it performs a weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network based on the probability distribution vector to obtain a weighted combination result. The backbone network processes the first training sample data corresponding to the first task, and outputs the predicted sequence representation corresponding to the first training sample data based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them, thereby preserving the expressive power of the key features related to the task as much as possible and improving the overall performance of multi-task joint optimization.
[0163] Furthermore, in this embodiment, by clustering the embedding representation vectors of at least two training sample data for the same task, and selecting the embedding representation vector of the training sample data corresponding to the cluster center as the embedding representation vector of the task, the distribution characteristics of the training sample data itself can be effectively utilized, so that the task representation has a certain semantic discrimination ability in the early stage of training, thereby alleviating the cold start problem caused by random initialization, providing a more reliable input basis for the routing network, and enhancing the reliability of routing decisions and training stability.
[0164] In addition, the embodiments of this application can dynamically adjust the adoption probability of each task based on the relationship between the verification loss functions of the first task and at least two fourth loss functions corresponding to the verification sample data of at least two tasks, thereby alleviating the imbalance and overfitting problems in the training of multi-task frameworks.
[0165] Figure 6 This is a schematic flowchart illustrating another data processing method 600 provided in an embodiment of this application. Method 600 can be executed by any electronic device with data processing capabilities. For example, the electronic device can be implemented as... Figure 1 The calculation module 109 in the application is not limited in this respect. Figure 6 As shown, method 600 includes steps S610 to S640.
[0166] S610, obtain the input data for the first task.
[0167] For example, the first task can be a previously learned task in the multi-task framework learning phase, or it can be a new task; this application does not limit this. Optionally, the input data can include at least one of text data, image data, and audio data, without limitation.
[0168] For example, see Figure 5The input data can be sample data from the test set, and this application does not limit this. Steps S610 to S640 can correspond to... Figure 5 The multi-task reasoning generation process in [the context of the text].
[0169] S620, the embedding representation vector corresponding to the first task is processed using the routing network to obtain a probability distribution vector. The probability distribution vector is used to represent the weights of the expert network corresponding to at least two tasks, including the first task.
[0170] S630, the basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network.
[0171] S640, the backbone network is used to process the input data, and the predicted sequence representation corresponding to the input data is output according to the weighted combination result.
[0172] Specifically, the processing steps S620 to S640 are similar to... Figure 3 Steps S320 to S340 are similar and can be found in the descriptions above.
[0173] In some embodiments, the multi-task model includes the routing network, the backbone network, and the adaptation network, and the multi-task model is based on, for example... Figure 3 or Figure 4 The multi-task joint training method described above is used to obtain the model. The specific model training process can be found in the description above.
[0174] Therefore, this embodiment of the application processes the embedded representation vector corresponding to the first task using a routing network to obtain a probability distribution vector representing the weights of the expert networks corresponding to at least two tasks. Then, it performs a weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network based on the probability distribution vector to obtain a weighted combination result. The backbone network processes the input data corresponding to the first task, and outputs the predicted sequence representation corresponding to the input data based on the weighted combination result. This enables each task to adaptively select the basis vectors in the subspace corresponding to the weight update amount for weighted combination, rather than simply truncating them. This allows for dynamic adjustment of parameter capacity according to different task characteristics, preserving the expressive power of key task-related features as much as possible, and improving the overall performance of multi-task joint optimization.
[0175] This application's embodiments underwent comprehensive training and evaluation on the GLUE benchmark set and mainstream commonsense reasoning benchmarks. During the training phase, the number of training samples for each task was controlled to within 20,000 to ensure the efficiency and reproducibility of the experiments. Model performance strictly followed the principle of "optimization on the validation set and evaluation on the test set" to ensure the results were fair and reliable. The experiments used T5-3B as the basic pre-trained model (i.e., the backbone network), and the final comprehensive evaluation results showed that the method proposed in this application's embodiments significantly outperformed the selected baseline methods on multiple tasks. Regarding evaluation metrics, specific metrics were used for different tasks: the Matthews correlation coefficient (matthews_corrcoef) was reported for the cola task, the Pearson correlation coefficient (pearson_corrcoef) was reported for the stsb task, and accuracy was used uniformly for the remaining tasks to comprehensively and objectively reflect the model performance. The test results are shown in Table 1.
[0176] Table 1
[0177] In the baseline scheme, a traditional dynamic rank optimization method is adopted, where the task sampling probability is statically assigned, the routing mechanism adaptively assigns rank to each task based on a conventional gating structure, and the task embedding vectors are randomly initialized using a normal distribution. For fair comparison, experiments were conducted on the same dataset, training epochs, and learning rate settings in this application's embodiments. Experimental results show that the proposed method significantly outperforms the baseline method in overall average performance and across 12 specific tasks, verifying its effectiveness and superiority in multi-task scenarios.
[0178] Furthermore, embodiments of this application have verified the function of a series of key modules on the same training and test sets, as shown in Table 2: Table 2
[0179] Experimental results further demonstrate that among the various innovative strategies proposed in this application, the task embedding method based on center sample initialization contributes the most to the overall performance improvement, effectively enhancing the model's representation consistency and convergence stability in multi-task scenarios. Meanwhile, the dynamic sampling probability mechanism and the hybrid low-rank subspace routing strategy also exhibit significant improvement effects on different tasks, synergistically enhancing the overall performance of the method from the perspectives of training balance and flexible parameter allocation.
[0180] The specific embodiments of this application have been described in detail above with reference to the accompanying drawings. However, this application is not limited to the specific details of the above embodiments. Within the scope of the technical concept of this application, various simple modifications can be made to the technical solutions of this application, and these simple modifications all fall within the protection scope of this application. For example, the various specific technical features described in the above embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, this application will not describe the various possible combinations separately. Furthermore, various different embodiments of this application can also be arbitrarily combined, as long as they do not violate the spirit of this application, they should also be considered as the content disclosed in this application.
[0181] It should also be understood that, in the various method embodiments of this application, the sequence numbers of the above processes do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. It should be understood that these sequence numbers can be interchanged where appropriate so that the embodiments of this application described can be implemented in a sequence other than those illustrated or described.
[0182] The method embodiments of this application have been described in detail above. The following description, in conjunction with... Figures 7 to 9 The following describes in detail the device embodiments of this application.
[0183] Figure 7 This is a schematic block diagram of the data processing apparatus 10 according to an embodiment of this application. Figure 7 As shown, the device 10 may include an acquisition unit 11, a routing network 12, a weighted combination unit 13, a backbone network 14, and a training unit 14.
[0184] Acquisition unit 11 is used to acquire at least one training sample data corresponding to at least two tasks respectively; the at least two tasks include a first task. The routing network 12 is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks. The weighted combination unit 13 is used to perform weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network. The backbone network 14 is used to process the first training sample data corresponding to the first task, and output the predicted sequence representation corresponding to the first training sample data according to the weighted combination result. The parameter update unit 15 is used to update the parameters of the routing network and the weight update amount according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
[0185] In some embodiments, the weighting combination unit 13 is specifically used for: Convert the probability distribution vector into a diagonal matrix; The first matrix and the second matrix are decomposed into r subspaces along the rank dimension, where r is the rank of the diagonal matrix and r is a positive integer; the first matrix and the second matrix are obtained by performing low-rank decomposition on the weight update amount; The basis vectors of the r subspaces are weighted and combined using the diagonal matrix to obtain the weighted combination result.
[0186] In some embodiments, each element in the probability distribution vector takes the value 0 or 1.
[0187] In some embodiments, the acquisition unit 11 is further configured to: Obtain at least two embedding representation vectors corresponding to at least two training sample data corresponding to the first task; Cluster centers are obtained by clustering based on the at least two embedded representation vectors; The embedding representation vector corresponding to the first task is determined based on the embedding representation vector of the training sample data corresponding to the cluster center.
[0188] In some embodiments, the parameter update unit 15 is specifically used for: A first loss function is determined based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data; Based on the first loss function, the routing network and the weight update amount are updated.
[0189] In some embodiments, the parameter update unit 15 is specifically used for: A second loss function is obtained based on the embedding vector representation of the first training sample data, the embedding representation vector corresponding to the first task, and the embedding representation vector corresponding to the second task among the at least two tasks; wherein the first task is different from the second task. Based on the first loss function and the second loss function, the parameters of the routing network, the weight update amount, and the embedding representation vector corresponding to the first task are updated.
[0190] In some embodiments, the device 10 further includes a sampling unit for: The first training sample data is obtained by sampling at least two training sample data corresponding to the first task according to the first sampling probability, wherein the first sampling probability is proportional to the number of training sample data corresponding to the first task. The parameter update unit 15 is also used for: Determine the third loss function corresponding to the current verification sample data of the first task, and at least two fourth loss functions corresponding to the current verification sample data of the at least two tasks; The first sampling probability is adjusted according to the third loss function and the at least two fourth loss functions, and at least two training samples corresponding to the first task are sampled according to the adjusted first sampling probability.
[0191] In some embodiments, the parameter update unit 15 is specifically used for: If the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is lower than the average of the at least two fourth loss functions, then the first sampling probability is reduced by a first value to obtain a second sampling probability, and at least two training samples corresponding to the first task are sampled according to the second sampling probability. If the third loss function does not show an upward trend relative to the loss function corresponding to the historical validation sample data, and is higher than the average of the at least two fourth loss functions, then the first sampling probability is increased by a second value to obtain a third sampling probability, and at least two training samples corresponding to the first task are sampled according to the third sampling probability. If the third loss function shows an upward trend relative to the loss function corresponding to the historical validation sample data, and is lower than the average of the at least two fourth loss functions, then the third value is reduced from the first sampling probability to obtain the fourth sampling probability, and at least two training samples corresponding to the first task are sampled according to the fourth sampling probability; wherein, the third value is greater than the first value.
[0192] In some embodiments, the training sample data includes at least one of text sample data, image sample data, and audio sample data.
[0193] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be found in the method embodiments. To avoid repetition, further details are omitted here. Specifically, Figure 7 The apparatus 10 shown can execute the above-described method embodiments, and the aforementioned and other operations and / or functions of each module in the apparatus 10 are respectively for implementing the corresponding processes in the above-described methods 300 or 400. For the sake of brevity, they will not be described in detail here.
[0194] Figure 8This is a schematic block diagram of the data processing apparatus 20 according to an embodiment of this application. Figure 8 As shown, the device 20 may include an acquisition unit 21, a routing network 22, a weighted combination unit 23, and a backbone network 24.
[0195] Acquisition unit 21 is used to acquire the input data of the first task; The routing network 22 is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector. The probability distribution vector is used to represent the weights of the expert network corresponding to at least two tasks, including the first task. The weighted combination unit 23 is used to perform weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network 24 is used to process the input data and output the predicted sequence representation corresponding to the input data based on the weighted combination result.
[0196] Optionally, the multi-task model includes the routing network, the backbone network, and the adaptation network, and the multi-task model is obtained according to the multi-task joint training method described in method 300 or 400.
[0197] It should be understood that the device embodiments and method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 8 The apparatus 20 shown can execute the above-described method embodiments, and the aforementioned and other operations and / or functions of each module in the apparatus 20 are respectively for implementing the corresponding processes in the above-described method 600. For the sake of brevity, they will not be described in detail here.
[0198] The apparatus of this application embodiment has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the method embodiments in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the method disclosed in this application embodiment can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps in the above method embodiments.
[0199] Figure 9 This is a schematic block diagram of the electronic device 30 provided in the embodiments of this application.
[0200] like Figure 9 As shown, the electronic device 30 may include: The system includes a memory 31 and a processor 32. The memory 31 stores computer programs and transfers the program code to the processor 32. In other words, the processor 32 can retrieve and run the computer programs from the memory 31 to implement the methods described in the embodiments of this application.
[0201] For example, the processor 32 can be used to execute the above-described method embodiments according to instructions in the computer program.
[0202] In some embodiments of this application, the processor 32 may include, but is not limited to: General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0203] In some embodiments of this application, the memory 31 includes, but is not limited to: Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DR RAM).
[0204] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 31 and executed by the processor 32 to perform the method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the electronic device.
[0205] like Figure 9 As shown, the electronic device 30 may further include: Transceiver 33, which can be connected to processor 32 or memory 31.
[0206] The processor 32 can control the transceiver 33 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 730 may include a transmitter and a receiver. The transceiver 33 may further include antennas, and the number of antennas may be one or more.
[0207] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0208] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the methods of the above-described method embodiments. Alternatively, embodiments of this application also provide a computer program product containing instructions that, when executed by a computer, cause the computer to perform the methods of the above-described method embodiments.
[0209] When implemented using software, it can be implemented entirely or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0210] It is understood that in the specific implementation of this application, when the above embodiments of this application are applied to specific products or technologies and involve user information and other related data, user permission or consent is required, and the collection, use and processing of related data must comply with relevant laws, regulations and standards.
[0211] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0212] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0213] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0214] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A data processing method, characterized in that, include: Obtain at least one training sample data corresponding to at least two tasks; the at least two tasks include a first task. The embedding representation vector corresponding to the first task is processed using a routing network to obtain a probability distribution vector, which is used to represent the weights of the expert networks corresponding to the at least two tasks. The basis vectors in the subspace corresponding to the weight update amount of the adaptation network are weighted and combined according to the probability distribution vector to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network is used to process the first training sample data corresponding to the first task, and the predicted sequence representation corresponding to the first training sample data is output according to the weighted combination result. Based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data, the routing network and the weight update amount are updated.
2. The method according to claim 1, characterized in that, The step of weighting and combining the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector to obtain the weighted combination result includes: Convert the probability distribution vector into a diagonal matrix; The first matrix and the second matrix are decomposed into r subspaces along the rank dimension, where r is the rank of the diagonal matrix and r is a positive integer; the first matrix and the second matrix are obtained by performing low-rank decomposition on the weight update amount; The basis vectors of the r subspaces are weighted and combined using the diagonal matrix to obtain the weighted combination result.
3. The method according to claim 1, characterized in that, Also includes: Obtain at least two embedding representation vectors corresponding to at least two training sample data corresponding to the first task; Cluster centers are obtained by clustering based on the at least two embedded representation vectors; The embedding representation vector corresponding to the first task is determined based on the embedding representation vector of the training sample data corresponding to the cluster center.
4. The method according to claim 1, characterized in that, The step of updating the parameters of the routing network and the weight update amount based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data includes: A first loss function is determined based on the predicted sequence representation and the target sequence representation corresponding to the first training sample data; Based on the first loss function, the routing network and the weight update amount are updated.
5. The method according to claim 4, characterized in that, Also includes: A second loss function is obtained based on the embedding vector representation of the first training sample data, the embedding representation vector corresponding to the first task, and the embedding representation vector corresponding to the second task among the at least two tasks; wherein the first task is different from the second task. The step of updating the parameters of the routing network and the weight update amount according to the first loss function includes: Based on the first loss function and the second loss function, the parameters of the routing network, the weight update amount, and the embedding representation vector corresponding to the first task are updated.
6. The method according to claim 1, characterized in that, Also includes: The first training sample data is obtained by sampling at least two training sample data corresponding to the first task according to the first sampling probability, wherein the first sampling probability is proportional to the number of training sample data corresponding to the first task. Determine the third loss function corresponding to the current verification sample data of the first task, and at least two fourth loss functions corresponding to the current verification sample data of the at least two tasks; The first sampling probability is adjusted according to the third loss function and the at least two fourth loss functions, and at least two training samples corresponding to the first task are sampled according to the adjusted first sampling probability.
7. The method according to claim 6, characterized in that, The step of adjusting the first sampling probability according to the third loss function and the at least two fourth loss functions, and sampling at least two training samples corresponding to the first task according to the adjusted first sampling probability, includes at least one of the following: If the third loss function does not show an upward trend relative to the loss function corresponding to the historical verification sample data, and is lower than the average of the at least two fourth loss functions, then the first sampling probability is reduced by a first value to obtain a second sampling probability, and at least two training samples corresponding to the first task are sampled according to the second sampling probability. If the third loss function does not show an upward trend relative to the loss function corresponding to the historical validation sample data, and is higher than the average of the at least two fourth loss functions, then the first sampling probability is increased by a second value to obtain a third sampling probability, and at least two training samples corresponding to the first task are sampled according to the third sampling probability. If the third loss function shows an upward trend relative to the loss function corresponding to the historical validation sample data, and is lower than the average of the at least two fourth loss functions, then the third value is reduced from the first sampling probability to obtain the fourth sampling probability, and at least two training samples corresponding to the first task are sampled according to the fourth sampling probability; wherein, the third value is greater than the first value.
8. The method according to any one of claims 1-7, characterized in that, Each element in the probability distribution vector takes the value 0 or 1.
9. The method according to any one of claims 1-7, characterized in that, The training sample data includes at least one of text sample data, image sample data, and audio sample data.
10. A data processing apparatus, characterized in that, include: An acquisition unit is used to acquire at least one training sample data corresponding to at least two tasks; the at least two tasks include a first task. A routing network is used to process the embedding representation vector corresponding to the first task to obtain a probability distribution vector, wherein the probability distribution vector is used to represent the weights of the expert networks corresponding to the at least two tasks. The weighted combination unit is used to perform weighted combination of the basis vectors in the subspace corresponding to the weight update amount of the adaptation network according to the probability distribution vector, so as to obtain the weighted combination result; wherein, the adaptation network is the parameter adjustable module of the backbone network; The backbone network is used to process the first training sample data corresponding to the first task, and output the predicted sequence representation corresponding to the first training sample data according to the weighted combination result. The parameter update unit is used to update the parameters of the routing network and the weight update amount according to the predicted sequence representation and the target sequence representation corresponding to the first training sample data.
11. An electronic device, characterized in that, The method includes a processor and a memory, wherein the memory stores instructions, and when the processor executes the instructions, it causes the processor to perform the method according to any one of claims 1-9.
12. A computer storage medium, characterized in that, Used for storing computer programs, said computer programs including methods for performing any one of claims 1-9.
Citation Information
Cited By
Automatic driving track planning and control method and system based on parameter space skill combination and storage medium
CN122047307A