Multi-task artificial intelligence system
The split-merge mechanism in the multi-task AI system addresses memory and throughput issues by processing input data through a base model and adapter models, enhancing efficiency in AI systems with limited memory capacity.
Patent Information
- Application Number
- PCT/CN2024/077532
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-02-19
- Publication Date
- 2025-08-28
AI Technical Summary
Existing multi-adapter fine-tuned models face challenges with memory explosion and suboptimal throughput and latency during inference, particularly in AI accelerators with limited memory capacity, leading to decreased batching probability and reduced throughput.
A split-merge mechanism for a multi-task AI system that processes input data through a base model and adapter models, splitting data into task-specific batches, merging outputs, and optimizing throughput while avoiding memory explosion.
The solution enhances inference throughput and optimizes memory usage by allowing multiple tasks to be performed with a single batch, improving the efficiency of AI systems with limited memory capacity.
Smart Images

Figure CN2024077532_28082025_PF_FP_ABST
Abstract
Description
MULTI-TASK ARTIFICIAL INTELLIGENCE SYSTEMTechnical Field
[0001] This disclosure relates generally to neural networks (also referred to as “deep neural networks” or “DNNs” ) , and more specifically, to an artificial intelligence (AI) system with multiple adapter DNNs coupled with a base DNN.Background
[0002] The last decade has witnessed a rapid rise in AI-based data processing, particularly based on DNNs. DNNs are widely used in the domains of language processing, image recognition, video understanding, image or video generation, machine translation, mathematical reasoning, and so on. For instance, a large language model (LLM) usually includes a set of DNNs to extract meanings from text and understand the relationship between words and phrases in the text.Brief Description of the Drawings
[0003] Embodiments will be readily understood by the following detailed description in conjunction with the accompanying drawings. To facilitate this description, like reference numerals designate like structural elements. Embodiments are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings.
[0004] FIG. 1 is a block diagram of a multi-task AI system, in accordance with various embodiments.
[0005] FIG. 2 illustrates a multi-task AI system performing two different AI tasks, in accordance with various embodiments.
[0006] FIG. 3 illustrates an example inference process of a multi-task AI system, in accordance with various embodiments.
[0007] FIG. 4 illustrates an example DNN, in accordance with various embodiments.
[0008] FIG. 5 is a flowchart showing a method of performing multiple AI tasks, in accordance with various embodiments.
[0009] FIG. 6 is a block diagram of an example computing device, in accordance with various embodiments.Detailed Description
[0010] Overview
[0011] LLMs are very large deep learning models that are trained on vast amounts of data. LLMs often have a large number of internal parameters, such as hundreds of billions of parameters. A LLM can facilitate performance of various tasks such as generating content, answering questions, summarizing documents, translating languages, and so on. In multi-task settings, a base LLM can be coupled with other models to adapt to various downstream tasks. These other models are usually smaller and have less internal parameters than the base model. Such models are referred to as adapter models. The adapter models can be finetuned for the corresponding tasks. Parameter Efficient Fine Tuning (PEFT) is a currently available approach to adapt a base LLM to various downstream tasks. The common practice of PEFT is to freeze the base model and add some adapter models to the base model. The adapter parameters are then trained to fit specified task. An example PEFT algorithm is low-rank adaption, which can freeze the pre-trained based model weights and injects trainable rank decomposition matrices into each layer of the transformer architecture.
[0012] However, there have been challenges to inference multi-adapter finetuned models which share the same base model with optimal throughput and latency. An approach is to merge each adapter model into the base model and generate multiple models that have the same number of internal parameters as the base model. This approach can cause memory explosion as N times memory will be needed to serve N models. LLM inference can be bottlenecked by memory capacity since AI accelerators usually do not have a great amount of memory mounted. With this approach, an accelerator can serve far less models even if it has extra compute power, since the models cannot be loaded into the device memory. This will also decrease the probability of batching. When each task has its own model, multi-task batching cannot be done to increase the throughput. For LLMs, batching can be very important for throughput. For instance, the throughput for batch size of 16 is almost 16 times the throughput for batch size of 1.
[0013] Another approach is to share one base model for multiple tasks and add a switch to select which adapter models to use for each input batch. Since multiple tasks can share one base model, this approach can greatly save memory. During inference, the data in each batch is to be processed by a single adapter model, and the switch will turn on the adapter model and a batch of data for the corresponding task can be loaded to execute the inference process. Even though this approach can solve the memory explosion problem, it fails to increase throughput since each batch runs a single task. The probability of batching is not desirable.
[0014] Embodiments of the present disclosure may improve on at least some of the challenges and issues described above by using a split-merge mechanism for inference of a multi-task AI system that includes a base model coupled with a plurality of adapter models. In an example process of performing multiple tasks, the multi-task AI system may receive input data for all the tasks. The input data may be processed by the base model. The input data may also be split into multiple batches, each batch is for a different task and processed by the adapter model trained for the task. The outputs of the adapter models can be merged and further merged with the output of the base model to generate a final output. The split-merge mechanism can avoid the memory explosion problem and can optimize inference throughput as multiple tasks can be performed with a single batch of input data.
[0015] In various embodiments of the present disclosure, a multi-task AI system may receive an input tensor including input data elements to be processed for performing multiple tasks. The input tensor may be processed in a layer of the base model to generate a base tensor including base data elements associated with the different tasks. The input tensor may be split into task tensors. A task tensor includes one or more input data elements that are associated with the same task. For instance, task indexes of the input data elements may be determined to indicate which task each input data element is used for. The input data element (s) having the same task index may be grouped to form a task tensor. The task tensors may be processed in the adapter models to generate adapter tensors. A task tensor may be processed in a layer of the corresponding adapter model. Different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors. An output tensor may be generated by merging the base tensor with the adapter tensors. The output tensor may be processed by another layer in the base model as a new input tensor. The output tensor may also be split into new task tensors, which may be processed by other layers of the adapter models. This may continue till the execution of all layers in the base model and adapter models is done. The multi-task AI system may output results of the multiple tasks.
[0016] For purposes of explanation, specific numbers, materials and configurations are set forth in order to provide a thorough understanding of the illustrative implementations. However, it will be apparent to one skilled in the art that the present disclosure may be practiced without the specific details or / and that the present disclosure may be practiced with only some of the described aspects. In other instances, well known features are omitted or simplified in order not to obscure the illustrative implementations.
[0017] Further, references are made to the accompanying drawings that form a part hereof, and in which is shown, by way of illustration, embodiments that may be practiced. It is to be understood that other embodiments may be utilized, and structural or logical changes may be made without departing from the scope of the present disclosure. Therefore, the following detailed description is not to be taken in a limiting sense.
[0018] Various operations may be described as multiple discrete actions or operations in turn, in a manner that is most helpful in understanding the claimed subject matter. However, the order of description should not be construed as to imply that these operations are necessarily order dependent. In particular, these operations may not be performed in the order of presentation. Operations described may be performed in a different order from the described embodiment. Various additional operations may be performed or described operations may be omitted in additional embodiments.
[0019] For the purposes of the present disclosure, the phrase “A or B” or the phrase "A and / or B" means (A) , (B) , or (A and B) . For the purposes of the present disclosure, the phrase “A, B, or C” or the phrase "A, B, and / or C" means (A) , (B) , (C) , (A and B) , (A and C) , (B and C) , or (A, B, and C) . The term "between, " when used with reference to measurement ranges, is inclusive of the ends of the measurement ranges.
[0020] The description uses the phrases "in an embodiment" or "in embodiments, " which may each refer to one or more of the same or different embodiments. The terms "comprising, " "including, " "having, " and the like, as used with respect to embodiments of the present disclosure, are synonymous. The disclosure may use perspective-based descriptions such as "above, " "below, " "top, " "bottom, " and "side" to explain various features of the drawings, but these terms are simply for ease of discussion, and do not imply a desired or required orientation. The accompanying drawings are not necessarily drawn to scale. Unless otherwise specified, the use of the ordinal adjectives “first, ” “second, ” and “third, ” etc., to describe a common object, merely indicates that different instances of like objects are being referred to and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking or in any other manner.
[0021] In the following detailed description, various aspects of the illustrative implementations will be described using terms commonly employed by those skilled in the art to convey the substance of their work to others skilled in the art.
[0022] The terms “substantially, ” “close, ” “approximately, ” “near, ” and “about, ” generally refer to being within + / -20%of a target value as described herein or as known in the art. Similarly, terms indicating orientation of various elements, e.g., “coplanar, ” “perpendicular, ” “orthogonal, ” “parallel, ” or any other angle between the elements, generally refer to being within + / -5-20%of a target value as described herein or as known in the art.
[0023] In addition, the terms “comprise, ” “comprising, ” “include, ” “including, ” “have, ” “having” or any other variation thereof, are intended to cover a non-exclusive inclusion. For example, a method, process, device, or DNN accelerator that comprises a list of elements is not necessarily limited to only those elements but may include other elements not expressly listed or inherent to such method, process, device, or DNN accelerators. Also, the term “or” refers to an inclusive “or” and not to an exclusive “or. ”
[0024] The systems, methods and devices of this disclosure each have several innovative aspects, no single one of which is solely responsible for all desirable attributes disclosed herein. Details of one or more implementations of the subject matter described in this specification are set forth in the description below and the accompanying drawings.
[0025] Example Multi-task AI System
[0026] FIG. 1 is a block diagram of a multi-task AI system 100, in accordance with various embodiments. The multi-task AI system 100 can perform multiple tasks with a single batch of input data. The multi-task AI system 100 includes an interface module 110, a base model 120, adapter model 130 (individually referred to as “adapter model 130” ) , an indexing module 140, a tokenizing module 150, a splitting module 160, a merging module 170, a training module 180, a validating module 190, and a datastore 195. In other embodiments, alternative configurations, different or additional components may be included in the multi-task AI system 100. For instance, the multi-task AI system 100 may include a different number of adapter models. Further, functionality attributed to a component of the multi-task AI system 100 may be accomplished by a different component included in the multi-task AI system 100 or by a different module.
[0027] The interface module 110 facilitates communications of the multi-task AI system 100 with other systems, devices, or modules. In some embodiments, the interface module 110 may receive data from an online system (e.g., a social media system, an online image gallery, an online search tool, etc. ) , a client device associated with one or more users, and so on. For example, the interface module 110 may receive data for training the base model 120 or adapter models 130. The interface module 110 may also receive requests for performing various AI tasks, such as tasks for which the base model 120 and adapter model 130 are trained. Examples of the AI tasks include content generation, content classification, content interpretation, language translation, and so on. Content may be text, image, audio, video, or other types of content. A request may include data to be processed by the base model 120 and adapter model 130 for performing the AI tasks. The data may include words, phrases, sentences, images, audio, tokens, or other types of data.
[0028] In some embodiments, the interface module 110 may transmit data generated by the multi-task AI system 100 to other systems, devices, or modules. For instance, the interface module 110 may transmit outputs of the multi-task AI system 100 to other systems, devices, or modules. The outputs of the multi-task AI system 100 may include results of performing the AI tasks.
[0029] The base model 120 is a DNN model that includes a plurality of layers. The layers may be arranged in a sequence. The layers are also referred to as DNN layers. Examples of the layers may include the layers in the DNN 400 in FIG. 4. In some embodiments, the base model 120 may include multiple DNNs. The base model 120 has internal parameters, such as weights, etc. The number of internal parameters in the base model 120 may be large, such as millions, hundreds of millions, billions, and so on. The values of the internal parameters may be determined by training the base model 120, e.g., by the training module 180. In some embodiments, the base model 120 may be an LLM. The base model 120 may be used for performing a variety of natural language processing tasks. The base model 120 may be trained using one or more large textual datasets. The base model 120 may be or include a transformer that includes a plurality of transformer blocks. A transformer block may be a DNN layer.
[0030] In some embodiments, a DNN layer may include one or more deep learning operations (also referred to as “neural network operations” ) , such as convolution, pooling, elementwise operation, linear operation, nonlinear operation, and so on. A DL operation in a DNN may be performed on one or more internal parameters of the DNNs (e.g., weights) , which are determined during the training phase, and one or more activations. An activation may be a data point (also referred to as “data elements” or “elements” ) . Activations or weights of a DNN layer may be elements of a tensor of the DNN layer. A tensor is a data structure having multiple elements across one or more dimensions. Example tensors include a vector, which is a one-dimensional tensor, and a matrix, which is a two-dimensional tensor. There can also be three-dimensional tensors and even higher dimensional tensors. A DNN layer may have an input tensor (also referred to as “input feature map (IFM) ” ) including one or more input activations (also referred to as “input elements” ) and a weight tensor including one or more weights. A weight is an element in the weight tensor. A weight tensor of a convolution may be a kernel, a filter, or a group of filters. The output data of the DNN layer may be an output tensor (also referred to as “output feature map (OFM) ” ) that includes one or more output activations (also referred to as “output elements” ) .
[0031] The adapter models 130 are deep learning models coupled with the base model 120 to perform various tasks. An adapter model 130 may be trained for a particular type of task that may be different from the tasks for which one or more other adapter model 130 are trained. The adapter model 130 may be adapted to the base model 120. In an example, the base model 120 may be trained for natural language processing. The adapter models 130 may be trained for specific tasks such as language translation, question answering, summarization, and so on. In some embodiments, the outputs of the adapter models 130 may be combined with an output of the base model 120 to provide results of the tasks. In an example, the base model 120 may output data for all the tasks. The outputs of the adapter models 130 may be aggregated with different portions of the output of the base model 120.
[0032] In some embodiments, each adapter model 130 may be a DNN including a sequence of layers. Examples of the layers may include the layers in the DNN 400 in FIG. 4. An adapter model 130 may be or include a transformer that includes a plurality of transformer blocks. A transformer block may be a DNN layer. In some embodiments, some or even all the adapter models 130 may have the same number of transformer blocks. Some or even all the adapter models 130 may have the same number of transformer blocks as the base model 120. The adapter models 130 may process different portions of an input dataset received by the multi-task AI system 100, and the base model 120 may process the entire input dataset. The processing of the input dataset in the base model 120 may be in parallel with the processing of one or more portions of the input dataset in one or more adapter models 130.
[0033] The indexing module 140 indexes input data based on tasks. In some embodiments, the multi-task AI system 100 receives an input dataset that includes data to be processed for performing various tasks. The indexing module 140 may index data in the input dataset and label the data elements in the input dataset with task indexes. In an example, the multi-task AI system 100 receives an input tensor that includes a plurality of data elements. The indexing module 140 may determine which task every data element is associated with and generate an index tensor. Each element in the index tensor is a task index that corresponds to an element in the input tensor and indicates which task the element in the input tensor is used for.
[0034] In some embodiments, the size of the index tensor (e.g., the total number of elements in the index tensor) may equal the size of the input tensor (e.g., the total number of elements in the input tensor) . Different elements in the index tensor may have the same value, as different elements in the input tensor may be used for the same task and therefore, have the same task index. In some embodiments, the indexing module 140 may generate a task index for a segment of the input tensor, and the segment may include multiple data elements. The segment of the input tensor may be a subtensor, such as a vector, a matrix, etc.
[0035] In an example, an input tensor received by the multi-task AI system 100 may be represented as X= {x0, x1, x2, x3, x4, x5} . x0, x1, x2, x3, x4, or x5 may be a data element, a vector, a matrix, etc. The indexing module 140 may generate an index tensor represented as {1, 2, 1, 2, 1, 2} , which indicates that x0, x2, and x4 are for the same task: task 1 and that x1, x3, and x5 are for another task: task 2. In other examples, the input tensor may have a different size or may include data element for a different number of tasks.
[0036] The tokenizing module 150 generates input tokens from text received by the multi-task AI system 100. In some embodiments, the multi-task AI system 100 may receive textual inputs, such as words, phrases, sentences, and so on. The tokenizing module 150 may transform such textual inputs into input tokens that can be processed by the base model 120 and the adapter model 130. An input token may include one or more data elements that encode or represent the corresponding text. In some embodiments (e.g., embodiments where an input token includes multiple data elements) , the input token may be a vector, a matrix, or a tensor with a different number of dimensions. In some embodiments, the tokenizing module 150 may generate the input tokens before the indexing module generates the task indexes, an input token may be one or more data elements in the input tensor.
[0037] The splitting module 160 splits input datasets into tasks datasets. In some embodiments, the splitting module 160 may split an input tensor received by the multi-task AI system 100 into a plurality of task tensors. Each task tensor may be a portion of the input tensor and includes one or more data elements in the input tensor. All the data element (s) in a task tensor are associated with and to be processed for performing the same task. In some embodiments, the splitting module 160 may split the input tensor based on the task indexes generated by the indexing module 140. For instance, the splitting module 160 may group data element (s) having the same task index together to form a task tensor. In the example where the input tensor received by the multi-task AI system 100 is X= {x0, x1, x2, x3, x4, x5} , the splitting module 160 may split the input tensor into two task tensors based on the index tensor determined by the indexing module 140. The first task tensor may be represented as {x0, x2, x4} . The second task tensor may be represented as {x1, x3, x5} .
[0038] The merging module 170 merges outputs of the base model 120 and outputs of the adapter model 130. In some embodiments, for an input of the multi-task AI system 100, the merging module 170 may first merge the outputs of the adapter model 130 to generate a merged adapter output, then combine the merged adapter output with an output of the base model 120. For instance, the base model 120 may output a base tensor generated from processing an input tensor received by the multi-task AI system 100. The adapter models 130 may output adapter tensors generated from processing adapter tensors. The merging module 170 may merge the adapter tensors into a merged tensor that includes data elements in all the adapter tensors. The merged tensor may have the same size (e.g., the same number of data elements) as the base tensor. The merging module 170 may further combine the merged tensor with the base tensor, e.g., by performing elementwise aggregation. For each element in the merged tensor, the merging module 170 may aggregate it with a corresponding element in the base tensor to produce an aggregated element. The position of the element in the merged tensor may match (e.g., be the same) as the position of the corresponding element in the base tensor. The merging module 170 may produce an aggregated tensor that includes the aggregated elements. The aggregated tensor constitutes an output tensor of the multi-task AI system 100.
[0039] In the example where the input tensor received by the multi-task AI system 100 is X= {x0, x1, x2, x3, x4, x5} , the base tensor may be represented as Yb= {yb0, yb1, yb2, yb3, yb4, yb5} . The adapter tensor generated by the adapter model 130 for task 1 may be represented as Ya= {ya0, ya2, ya4} . The adapter tensor generated by the adapter model 130 for task 2 may be represented as Ya= {ya1, ya3, ya5} . The merging module 170 may merge the two adapter tensor and generate a merged tensor represented as Ya= {ya0, ya1, ya2, ya3, ya4, ya5} . The merged tensor has the same size as the base tensor. The merging module 170 may further aggregate the merged tensor and the base tensor and generate an output tensor represented as Y= {ya0+yb0, ya1+yb1, ya2+yb2, ya3+ yb3, ya4+yb4, ya5+yb5} . The output tensor may constitute an output of the multi-task AI system 100.
[0040] The splitting module 160 and the merging module 170 may perform sequential rounds of splitting-merging operations during inference of the base model 120 and the adapter models 130 based on an input tensor received by the multi-task AI system 100. For instance, in the first round, the splitting module 160 may split the input tensor to form the first group of task tensors, the input tensor may be processed in the first transformer block of the base model, the first group of task tensors may be each processed in the first transformer block of the corresponding adapter model 130, and the merging module 170 may generates the first output tensor based on the outputs of the first transformer blocks. In the second round, the splitting module 160 may split the first output tensor to form the second group of task tensors, the first output tensor may be processed in the second transformer block of the base model, the second group of task tensors may be each processed in the second transformer block of the corresponding adapter model 130, and the merging module 170 may generates the second output tensor based on the outputs of the second transformer blocks. In the third round, the splitting module 160 may split the second output tensor to form the third group of task tensors, the second output tensor may be processed in the third transformer block of the base model, the third group of task tensors may be each processed in the third transformer block of the corresponding adapter model 130, and the merging module 170 may generates the third output tensor based on the outputs of the third transformer blocks. This process may continue till all the transformer blocks in the base model 120 and adapter model 130 are executed.
[0041] The training module 180 trains DNNs, including the base model 120 and adapter models 130. In some embodiments, the training module 180 may train the base model 120 first or receive the base model 120 from another system after the base model 120 is trained. The training module 180 may then train or fine-tune the adapter models 130 so that the adapter models are adapted to the base model 120. In an embodiment, the training module 180 may train or fine-tune an adapter model 130 based on the task to be performed by the adapter model 130.
[0042] In some embodiments, the training module 180 trains a model with a training dataset. The training module 180 forms the training dataset. In an embodiment where the training module 180 trains an DNN to recognize objects in images, the training dataset includes training images and training labels. The training labels describe ground-truth classifications of objects in the training images. In some embodiments, each label in the training dataset corresponds to an object in a training image. In some embodiments, a part of the training dataset may be used to initially train the DNN, and the rest of the training dataset may be held back as a validation subset used by the validating module 190 to validate performance of a trained DNN. The portion of the training dataset not including the tuning subset and the validation subset may be used to train the DNN.
[0043] The training module 180 also determines hyperparameters for training the DNN. Hyperparameters are variables specifying the DNN training process. Hyperparameters are different from parameters inside the DNN (e.g., weights of filters) . In some embodiments, hyperparameters include variables determining the architecture of the DNN, such as number of hidden layers, etc. Hyperparameters also include variables which determine how the DNN is trained, such as batch size, number of epochs, etc. A batch size defines the number of training samples to work through before updating the parameters of the DNN. The batch size is the same as or smaller than the number of samples in the training dataset. The training dataset can be divided into one or more batches. The number of epochs defines how many times the entire training dataset is passed forward and backwards through the entire network. The number of epochs defines the number of times that the deep learning algorithm works through the entire training dataset. One epoch means that each training sample in the training dataset has had an opportunity to update the parameters inside the DNN. An epoch may include one or more batches. The number of epochs may be 1, 5, 10, 50, 100, 500, 1000, or even larger.
[0044] The training module 180 defines the architecture of the DNN, e.g., based on some of the hyperparameters. The architecture of the DNN includes an input layer, an output layer, and a plurality of hidden layers. The input layer of an DNN may include tensors (e.g., a multidimensional array) specifying attributes of the input image, such as the height of the input image, the width of the input image, and the depth of the input image (e.g., the number of bits specifying the color of a pixel in the input image) . The output layer includes labels of objects in the input layer. The hidden layers are layers between the input layer and output layer. The hidden layers include one or more convolutional layers and one or more other types of layers, such as pooling layers, fully-connected layers, normalization layers, SoftMax or logistic layers, and so on. The convolutional layers of the DNN abstract the input image to a feature map that is represented by a tensor specifying the feature map height, the feature map width, and the feature map channels (e.g., red, green, blue images include three channels) . A pooling layer is used to reduce the spatial volume of input image after convolution. It is used between two convolution layers. A fully-connected layer involves weights, biases, and neurons. It connects neurons in one layer to neurons in another layer. It is used to classify images between different categories by training.
[0045] In the process of defining the architecture of the DNN, the training module 180 also adds an activation function to a hidden layer or the output layer. An activation function of a layer transforms the weighted sum of the input of the layer to an output of the layer. The activation function may be, for example, a rectified linear unit (ReLU) activation function, a tangent activation function, or other types of activation functions.
[0046] After the training module 180 defines the architecture of the DNN, the training module 180 inputs a training dataset into the DNN. The training dataset includes a plurality of training samples. An example of a training sample includes an object in an image and a ground-truth label of the object. The training module 180 modifies the parameters inside the DNN ( “internal parameters of the DNN” ) to minimize the error between labels of the training objects that are generated by the DNN and the ground-truth labels of the objects. The internal parameters include weights of filters in the convolutional layers of the DNN. In some embodiments, the training module 180 uses a cost function to minimize the error.
[0047] The training module 180 may train the DNN for a predetermined number of epochs. The number of epochs is a hyperparameter that defines the number of times that the deep learning algorithm will work through the entire training dataset. One epoch means that each sample in the training dataset has had an opportunity to update internal parameters of the DNN. After the training module 180 finishes the predetermined number of epochs, the training module 180 may stop updating the parameters in the DNN. The DNN having the updated parameters is referred to as a trained DNN.
[0048] The validating module 190 verifies accuracy of trained DNNs, including the base model 120 and adapter models 130. In some embodiments, the validating module 190 inputs samples in a validation dataset into a trained DNN and uses the outputs of the DNN to determine the model accuracy. In some embodiments, a validation dataset may be formed of some or all the samples in the training dataset. Additionally or alternatively, the validation dataset includes additional samples, other than those in the training sets. In some embodiments, the validating module 190 may determine an accuracy score measuring the precision, recall, or a combination of precision and recall of the DNN. The validating module 190 may use the following metrics to determine the accuracy score: Precision = TP / (TP + FP) and Recall = TP / (TP + FN) , where precision may be how many the DNN correctly predicted (TP or true positives) out of the total it predicted (TP + FP or false positives) , and recall may be how many the DNN correctly predicted (TP) out of the total number of objects that did have the property in question (TP + FN or false negatives) . The F-score (F-score = 2 *PR / (P + R) ) unifies precision and recall into a single measure.
[0049] The validating module 190 may compare the accuracy score with a threshold score. In an example where the validating module 190 determines that the accuracy score of the DNN is less than the threshold score, the validating module 190 instructs the training module 180 to re-train the DNN. In one embodiment, the training module 180 may iteratively re-train the DNN until the occurrence of a stopping condition, such as the accuracy measurement indication that the DNN may be sufficiently accurate, or a number of training rounds having taken place.
[0050] The datastore 195 stores data associated with the multi-task AI system 100, such as data received, generated, or used by components of the multi-task AI system 100. For instance, the datastore 195 may store parameters (e.g., internal parameters, hyperparameters, etc. ) of the base model 120 or the adapter models 130. The datastore 195 may also store training data and validation data used to train and validate the base model 120 or the adapter models 130. The datastore 195 may further store input data received by the interface module 110 and outputs of the base model 120, adapter models 130, indexing module 140, tokenizing module 150, splitting module 160, or merging module 170. In some embodiments, the multi-task AI system 100 may include or be associated with more than one datastore. The datastore 195 may be implemented as a random-access memory (RAM) , such as a static RAM (SRAM) , disk storage, nearline storage, online storage, offline storage, and so on.
[0051] FIG. 2 illustrates a multi-task AI system 200 performing two different AI tasks, in accordance with various embodiments. The multi-task AI system 200 may be an example of the multi-task AI system 100 in FIG. 1. As shown in FIG. 2, the multi-task AI system 200 includes a base model 210, two adapter models 220A and 220B, a splitting module 230, a merging module 240, and an adder 250. The base model 210 may be an example of the base model 120 in FIG. 1. The adapter models 220A and 220B may be examples of the adapter models 130 in FIG. 1. The splitting module 230 may be an example of the splitting module 160 in FIG. 1. The combination of the merging module 240 and adder 250 may constitute an example of the merging module 170 in FIG. 1. In other embodiments, the multi-task AI system 200 may include more, fewer, or different components.
[0052] The base model 210 has been trained to perform a variety of AI tasks. The adapter models 220A and 220B have been trained to perform the two different tasks, respectively. The adapter models 220A and 220B are adapted to the base model 210. In some embodiments, the first task may be performed by the base model 210 and the adapter model 220A. An output of the base model 210 and an output of the adapter model 220A may be aggregated to form a result of the first task. The second task may be performed by the base model 210 and the adapter model 220B. An output of the base model 210 and an output of the adapter model 220B may be aggregated to form a result of the second task.
[0053] In the embodiments of FIG. 2, the multi-task AI system 200 receives an input tensor 201. The input tensor 201 includes six subtensors, each of which is represented by a box in FIG. 2. Each subtensor may include one or more data elements. Three subtensors, which are represented by plain boxes in FIG. 2, are for the first task. The other three subtensors, which are represented by boxes having a dotted pattern, are for the second task. The splitting module 230 receives the input tensor 201 and divides the input tensor 201 into two task tensors 202A and 202B. The task tensor 202A includes the three subtensors for the first task. The task tensor 202B includes the three subtensors for the second task.
[0054] The base model 210 processes the input tensor 201 and outputs a base tensor 203. The adapter model 220A processes the task tensor 202A and outputs an adapter tensor 204A. The adapter model 220B processes the task tensor 202B and outputs an adapter tensor 204B. The merging module 240 receives the adapter tensors 204A and 204B and forms a merged tensor 205. The merged tensor 205 includes the elements in the adapter tensors 204A and 204B. The merged tensor 205 and the base tensor 203 are provided to the adder 250. The adder 250 may perform an elementwise aggregation on the merged tensor 205 and the base tensor 203 and computes an output tensor 206. The output tensor 206 may be an output of the multi-task AI system 200.
[0055] In some embodiments, the output tensor 206 may be an output of a transformer block of the multi-task AI system 200. The transformer block of the multi-task AI system may include a layer in the base model 210, a layer in the adapter model 220A, and a layer in the adapter model 220B. The output tensor may be further processed by a subsequent transformer block of the multi-task AI system 200 as a new input tensor. The subsequent transformer block may include a subsequent layer in the base model 210, a subsequent layer in the adapter model 220A, and a subsequent layer in the adapter model 220B. This process may continue till all the transformer blocks of the multi-task AI system 200 are executed and a final output of the multi-task AI system 200 is computed. The final output of the multi-task AI system 200 may include results of the two different tasks.
[0056] FIG. 3 illustrates an example inference process 300 of a multi-task AI system, in accordance with various embodiments. The multi-task AI system may be an example of the multi-task AI system 100 in FIG. 1. In the embodiments of FIG. 3, the multi-task AI system includes an indexing module 310, a tokenizing module 320, a common model 330, a base model 340, adapter models 350, a splitting module 360, and a merging module 370. In other embodiments, the multi-task AI system in FIG. 3 may include more, fewer, or different components. The indexing module 310 may be an example of the indexing module 140 in FIG. 1.The tokenizing module 320 may be an example of the tokenizing module 150 in FIG. 1. The base model 340 may be an example of the base model 120 in FIG. 1. The adapter models 350 may be examples of the adapter models 130 in FIG. 1. The splitting module 360 may be an example of the splitting module 160 in FIG. 1. The merging module 370 may constitute an example of the merging module 170 in FIG. 1.
[0057] The indexing module 310 may receive requests for performing various tasks. The requests include text to be processed for performing the various tasks. The indexing module 310 may process the requests and output request text and task indices. A task index may indicate which task a request is associated with. The indexing module 310 may receive one or more requests for each of the tasks and generates a task index for each of the requests. The tokenizing module 320 may process the request texts and generate request tokens. The request tokens are provided to a common model 330. The common model 330 may compute a tensor using the request tokens. The tensor may be input into a layer in the base model 340 as an input tensor. The layer of the base model 340 computes a base tensor. The tensor is also input into the splitting module 360, which splits the tensor into task tensors. The splitting module 360 also receives the task indices of the request tokens and may split the tensor using the task indices. The task tensors are input into the adapter models 350. A layer in each adapter model 350 receives a different one of the task tensors and computes a corresponding adapter tensor.
[0058] The merging module 370 receives the adapter tensors and forms a merged tensor by merging the adapter tensors. The merging module 370 also receives the task indices and may merge the adapter tensors using the task indices. For instance, the merging module 370 may determine the position of a data element in the merged tensor based on the task index of the data element or the task index of the adapter tensor including the data element. The merging module 370 also aggregates the merged tensor with the base tensor and generates an output tensor. The output tensor is then processed by the common model 330 to generate a new tensor that is to be processed by another layer in the base model 340 and split by the splitting module 360 before being processed by layers of the adapter models 350. This splitting-merging process may be repeated N times for N transformer blocks in the multi-task AI system.
[0059] Example DNN
[0060] FIG. 4 illustrates an example DNN 400, in accordance with various embodiments. The DNN 400 (or part of the DNN 400) may be an example of the base model 120 or an adapter model 130 in FIG. 1. In the embodiments of FIG. 4, the DNN 400 includes a sequence of layers comprising a plurality of convolutional layers 410 (individually referred to as “convolutional layer 410” ) , a plurality of pooling layers 420 (individually referred to as “pooling layer 420” ) , and a plurality of fully-connected layers 430 (individually referred to as “fully-connected layer 430” ) . In other embodiments, the DNN 400 may include fewer, more, or different layers. In an inference of the DNN 400, the layers of the DNN 400 execute tensor computation that includes many tensor operations, such as convolution (e.g., multiply-accumulate (MAC) operations, etc. ) , pooling operations, elementwise operations (e.g., elementwise addition, elementwise multiplication, etc. ) , other types of tensor operations, or some combination thereof.
[0061] The convolutional layers 410 summarize the presence of features in the input to the DNN 400. The convolutional layers 410 function as feature extractors. The first layer of the DNN 400 is a convolutional layer 410. In an example, a convolutional layer 410 performs a convolution on an input tensor 440 (also referred to as IFM 440) and a filter 450. As shown in FIG. 4, the IFM 440 is represented by a 7×7×3 three-dimensional (3D) matrix. The IFM 440 includes 3 input channels, each of which is represented by a 7×7 two-dimensional (2D) matrix. The 7×7 2D matrix includes 7 input elements (also referred to as input points) in each row and seven input elements in each column. The filter 450 is represented by a 3×3×3 3D matrix. The filter 450 includes 3 kernels, each of which may correspond to a different input channel of the IFM 440. A kernel is a 2D matrix of weights, where the weights are arranged in columns and rows. A kernel can be smaller than the IFM. In the embodiments of FIG. 4, each kernel is represented by a 3×3 2D matrix. The 3×3 kernel includes 3 weights in each row and three weights in each column. Weights can be initialized and updated by backpropagation using gradient descent. The magnitudes of the weights can indicate importance of the filter 450 in extracting features from the IFM 440.
[0062] The convolution includes MAC operations with the input elements in the IFM 440 and the weights in the filter 450. The convolution may be a standard convolution 463 or a depthwise convolution 483. In the standard convolution 463, the whole filter 450 slides across the IFM 440. All the input channels are combined to produce an output tensor 460 (also referred to as OFM 460) . The OFM 460 is represented by a 5×5 2D matrix. The 5×5 2D matrix includes 5 output elements (also referred to as output points) in each row and five output elements in each column. For the purpose of illustration, the standard convolution includes one filter in the embodiments of FIG. 4. In embodiments where there are multiple filters, the standard convolution may produce multiple output channels in the OFM 460.
[0063] The multiplication applied between a kernel-sized patch of the IFM 440 and a kernel may be a dot product. A dot product is the elementwise multiplication between the kernel-sized patch of the IFM 440 and the corresponding kernel, which is then summed, always resulting in a single value. Because it results in a single value, the operation is often referred to as the “scalar product. ” Using a kernel smaller than the IFM 440 is intentional as it allows the same kernel (set of weights) to be multiplied by the IFM 440 multiple times at different points on the IFM 440. Specifically, the kernel is applied systematically to each overlapping part or kernel-sized patch of the IFM 440, left to right, top to bottom. The result from multiplying the kernel with the IFM 440 one time is a single value. As the kernel is applied multiple times to the IFM 440, the multiplication result is a 2D matrix of output elements. As such, the 2D output matrix (i.e., the OFM 460) from the standard convolution 463 is referred to as an OFM.
[0064] In the depthwise convolution 483, the input channels are not combined. Rather, MAC operations are performed on an individual input channel and an individual kernel and produce an output channel. As shown in FIG. 4, the depthwise convolution 483 produces a depthwise output tensor 480. The depthwise output tensor 480 is represented by a 5×5×3 3D matrix. The depthwise output tensor 480 includes 3 output channels, each of which is represented by a 5×5 2D matrix. The 5×5 2D matrix includes 5 output elements in each row and five output elements in each column. Each output channel is a result of MAC operations of an input channel of the IFM 440 and a kernel of the filter 450. For instance, the first output channel (patterned with dots) is a result of MAC operations of the first input channel (patterned with dots) and the first kernel (patterned with dots) , the second output channel (patterned with horizontal strips) is a result of MAC operations of the second input channel (patterned with horizontal strips) and the second kernel (patterned with horizontal strips) , and the third output channel (patterned with diagonal stripes) is a result of MAC operations of the third input channel (patterned with diagonal stripes) and the third kernel (patterned with diagonal stripes) . In such a depthwise convolution, the number of input channels equals the number of output channels, and each output channel corresponds to a different input channel. The input channels and output channels are referred to collectively as depthwise channels. After the depthwise convolution, a pointwise convolution 493 is then performed on the depthwise output tensor 480 and a 4×1×3 tensor 490 to produce the OFM 460.
[0065] The OFM 460 is then passed to the next layer in the sequence. In some embodiments, the OFM 460 is passed through an activation function. An example activation function is ReLU. ReLU is a calculation that returns the value provided as input directly, or the value zero if the input is zero or less. The convolutional layer 410 may receive several images as input and calculate the convolution of each of them with each of the kernels. This process can be repeated several times. For instance, the OFM 460 is passed to the subsequent convolutional layer 410 (i.e., the convolutional layer 410 following the convolutional layer 410 generating the OFM 460 in the sequence) . The subsequent convolutional layers 410 perform a convolution on the OFM 460 with new kernels and generate a new feature map. The new feature map may also be normalized and resized. The new feature map can be kernelled again by a further subsequent convolutional layer 410, and so on.
[0066] In some embodiments, a convolutional layer 410 has four hyperparameters: the number of kernels, the size F kernels (e.g., a kernel is of dimensions F×F×D pixels) , the S step with which the window corresponding to the kernel is dragged on the image (e.g., a step of one means moving the window one pixel at a time) , and the zero-padding P (e.g., adding a black contour of P pixels thickness to the input image of the convolutional layer 410) . The convolutional layers 410 may perform various types of convolutions, such as 2-dimensional convolution, dilated or atrous convolution, spatial separable convolution, depthwise separable convolution, transposed convolution, and so on. The DNN 400 includes 46 convolutional layers 410. In other embodiments, the DNN 400 may include a different number of convolutional layers.
[0067] The pooling layers 420 down-sample feature maps generated by the convolutional layers, e.g., by summarizing the presence of features in the patches of the feature maps. A pooling layer 420 is placed between two convolution layers 410: a preceding convolutional layer 410 (the convolution layer 410 preceding the pooling layer 420 in the sequence of layers) and a subsequent convolutional layer 410 (the convolution layer 410 subsequent to the pooling layer 420 in the sequence of layers) . In some embodiments, a pooling layer 420 is added after a convolutional layer 410, e.g., after an activation function (e.g., ReLU, etc. ) has been applied to the OFM 460.
[0068] A pooling layer 420 receives feature maps generated by the preceding convolution layer 410 and applies a pooling operation to the feature maps. The pooling operation reduces the size of the feature maps while preserving their important characteristics. Accordingly, the pooling operation improves the efficiency of the CNN and avoids over-learning. The pooling layers 420 may perform the pooling operation through average pooling (calculating the average value for each patch on the feature map) , max pooling (calculating the maximum value for each patch of the feature map) , or a combination of both. The size of the pooling operation is smaller than the size of the feature maps. In various embodiments, the pooling operation is 2×2 pixels applied with a stride of two pixels, so that the pooling operation reduces the size of a feature map by a factor of 2, e.g., the number of pixels or values in the feature map is reduced to one quarter the size. In an example, a pooling layer 420 applied to a feature map of 6×6 results in an output pooled feature map of 3×3. The output of the pooling layer 420 is inputted into the subsequent convolution layer 410 for further feature extraction. In some embodiments, the pooling layer 420 operates upon each feature map separately to create a new set of the same number of pooled feature maps.
[0069] The fully-connected layers 430 are the last layers of the CNN. The fully-connected layers 430 may be convolutional or not. The fully-connected layers 430 may also be referred to as linear layers. In some embodiments, a fully-connected layer 430 (e.g., the first fully-connected layer in the DNN 400) may receive an input operand. The input operand may define the output of the convolutional layers 410 and pooling layers 420 and includes the values of the last feature map generated by the last pooling layer 420 in the sequence. The fully-connected layer 430 may apply a linear transformation to the input operand through a weight matrix. The weight matrix may be a kernel of the fully-connected layer 430. The linear transformation may include a tensor multiplication between the input operand and the weight matrix. The result of the linear transformation may be an output operand. In some embodiments, the fully-connected layer may further apply a nonlinear transformation (e.g., by using a nonlinear activation function) on the result of the linear transformation to generate an output operand. The output operand may contain as many elements as there are classes: element i represents the probability that the image belongs to class i. Each element is therefore between 0 and 4, and the sum of all is worth one. These probabilities are calculated by the last fully-connected layer 430 by using a logistic function (binary classification) or a SoftMax function (multi-class classification) as an activation function.
[0070] Example Method of Performing Multiple AI Tasks
[0071] FIG. 5 is a flowchart showing a method 500 of performing multiple AI tasks, in accordance with various embodiments. The method 500 may be performed by the multi-task AI system 100 in FIG. 1. Although the method 500 is described with reference to the flowchart illustrated in FIG. 5, many other methods for performing multiple AI tasks may alternatively be used. For example, the order of execution of the steps in FIG. 5 may be changed. As another example, some of the steps may be changed, eliminated, or combined.
[0072] The multi-task AI system 100 receives 510 an input tensor. The input tensor comprises input data elements associated with different tasks. In some embodiments, the input tensor is generated from requests for performing the different tasks. A request comprises a text string, and the input tensor comprises a token that encodes the text string.
[0073] The multi-task AI system 100 processes 520 the input tensor in a base model. The base model generates a base tensor. The base tensor comprises base data elements associated with the different tasks. In some embodiments, the input tensor is processed in a layer of the base model.
[0074] The multi-task AI system 100 splits 530 the input tensor into task tensors. A task tensor comprises one or more input data elements that are associated with a same task. In some embodiments, the multi-task AI system 100 generates task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with. The multi-task AI system 100 splits the input tensor into the task tensors based on the task indexes.
[0075] The multi-task AI system 100 processes 540 the task tensors in adapter models. The adapter models generate adapter tensors. Different ones of the adapter models receive different ones of the task tensors and generate different ones of the adapter tensors. In some embodiments, the task tensors are processed in layers of the adapter models.
[0076] The multi-task AI system 100 generates 550 an output tensor by merging the base tensor with the adapter tensors. In some embodiments, each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated. The multi-task AI system 100 merges the adapter tensors to form a merged tensor. The merged tensor comprises data elements in the adapter tensors. A position of a data element in the merged tensor is determined based on a task index associated with an adapter tensor including the data element. The multi-task AI system 100 aggregates the merged tensor and the base tensor. In some embodiments, the multi-task AI system 100 aggregates a first data element in the merged tensor with a second data element in the base tensor. A position of the first data element in the merged tensor matches a position of the second data element in the base tensor.
[0077] In some embodiments, the output tensor is processed in a subsequent layer of the base model. In some embodiments, the multi-task AI system 100 splits the output tensor into additional task tensors. An additional task tensor comprises one or more data elements in the output tensor that are associated with the same task. The multi-task AI system 100 processes the additional task tensors in subsequent layers of the adapter models.
[0078] Example Computing Device
[0079] FIG. 6 is a block diagram of an example computing device 600, in accordance with various embodiments. In some embodiments, the computing device 600 can be used as at least part of the multi-task AI system 100. A number of components are illustrated in FIG. 6 as included in the computing device 600, but any one or more of these components may be omitted or duplicated, as suitable for the application. In some embodiments, some or all of the components included in the computing device 600 may be attached to one or more motherboards. In some embodiments, some or all of these components are fabricated onto a single system on a chip (SoC) die. Additionally, in various embodiments, the computing device 600 may not include one or more of the components illustrated in FIG. 6, but the computing device 600 may include interface circuitry for coupling to the one or more components. For example, the computing device 600 may not include a display device 606, but may include display device interface circuitry (e.g., a connector and driver circuitry) to which a display device 606 may be coupled. In another set of examples, the computing device 600 may not include an audio input device 618 or an audio output device 608, but may include audio input or output device interface circuitry (e.g., connectors and supporting circuitry) to which an audio input device 618 or audio output device 608 may be coupled.
[0080] The computing device 600 may include a processing device 602 (e.g., one or more processing devices) . The processing device 602 processes electronic data from registers and / or memory to transform that electronic data into other electronic data that may be stored in registers and / or memory. The computing device 600 may include a memory 604, which may itself include one or more memory devices such as volatile memory (e.g., DRAM) , nonvolatile memory (e.g., read-only memory (ROM) ) , high bandwidth memory (HBM) , flash memory, solid state memory, and / or a hard drive. In some embodiments, the memory 604 may include memory that shares a die with the processing device 602. In some embodiments, the memory 604 includes one or more non-transitory computer-readable media storing instructions executable to perform operations for performing multiple AI tasks, e.g., the method 500 described above in conjunction with FIG. 5 or some operations performed by the multi-task AI system 100. The instructions stored in the one or more non-transitory computer-readable media may be executed by the processing device 602.
[0081] In some embodiments, the computing device 600 may include a communication chip 612 (e.g., one or more communication chips) . For example, the communication chip 612 may be configured for managing wireless communications for the transfer of data to and from the computing device 600. The term "wireless" and its derivatives may be used to describe circuits, devices, systems, methods, techniques, communications channels, etc., that may communicate data through the use of modulated electromagnetic radiation through a nonsolid medium. The term does not imply that the associated devices do not contain any wires, although in some embodiments they might not.
[0082] The communication chip 612 may implement any of a number of wireless standards or protocols, including but not limited to Institute for Electrical and Electronic Engineers (IEEE) standards including Wi-Fi (IEEE 802.10 family) , IEEE 802.16 standards (e.g., IEEE 802.16-2005 Amendment) , Long-Term Evolution (LTE) project along with any amendments, updates, and / or revisions (e.g., advanced LTE project, ultramobile broadband (UMB) project (also referred to as "3GPP2" ) , etc. ) . IEEE 802.16 compatible Broadband Wireless Access (BWA) networks are generally referred to as WiMAX networks, an acronym that stands for worldwide interoperability for microwave access, which is a certification mark for products that pass conformity and interoperability tests for the IEEE 802.16 standards. The communication chip 612 may operate in accordance with a Global System for Mobile Communication (GSM) , General Packet Radio Service (GPRS) , Universal Mobile Telecommunications System (UMTS) , High Speed Packet Access (HSPA) , Evolved HSPA (E-HSPA) , or LTE network. The communication chip 612 may operate in accordance with Enhanced Data for GSM Evolution (EDGE) , GSM EDGE Radio Access Network (GERAN) , Universal Terrestrial Radio Access Network (UTRAN) , or Evolved UTRAN (E-UTRAN) . The communication chip 612 may operate in accordance with Code-division Multiple Access (CDMA) , Time Division Multiple Access (TDMA) , Digital Enhanced Cordless Telecommunications (DECT) , Evolution-Data Optimized (EV-DO) , and derivatives thereof, as well as any other wireless protocols that are designated as 3G, 4G, 5G, and beyond. The communication chip 612 may operate in accordance with other wireless protocols in other embodiments. The computing device 600 may include an antenna 622 to facilitate wireless communications and / or to receive other wireless communications (such as AM or FM radio transmissions) .
[0083] In some embodiments, the communication chip 612 may manage wired communications, such as electrical, optical, or any other suitable communication protocols (e.g., the Ethernet) . As noted above, the communication chip 612 may include multiple communication chips. For instance, a first communication chip 612 may be dedicated to shorter-range wireless communications such as Wi-Fi or Bluetooth, and a second communication chip 612 may be dedicated to longer-range wireless communications such as global positioning system (GPS) , EDGE, GPRS, CDMA, WiMAX, LTE, EV-DO, or others. In some embodiments, a first communication chip 612 may be dedicated to wireless communications, and a second communication chip 612 may be dedicated to wired communications.
[0084] The computing device 600 may include battery / power circuitry 614. The battery / power circuitry 614 may include one or more energy storage devices (e.g., batteries or capacitors) and / or circuitry for coupling components of the computing device 600 to an energy source separate from the computing device 600 (e.g., AC line power) .
[0085] The computing device 600 may include a display device 606 (or corresponding interface circuitry, as discussed above) . The display device 606 may include any visual indicators, such as a heads-up display, a computer monitor, a projector, a touchscreen display, a liquid crystal display (LCD) , a light-emitting diode display, or a flat panel display, for example.
[0086] The computing device 600 may include an audio output device 608 (or corresponding interface circuitry, as discussed above) . The audio output device 608 may include any device that generates an audible indicator, such as speakers, headsets, or earbuds, for example.
[0087] The computing device 600 may include an audio input device 618 (or corresponding interface circuitry, as discussed above) . The audio input device 618 may include any device that generates a signal representative of a sound, such as microphones, microphone arrays, or digital instruments (e.g., instruments having a musical instrument digital interface (MIDI) output) .
[0088] The computing device 600 may include a GPS device 616 (or corresponding interface circuitry, as discussed above) . The GPS device 616 may be in communication with a satellite-based system and may receive a location of the computing device 600, as known in the art.
[0089] The computing device 600 may include another output device 610 (or corresponding interface circuitry, as discussed above) . Examples of the other output device 610 may include an audio codec, a video codec, a printer, a wired or wireless transmitter for providing information to other devices, or an additional storage device.
[0090] The computing device 600 may include another input device 620 (or corresponding interface circuitry, as discussed above) . Examples of the other input device 620 may include an accelerometer, a gyroscope, a compass, an image capture device, a keyboard, a cursor control device such as a mouse, a stylus, a touchpad, a bar code reader, a Quick Response (QR) code reader, any sensor, or a radio frequency identification (RFID) reader.
[0091] The computing device 600 may have any desired form factor, such as a handheld or mobile computer system (e.g., a cell phone, a smart phone, a mobile internet device, a music player, a tablet computer, a laptop computer, a netbook computer, an ultrabook computer, a personal digital assistant (PDA) , an ultramobile personal computer, etc. ) , a desktop computer system, a server or other networked computing component, a printer, a scanner, a monitor, a set-top box, an entertainment control unit, a vehicle control unit, a digital camera, a digital video recorder, or a wearable computer system. In some embodiments, the computing device 600 may be any other electronic device that processes data.
[0092] Select Examples
[0093] The following paragraphs provide various examples of the embodiments disclosed herein.
[0094] Example 1 provides a method, including receiving an input tensor, the input tensor including input data elements associated with different tasks; processing the input tensor in a base model, the base model generating a base tensor, the base tensor including base data elements associated with the different tasks; splitting the input tensor into task tensors, a task tensor including one or more input data elements that are associated with a same task; processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors; and generating an output tensor by merging the base tensor with the adapter tensors.
[0095] Example 2 provides the method of example 1, in which splitting the input tensor into the task tensors includes generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; and splitting the input tensor into the task tensors based on the task indexes.
[0096] Example 3 provides the method of example 2, in which each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors includes merging the adapter tensors to form a merged tensor, the merged tensor including data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; and aggregating the merged tensor and the base tensor.
[0097] Example 4 provides the method of example 3, in which aggregating the merged tensor and the base tensor includes aggregating a first data element in the merged tensor with a second data element in the base tensor, in which a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.
[0098] Example 5 provides the method of any one of examples 1-4, in which the input tensor is processed in a layer of the base model, and the method further includes processing the output tensor in a subsequent layer of the base model.
[0099] Example 6 provides the method of example 5, in which the task tensors are processed in layers of the adapter models, and the method further includes splitting the output tensor into additional task tensors, an additional task tensor including one or more data elements in the output tensor that are associated with a same task; and processing the additional task tensors in subsequent layers of the adapter models.
[0100] Example 7 provides the method of any one of examples 1-6, in which the input tensor is generated from requests for performing the different tasks, a request includes a text string, and the input tensor includes a token that encodes the text string.
[0101] Example 8 provides one or more non-transitory computer-readable media storing instructions executable to perform operations, the operations including receiving an input tensor, the input tensor including input data elements associated with different tasks; processing the input tensor in a base model, the base model generating a base tensor, the base tensor including base data elements associated with the different tasks; splitting the input tensor into task tensors, a task tensor including one or more input data elements that are associated with a same task; processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors; and generating an output tensor by merging the base tensor with the adapter tensors.
[0102] Example 9 provides the one or more non-transitory computer-readable media of example 8, in which splitting the input tensor into the task tensors includes generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; and splitting the input tensor into the task tensors based on the task indexes.
[0103] Example 10 provides the one or more non-transitory computer-readable media of example 9, in which each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors includes merging the adapter tensors to form a merged tensor, the merged tensor including data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; and aggregating the merged tensor and the base tensor.
[0104] Example 11 provides the one or more non-transitory computer-readable media of example 10, in which aggregating the merged tensor and the base tensor includes aggregating a first data element in the merged tensor with a second data element in the base tensor, in which a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.
[0105] Example 12 provides the one or more non-transitory computer-readable media of any one of examples 8-11, in which the input tensor is processed in a layer of the base model, and the operations further include processing the output tensor in a subsequent layer of the base model.
[0106] Example 13 provides the one or more non-transitory computer-readable media of example 12, in which the task tensors are processed in layers of the adapter models, and the operations further include splitting the output tensor into additional task tensors, an additional task tensor including one or more data elements in the output tensor that are associated with a same task; and processing the additional task tensors in subsequent layers of the adapter models.
[0107] Example 14 provides the one or more non-transitory computer-readable media of any one of examples 8-13, in which the input tensor is generated from requests for performing the different tasks, a request includes a text string, and the input tensor includes a token that encodes the text string.
[0108] Example 15 provides an apparatus, including a computer processor for executing computer program instructions; and a non-transitory computer-readable memory storing computer program instructions executable by the computer processor to perform operations including receiving an input tensor, the input tensor including input data elements associated with different tasks, processing the input tensor in a base model, the base model generating a base tensor, the base tensor including base data elements associated with the different tasks, splitting the input tensor into task tensors, a task tensor including one or more input data elements that are associated with a same task, processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors, and generating an output tensor by merging the base tensor with the adapter tensors.
[0109] Example 16 provides the apparatus of example 15, in which splitting the input tensor into the task tensors includes generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; and splitting the input tensor into the task tensors based on the task indexes.
[0110] Example 17 provides the apparatus of example 16, in which each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors includes merging the adapter tensors to form a merged tensor, the merged tensor including data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; and aggregating the merged tensor and the base tensor.
[0111] Example 18 provides the apparatus of example 17, in which aggregating the merged tensor and the base tensor includes aggregating a first data element in the merged tensor with a second data element in the base tensor, in which a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.
[0112] Example 19 provides the apparatus of any one of examples 15-18, in which the input tensor is processed in a layer of the base model, and the operations further include processing the output tensor in a subsequent layer of the base model.
[0113] Example 20 provides the apparatus of example 19, in which the task tensors are processed in layers of the adapter models, and the operations further include splitting the output tensor into additional task tensors, an additional task tensor including one or more data elements in the output tensor that are associated with a same task; and processing the additional task tensors in subsequent layers of the adapter models.
[0114] The above description of illustrated implementations of the disclosure, including what is described in the Abstract, is not intended to be exhaustive or to limit the disclosure to the precise forms disclosed. While specific implementations of, and examples for, the disclosure are described herein for illustrative purposes, various equivalent modifications are possible within the scope of the disclosure, as those skilled in the relevant art will recognize. These modifications may be made to the disclosure in light of the above detailed description.
Claims
1.A method, comprising:receiving an input tensor, the input tensor comprising input data elements associated with different tasks;processing the input tensor in a base model, the base model generating a base tensor, the base tensor comprising base data elements associated with the different tasks;splitting the input tensor into task tensors, a task tensor comprising one or more input data elements that are associated with a same task;processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors; andgenerating an output tensor by merging the base tensor with the adapter tensors.2.The method of claim 1, wherein splitting the input tensor into the task tensors comprises:generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; andsplitting the input tensor into the task tensors based on the task indexes.3.The method of claim 2, wherein each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors comprises:merging the adapter tensors to form a merged tensor, the merged tensor comprising data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; andaggregating the merged tensor and the base tensor.4.The method of claim 3, wherein aggregating the merged tensor and the base tensor comprises:aggregating a first data element in the merged tensor with a second data element in the base tensor, wherein a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.5.The method of claim 1, wherein the input tensor is processed in a layer of the base model, and the method further comprises:processing the output tensor in a subsequent layer of the base model.6.The method of claim 5, wherein the task tensors are processed in layers of the adapter models, and the method further comprises:splitting the output tensor into additional task tensors, an additional task tensor comprising one or more data elements in the output tensor that are associated with a same task; andprocessing the additional task tensors in subsequent layers of the adapter models.7.The method of claim 1, wherein the input tensor is generated from requests for performing the different tasks, a request comprises a text string, and the input tensor comprises a token that encodes the text string.8.One or more non-transitory computer-readable media storing instructions executable to perform operations, the operations comprising:receiving an input tensor, the input tensor comprising input data elements associated with different tasks;processing the input tensor in a base model, the base model generating a base tensor, the base tensor comprising base data elements associated with the different tasks;splitting the input tensor into task tensors, a task tensor comprising one or more input data elements that are associated with a same task;processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors; andgenerating an output tensor by merging the base tensor with the adapter tensors.9.The one or more non-transitory computer-readable media of claim 8, wherein splitting the input tensor into the task tensors comprises:generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; andsplitting the input tensor into the task tensors based on the task indexes.10.The one or more non-transitory computer-readable media of claim 9, wherein each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors comprises:merging the adapter tensors to form a merged tensor, the merged tensor comprising data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; andaggregating the merged tensor and the base tensor.11.The one or more non-transitory computer-readable media of claim 10, wherein aggregating the merged tensor and the base tensor comprises:aggregating a first data element in the merged tensor with a second data element in the base tensor, wherein a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.12.The one or more non-transitory computer-readable media of claim 8, wherein the input tensor is processed in a layer of the base model, and the operations further comprise:processing the output tensor in a subsequent layer of the base model.13.The one or more non-transitory computer-readable media of claim 12, wherein the task tensors are processed in layers of the adapter models, and the operations further comprise:splitting the output tensor into additional task tensors, an additional task tensor comprising one or more data elements in the output tensor that are associated with a same task; andprocessing the additional task tensors in subsequent layers of the adapter models.14.The one or more non-transitory computer-readable media of claim 8, wherein the input tensor is generated from requests for performing the different tasks, a request comprises a text string, and the input tensor comprises a token that encodes the text string.15.An apparatus, comprising:a computer processor for executing computer program instructions; anda non-transitory computer-readable memory storing computer program instructions executable by the computer processor to perform operations comprising:receiving an input tensor, the input tensor comprising input data elements associated with different tasks,processing the input tensor in a base model, the base model generating a base tensor, the base tensor comprising base data elements associated with the different tasks,splitting the input tensor into task tensors, a task tensor comprising one or more input data elements that are associated with a same task,processing the task tensors in adapter models, the adapter models generating adapter tensors, different ones of the adapter models receiving different ones of the task tensors and generating different ones of the adapter tensors, andgenerating an output tensor by merging the base tensor with the adapter tensors.16.The apparatus of claim 15, wherein splitting the input tensor into the task tensors comprises:generating task indexes of the task tensors, a task index of a task tensor indicating which task the task tensor is associated with; andsplitting the input tensor into the task tensors based on the task indexes.17.The apparatus of claim 16, wherein each respective adapter tensor is associated with a task index of a task tensor form which the respective adapter tensor is generated, and merging the base tensor with the adapter tensors comprises:merging the adapter tensors to form a merged tensor, the merged tensor comprising data elements in the adapter tensors, a position of a data element in the merged tensor determined based on a task index associated with an adapter tensor including the data element; andaggregating the merged tensor and the base tensor.18.The apparatus of claim 17, wherein aggregating the merged tensor and the base tensor comprises:aggregating a first data element in the merged tensor with a second data element in the base tensor, wherein a position of the first data element in the merged tensor matches a position of the second data element in the base tensor.19.The apparatus of claim 15, wherein the input tensor is processed in a layer of the base model, and the operations further comprise:processing the output tensor in a subsequent layer of the base model.20.The apparatus of claim 19, wherein the task tensors are processed in layers of the adapter models, and the operations further comprise:splitting the output tensor into additional task tensors, an additional task tensor comprising one or more data elements in the output tensor that are associated with a same task; andprocessing the additional task tensors in subsequent layers of the adapter models.
Citation Information
Patent Citations
Multi-task adapter neural network
CN114424215A
Multi-task parallel processing method and device for deep learning framework, equipment and medium
CN115759232A
Performing operation in neural network with storage pointer and sparsity map
US20230376765A1
Training neural network with budding ensemble architecture based on diversity loss
US20230401427A1