Task execution method and device for large model, equipment, medium and product
Through the combined method of executing modal routing, domain routing and feed-forward tasks in large models, dynamically adapting computing resources solves the problems of resource redundancy and high energy consumption in task processing of large models, and achieves high efficiency and low energy consumption. task execution.
Patent Information
- Application Number
- CN202410781150.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2044-06-17
AI Technical Summary
It is difficult for large models to simultaneously ensure high model performance and superior reasoning efficiency when processing tasks, resulting in resource redundancy and high energy consumption.
Through the combination of modal routing tasks, domain routing tasks and feedforward tasks, the target computing unit is used to perform modal identification, domain identification and feedforward tasks, dynamically adapt the activated model parameters, and reduce computing resource requirements and energy consumption.
It improves the reasoning efficiency and performance of large models, reduces unnecessary parameter redundancy, and improves the flexibility and pertinence of task execution.
Smart Images

Figure CN118550707A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, in particular to the field of deep learning technology and the field of large model technology, and specifically to a task execution method, device, electronic device, storage medium and program product for large models. Background Art
[0002] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Artificial intelligence technology generally includes big model technology. Big model technology can be widely used in various fields of artificial intelligence. For example, text processing, semantic understanding, machine translation, human-computer interaction, etc. Using big models to perform tasks in different fields requires comprehensive consideration of factors such as timeliness and cost. Summary of the invention
[0003] The present disclosure provides a task execution method, device, electronic device, storage medium and program product for a large model.
[0004] According to one aspect of the present disclosure, a task execution method for a large model is provided, comprising: based on target features to be processed, using a target computing unit to execute a modal routing task to obtain a modal recognition result; based on the target features to be processed and target domain gating model parameters, using the target computing unit to execute a domain routing task to obtain a domain recognition result, wherein the target domain gating model parameters are domain gating model parameters corresponding to the modal recognition result and read from a target storage unit; and based on the target features to be processed and target feedforward task model parameters, using the target computing unit to execute a feedforward task to obtain a task execution result, wherein the target feedforward task model parameters are feedforward task model parameters corresponding to the domain recognition result and read from the target storage unit.
[0005] According to another aspect of the present disclosure, a task execution device for a large model is provided, comprising: a target storage unit storing a plurality of domain gating model parameters and a plurality of feedforward task model parameters; a target computing unit configured to: based on target features to be processed, use the target computing unit to execute a modal routing task to obtain a modal recognition result; based on the target features to be processed and the target domain gating model parameters, use the target computing unit to execute a domain routing task to obtain a domain recognition result, wherein the target domain gating model parameters are domain gating model parameters corresponding to the modal recognition result and read from the target storage unit; and based on the target features to be processed and the target feedforward task model parameters, use the target computing unit to execute a feedforward task to obtain a task execution result, wherein the target feedforward task model parameters are feedforward task model parameters corresponding to the domain recognition result and read from the target storage unit.
[0006] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described above.
[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the above method.
[0008] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and the computer program implements the above method when executed by a processor.
[0009] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0011] Figure 1 Schematically illustrates an exemplary system architecture to which a task execution method and apparatus for a large model can be applied according to an embodiment of the present disclosure;
[0012] Figure 2 A flowchart of a task execution method for a large model according to an embodiment of the present disclosure is schematically shown;
[0013] Figure 3 is a schematic diagram of the structure of the processing layer of a large model according to an embodiment of the present disclosure;
[0014] Figure 4A A schematic diagram of determining a large model according to an embodiment of the present disclosure is schematically shown;
[0015] Figure 4B A schematic diagram of determining a large model according to another embodiment of the present disclosure is schematically shown;
[0016] Figure 5 A block diagram schematically shows a task execution device for a large model according to an embodiment of the present disclosure; and
[0017] Figure 6 A block diagram of an electronic device suitable for implementing a task execution method for a large model according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0018] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0019] In the field of deep learning, the application of large models is constantly expanding. For example, large models can include large language models (LLMs), large image models, and large audio models. Large models demonstrate superb task processing capabilities. However, it is usually difficult to ensure that large models have high model performance and excellent processing efficiency at the same time.
[0020] The large model can be a pre-trained large model. The architecture of the large model can be a Transformer (encoder-decoder) architecture. The Transformer architecture has powerful data processing capabilities and flexibility, and its application in the field of natural language processing is constantly expanding. The large model of the Transformer architecture can include multiple processing layers. The structure of each processing layer can be the same, including a module based on the Multi Head self Attention mechanism (MHA) and a module based on the Feed-Forward Network (FFN).
[0021] All parameters in each processing layer process the input data. Each parameter in the processing layer plays a different role for input data of different domain types and different modal types. This means that during each task execution, the entire large model must be run, but only a small number of parameters can actually play a role. In the case of redundant parameters, the model reasoning efficiency may be low.
[0022] Therefore, in order to ensure high model performance of large models while having superior reasoning efficiency, the present disclosure provides a task execution method for large models, which will be described below.
[0023] Figure 1 An exemplary system architecture to which the task execution method and apparatus for a large model according to an embodiment of the present disclosure can be applied is schematically shown.
[0024] It should be noted that Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0025] like Figure 1 As shown, the system architecture according to this embodiment may include a terminal device 101, a network 102, and a server cluster 103. The network 102 is used to provide a medium for a communication link between the terminal device 101 and the server cluster 103. The network 102 may also be used to provide a medium for a communication link within the server cluster 103. The network 102 may include various connection types, such as wired and / or wireless communication links, etc.
[0026] The user can use the terminal device 101 to interact with the server cluster 103 through the network 102 to receive or send messages, etc. For example, the terminal device 101 can send a request for training a deep learning model to the server cluster 103 through the network 102.
[0027] Various communication client applications may be installed on the terminal device 101, such as knowledge reading applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software (for example only).
[0028] The terminal device 101 may be any electronic device having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like.
[0029] The server cluster 103 may be a server that provides various services, such as a background management server that provides support for requests sent by users using the terminal device 101 (only an example).
[0030] The server cluster 103 may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0031] The server cluster 103 includes multiple server nodes 1031, 1032, 1033, 1034, each of which includes one or more hardware devices. The server cluster 103 or the server node can be used to execute the task execution method for a large model provided by the present disclosure to achieve deployment, reasoning or training of a large model with lower computing resources.
[0032] It can be understood that the above describes the system architecture of the present disclosure, and the following will describe the method of the present disclosure.
[0033] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure and application of user personal information involved comply with the provisions of relevant laws and regulations, take necessary confidentiality measures, and do not violate public order and good morals.
[0034] In the technical solution of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0035] Figure 2 The flowchart of the task execution method for a large model according to an embodiment of the present disclosure is schematically shown.
[0036] like Figure 2 As shown, the method includes operations S210 to S230.
[0037] In operation S210, based on the target features to be processed, a target computing unit is used to execute a modality routing task to obtain a modality recognition result.
[0038] In the embodiment of the present disclosure, the target computing unit may include at least one of a central processing unit (CPU), a graphics processing unit (GPU), and an artificial intelligence computing unit. The artificial intelligence computing unit may include at least one of a neural network processing unit (NPU), a tensor processing unit (TPU), and a Kunlun core.
[0039] In the disclosed embodiment, the processing layer of the large model may include a modal router. The modal router is used to perform modal recognition on the target feature to be processed to obtain a modal recognition result. The modal router can be used to perform modal recognition on the target feature to be processed. The modal router can be implemented using a linear layer such as Softmax. The target computing unit can be used to process the target feature to be processed based on the modal routing model parameters of the modal router to obtain a modal recognition result to complete the modal routing task.
[0040] In the embodiment of the present disclosure, the modality recognition result may characterize the modality type of the target feature to be processed. For example, the modality type of the target feature to be processed may include at least one of text, image or audio.
[0041] In operation S220 , based on the target to-be-processed features and the target domain gating model parameters, the target computing unit is used to perform the domain routing task to obtain a domain recognition result.
[0042] In the disclosed embodiment, the domain router included in the processing layer of the large model is used to perform domain identification on the target feature to be processed to obtain a domain identification result. The domain router can also be implemented using a linear layer such as Softmax. The target computing unit can be used to perform domain routing tasks on the target feature to be processed based on the target domain gating model parameters to obtain a domain identification result.
[0043] In the disclosed embodiment, the domain identification result may characterize the domain type of the target feature to be processed. For example, the domain type of the target feature to be processed may include at least one of translation, question answering, retrieval, text generation, and intent recognition.
[0044] In the disclosed embodiment, each processing layer of the large model can be configured with multiple domain gaters, such as Router1, Router2, and Router3. Each domain gater corresponds to a modality type. For example, Router1 corresponds to a text modality type, Router2 corresponds to an image modality type, and Router3 corresponds to an audio modality type.
[0045] In the disclosed embodiment, the target domain gating model parameters may be domain gating model parameters corresponding to the modal recognition result read from the target storage unit. For example, the domain gating model parameters of Router1, Router2, and Router3 may be stored in the target storage unit. In the case where the modal recognition result indicates that the modal type of the data to be processed is a text modal type, the domain gating model parameters of Router1 may be read from the target storage unit as the target domain gating model parameters.
[0046] In operation S230, based on the target to-be-processed features and the target feedforward task model parameters, the target computing unit is used to execute the feedforward task to obtain a task execution result.
[0047] In the disclosed embodiment, the processing layer of the large model may include multiple modality expert modules, each modality expert module matches a modality type. Each modality expert module includes multiple domain expert submodules. Each domain expert submodule matches a domain type.
[0048] In the disclosed embodiment, each domain expert submodule may include at least one feedforward neural network. Each domain expert submodule is used to process the target feature to be processed, such as vector mapping, to obtain a task execution result. The target computing unit can perform a feedforward task on the target feature to be processed based on the target feedforward task model parameters of the target domain expert submodule to obtain a task execution result.
[0049] In the disclosed embodiment, each processing layer of the large model may be configured with a plurality of modal expert modules corresponding to each modal type, for example, modal expert modules Expert1, Expert1 and Expert1. Each modal expert module may include a plurality of domain expert sub-modules, for example, the modal expert module Expert1 includes domain expert sub-modules Expert1-1, Expert1-2 and Expert1-3. Each domain expert sub-module corresponds to a domain type. For example, the domain expert sub-module Expert 1-1 corresponds to the question-and-answer domain type, the domain expert sub-module Expert 1-2 corresponds to the retrieval domain type, and the domain expert sub-module Expert1-3 corresponds to the translation domain type.
[0050] In the disclosed embodiment, the target feedforward task model parameters are target feedforward task model parameters corresponding to the domain recognition result read from the target storage unit. For example, the feedforward task model parameters of the domain expert submodules Expert1-1, Expert1-2, and Expert1-3 can be stored in the target storage unit. In the case where the modal type of the modal recognition result characterizing the data to be processed is a question-answering domain type, the target feedforward task model parameters can be the feedforward task model parameters of the domain expert submodule Expert 1-1.
[0051] Through the disclosed embodiments, in the processing layer of the large model, multiple domain expert submodules are combined through an integrated learning method to form multiple modal expert modules, which can process data of different modal types, thereby improving the application ability and application scope of the large model and improving the universality of the large model. In addition, each domain expert submodule focuses on solving the feedforward task of a specific domain type under a specific modal type, thereby improving the application granularity of the large model and improving the pertinence of the large model. In addition, when executing the feedforward task of a specific domain type under the modal type, it is only necessary to use the target computing unit to perform the feedforward task based on the target feedforward task model parameters, without using all the feedforward task model parameters in all domain expert submodules, thereby improving the processing efficiency of the target computing unit while reducing the hardware resource requirements and energy consumption of the target computing unit. In addition, the modal gate controller, multiple domain gate controllers and multiple modal expert modules are combined to form a complete processing layer. The modal gate controller can dynamically adapt the target domain gate controller according to the data characteristics of the target feature to be processed, and the target domain gate controller can dynamically adapt the target domain expert submodule under the target modal expert module according to the data characteristics of the target feature to be processed, so as to improve the reasoning performance of the activated target feedforward task model parameters. In this way, the reasoning performance is improved while ensuring the reasoning efficiency of the large model.
[0052] It can be understood that the above is an overview of the method of the present invention, and the task execution method for a large model of the present invention will be further explained below.
[0053] Figure 3 It is a schematic diagram of the structure of the processing layer of a large model according to an embodiment of the present disclosure.
[0054] like Figure 3 As shown, a single processing layer of the large model includes modal gate controller Router0, first domain gate controller Router1, second domain gate controller Router2, ..., nth domain gate controller Routern, first modal expert module Expert1, second modal expert module Expert2, ..., nth modal expert module Expertn. The first modal expert module Expert1 corresponding to the first domain gate controller Router1 includes the first domain expert submodule Expert1-1, the second domain expert submodule Expert1-2, ..., the i-th domain expert submodule Expert1-i. The second modal expert module Expert2 corresponding to the second domain gate controller Router2 includes the first domain expert submodule Expert2-1, the second domain expert submodule Expert2-2, ..., the i-th domain expert submodule Expert2-i. The nth modal expert module Expertn corresponding to the nth domain gate controller Routern includes the first domain expert submodule Expertn-1, the second domain expert submodule Expertn-2, ..., the i-th domain expert submodule Expertn-i.
[0055] The domain gating model parameters of the first domain gate controller Router1, the second domain gate controller Router2, ..., and the nth domain gate controller Routern correspond to different modal types.
[0056] The feedforward task model parameters of the multiple domain expert sub-modules corresponding to the same domain gate controller correspond to different domain types.
[0057] Modal gating model parameters, multiple domain gating model parameters and multiple feedforward task model parameters may be pre-stored in a target storage unit.
[0058] like Figure 3As shown, based on the target feature to be processed 310 and the modal gating model parameters of the modal gate stored in the target storage unit, the target computing unit can be used to perform the modal routing task to obtain a modal recognition result. For example, the modal recognition result characterizes that the modal type of the target feature to be processed corresponds to the first domain gate Router1. Based on the target feature to be processed and the target domain gating model parameters of the first domain gate Router1, the target computing unit can be used to perform the domain routing task to obtain a domain recognition result. For example, the domain recognition result characterizes that the domain type of the target feature to be processed corresponds to the first domain expert submodule Expert1-1. Based on the target feature to be processed and the target feedforward task model parameters of the first domain expert submodule Expert1-1, the target computing unit can be used to perform the feedforward task to obtain a task execution result 320.
[0059] According to an embodiment of the present disclosure, the task execution method for a large model may further include: based on the modal recognition result, obtaining a target domain gating model parameter from a plurality of domain gating model parameters stored in a target storage unit. Based on the target to-be-processed features and the target domain gating model parameter, the target computing unit is used to execute a domain routing task to obtain a domain recognition result.
[0060] According to an embodiment of the present disclosure, the task execution method for a large model may further include: based on the domain recognition result, obtaining a target feedforward task model parameter from a plurality of feedforward task model parameters stored in a target storage unit. Based on the target to-be-processed features and the target feedforward task model parameter, the target computing unit is used to execute the feedforward task to obtain a task execution result.
[0061] In the embodiment of the present disclosure, the input data of the large model can be the data to be processed whose modality type is text and whose domain type is question and answer. After being processed by the pre-processing layer of the processing layer, the target feature to be processed is obtained. After the task execution method provided by the embodiment of the present disclosure, the obtained task execution result can be used to obtain the output result of the large model. The output result can be the answer corresponding to the data to be processed.
[0062] According to an embodiment of the present disclosure, the modality type may include at least one of the following: image, text, audio. The domain type may include at least one of the following: translation data, question and answer data, retrieval data, text generation data, and intent recognition data.
[0063] In other embodiments, the processing layer of the large model may be composed of two parts: a gating network and an expert module. The expert modules may include: the first expert module Expert1-1, Expert2-1, ..., Expertn-1. The second expert module Expert1-2, Expert2-2, ..., Expertn-2. The i-th expert module Experti-1, Experti-2, ..., Experti-n. The gating network is responsible for dynamically determining which expert module should be activated to generate the best prediction based on the characteristics of the target feature to be processed. Based on the results output by the gating network, the target expert module is determined from multiple expert modules. Thus, the target feature to be processed is processed using the target computing unit based on the model parameters of the target expert module to obtain the task execution result.
[0064] Compared with the task execution method using a gated network, the task execution method provided by the embodiment of the present disclosure can complete the modal classification of the target to-be-processed features by executing the modal routing task corresponding to the target domain gated model parameters. By executing the domain routing task corresponding to the target feedforward task model parameters, the domain classification of the target to-be-processed features is completed. Thus, through two-level type recognition, the target feedforward task model parameters obtained from multiple feedforward task model parameters are accurate and effective, thereby improving the reasoning accuracy and reasoning efficiency of the task execution method for large models.
[0065] It can be understood that the above describes the network structure of the processing layer of the large model. The following will further describe the method of obtaining the model parameters of the processing layer.
[0066] In the embodiments of the present disclosure, the task execution method for a large model can be applied to any service node of a server, but is not limited thereto and can also be applied to a terminal device.
[0067] In the embodiment of the present disclosure, the task execution method for a large model may further include an operation of obtaining model parameters.
[0068] For example, a model acquisition request is sent to a server using an interface. In response to receiving a plurality of feedforward task model parameters and a plurality of domain gated model parameters corresponding to the model acquisition request, the plurality of feedforward task model parameters and the plurality of domain gated model parameters are stored in a target storage unit.
[0069] In an embodiment of the present disclosure, the terminal device may send a model acquisition request to the server through an interface. After the server receives the model acquisition request sent by the terminal device, the model parameters of the large model, such as modal gated model parameters, multiple feedforward task model parameters, and multiple domain gated model parameters, may be sent to the terminal device through the interface. In response to receiving the model parameters, the terminal device stores the modal gated model parameters, multiple feedforward task model parameters, and multiple domain gated model parameters in a target storage unit. In this way, the corresponding model parameters can be obtained from the target storage unit during the process of executing a task using the target computing unit.
[0070] In the disclosed embodiment, the model acquisition request may include model performance requirements. The model performance requirements may include at least one of the following: model accuracy, model latency, energy consumption of the target computing unit, and model parameter quantity. However, it is not limited to this. It may also include the domain type of the domain expert submodule and / or the modal type of the domain gate controller.
[0071] In an embodiment of the present disclosure, the multiple feedforward task model parameters corresponding to the model acquisition request may include feedforward task model parameters that meet the model performance requirements and multiple domain gating model parameters.
[0072] Through the task execution method for large models provided by the embodiments of the present disclosure, a model acquisition request can be generated for the hardware of the terminal device, such as the resource configuration of the target computing unit, user needs, etc. Based on the model acquisition request, model parameters adapted to the hardware resources or user needs of the terminal device are obtained and successfully applied to the terminal device, thereby improving the flexibility and pertinence of the task execution method for large models and improving the satisfaction of personalized needs.
[0073] The above describes how to obtain model parameters. The following will further describe how to obtain and optimize the parameters of the feedforward task model.
[0074] According to an embodiment of the present disclosure, multiple feedforward task model parameters may be obtained in the following manner.
[0075] For example, based on the sample set and the pre-trained large model, multiple target compression large models are obtained. Based on the multiple target compression large models, multiple feedforward task model parameters are obtained.
[0076] In the disclosed embodiment, the pre-trained large model may include a pre-trained large model containing a Transformer structure. The pre-trained large model may include model parameters to be compressed that have the same functions as the model parameters of the feedforward task. The model parameters to be compressed may include, for example, model parameters for performing the feedforward task, such as model parameters of FFN. Compared with the model parameters of the feedforward task, the model parameters to be compressed have a large number of parameters.
[0077] In the disclosed embodiment, the sample set may include multiple sample subsets of different domain types. For example, the sample set may include a text-type question-and-answer sample subset, a text-type retrieval sample subset, a text-type translation sample subset, an audio-type question-and-answer sample subset, an audio-type retrieval sample subset, an audio-type translation sample subset, an image-type question-and-answer sample subset, an image-type retrieval sample subset, and an image-type translation sample subset.
[0078] In the embodiment of the present disclosure, based on multiple sample subsets and the same pre-trained large model, a computing unit can be used to perform compression tasks to obtain multiple target compression large models that correspond one-to-one to the multiple sample subsets.
[0079] In the embodiments of the present disclosure, the compression task may refer to compressing predetermined parameters in a pre-trained large model, such as model parameters to be compressed, by using a sample set, such as cropping or lightweight processing, to obtain a target compressed large model that inherits the knowledge and capabilities of the pre-trained large model and whose model parameters are smaller than the model parameters of the pre-trained large model.
[0080] In the disclosed embodiment, each of the multiple target compression models maintains the same backbone network (Backbone) as the pre-trained large model, and only the model parameters of the FFN used to perform the feedforward task are different. For example, the model parameters of the FFN used to perform the feedforward task in the target compression model correspond to the corresponding sample subset.
[0081] In the disclosed embodiment, the FFN model parameters of each of the multiple target compression models may be used as multiple feedforward task model parameters.
[0082] By using the compression method of the target compression large model provided by the embodiment of the present disclosure, the parameters of the model to be compressed are compressed, so that the model parameters of the compressed target compression large model have a small parameter amount and can well inherit the knowledge and reasoning ability of the parameters of the model to be compressed. In addition, through multiple sample subsets of different domain types, the target compression large model inherits the reasoning ability and knowledge of different domain types of the pre-trained large model under different modality types.
[0083] In the embodiment of the present disclosure, obtaining multiple target compression large models based on a sample set and a pre-trained large model may include the following operations.
[0084] For example, for each sample subset, a compressed large model is obtained based on the cropping matrix and the pre-trained large model. Based on the compressed sample subset, the pre-trained large model and the compressed large model, a target compressed large model is obtained.
[0085] In the embodiment of the present disclosure, the cropping matrix can be used to indicate the cropping method of the model parameters to be compressed. The cropping matrix Z may include multiple cropping elements, each of which can be represented by 0 or 1. Each cropping element corresponds to a model parameter of the model parameter to be compressed. 0 indicates that the model parameter is cropped, and 1 indicates that the model parameter is retained.
[0086] In the disclosed embodiment, the clipping matrix can be vector-multiplied with the model parameters of the pre-trained large model to obtain the compressed large model. Based on the sample subset, the pre-trained large model and the compressed large model, the target compressed large model is obtained.
[0087] Based on the sample subset, the pre-trained large model and the compressed large model, a target compressed large model is obtained, which may include the following operations: based on the sample subset, the pre-trained large model and the compressed large model, a computing unit is used to perform a cyclic compression task to obtain a target compressed large model.
[0088] In an embodiment of the present disclosure, the loop compression task may include: when it is determined based on the sample subset that the model performance of the pre-trained large model matches the model performance of the compressed large model, using the compressed large model as the target compressed large model. When it is determined based on the sample subset that the model performance of the pre-trained large model does not match the model performance of the compressed large model, updating the clipping matrix, thereby obtaining an updated compressed large model. The loop compression task is repeatedly performed using the updated compressed large model, the sample subset, and the pre-trained large model until the model performance of the pre-trained large model matches the model performance of the compressed large model.
[0089] By compressing the pre-trained large model through the clipping matrix provided by the embodiment of the present disclosure, the entire compression process can be analyzed, thereby improving the compression efficiency. In addition, by compressing the pre-trained large model using multiple sample subsets of different field types, the type of the obtained target compressed large model can be improved, thereby further improving the compression efficiency.
[0090] In the disclosed embodiment, obtaining a target compressed large model based on a sample subset, a pre-trained large model, and a compressed large model may include the following operations: determining a reference reasoning capability of the pre-trained large model and a verification reasoning capability of the compressed large model based on the sample subset. When the verification reasoning capability matches the reference reasoning capability, determining a target compressed large model based on the compressed large model.
[0091] For example, the sample data subsets in the sample subsets can be processed using the pre-trained large model and the compressed large model, respectively, to obtain a first prediction result corresponding to the pre-trained large model and a second prediction result corresponding to the compressed large model. Based on the first prediction result and the label subset corresponding to the sample data subset, a reference reasoning capability is obtained. Based on the second prediction result and the label subset corresponding to the sample data subset, a verification reasoning capability is obtained. When the similarity between the verification reasoning capability and the reference reasoning capability is greater than a threshold, it is determined that the verification reasoning capability matches the reference reasoning capability.
[0092] When the similarity between the verification reasoning capability and the reference reasoning capability is less than or equal to the threshold, it is determined that the verification reasoning capability does not match the reference reasoning capability. Based on the reference reasoning capability and the verification reasoning capability, the model parameters of the pre-trained large model and the cropping elements of the cropping matrix can be adjusted to obtain an updated pre-trained large model and an updated cropping matrix.
[0093] Based on the sample subset, the updated pre-trained large model and the updated cropping elements of the cropping matrix, the compression task is re-executed until the reference reasoning capability matches the verification reasoning capability. The compression large model whose reference reasoning capability matches the verification reasoning capability is used as the target compression large model.
[0094] In another embodiment of the present disclosure, a predetermined sparsity may be set. The predetermined sparsity is used to indicate a predetermined clipping granularity. The predetermined sparsity may be determined based on information carried in the model acquisition request.
[0095] Based on the reference reasoning capability and the verification reasoning capability, adjusting the model parameters of the pre-trained large model and the cropping elements of the cropping matrix to obtain the updated pre-trained large model and the cropping elements of the updated cropping matrix may include: determining the sparsity based on the cropping matrix. Determining the sparse loss value based on the sparsity and the predetermined sparsity. Based on the reference reasoning capability, the verification reasoning capability, and the sparse loss value, adjusting the model parameters of the pre-trained large model and the cropping elements of the cropping matrix to obtain the updated pre-trained large model and the cropping elements of the updated cropping matrix.
[0096] In the disclosed embodiment, the sparse loss value can be determined based on the sparsity and the predetermined sparsity using a loss function. Using the loss function, a reference reasoning capability is obtained based on the first prediction result and the label subset corresponding to the sample data subset. Using the loss function, a verification reasoning capability is obtained based on the second prediction result and the label subset corresponding to the sample data subset. The loss function can use a cross entropy loss function, but is not limited to this, and other functions that can characterize the matching degree between two data to be evaluated can also be used.
[0097] Based on the sample subset, the updated pre-trained large model and the updated cropping elements of the cropping matrix, the compression task is re-executed until the reference reasoning ability matches the verification reasoning ability and the sparsity of the compressed large model meets the predetermined sparsity. The compressed large model whose reference reasoning ability matches the verification reasoning ability and the sparsity of the compressed large model meets the predetermined sparsity is used as the target compressed large model.
[0098] In the disclosed embodiment, compressed model parameters corresponding to the model parameters to be compressed in the target compression model may be used as feedforward task model parameters.
[0099] The target compressed large model is obtained by the compression method provided by the embodiment of the present disclosure, so that the model parameters of the target compressed large model are clipped with respect to the model parameters of the pre-trained large model, and are model parameters after lightweight processing, thereby reducing the parameter amount of the model parameters of the target compressed large model. In addition, using a sample subset as a compressed sample, the pre-trained large model is trained while compressing the pre-trained large model, thereby improving the model reasoning ability of the target compressed large model for the data of the domain type under this modality type inherited by the updated pre-trained large model, thereby improving the model reasoning ability of the target compressed large model.
[0100] In the embodiment of the present disclosure, the multiple feedforward model parameters obtained in the above manner can be directly used as the feedforward model parameters of the large model.
[0101] In another embodiment of the present disclosure, the multiple feedforward model parameters obtained in the above manner can also be used as multiple initial feedforward model parameters. Based on the pre-trained large model, multiple initial domain gated model parameters, multiple initial feedforward task model parameters and initial modal gated model parameters, an initial large model is obtained. The initial modal gated model parameters have the same function as the model parameters used to perform the modal routing task, each initial domain gated model parameter has the same function as the domain gated model parameter, and each initial feedforward task model parameter has the same function as the feedforward task model parameter.
[0102] For example, obtaining an initial large model based on a pre-trained large model, multiple initial domain gated model parameters, multiple initial feedforward task model parameters, and initial modal gated model parameters may include: replacing the model parameters to be compressed in the pre-trained large model with the multiple initial domain gated model parameters, multiple initial feedforward task model parameters, and initial modal gated model parameters to obtain the initial large model. For example, multiple initial domain gated model parameters, multiple initial feedforward task model parameters, and initial modal gated model parameters are used as a hybrid expert architecture to replace the FFN layer corresponding to the model parameters to be compressed in the pre-trained large model to obtain the initial large model. The hybrid expert architecture contains multiple hierarchical networks, and can use multi-level routing in multiple hierarchical networks to accurately locate the initial feedforward task model parameters. The initial feedforward task model parameters can ensure the inference performance while improving the inference efficiency through the small model parameter amount.
[0103] The initial large model can be optimized and trained to obtain a large model. Through optimization training, the model combination suitability of the hybrid expert architecture is further improved, thereby improving the model reasoning performance of the large model.
[0104] The optimization training of the initial large model to obtain the large model will be further explained below.
[0105] According to an embodiment of the present disclosure, optimizing and training the initial large model to obtain the large model may include: obtaining a model output result set based on a sample data set of a sample set and the initial large model. Obtaining multiple loss values based on the model output result set and the label set. Obtaining the large model based on the multiple loss values and the initial large model. Using the model parameters in the large model that have the same function as the feedforward task model parameters as the feedforward task model parameters.
[0106] The sample set may also include a label set that matches the sample data set, the sample data set includes multiple sample data subsets of different domain types, and the initial large model includes model parameters with the same functions as the feedforward task model parameters.
[0107] In the disclosed embodiment, a sample data set of a sample set can be input into an initial large model to obtain a model output result set. The model output result set and the label set are input into a loss function to obtain multiple loss values. Based on the multiple loss values and the initial large model, a large model is obtained. The multiple loss values correspond one-to-one to the multiple sample data subsets.
[0108] There is no restriction on the type of loss function. It can include the cross entropy loss function. Any loss function that can determine the loss value will do.
[0109] According to an embodiment of the present disclosure, obtaining feedforward task model parameters based on multiple loss values and an initial large model may include: obtaining a target loss value based on multiple loss values. Obtaining feedforward task model parameters based on the target loss value and the initial large model.
[0110] Based on the multiple loss values, obtaining the target loss value may include: performing weighted summation on the multiple loss values to obtain the target loss value. When it is determined that the target loss value does not converge, adjusting the initial large model. When it is determined that the target loss value converges, using the initial large model with the converged target loss value as the large model. Using the model parameters in the large model corresponding to the initial feedforward task model parameters as the feedforward task model parameters.
[0111] Through the above hybrid training method, the sample set can be used to perform hybrid fine-tuning on the entire hybrid expert architecture to improve the overall adaptability. This can improve the reasoning efficiency and reasoning performance of the large model feedforward task model parameters, while improving the classification performance of the modal routing task parameters and domain routing task parameters, thereby improving the overall performance of the large model.
[0112] Figure 4A A schematic diagram of determining a large model according to an embodiment of the present disclosure is schematically shown.
[0113] like Figure 4A As shown, the pre-trained large model may include multiple processing layers, each of which includes a multi-head attention module (MHA), an addition and normalization module (Add&Norm) and a feedforward module (FFN). The model parameters of the FFN of the pre-trained large model can be compressed using the sample set to obtain multiple target compressed large models. Based on the multiple target compressed large models, multiple initial feedforward task model parameters FFN1, ..., FFNX are obtained.
[0114] like Figure 4A As shown, multiple initial domain gating model parameters Router1, ..., RouterX, multiple initial feedforward task model parameters FFN1, ..., FFNX and initial modal gating model parameters Router0 replace the model parameters of FFN in the pre-trained large model to obtain the initial large model M410.
[0115] like Figure 4A As shown, the initial large model 410 is optimized and trained using the sample set to obtain a large model M420.
[0116] Figure 4B A schematic diagram of determining a large model according to another embodiment of the present disclosure is schematically shown.
[0117] like Figure 4B As shown, the task execution method is similar to Figure 4AThe task execution method shown is similar, with the only difference being that a sample subset in the sample set is used to compress the model parameters of the FFN of the pre-trained large model to obtain a lightweight large model that matches the sample subset. The FFN parameters in the lightweight large model are copied to obtain multiple initial feedforward task parameters FFN'.
[0118] The model parameters of the FFN in the pre-trained large model are replaced by multiple initial domain gating model parameters, multiple initial feedforward task model parameters and initial modality gating model parameters to obtain an initial large model M410'. The initial large model M410' is trained using the sample set to obtain a large model M420'.
[0119] With Figure 4B Compared with the method of determining the large model shown in Figure 4A The method of determining the large model can use different types of sample subsets in the sample set so that multiple initial feedforward task model parameters can well inherit the knowledge of the pre-trained large model before trimming. The multiple initial feedforward task model parameters have natural differentiation from each other, which is conducive to improving the training efficiency and training accuracy of hybrid training.
[0120] Figure 5 A block diagram of a task execution device for a large model according to an embodiment of the present disclosure is schematically shown.
[0121] like Figure 5 As shown, the task execution device 500 for a large model includes: a target storage unit 510 and a target calculation unit 520.
[0122] The target storage unit 510 stores a plurality of domain gating model parameters and a plurality of feedforward task model parameters.
[0123] The target computing unit 520 is configured as follows:
[0124] Based on the target features to be processed, the target computing unit is used to perform the modal routing task and obtain the modal recognition result.
[0125] Based on the target features to be processed and the target domain gating model parameters, the target computing unit is used to perform the domain routing task to obtain the domain recognition result, wherein the target domain gating model parameters are the domain gating model parameters corresponding to the modal recognition result and read from the target storage unit.
[0126] Based on the target features to be processed and the target feedforward task model parameters, the target computing unit is used to execute the feedforward task to obtain a task execution result, wherein the target feedforward task model parameters are feedforward task model parameters corresponding to the domain recognition result and read from the target storage unit.
[0127] According to an embodiment of the present disclosure, the task execution device 500 for a large model further includes: an executor.
[0128] The actuator is configured as:
[0129] Based on the modality recognition result, a target domain gating model parameter is obtained from a plurality of domain gating model parameters stored in a target storage unit, wherein the plurality of domain gating model parameters correspond to different modality types.
[0130] According to an embodiment of the present disclosure, the actuator is further configured to:
[0131] Based on the domain recognition result, a target feedforward task model parameter is obtained from a plurality of feedforward task model parameters stored in a target storage unit, wherein the domain types corresponding to the plurality of feedforward task model parameters are different from each other.
[0132] According to an embodiment of the present disclosure, multiple feedforward task model parameters are obtained in the following manner.
[0133] According to an embodiment of the present disclosure, the target computing unit is further configured to:
[0134] Based on the sample set and the pre-trained large model, a plurality of target compression large models are obtained, wherein the sample set includes a plurality of sample subsets of different domain types, and the pre-trained large model includes model parameters to be compressed having the same functions as the parameters of the feedforward task model; and
[0135] Based on multiple target compression large models, multiple feed-forward task model parameters are obtained.
[0136] According to an embodiment of the present disclosure, based on a sample set and a pre-trained large model, multiple target compression large models are obtained, including:
[0137] For each sample subset, a compressed large model is obtained based on a cropping matrix and a pre-trained large model, wherein the cropping matrix is used to indicate a cropping method for parameters of the compressed model; and
[0138] A target compressed large model is obtained based on the sample subset, the pre-trained large model and the compressed large model.
[0139] According to an embodiment of the present disclosure, a target compressed large model is obtained based on a sample subset, a pre-trained large model and a compressed large model, including:
[0140] Determine the reference reasoning capability of the pre-trained large model and the verification reasoning capability of the compressed large model based on the sample subset; and
[0141] When the verification reasoning capability matches the reference reasoning capability and the sparsity of the compressed large model satisfies the predetermined sparsity, a target compressed large model is determined based on the compressed large model.
[0142] According to an embodiment of the present disclosure, the feedforward task model parameters are obtained in the following manner:
[0143] The target computing unit is also configured to:
[0144] Based on the sample data set and the initial large model of the sample set, a model output result set is obtained, wherein the sample set also includes a label set matching the sample data set, the sample data set includes multiple sample data subsets of different domain types, and the initial large model includes model parameters with the same function as the feedforward task model parameters.
[0145] Based on the model output result set and the label set, multiple loss values are obtained, wherein the multiple loss values correspond one-to-one to the multiple sample data subsets.
[0146] Based on multiple loss values and the initial large model, the feedforward task model parameters are obtained.
[0147] According to an embodiment of the present disclosure, based on multiple loss values and an initial large model, feedforward task model parameters are obtained, including:
[0148] Based on multiple loss values, a target loss value is obtained.
[0149] Based on the target loss value and the initial large model, the feedforward task model parameters are obtained.
[0150] According to an embodiment of the present disclosure, the initial large model is obtained by:
[0151] The target computing unit is also configured to:
[0152] Based on the pre-trained large model, multiple initial domain gating model parameters, multiple initial feedforward task model parameters and initial modal gating model parameters, an initial large model is obtained, wherein the initial modal gating model parameters have the same function as the model parameters used to perform the modal routing task, each initial domain gating model parameter has the same function as the domain gating model parameter, and each initial feedforward task model parameter has the same function as the feedforward task model parameter.
[0153] According to an embodiment of the present disclosure, the modality type includes at least one of the following: image, text, and audio.
[0154] Domain types include at least one of the following: translation, question answering, retrieval, text generation, and intent recognition.
[0155] According to an embodiment of the present disclosure, the target computing unit is further configured to:
[0156] Use the interface to send a model acquisition request to the server.
[0157] In response to receiving a plurality of feedforward task model parameters and a plurality of domain gated model parameters corresponding to the model acquisition request, the plurality of feedforward task model parameters and the plurality of domain gated model parameters are stored in a target storage unit.
[0158] According to an embodiment of the present disclosure, the model acquisition request includes a model performance requirement.
[0159] The plurality of feedforward task model parameters corresponding to the model acquisition request include feedforward task model parameters that meet the model performance requirements.
[0160] According to an embodiment of the present disclosure, the model performance requirement includes at least one of the following:
[0161] Model accuracy, model latency, energy consumption of the target computing unit, and model parameter quantity.
[0162] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0163] According to an embodiment of the present disclosure, an electronic device includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0164] According to an embodiment of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause a computer to execute the method as described above.
[0165] According to an embodiment of the present disclosure, a computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements the method as described above.
[0166] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0167] like Figure 6As shown, the device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0168] A number of components in the device 600 are connected to an input / output (I / O) interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a disk, an optical disk, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0169] The computing unit 601 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 601 performs the various methods and processes described above, such as a task execution method for a large model. For example, in some embodiments, the task execution method for a large model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the task execution method for the large model described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to execute the task execution method for the large model in any other appropriate manner (e.g., by means of firmware).
[0170] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0171] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0172] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0173] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0174] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0175] A computer system may include a client and a server. The client and the server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises through computer programs running on respective computers and having a client-server relationship to each other. The server may be a cloud server, a server in a distributed system, or a server combined with a blockchain.
[0176] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0177] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A task execution method for a large model, comprising: Based on the target features to be processed, the target computing unit is used to perform the modal routing task to obtain the modal recognition result; Based on the target to-be-processed features and the target domain gating model parameters, the target computing unit is used to perform a domain routing task to obtain a domain recognition result, wherein the target domain gating model parameters are domain gating model parameters corresponding to the modality recognition result and read from the target storage unit; and Based on the target features to be processed and the target feedforward task model parameters, the target computing unit is used to execute the feedforward task to obtain a task execution result, wherein the target feedforward task model parameters are feedforward task model parameters corresponding to the domain recognition result and read from the target storage unit.
2. The method according to claim 1, further comprising: Based on the modality recognition result, the target domain gating model parameter is obtained from a plurality of domain gating model parameters stored in the target storage unit, wherein the plurality of domain gating model parameters correspond to different modality types.
3. The method according to claim 1 or 2, further comprising: Based on the domain identification result, the target feedforward task model parameter is obtained from a plurality of feedforward task model parameters stored in the target storage unit, wherein the domain types corresponding to the plurality of feedforward task model parameters are different from each other.
4. The method according to any one of claims 1 to 3, wherein: The multiple feedforward task model parameters are obtained in the following manner: Based on the sample set and the pre-trained large model, a plurality of target compression large models are obtained, wherein the sample set includes a plurality of sample subsets of different domain types, and the pre-trained large model includes model parameters to be compressed having the same functions as the feedforward task model parameters; and Based on the multiple target compression large models, the multiple feedforward task model parameters are obtained.
5. The method according to claim 4, wherein: Based on the sample set and the pre-trained large model, multiple target compression large models are obtained, including: For each of the sample subsets, a compressed large model is obtained based on a cropping matrix and the pre-trained large model, wherein the cropping matrix is used to indicate a cropping method for the parameters of the model to be compressed; and The target compressed large model is obtained based on the sample subset, the pre-trained large model and the compressed large model.
6. The method according to claim 5, wherein: The step of obtaining the target compressed large model based on the sample subset, the pre-trained large model and the compressed large model comprises: Determining a reference reasoning capability of the pre-trained large model and a verification reasoning capability of the compressed large model based on the sample subset; and In a case where the verification reasoning capability matches the reference reasoning capability and the sparsity of the compressed large model satisfies a predetermined sparsity, the target compressed large model is determined based on the compressed large model.
7. The method according to any one of claims 1 to 6, wherein: The feedforward task model parameters are obtained in the following way: Based on the sample data set and the initial large model of the sample set, a model output result set is obtained, wherein the sample set also includes a label set matching the sample data set, the sample data set includes a plurality of sample data subsets of different domain types, and the initial large model includes model parameters with the same function as the feedforward task model parameters; Based on the model output result set and the label set, a plurality of loss values are obtained, wherein the plurality of loss values correspond one-to-one to the plurality of sample data subsets; and Based on the multiple loss values and the initial large model, the feedforward task model parameters are obtained.
8. The method according to claim 7, wherein: The step of obtaining the feedforward task model parameters based on the multiple loss values and the initial large model includes: Based on the multiple loss values, obtaining a target loss value; and Based on the target loss value and the initial large model, the feedforward task model parameters are obtained.
9. The method according to claim 7 or 8, wherein: The initial large model is obtained in the following way: The initial large model is obtained based on a pre-trained large model, multiple initial domain gating model parameters, multiple initial feedforward task model parameters and initial modal gating model parameters, wherein the initial modal gating model parameters have the same function as the model parameters used to perform the modal routing task, each of the initial domain gating model parameters has the same function as the domain gating model parameters, and each of the initial feedforward task model parameters has the same function as the feedforward task model parameters.
10. The method according to any one of claims 1 to 9, wherein: The modality type includes at least one of the following: image, text, audio; The field type includes at least one of the following: translation, question answering, retrieval, text generation, and intent recognition.
11. The method according to any one of claims 1 to 9, further comprising: Use the interface to send a model acquisition request to the server; In response to receiving a plurality of feedforward task model parameters and a plurality of domain gated model parameters corresponding to the model acquisition request, the plurality of feedforward task model parameters and the plurality of domain gated model parameters are stored in the target storage unit.
12. The method according to claim 11, in, The model acquisition request includes model performance requirements, The plurality of feedforward task model parameters corresponding to the model acquisition request include feedforward task model parameters that meet the model performance requirements; The model performance requirements include at least one of the following: Model accuracy, model delay, energy consumption of the target computing unit, and model parameter quantity.
13. A task execution device for a large model, comprising: A target storage unit stores multiple domain gating model parameters and multiple feedforward task model parameters; The target computing unit is configured as: Based on the target features to be processed, the target computing unit is used to perform the modal routing task to obtain the modal recognition result; Based on the target to-be-processed features and the target domain gating model parameters, the target computing unit is used to perform a domain routing task to obtain a domain recognition result, wherein the target domain gating model parameters are domain gating model parameters corresponding to the modality recognition result and read from the target storage unit; and Based on the target features to be processed and the target feedforward task model parameters, the target computing unit is used to execute the feedforward task to obtain a task execution result, wherein the target feedforward task model parameters are feedforward task model parameters corresponding to the domain recognition result and read from the target storage unit.
14. The apparatus according to claim 13, further comprising: The actuator is configured as: Based on the modality recognition result, the target domain gating model parameter is obtained from a plurality of domain gating model parameters stored in the target storage unit, wherein the plurality of domain gating model parameters correspond to different modality types.
15. The device according to claim 13 or 14, wherein: The actuator is also configured to: Based on the domain identification result, the target feedforward task model parameter is obtained from a plurality of feedforward task model parameters stored in the target storage unit, wherein the domain types corresponding to the plurality of feedforward task model parameters are different from each other.
16. The device according to any one of claims 13 to 15, wherein: The multiple feedforward task model parameters are obtained in the following manner: The target computing unit is further configured to: Based on the sample set and the pre-trained large model, a plurality of target compression large models are obtained, wherein the sample set includes a plurality of sample subsets of different domain types, and the pre-trained large model includes model parameters to be compressed having the same functions as the feedforward task model parameters; and Based on the multiple target compression large models, the multiple feedforward task model parameters are obtained.
17. The device according to claim 16, wherein: Based on the sample set and the pre-trained large model, multiple target compression large models are obtained, including: For each of the sample subsets, a compressed large model is obtained based on a cropping matrix and the pre-trained large model, wherein the cropping matrix is used to indicate a cropping method for the parameters of the model to be compressed; and The target compressed large model is obtained based on the sample subset, the pre-trained large model and the compressed large model.
18. The device according to claim 17, wherein: The step of obtaining the target compressed large model based on the sample subset, the pre-trained large model and the compressed large model comprises: Determining a reference reasoning capability of the pre-trained large model and a verification reasoning capability of the compressed large model based on the sample subset; and In a case where the verification reasoning capability matches the reference reasoning capability and the sparsity of the compressed large model satisfies a predetermined sparsity, the target compressed large model is determined based on the compressed large model.
19. The device according to any one of claims 13 to 18, wherein: The feedforward task model parameters are obtained in the following way: The target computing unit is further configured to: Based on the sample data set and the initial large model of the sample set, a model output result set is obtained, wherein the sample set also includes a label set matching the sample data set, the sample data set includes a plurality of sample data subsets of different domain types, and the initial large model includes model parameters with the same function as the feedforward task model parameters; Based on the model output result set and the label set, a plurality of loss values are obtained, wherein the plurality of loss values correspond one-to-one to the plurality of sample data subsets; and Based on the multiple loss values and the initial large model, the feedforward task model parameters are obtained.
20. The device according to claim 19, wherein The step of obtaining the feedforward task model parameters based on the multiple loss values and the initial large model includes: Based on the multiple loss values, obtaining a target loss value; and Based on the target loss value and the initial large model, the feedforward task model parameters are obtained.
21. The device according to claim 19 or 20, wherein: The initial large model is obtained in the following way: The target computing unit is further configured to: The initial large model is obtained based on a pre-trained large model, multiple initial domain gating model parameters, multiple initial feedforward task model parameters and initial modal gating model parameters, wherein the initial modal gating model parameters have the same function as the model parameters used to perform the modal routing task, each of the initial domain gating model parameters has the same function as the domain gating model parameters, and each of the initial feedforward task model parameters has the same function as the feedforward task model parameters.
22. The device according to any one of claims 13 to 21, wherein: The modality type includes at least one of the following: image, text, audio; The field type includes at least one of the following: translation, question answering, retrieval, text generation, and intent recognition.
23. The apparatus according to any one of claims 13 to 22, wherein the target computing unit is further configured to: Send a model acquisition request to the server using the interface; and In response to receiving a plurality of feedforward task model parameters and a plurality of domain gated model parameters corresponding to the model acquisition request, the plurality of feedforward task model parameters and the plurality of domain gated model parameters are stored in the target storage unit.
24. The device according to claim 23, wherein: The model acquisition request includes model performance requirements, The plurality of feedforward task model parameters corresponding to the model acquisition request include feedforward task model parameters that meet the model performance requirements; The model performance requirements include at least one of the following: Model accuracy, model delay, energy consumption of the target computing unit, and model parameter quantity.
25. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 12.
26. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-12.
27. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 12.
Citation Information
Patent Citations
Sql statement testing method and device, electronic equipment and readable storage medium
CN113886244A
Training method of medical image processing model and image processing method and device
CN115797266A
Data processing method, device and equipment
CN116010545A
Application method and device for image processing network model parameter cutting and medium
CN116777943A
Data processing method and device, electronic equipment and storage medium
CN117034959A
Cited By
Training method and device of hybrid expert model, equipment and medium
CN120911554A
