Model processing method and apparatus, computer device, and storage medium

By fine-tuning the task instructions and labels and pruning the parameters in the neural network model, the problem of the model's basic capabilities being destroyed is solved, and the model's adaptability and training effectiveness are achieved, maintaining good execution capabilities in multiple downstream tasks.

CN122114036APending Publication Date: 2026-05-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2024-11-29
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing technologies, when fine-tuning neural network models for downstream tasks, can easily damage the model's fundamental capabilities, leading to poorer output and difficulty in adapting to multiple downstream tasks while maintaining the fundamental capabilities.

Method used

By acquiring task instructions and task labels from business scenarios, the neural network model is trained and fine-tuned. Combined with parameter pruning rules, unnecessary model parameters are pruned, and important task parameters are retained to form the target neural network model.

Benefits of technology

While ensuring the model's basic capabilities, the model's adaptability and execution ability in multiple downstream tasks were improved, the offset between the fine-tuned model parameters and the pre-trained model parameters was reduced, and the training effectiveness was improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122114036A_ABST
    Figure CN122114036A_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a model processing method and device, computer equipment and a storage medium, wherein the method comprises: obtaining a task instruction and a task label of the task instruction in a business scenario, the task instruction and the task label being used for training a neural network model; calling the neural network model to perform task execution processing based on the task instruction, to obtain a first execution result of the task instruction; fine-tuning model parameters of the neural network model according to the first execution result of the task instruction and the corresponding task label, to obtain fine-tuned model parameters; and performing parameter pruning processing on the fine-tuned model parameters according to a parameter pruning rule, to obtain a target neural network model; wherein the target neural network model is used for performing task execution processing according to the task instruction in the business scenario, and can improve the effectiveness of model training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a model processing method, apparatus, computer device, and storage medium. Background Technology

[0002] With the continuous development of computer technology, neural network models can be applied to downstream tasks to improve execution efficiency. Currently, before applying a neural network model to a downstream task, it is generally trained and fine-tuned using relevant task data from that downstream task. This ensures the trained neural network model has good business output capabilities in the downstream task. However, fine-tuning the neural network model using downstream task data may result in a significant gap between the fine-tuned model and the base model, damaging the model's fundamental capabilities and degrading its output performance. Therefore, how to effectively fine-tune the neural network model using downstream task data to ensure it possesses both basic business output capabilities and fundamental performance has become a current research hotspot. Summary of the Invention

[0003] This invention provides a model processing method, apparatus, computer device, and storage medium that can improve the effectiveness of model training.

[0004] On one hand, embodiments of the present invention provide a model processing method, including:

[0005] Obtain task instructions and task tags for the business scenario; the task instructions and task tags are used to train the neural network model.

[0006] The neural network model is invoked to perform task execution processing based on the task instruction, and the first execution result of the task instruction is obtained;

[0007] Based on the first execution result of the task instruction and the corresponding task label, the model parameters of the neural network model are fine-tuned to obtain the fine-tuned model parameters;

[0008] The fine-tuned model parameters are pruned according to the parameter pruning rules to obtain the target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

[0009] In another aspect, embodiments of the present invention provide a model processing apparatus, comprising:

[0010] The acquisition unit is used to acquire task instructions and task tags of the task instructions in the business scenario, and the task instructions and task tags are used to train the neural network model.

[0011] The processing unit is used to call the neural network model to perform task execution processing based on the task instruction, and obtain the first execution result of the task instruction;

[0012] The processing unit is further configured to fine-tune the model parameters of the neural network model based on the first execution result of the task instruction and the corresponding task label, so as to obtain the fine-tuned model parameters.

[0013] The processing unit is further configured to perform parameter pruning on the fine-tuned model parameters according to parameter pruning rules to obtain a target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

[0014] In one embodiment, the processing unit is specifically used for:

[0015] From the fine-tuned model parameters, the task parameters of the fine-tuned neural network model when performing task execution are determined;

[0016] The task parameters are pruned according to the parameter pruning rules to obtain the target neural network.

[0017] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters. Fine-tuning the model parameters of the neural network model is fine-tuning the pre-trained model parameters. The processing unit is specifically used for:

[0018] The difference between the fine-tuned model parameters and the pre-trained model parameters is calculated by performing a difference operation;

[0019] The difference is used as a task parameter for the fine-tuned neural network model when performing task execution.

[0020] In one embodiment, the task parameters include at least one parameter value; the processing unit is specifically used for:

[0021] The importance of each parameter value in the task parameters during the task execution process is obtained, and the task parameters are pruned according to the importance to obtain the pruned task parameters.

[0022] The target neural network is determined based on the task parameters after parameter pruning.

[0023] In one embodiment, the fine-tuned neural network model further includes a parameter mask, which is used to mask the task parameters; the processing unit is specifically used for:

[0024] The task parameters are masked using the parameter mask to obtain the masked task parameters;

[0025] Under the constraints of the task parameters after the masking process, the fine-tuned neural network model is invoked to perform task execution processing based on the task instructions, and a second execution result of the task instructions is obtained.

[0026] Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained.

[0027] In one embodiment, the task tag is a reference execution result after task execution processing based on the task instruction, and the reference execution result consists of T sequentially arranged tokens, where T is a positive integer greater than or equal to 1; the processing unit is specifically used for:

[0028] The model is invoked to perform task execution processing based on the task instruction and the t-1 words of the reference execution result, to obtain the probability of the model outputting the t-th word of the reference execution result; where 1≤t≤T and are positive integers; the model includes: the neural network model, and a neural network model under the constraints of the task parameters after masking processing;

[0029] The probability of each word element output by the model is used as the corresponding execution result of the task instruction;

[0030] Wherein, when the model is the neural network model, the probability is the first execution result; when the model is a neural network model constrained by task parameters after masking, the probability is the second execution result.

[0031] In one embodiment, the processing unit is specifically used for:

[0032] Based on the probability of each word output by the fine-tuned neural network model, determine the first loss value of the reference execution result output by the fine-tuned neural network model;

[0033] Following the direction of reducing the first loss value, the processing parameters associated with each parameter value of the task parameters are adjusted to obtain the adjusted processing parameters;

[0034] Based on the adjusted processing parameters, the importance of each parameter value in the task parameters during the task execution process is determined.

[0035] In one embodiment, the processing unit is specifically used for:

[0036] Obtain the values ​​of the processing parameters associated with each parameter value of the task parameters, and perform sparsity calculation on the values ​​of each processing parameter to obtain the sparsity of the values ​​of the processing parameters associated with each parameter value.

[0037] The sparsity of the values ​​is used as the second loss value, and the first loss value and the second loss value are weighted and summed to obtain the target loss value;

[0038] The processing parameters associated with each parameter value of the task parameters are adjusted in the direction of reducing the target loss value.

[0039] In one embodiment, the processing unit is specifically used for:

[0040] Obtain random noise set for each parameter value of the task parameters;

[0041] By using random noise with any parameter value set, the processing parameters associated with the parameter value are adjusted to obtain the adjusted processing parameters;

[0042] The adjusted processing parameter corresponding to any one of the parameter values ​​is taken as the importance of any one of the parameter values ​​in the task execution process.

[0043] In one embodiment, the adjusted processing parameter includes a first value and a second value;

[0044] When the processing parameter takes the first value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as first importance; when the processing parameter takes the second value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as second importance.

[0045] Among them, the parameter value with the highest importance is the parameter value that needs to be retained using the first value; the parameter value with the highest importance is the parameter value that needs to be invalidated using the second value.

[0046] In one embodiment, the importance of each parameter value in the task parameters during the task execution process is indicated by the processing parameters contained in the parameter mask; the processing unit is specifically used for:

[0047] Obtain the association between each processing parameter in the parameter mask and each parameter value of the task parameter; wherein, the association is: one processing parameter in the parameter mask is associated with one parameter value of the task parameter;

[0048] Based on the aforementioned association, the processing parameters of the parameter mask are used to perform multiplication on the corresponding parameter values ​​in the task parameters, and the parameter values ​​after multiplication are used as the task parameters after parameter pruning.

[0049] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters; the processing unit is specifically used for:

[0050] In determining the importance of each parameter value in the task parameters during the task execution process, the pre-trained model parameters and the task parameters are frozen.

[0051] After obtaining the task parameters after parameter pruning, the task parameters after parameter pruning and the pre-trained model parameters are merged to obtain the target neural network model.

[0052] In one embodiment, the number of business scenarios is one or more. When the number of business scenarios is at least two, the acquired task instructions and corresponding task tags under each business scenario include: the task instructions under each of the at least two business scenarios, and the task tags corresponding to the task instructions under each business scenario; the first execution result includes: the execution result obtained after the task instructions under each business scenario undergo task execution processing; the processing unit is specifically used for:

[0053] Based on the execution results obtained after task execution processing of task instructions in each business scenario, and the corresponding task labels, the neural network model is fine-tuned.

[0054] In one embodiment, the acquisition unit is further configured to acquire task instructions under the business scenario;

[0055] The processing unit is further configured to invoke the target neural network model to perform task execution processing based on the task instruction, and obtain the target execution result of the task instruction.

[0056] In another aspect, embodiments of the present invention provide a computer device, including a processor, an input device, an output device, and a memory, wherein the computer device, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program supporting the computer device in executing the above-described method, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the following steps:

[0057] Obtain task instructions and task tags for the business scenario; the task instructions and task tags are used to train the neural network model.

[0058] The neural network model is invoked to perform task execution processing based on the task instruction, and the first execution result of the task instruction is obtained;

[0059] Based on the first execution result of the task instruction and the corresponding task label, the model parameters of the neural network model are fine-tuned to obtain the fine-tuned model parameters;

[0060] The fine-tuned model parameters are pruned according to the parameter pruning rules to obtain the target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

[0061] In another aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method described in the first aspect.

[0062] In another aspect, embodiments of the present invention provide a computer program product, the computer program product including a computer program, the computer program including program instructions, and when the program instructions are invoked by a processor, causing the processor to execute the method described in the first aspect.

[0063] In this embodiment, when training a neural network model, the computer device can first obtain task instructions and corresponding task labels from at least one business scenario. Then, it can call the neural network model to perform task execution processing on the task instructions in the corresponding business scenario. Based on the obtained first execution result and the task label corresponding to the task instruction, the model parameters of the neural network model can be fine-tuned. Through this model fine-tuning method, the fine-tuned neural network model can recognize task instructions in the corresponding business scenario and perform related task execution. Furthermore, when the number of business scenarios involved in the fine-tuning of the neural network model is multiple, the fine-tuned neural network model can perform related task execution in different business scenarios. This allows the fine-tuned neural network model to adapt better to multiple different downstream tasks, thereby improving the adaptability of the neural network model. On the other hand, in order to ensure that the fundamental capabilities of the fine-tuned neural network model are not compromised, the computer device can further prune the model parameters according to parameter pruning rules. This simplifies the values ​​of the fine-tuned model parameters. Based on this simplification, the deviation between the simplified model parameters and the pre-trained model parameters is reduced compared to the deviation before simplification. Therefore, the computer device ensures the fundamental capabilities of the model while maintaining its downstream task execution capabilities, thus improving the training effectiveness of the neural network model. Attached Figure Description

[0064] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0065] Figure 1a This is a schematic diagram of a model fine-tuning process provided in an embodiment of the present invention;

[0066] Figure 1b This is a schematic diagram of a model processing system provided in an embodiment of the present invention;

[0067] Figure 2 This is a schematic flowchart of a model processing method provided in an embodiment of the present invention;

[0068] Figure 3a This is an overall flowchart of task parameter pruning provided by an embodiment of the present invention;

[0069] Figure 3b This is a schematic diagram illustrating the execution of task instructions using a trained target neural network model, as provided in an embodiment of the present invention.

[0070] Figure 4 This is a schematic flowchart of another model processing method provided in an embodiment of the present invention;

[0071] Figure 5a This is a schematic diagram of an efficient parameter fine-tuning process provided in an embodiment of the present invention;

[0072] Figure 5b This is a schematic diagram illustrating how an execution result is obtained according to an embodiment of the present invention;

[0073] Figure 5c This is a schematic diagram illustrating another way of obtaining an execution result provided by an embodiment of the present invention;

[0074] Figure 6 This is a schematic block diagram of a model processing device provided in an embodiment of the present invention;

[0075] Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation

[0076] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0077] This application proposes a model processing method that allows a computer device to fine-tune a neural network model after pre-training it, obtaining fine-tuned model parameters. To reduce the parameter offset between the fine-tuned parameters and the pre-trained model parameters (i.e., the parameters of the pre-trained neural network model), parameter pruning is performed on the fine-tuned parameters according to parameter pruning rules to obtain the target neural network model. This parameter pruning process removes some parameter values ​​from the fine-tuned model parameters while maintaining the model's ability to perform task execution. After removing some parameter values, the number of parameters in the target neural network model that have values ​​is necessarily less than the number of parameters in the fine-tuned model, thus simplifying the values ​​of the fine-tuned model parameters. This simplification reduces the offset between the final target neural network model parameters and the pre-trained model parameters, ensuring the basic task execution capabilities learned by the target neural network model during the pre-training stage. In other words, the final target neural network model is one that maintains the basic capabilities of the model while also possessing good downstream task execution capabilities. This effectively improves the adaptability of the trained target neural network model in downstream tasks, thereby enhancing the training effectiveness of the neural network model.

[0078] In one embodiment, the neural network model is a pre-trained Large Language Model (LLM), a pre-trained language model, or a pre-trained large model. A pre-trained language model refers to a language model trained on a large-scale corpus without manual annotation. It can learn general language representations and knowledge from the large-scale corpus and apply them to multiple downstream tasks, such as natural language understanding, generation, translation, classification, and response. The training of this language model mainly includes a pre-training process and a fine-tuning process. The following section will combine... Figure 1a A brief explanation of the technical means used by the computer equipment in the pre-training and fine-tuning processes is provided.

[0079] (I) Pre-training process.

[0080] The pre-training process of a large language model is similar to that of a general model training process. Both involve inputting sample data, obtaining corresponding output prediction data based on the model's recognition of the input sample data, and then updating the model parameters based on the difference between the input sample data and the output prediction data.

[0081] Large language models typically employ a network structure based on a self-attention mechanism to effectively process sequential data (such as text data). Generally, these large language models include an encoder and a decoder. The encoder encodes the input sample data into feature representations, while the decoder decodes the feature representations obtained by the encoder into an output sequence (i.e., output prediction data).

[0082] The neural network model in this embodiment also employs a network architecture based on a self-attention mechanism. For example, it could be a large model based on a transformer (a transfer learning model) architecture to handle natural language tasks, such as machine translation, text classification, and text generation. The self-attention mechanism effectively learns the weight of each element in the input sequence (input sample data, i.e., the input text data) and obtains the weight of each element by calculating the similarity between each element and other elements in the sequence. This allows for focused attention on elements relevant to the current task when processing sequence data.

[0083] Wherein, if the model parameters of the initial large language model are denoted as θ0, then the model parameters of the pre-trained large language model (i.e., the pre-trained model parameters) can be denoted as θ. pre In one embodiment, when pre-training a large language model, since the neural network model in this embodiment performs task execution processing in a business scenario, task instructions related to task execution can be used to pre-train the large language model. In a specific implementation, unsupervised learning can be used, employing a sample dataset containing a large number of task instructions to pre-train the large language model. After obtaining the sample dataset, the computer device can call the large language model to learn the knowledge and features within each task instruction in the sample dataset, thereby acquiring the underlying corpus structure and semantic knowledge in the corpus. Then, through continuous iterative learning, the model parameters are updated to make the large language model output results that are as close as possible to the actual execution of the task instructions. That is to say, the pre-training process of the large language model is to enable the large language model to possess basic text recognition and processing capabilities. Therefore, the pre-trained model parameters θ contained in the pre-trained large language model... pre These are the model parameters that characterize the basic capabilities of the large language model.

[0084] (II) Fine-tuning process.

[0085] This fine-tuning process is for the pre-trained large language model, that is, for the model parameters θ. pre The large language model is fine-tuned. In this embodiment, the computer device performs fine-tuning in the following two ways:

[0086] (1) Parameter-Efficient Fine-Tuning: This is a fine-tuning technique for pre-trained models. Compared to full fine-tuning, which usually requires updating all parameters of the pre-trained model and consumes a lot of computing resources and storage space, parameter-efficient fine-tuning only needs to adjust a part of the model's parameters or introduce a small number of additional parameters to achieve a similar effect to full fine-tuning, which can significantly reduce computing and storage overhead.

[0087] (2) Instruction fine-tuning: This method improves the response of a large language model to instructions by performing additional training on specific instructions. In this method, the model is fine-tuned on a dataset containing a variety of instructions. This dataset typically consists of some input instructions and their corresponding expected outputs. Through this fine-tuning method, the model can learn the ability to generate appropriate outputs based on different input instructions.

[0088] In this embodiment of the application, when fine-tuning the model, a dataset of multiple instructions can be used to fine-tune the instructions so that the model can adapt to different downstream tasks. In the actual fine-tuning, a small number of additional parameters (i.e., task parameters, denoted as τ) are introduced, and by modifying the additional parameters, the model can achieve the implementation of downstream tasks.

[0089] The fine-tuned model parameters (denoted as θ) obtained using this fine-tuning method are then... ft This includes: pre-trained model parameters θ pre and the trained task parameters (denoted as τ) ft In other words, the fine-tuned model parameters satisfy: θ ft =τ ft +θ pre .

[0090] In one embodiment, after fine-tuning the large language model, the fine-tuned model can adapt to downstream tasks based on the task parameters it contains. However, to adapt the fine-tuned model to different downstream tasks, task instructions from different downstream task scenarios will be used for fine-tuning. This may result in a significant deviation in model parameters between the fine-tuned model (i.e., the fine-tuned neural network model) and the pre-trained large language model (i.e., the neural network model). Therefore, the fine-tuned model obtained in this case is at risk of catastrophic forgetting. Catastrophic forgetting refers to the neural network model forgetting previously learned tasks when learning new tasks, leading to a decline in the model's performance on downstream tasks.

[0091] To avoid catastrophic forgetting in the fine-tuned large language model, which could compromise its fundamental capabilities, the computer device can perform parameter pruning on the fine-tuned model parameters after obtaining the model. This removes parameter values ​​that have little impact on downstream task execution, simplifying the parameter values ​​while still ensuring effective downstream task execution. In other words, through parameter pruning, the model can effectively execute downstream tasks while minimizing the offset between the fine-tuned large language model (with added task parameters) and the pre-trained model, thus preserving the model's fundamental capabilities.

[0092] Please see Figure 1b , Figure 1b This is a schematic diagram of the network architecture of a model processing method provided in an embodiment of this application. For example... Figure 1b As shown, this network architecture may include a server 200 and a terminal device cluster. The terminal device cluster may include one or more terminal devices; the number of terminal devices is not limited here. Figure 1b As shown, multiple terminal devices can specifically include terminal device 1, terminal device 2, terminal device 3, ..., terminal device n, where n is a positive integer. For example... Figure 1b As shown, terminal device 1, terminal device 2, terminal device 3, ..., terminal device n can all connect to server 200 via the network, so that each terminal device can interact with server 200 through the network connection.

[0093] like Figure 1b The server 200 shown can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The terminal device can be a smartphone, tablet, laptop, desktop computer, smart TV, in-vehicle terminal, smart home device, or other smart terminal. The following description uses the communication between terminal device 1 and server 200 as an example to illustrate the specific implementation of this application.

[0094] In this context, terminal device 1 can be a user terminal, and terminal device 1 can have a business client. The business client is a client that can perform task execution processing based on input task instructions. The client can be software, a mini-program (a program that does not require installation), a webpage, etc., and server 200 can be the backend server to which the business client belongs.

[0095] The following description uses terminal device 1 and server 200 as examples to illustrate the overall process of model processing involved in the embodiments of this application:

[0096] ① Obtain the task instruction input to the service client from terminal device 1, and the task label of the task instruction; wherein, the task label is the reference execution result expected by the relevant object based on the task instruction;

[0097] ②Based on the acquired task instructions and corresponding task tags, the server 200 performs task execution processing by calling a neural network model to obtain the first execution result of the task instructions, and then fine-tunes the neural network model based on the first execution result;

[0098] ③ Server 200 performs parameter pruning on the fine-tuned model parameters according to the parameter pruning rules, so as to remove parameter values ​​that are less important for task execution while ensuring the model's ability to perform tasks.

[0099] ④The neural network model indicated by the fine-tuned model parameters after removing the less important parameter values ​​is taken as the target neural network model.

[0100] By pruning the parameters of the fine-tuned neural network model, the basic capabilities of the model can be preserved while retaining its ability to perform question-answering tasks downstream, thereby improving the training effectiveness of the model.

[0101] It should be specifically noted that the data involved in the model processing of this application (such as task instructions, task tags of task instructions, etc.) requires the permission or consent of the target user when the above embodiments of this application are applied to specific products or technologies. Furthermore, the collection, use, and processing of related data must comply with the relevant laws, regulations, and standards of the region, and conform to the principles of legality, legitimacy, and necessity, without involving the acquisition of data types prohibited or restricted by laws and regulations. In some optional embodiments, the related data involved in the embodiments of this application is obtained after separate authorization from the target user. Additionally, when obtaining separate authorization from the target user, the purpose of the related data is explained to the target user.

[0102] Please see Figure 2 This is a schematic flowchart illustrating a model processing method proposed in an embodiment of this application. This model processing method can be executed by a computer device, wherein the computer device can specifically be as follows: Figure 1b The server shown can also be as follows: Figure 1b The terminal device shown is not limited in the embodiments of this application. Figure 2 As shown, the method may include:

[0103] S201, Obtain the task instructions and task tags of the task instructions in the business scenario. The task instructions and task tags are used to train the neural network model.

[0104] The task label acquired by the computer device is used to indicate the reference execution result output according to the task instruction, that is, the standard result to be output after the task processing is performed based on the task instruction. After acquiring the task instruction and the corresponding task label, the computer device will first standardize the format of the task instruction and task label to make it into standard "instruction-output" format data. Then, the data in this standard format can be input into the neural network model. In the embodiments of this application, the task instruction in the standard instruction-output format is mainly instruction text, and the task label is mainly text label. Therefore, when the task instruction and / or the corresponding task label acquired by the computer device is non-text data such as images, audio, or video, text extraction technology can be used to extract the corresponding text from the non-text data such as images, audio, or video. The text form of the task instruction and the corresponding task label are then organized into the standard instruction-output format and input into the neural network model.

[0105] In one embodiment, the computer device can acquire task instructions and corresponding task tags from a specific business scenario. After fine-tuning and pruning the neural network model using these task instructions and tags, the resulting target neural network model can perform task execution based on the input task instructions within that business scenario and output the execution results. This business scenario can be any of the following: medical, e-commerce, or gaming scenarios. The computer device acquires the task instructions and corresponding task tags for a specific business scenario by obtaining the business data within that scenario; that is, by acquiring the business data within the business scenario, the computer device can obtain the task instructions and corresponding task tags for that specific business scenario.

[0106] In the medical setting, the business data acquired may include: consultation data, knowledge response data, and medical writing data. The task instructions and task tags obtained based on the consultation data are: consultation question and consultation response result, respectively. Specifically, the consultation question may be: What should I do if I have a fever? The consultation response result may be: For a low-grade fever, physical cooling methods can be used. For a high fever, please use antipyretics as prescribed by a doctor. In addition, if there is a recurring fever, please go to the nearest hospital for treatment as soon as possible.

[0107] In e-commerce scenarios, the business data acquired may include live streaming interaction data, etc. The task instructions and corresponding task tags obtained based on the live streaming interaction data may be: the viewing problem of the live streaming audience and the solution to the viewing problem. Specifically, the viewing problem of the live streaming audience may be: the picture resolution is too low, and the solution to the viewing problem may be: please re-enter the live streaming room, or select a higher resolution setting to watch.

[0108] In a game scenario, the business data acquired can include game data. The task instructions and corresponding task tags derived from this game data can be: operation instructions for game objects and the corresponding actions performed by those game objects in the game based on these operation instructions. Here, a game object refers to a virtual object within the game, and the operation instructions for that game object can specifically be: movement instructions that control the movement of the game object. Therefore, the action performed in the game based on these movement instructions is: the game object's position in the game changes.

[0109] In another implementation, the computer device can also acquire task instructions and corresponding task tags from at least two business scenarios, and use the task instructions and task tags from each of the at least two business scenarios to perform subsequent fine-tuning and parameter pruning on the neural network model in each business scenario. After fine-tuning and pruning the neural network model using the task instructions and task tags acquired from at least two business scenarios, the final target neural network model can perform task execution processing on the task instructions of any of the at least two business scenarios and output the execution result of the input task instructions. The at least two business scenarios can be the aforementioned medical scenario and e-commerce scenario, or the aforementioned medical scenario, e-commerce scenario, and game scenario, etc. In this embodiment, the number of business scenarios involved in acquiring task instructions and corresponding task tags from the computer device is not limited.

[0110] Therefore, if the number of business scenarios involved in acquiring task instructions and corresponding task labels during the model training phase of the computer device is large enough, the computer device can execute task instructions in any business scenario. That is, after the computer device fine-tunes the neural network model using a sufficient number of task instructions and corresponding task labels from various business scenarios during the model training phase, the computer device can execute any acquired task instruction during the inference phase. This improves the adaptability of the computer device when calling the model to execute task instructions, and thus enhances the training effectiveness of the neural network model.

[0111] In one embodiment, the neural network model is an arbitrary large language model capable of executing task instructions. In the embodiments of this application, the neural network model is a large language model with a transformer (a type of transfer model) architecture. More specifically, the neural network model can be a question-answering model or a recommendation model, etc. In the embodiments of this application, the specific type of neural network model is not limited.

[0112] Furthermore, when training models, this computer device can select specific types of neural network models for training based on the type of business scenario involved in the acquired task instructions and corresponding task labels. In one embodiment, when the business scenario involved is mainly a question-and-answer type scenario, such as a medical scenario or an educational scenario, a question-and-answer model can be used as the neural network model for training. In another implementation, when the business scenario involved is mainly a recommendation type scenario, such as an e-commerce scenario or a live streaming scenario, a recommendation model can be used as the neural network model for training.

[0113] In one embodiment, when the task instructions and corresponding task tags obtained by the computer device are obtained from different business scenarios, the task instructions and corresponding task tags in different business scenarios can be obtained by acquiring business data in different business scenarios. Then, after fine-tuning the neural network model using the acquired task instructions and corresponding task tags in different task scenarios, the fine-tuned neural network model can adapt to different downstream tasks, thereby improving the adaptability of the fine-tuned neural network model to different downstream tasks.

[0114] S202, invoke the neural network model to perform task execution processing based on the task instructions, and obtain the first execution result of the task instructions.

[0115] S203, based on the first execution result of the task instruction and the corresponding task label, fine-tune the model parameters of the neural network model to obtain the fine-tuned model parameters.

[0116] In steps S202 and S203, in one embodiment, when the acquired task instruction and corresponding task label are obtained from a certain business scenario, the computer device calls the neural network model to perform task execution processing based on the task instruction to obtain the first execution result, which is the execution result of the task instruction in that scenario. Then, the subsequent process of the computer device fine-tuning the neural network model based on the first execution result and the corresponding task label is to fine-tune the model parameters of the neural network model so that the fine-tuned neural network model can have the ability to execute the task instruction in that task scenario. That is, the fine-tuned neural network model can recognize the task instruction in that task scenario and output a result that satisfies the object.

[0117] In one embodiment, for a specific neural network model, when the neural network model is a question-answering model, the question-answering model can be fine-tuned based on the task instructions and corresponding task labels in the task scenario to obtain a fine-tuned question-answering model. The fine-tuned question-answering model can output a satisfactory answer based on the input question instruction (i.e., a task instruction). Specifically, in the case of a medical scenario, the fine-tuned question-answering model can output a satisfactory answer based on the input medical question. In another implementation, if the neural network model is a recommendation model, the fine-tuned recommendation model can output satisfactory recommendation data based on the input recommendation instruction (i.e., another task instruction). In the case of a medical scenario, the fine-tuned recommendation model can output satisfactory recommendation data based on the input recommendation description information, such as recommending a department (or a doctor, or a recommended appointment time, etc.) based on the input medical question.

[0118] In another implementation, when the acquired task instructions and corresponding task labels are obtained from at least two business scenarios, the computer device calls the neural network model to perform task execution processing based on the task instructions to obtain the first execution result, which includes the execution result of the task instructions of each of the at least two task scenarios. Then, the computer device subsequently performs fine-tuning processing on the neural network model based on the first execution result and the corresponding task labels. This involves fine-tuning the model parameters of the neural network model so that the fine-tuned neural network model has the ability to execute the task instructions of each of the at least two task scenarios. Furthermore, when the number of task scenarios is sufficiently large, the fine-tuned neural network model can process any task instruction.

[0119] In the process of fine-tuning the neural network model using task instructions and corresponding task labels obtained from at least two business scenarios, for each business scenario, the computer device can obtain at least one task instruction and corresponding task label from each business scenario to fine-tune the neural network model.

[0120] In one embodiment, after fine-tuning the neural network model using a sufficient number of task instructions and corresponding task labels from various business scenarios, the fine-tuned neural network model can then perform task execution on any task instruction. For example, if the fine-tuned neural network model can perform task execution on both medical and e-commerce scenarios, and if the neural network model is specifically a question-and-answer model, then by fine-tuning the question-and-answer model according to the task instructions from multiple business scenarios, the resulting fine-tuned question-and-answer model can output responses to question instructions in both medical and e-commerce scenarios. If the neural network model is specifically a recommendation model, then by fine-tuning the recommendation model according to the task instructions from multiple business scenarios, the resulting fine-tuned recommendation model can output recommendation data based on the recommendation description information in both medical and e-commerce scenarios.

[0121] In other words, by fine-tuning the neural network model using task instructions and task labels in downstream business scenarios, the fine-tuned neural network model can be equipped with the ability to process corresponding downstream tasks. Furthermore, by fine-tuning the neural network model using task instructions and corresponding task labels from at least two downstream business scenarios, the fine-tuned neural network model can be equipped with the ability to process different downstream tasks, thereby improving the adaptability of the fine-tuned neural network model to different downstream tasks and enhancing the model's adaptability in downstream tasks.

[0122] To further ensure the model's fundamental capabilities, one could, for example... Figure 3a As shown, the neural network model is trained using this task instruction and the corresponding task label. The specific training process mainly includes the following four steps:

[0123] (1) Using data from multiple downstream tasks, the pre-trained large language model (i.e., neural network model M) is improved. pre Its model parameters are the pre-trained model parameters θ pre Fine-tuning is performed to obtain the fine-tuned large language model (i.e., the fine-tuned neural network model M). ft Its model parameters are the fine-tuned model parameters θ. ft It can better adapt to downstream tasks.

[0124] (2) Based on the fine-tuned neural network model and the pre-trained large language model, determine the task parameters of the neural network model when performing downstream execution tasks.

[0125] (3) Perform parameter pruning on the task parameters so that the fine-tuned neural network model can adapt to downstream execution tasks while retaining the basic capabilities of the model.

[0126] (4) The task parameters after parameter pruning and the model parameters of the pre-trained model are merged to obtain the final target neural network model.

[0127] As described in steps (1) to (4) above, the training process of the neural network model by the computer device mainly includes the fine-tuning process in steps (1) and (2) above, as well as the parameter pruning and merging process in steps (3) and (4). Below, we will first describe in detail the fine-tuning process of the neural network model by the computer device, and for the parameter pruning and merging process, please refer to the description in subsequent step S204.

[0128] The fine-tuning process of a computer device for a neural network model is specifically as follows: to make the neural network model M... pre To better adapt to multiple downstream tasks, the neural network model M is optimized using task data (including task instructions and corresponding task labels) from n given downstream tasks. pre Parameter fine-tuning is performed, specifically by employing the aforementioned efficient parameter fine-tuning methods for the pre-trained neural network model. In one embodiment, the given n downstream tasks can be denoted as: {T1, T2, ..., T...} n The task data for each downstream task can be denoted as: D = {D1, D2, ..., D} n}, where n is a positive integer greater than or equal to 1. Any two downstream tasks among the n downstream tasks (e.g., T1 and T2) can belong to the same downstream task (e.g., T1 and T2 are both downstream tasks belonging to the medical scenario) or belong to different downstream tasks (e.g., T1 and T2 belong to the medical scenario and the e-commerce scenario respectively). Furthermore, for any two task data D among the downstream tasks, any two task data (e.g., D1 and D2) can belong to the same downstream task (e.g., D1 and D2 are both task data belonging to T1) or belong to different downstream tasks (e.g., D1 belongs to task data belonging to downstream task T1, and D2 belongs to task data belonging to downstream task T2).

[0129] When fine-tuning a pre-trained neural network model using task data from n downstream tasks, the task instruction and corresponding task label of each downstream task can be input into the neural network model for fine-tuning. In specific implementation, since the task label indicates the reference execution result output based on the task instruction, and this execution result consists of T sequentially arranged tokens, when fine-tuning the neural network model using the task instruction (denoted as x) and task label (denoted as y), the model can output the probability of the i-th token of the task instruction based on the first i-1 tokens of the task instruction x and task label when executing the task, and fine-tune the neural network model in the direction of increasing this probability. In other words, when the computer device fine-tunes the neural network model based on task data from n downstream tasks, the fitted loss function is shown in Equation 1.

[0130]

[0131] Where D represents the training dataset (i.e., task data for different downstream tasks), (x,y)∈D is a training sample, where x is the task instruction input into the neural network model by the computer device each time, and y is the task label corresponding to x. P(y i |x,y <i This means that, given the task instruction x and the first i-1 tokens of the task label, the output i-th token is the i-th token of the task label (i.e., the output y). i The probability of ).

[0132] As shown in Equation 1, the process by which this computer device fine-tunes the neural network model using training datasets collected from different business scenarios involves iteratively fine-tuning the neural network model using task data from the training dataset D until the loss function L is reached. ft When the minimum value is obtained and the fine-tuned neural network model converges, the fine-tuning of the neural network model for multiple scenarios is completed.

[0133] In another implementation, if only task instructions and task labels from a single business scenario are used to fine-tune the neural network model, the loss function shown in Equation 1 can be used to constrain the fine-tuning process. In this case, the training dataset identified by D in Equation 1 represents different task instructions and corresponding task labels collected from this single business scenario. The fine-tuning process is similar to that in a multi-task scenario. When the loss function reaches its minimum value and the fine-tuned neural network model converges, the fine-tuning of the neural network model in this business scenario is complete.

[0134] In other words, when a computer device fine-tunes a neural network model, the number of business scenarios involved can be one or more. When the number of business scenarios is at least two, the task instructions and corresponding task labels obtained under each business scenario include: the task instructions under each of the at least two business scenarios, and the task labels corresponding to the task instructions under each business scenario. Then, the first execution result includes: the execution result obtained after the task instructions under each business scenario have undergone task execution processing. Therefore, when the computer device fine-tunes the model parameters of the neural network model based on the first execution result of the task instructions and the corresponding task labels, it does so based on the execution result obtained after the task instructions under each business scenario have undergone task execution processing, and the corresponding task labels.

[0135] In another implementation, when there is only one business scenario, the first execution result includes the execution result after the task instruction in that specific business scenario is executed. Therefore, the fine-tuning of the neural network model based on this first execution result and the task label is a fine-tuning process within that business scenario. In one embodiment, during model training (including preprocessing, fine-tuning, and subsequent parameter pruning), the neural network model is invoked to perform task execution based on the task instruction. The first execution result obtained is not output; instead, the loss value is determined solely based on this first execution result, using the loss function shown in Equation 1. However, after the neural network model completes training, during inference, the model will output the instruction execution result after performing the task instruction.

[0136] After the computer device completes the fine-tuning of the neural network model, it can perform parameter pruning on the fine-tuned model parameters contained in the fine-tuned neural network model according to the parameter pruning rules, thereby obtaining the final target neural network model, and then proceed to step S204.

[0137] S204. Perform parameter pruning on the fine-tuned model parameters according to the parameter pruning rules to obtain the target neural network model; wherein, the target neural network model is used to perform task execution processing according to task instructions in business scenarios.

[0138] In one embodiment, the pre-trained model parameters θ corresponding to the neural network model pre Model parameters are used to indicate the basic capabilities of the model, while the fine-tuned neural network model corresponds to the fine-tuned model parameters θ. ftThis not only reflects the model's basic capabilities but also indicates the ability of the fine-tuned neural network model to perform downstream tasks. Therefore, the computer device determines the fine-tuned model parameters θ. ft Then, the fine-tuned model parameters θ can be adjusted according to the parameter pruning rules. ft Parameter pruning is performed to simplify the fine-tuned model parameters. This simplifies the fine-tuned model parameters θ. ft The parameter pruning rules used in parameter pruning stipulate that pruning must be performed while preserving the model's fundamental capabilities. In other words, after pruning the fine-tuned model parameters according to these rules, the pre-trained model parameters θ should not be affected. pre The indicated model's basic capabilities mean that, when performing parameter pruning on the fine-tuned model parameters according to this parameter pruning rule, the fine-tuned model parameters θ can be adjusted. ft and pre-trained model parameters θ pre By analyzing the differences in parameters, the basic capabilities of the model can be guaranteed after parameter pruning.

[0139] When a computer device performs parameter pruning on the fine-tuned model parameters according to parameter pruning rules, the fine-tuned neural network model can be called, and the fine-tuned model parameters θ can be used. ft Under the constraints, the task is executed based on the task instruction, and the second execution result of the task instruction is obtained. Then, based on the difference between the second execution result and the task label, the importance of each parameter value in the fine-tuned model parameters can be determined, and further parameter pruning can be performed on the fine-tuned model parameters based on the importance.

[0140] In one embodiment, if the fine-tuning of the neural network model is achieved using task instructions and corresponding task labels under a single business scenario, then the task instructions used by the computer device when performing parameter pruning on the fine-tuned neural network model are also task instructions under that business scenario. That is, during the parameter pruning process, the computer device also uses the fine-tuned neural network model to identify and process the task instructions under that business scenario and obtain the second execution result.

[0141] In another implementation, if the fine-tuning of the neural network model is achieved using task instructions and corresponding task labels from multiple business scenarios, then the task instructions used by the computer device when performing parameter pruning on the fine-tuned neural network model can be task instructions corresponding to any one of the multiple business scenarios. That is, during parameter pruning, the computer device also uses the fine-tuned neural network model to identify and process task instructions from any one of the multiple business scenarios, obtaining a second execution result. Furthermore, when the number of business scenarios involved in the fine-tuning of the neural network model is sufficiently large, the computer device can call the fine-tuned neural network model to identify and process any task instruction, obtaining a second execution result. Then, based on the obtained second execution result and the corresponding task label, the importance of the parameter values ​​of the fine-tuned model is determined, and parameter pruning is performed based on the determined importance.

[0142] In one embodiment, the neural network model obtained after parameter pruning by the computer device is the target neural network model. Since the architecture of this neural network model is a large model using a transformer architecture, the parameter pruning process can be implemented using a plug-and-play module. This allows the parameter pruning method to adapt to various large model bases; that is, it only needs to ensure that the base corresponding to the neural network model is a transformer architecture. Regardless of whether the number of business scenarios involved in fine-tuning the neural network model is single or multiple, parameter pruning of the fine-tuned model parameters can be achieved by obtaining the corresponding task instructions and task labels from the relevant business scenarios. This allows the trained target neural network model to adapt to downstream tasks in the corresponding business scenarios.

[0143] Below, in conjunction with Figure 3bThe following describes a scenario where the target neural network model, obtained after parameter pruning, performs inference: First, the computer device, after obtaining a task instruction from the corresponding business scenario, calls the target neural network model to execute the task indicated by the task instruction and obtain the target execution result. Specifically, after obtaining the task instruction, the neural network model can call the target neural network model to predict the first prediction token based on the task instruction. Then, combining the first prediction token and the target task instruction, it predicts the second prediction token. Further combining the first prediction token, the second prediction token, and the task instruction, it predicts the third prediction token, and so on. All the predicted tokens are used as the execution result of the task instruction, and in an interactive scenario, the execution result of the task instruction is output to the relevant object for display.

[0144] In this embodiment, when training a neural network model, the computer device can first obtain task instructions and corresponding task labels from at least one business scenario. Then, it can call the neural network model to perform task execution processing on the task instructions in the corresponding business scenario. Based on the obtained first execution result and the task label corresponding to the task instruction, the model parameters of the neural network model can be fine-tuned. Through this model fine-tuning method, the fine-tuned neural network model can recognize task instructions in the corresponding business scenario and perform related task execution. Furthermore, when the number of business scenarios involved in the fine-tuning of the neural network model is multiple, the fine-tuned neural network model can perform related task execution in different business scenarios. This allows the fine-tuned neural network model to adapt better to multiple different downstream tasks, thereby improving the adaptability of the neural network model. On the other hand, in order to ensure that the fundamental capabilities of the fine-tuned neural network model are not compromised, the computer device can further prune the model parameters according to parameter pruning rules. This simplifies the values ​​of the fine-tuned model parameters. Based on this simplification, the deviation between the simplified model parameters and the pre-trained model parameters is reduced compared to the deviation before simplification. Therefore, the computer device ensures the fundamental capabilities of the model while maintaining its downstream task execution capabilities, thus improving the training effectiveness of the neural network model.

[0145] Please see Figure 4 This is a schematic flowchart illustrating a model processing method proposed in an embodiment of this application. This model processing method can be executed by a computer device, wherein the computer device can specifically be as follows: Figure 1bThe server shown can also be as follows: Figure 1b The terminal device shown is not limited in the embodiments of this application. Figure 4 As shown, the method may include:

[0146] S401, obtain the task instructions and task tags of the task instructions in the business scenario. The task instructions and task tags are used to train the neural network model.

[0147] S402, invoke the neural network model to perform task execution processing based on the task instructions, and obtain the first execution result of the task instructions.

[0148] S403, based on the first execution result of the task instruction and the corresponding task label, fine-tunes the model parameters of the neural network model to obtain the fine-tuned model parameters.

[0149] Steps S401 to S403 are processes for fine-tuning the pre-trained neural network model. The specific implementation of this fine-tuning process can be found in the description of steps S201 to S203 above, and will not be repeated in this embodiment.

[0150] S404 determines the task parameters of the fine-tuned neural network model when performing task execution from the fine-tuned model parameters.

[0151] When computer equipment performs parameter pruning on the fine-tuned model parameters, it must do so without affecting the model's fundamental capabilities; that is, it must not affect the pre-trained model parameters θ. pre Due to constraints on the model, the parameter pruning process performed by the computer device on the fine-tuned model parameters is to prune the parameter differences between the fine-tuned model parameters and the trained model parameters. The computer device can achieve parameter pruning of the parameter differences by freezing the pre-trained parameter portion of the fine-tuned model parameters.

[0152] In one embodiment, the computer device may employ fine-tuned model parameters θ ft With the pre-trained model parameters θ pre The difference between them is used as the representation parameter of the fine-tuned neural network model when performing downstream tasks.

[0153] In one implementation, when the computer device performs fine-tuning of the neural network model using a parameter-efficient fine-tuning method, the parameter-efficient fine-tuning method can be as follows: Figure 5a As shown, then, Figure 5a As shown, when fine-tuning a large language model using an efficient parameter tuning method, the pre-trained model parameters (θ) of the neural network model are adjusted.pre The model parameters remain unchanged, while additional model parameters (such as...) are added. Figure 5a The parameter W in A The neural network model is trained using a parameter-efficient fine-tuning method. Therefore, after the computer equipment fine-tunes the neural network model using these parameters, the task parameters for task execution are determined from these fine-tuned model parameters. These are the additional model parameters added to complete the fine-tuning (i.e.,...). Figure 5a The parameter W in B ).

[0154] In another implementation, if the computer device fine-tunes the neural network model not through additional model parameters, then the computer device can determine the task parameters of the fine-tuned neural network model during task execution from the fine-tuned model parameters. ft With the pre-trained model parameters θ pre By performing a difference operation, the difference between the fine-tuned model parameters and the pre-trained model parameters is obtained, and the obtained difference can be used as the task parameters of the fine-tuned neural network model when performing task execution.

[0155] The task parameters of the fine-tuned neural network model when performing downstream tasks can be denoted as τ. ft Therefore, the task parameters for downstream task execution determined by the fine-tuned neural network model can be represented by Equation 2.

[0156] δ ft =θ ft -θ pre Formula 2

[0157] Where, θ pre θ represents the pre-trained model parameters corresponding to the neural network model. ft τ represents the fine-tuned model parameters corresponding to the fine-tuned neural network model. ft Indicates task parameters.

[0158] After the computer equipment completes the fine-tuning process, the determined task parameters τ ftThis not only indicates the ability of the fine-tuned neural network model to perform downstream tasks, but also indicates the degree of deviation of the fine-tuned neural network model compared to the pre-trained large language model. In other words, after determining the task parameters, the computer device can determine the degree of deviation between the fine-tuned neural network model and the pre-trained neural network model based on the absolute value of the task parameters, and then determine whether to perform parameter pruning on the task parameters based on this degree of deviation. In one embodiment, if the computer device determines that the degree of deviation between the fine-tuned neural network model and the pre-trained large language model is large (i.e., greater than a preset deviation threshold) based on the absolute value of the task parameters, it will perform parameter pruning on the task parameters and proceed to step S405. Otherwise, it will not perform parameter pruning on the task parameters, and will directly merge the task parameters and the pre-trained model parameters of the neural network model to obtain the target neural network model.

[0159] In another implementation, since at least one parameter value in the task parameters is less important to the execution of downstream tasks, the computer device can directly perform parameter pruning on the task parameters without determining the degree of deviation after determining the task parameters. This ensures that each parameter value in the task parameters after parameter pruning is a parameter value that is more important to the execution of downstream tasks, thus preserving the validity of each parameter value in the task parameters.

[0160] The parameter pruning process for task parameters in computer devices involves iterative processing using at least one sample of data (including task instructions and corresponding task tags) until the retained parameter values ​​are all of high importance to the execution of downstream tasks. In this embodiment, a single task instruction and its corresponding task tag are used to illustrate one round of parameter pruning.

[0161] S405. According to the parameter pruning rules, the task parameters are pruned to obtain the target neural network.

[0162] In one embodiment, due to the fine-tuned model parameters θ ft Deviation from pre-trained model parameters θ pre When there are many, that is, the task parameter τ ft When the absolute value of M is large, the fine-tuned neural network model M ft In the downstream task {T1,T2,…,T n While it offers good performance, it may significantly impact the fundamental capabilities of the pre-trained model, potentially even destroying its original capabilities. Therefore, the task parameter τ... ftIt simultaneously affects both the model's fundamental capabilities and its performance on downstream tasks. To enable the fine-tuned neural network model M... ft To achieve a performance balance between basic capabilities and downstream tasks—that is, to not only have good performance in downstream tasks but also reduce the damage to the basic capabilities of the model—then the parameters of the task can be pruned according to the parameter pruning rules.

[0163] In one embodiment, the task parameters include at least one parameter value. When the computer device performs parameter pruning on the task parameters according to parameter pruning rules, it can first obtain the importance of each parameter value in the task parameters during the task execution process, and then prune the task parameters according to their importance to obtain the pruned task parameters. In a specific implementation, when performing parameter pruning on the task parameters, the computer device can call the fine-tuned neural network model and perform task execution processing on the task instructions based on the task parameters. Based on the second execution result obtained from the task execution, the computer device can then determine the importance of each parameter value in the task parameters and perform parameter pruning on the task parameters based on their importance.

[0164] Among them, parameter pruning involves deleting the task parameter δ. ft Parameter values ​​that have little or no impact on downstream tasks are removed, and the fine-tuned neural network model M is then optimized. ft The performance on downstream tasks will not be significantly affected. Furthermore, removing these parameter values ​​simplifies the selection of task parameters. Therefore, the number of valid parameter values ​​in the simplified task parameters is necessarily less than the number of valid parameter values ​​in the unsimplified task parameters. Consequently, the absolute value of the simplified task parameters is necessarily less than the absolute value of the unsimplified task parameters. Since the absolute value of the task parameters is used to measure the offset between the fine-tuned model parameters and the pre-trained model parameters, simplifying the task parameter values ​​can effectively reduce the number of fine-tuned model parameters θ. ft Relative to the pre-trained model parameters θ pre The offset allows for parameter pruning of task parameters, simplifying parameter values ​​without affecting model performance in downstream tasks, thereby reducing the number of fine-tuned model parameters θ. ft Relative to the pre-trained model parameters θ pre The offset between parameters. Reducing the offset between model parameters can protect the basic capabilities of the model, thus protecting the basic capabilities of the neural network model while maintaining its ability to perform downstream tasks.

[0165] In one embodiment, the influence of each parameter value of the task parameter on the downstream task can be represented by a parameter mask (denoted as m) included in the neural network model. This parameter mask also contains multiple sub-masks, with each sub-mask corresponding to a parameter value of the task parameter and representing the influence (or importance) of that corresponding parameter value on the downstream task. The importance of each parameter value in the downstream task execution is categorized as either significant or minor. Significant indicates a large impact on the downstream task, while minor indicates a small impact. Therefore, the sub-mask associated with important parameter values ​​in the task parameters must have a first value (e.g., 1), while the sub-mask associated with less important parameter values ​​must have a second value (e.g., 0). Thus, for each parameter value in the task parameters, the parameter value with the first sub-mask value is the parameter value that needs to be retained, while the parameter value with the second sub-mask value is the parameter value that needs to be pruned (i.e., invalidated or deleted). In other words, the aforementioned process of deleting parameter values ​​in the task parameters is essentially a process of masking the parameter values ​​using the second sub-mask value.

[0166] Therefore, the parameter mask used to represent the importance of each parameter value in the task parameters takes the value of a discrete value, either a first value or a second value. However, the loss function built based on these discrete values ​​may not be differentiable during gradient backpropagation, thus preventing backpropagation. To ensure the differentiability of the loss function during model training, a differentiable parameter α can be introduced to represent the parameter mask during parameter pruning. In one embodiment, the parameter α used for parameter masking also includes multiple sub-parameters. By setting one sub-parameter as a processing parameter for a parameter value of the task parameters, the importance of the corresponding parameter value can be represented using the processing parameter.

[0167] Based on the introduced parameter α for parameter masking, the process of pruning task parameters in this embodiment involves adjusting the processing parameters of parameter α during model training. This ensures that the target neural network model obtained after parameter pruning using parameter α does not compromise its fundamental capabilities (i.e., the absolute values ​​of the pruned task parameters meet preset requirements, and the offset between the model parameters of the target neural network model and the pre-trained neural network model meets preset requirements), while retaining the execution capability of downstream tasks. Therefore, by adjusting the processing parameters in parameter α, the parameter mask contained in the neural network model can also be adjusted.

[0168] To further ensure the differentiability of processing parameters during model training, random noise can be added to the parameters. This noise is Gumbel noise, which provides a differentiable approximation of each processing parameter, allowing for parameter updates via backpropagation—essentially adjusting the processing parameters. This adjustment of the processing parameters then modifies the sub-masks representing them, thereby adjusting the importance of associated parameter values. By continuously adjusting the importance of these associated parameter values, parameter pruning can be performed according to their relative importance.

[0169] When determining the importance of a parameter value based on the processing parameters set for any parameter value of a task parameter, computer equipment can use Equation 3 for determination.

[0170]

[0171] Where, m i,j ∈[0,1] represents the importance of any parameter value in the task parameters, that is, the probability that the corresponding parameter value will be retained when performing parameter pruning, α i,j Let s be the processing parameter associated with any parameter value, and s represent the state of whether each parameter value in the task parameters is retained. Here, s1 represents the state where the corresponding parameter value is retained, and s2 represents the state where the corresponding parameter value is not retained. Then, S represents the set of states (specifically, whether they are retained or not) corresponding to each parameter value in the task parameters, that is, S satisfies: S = {s1, s2}.

[0172] By using s1 and s2 to represent the state of each parameter value in the task parameters, the processing parameter α associated with any parameter value is... i,j Specifically, it can be... or

[0173] In addition, g i,j Gumbel noise is added for any parameter value, where g i,j The determination is based on a uniform distribution u i,j The method of determination of ~Uniform(0,1) satisfies Equation 4.

[0174] g i,j =-log(-logu) i,j Equation 4

[0175] Furthermore, δ>0 is a temperature hyperparameter. The smaller the value of δ, i.e., τ→0, the smoother the function shown in Equation 3 above approximates the argmax function, thereby controlling m.i,j The value of m is 1 or 0, and when m i,j When m = 1 (i.e., the first value mentioned above), it means m i,j The task parameter values ​​represented are those that need to be retained, and when m i,j When m = 0 (i.e., the second value mentioned above), it means m i,j The parameter values ​​represented are those that need to be invalidated (i.e., not retained).

[0176] Therefore, when performing parameter pruning on task parameters, the computer device can determine the importance of corresponding parameter values ​​based on the processing parameters representing parameter masks, and then perform parameter pruning on the corresponding parameter values. When using processing parameters to determine the importance of each parameter value of a task, the computer device can use a fine-tuned neural network model to execute task instructions based on the parameter values, and determine the importance based on the difference between the obtained execution result and the reference execution result indicated by the task label.

[0177] In one embodiment, when a computer device invokes a neural network model to execute a task based on the task parameters, it can directly use the task parameters contained in the fine-tuned neural network model to process the task instructions. Specifically, as follows... Figure 5b As shown, the computer device can call this fine-tuned neural network model and, based on the fine-tuned model parameters θ ft Includes initial task parameters δ ft The task instruction is identified and processed to obtain the predicted second execution result corresponding to the task instruction.

[0178] In another implementation, when the computer device invokes the fine-tuned neural network model to execute the task based on the task instruction, it can also first use a parameter mask to adjust the parameters θ of the fine-tuned model. ft The task parameters contained within are masked to obtain masked task parameters. Then, under the constraints of the masked task parameters, a fine-tuned neural network model is invoked to perform task execution processing based on the task instructions, obtaining a second execution result of the task instructions. Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained. The process of the computer device invoking the fine-tuned neural network to execute task instructions under the constraints of the masked task parameters can be described as follows: Figure 5c As shown.

[0179] Among them, the neural network model constrained by the task parameters after masking can be used as a new neural network model. In one embodiment, if the parameter mask is denoted as m, then the process of masking the task parameters with the parameter mask is the process of multiplying each parameter value in the task parameters element-wise using a sub-mask of the parameter mask. Therefore, the new task parameters obtained after masking are m⊙τ. ft Furthermore, since this new neural network model also includes pre-trained model parameters that reflect the model's fundamental capabilities, the model parameters of the new neural network model satisfy: θ pre +m⊙τ ft Here, ⊙ represents element-wise multiplication.

[0180] In one embodiment, after the computer device invokes the fine-tuned neural network model based on the task parameters to perform task execution processing on the task instruction, the second execution result can be: outputting the probability of obtaining the task label corresponding to the task instruction, or a prediction output based on the task instruction. The parameter pruning process for the task parameters will be described in detail below for these two scenarios.

[0181] (i) When the second execution result is the probability of outputting the task label.

[0182] When the second execution result is the probability of the neural network model outputting the task label, the computer device will input the task instruction and the task label together into the fine-tuned neural network model, and make the fine-tuned neural network model recognize the task instruction and the task label based on the task parameters, thereby obtaining the probability of the neural network model outputting the task label.

[0183] In one embodiment, the task label is a reference execution result based on the task instruction output. The reference execution result consists of T sequentially arranged words, where T is a positive integer greater than or equal to 1. Then, under the constraint of task parameters (which can be masked or unmasked task parameters), when the computer device calls the fine-tuned neural network model to perform task execution based on the task instruction and obtains the second execution result of the task instruction, it can call the fine-tuned neural network model based on the task parameters, combining the task instruction and the (t-1) words of the reference execution result to execute the task, obtaining the probability of the t-th word of the reference execution result output by the fine-tuned neural network model; where 1 ≤ t ≤ T and is a positive integer. This allows the computer device to use the probability of each word output by the fine-tuned neural network model as the second execution result of the task instruction. The probability of the computer device calling the neural network model to output the t-th word of the reference execution result is P(y) in Equation 1. t |x).

[0184] After obtaining the probability P of each word in the output of the neural network model, the computer device determines the importance of each parameter value in the task execution process based on the second execution result and the task label. Then, based on the probability of each word in the output of the fine-tuned neural network model, it can determine the first loss value of the reference execution result of the output of the fine-tuned neural network model. Thus, the processing parameters associated with each parameter value of the task parameters can be adjusted in the direction of reducing the first loss value. Based on the adjusted processing parameters, the importance of each parameter value in the task parameters during the task execution process can be determined.

[0185] In one embodiment, the computer device determines the first loss value of the reference execution result output by the fine-tuned neural network model based on the probability of each word in the reference execution result, which can be denoted as L1, where L1 satisfies Equation 5.

[0186]

[0187] As shown in Equation 5, after the computer device determines the first loss value, it reduces the first loss value by adjusting the processing parameter α associated with each parameter value of the task parameter. In other words, the computer device adjusts and determines the importance of each parameter value in the task parameter by adjusting the processing parameter α. Based on the adjusted processing parameter α, the current importance of each parameter value in the task parameter is determined, and parameter pruning is performed on the parameter values ​​of the task parameter according to the currently determined importance.

[0188] In one embodiment, when adjusting the processing parameters associated with each parameter value of the task parameter in the direction of reducing the first loss value, the computer device can also combine the adjustment with the sparsity of the values ​​of the processing parameters associated with each parameter value. In a specific implementation, the computer device can obtain the values ​​of the processing parameters associated with each parameter value of the task parameter, and perform sparsity calculation on the values ​​of each processing parameter to obtain the sparsity of the values ​​of the processing parameters associated with each parameter value; then, the sparsity of the values ​​can be used as the second loss value, and the first loss value and the second loss value are weighted and summed to obtain the target loss value, thereby adjusting the processing parameters associated with each parameter value of the task parameter in the direction of reducing the target loss value.

[0189] The sparsity of the values ​​used as the second loss value can be denoted as L2, and L2 satisfies the following equation 6.

[0190] L2=min∑||m||1 Equation 6

[0191] Where ||·||1 represents the L1 norm, which is used to control the sparsity of the processing parameter values. The target loss value obtained by weighted summation based on the first loss value L1 and the second loss value L2 can be denoted as L, where the target loss value satisfies the following equation 7.

[0192] L=L1+λ·L2 Equation 7

[0193] In one embodiment, λ is the weight of the second loss value, which is specifically an adjustable hyperparameter, wherein the specific value of λ can be adjusted based on the sparsity of the desired processing parameters.

[0194] By introducing sparsity in the values ​​of processing parameters, when the computer device performs parameter pruning on the task parameters of the fine-tuned neural network model, it can remove more useless parameter values ​​from the task parameters and set the values ​​of the processing parameters associated with these parameter values ​​to 0. This reduces the complexity of the model, improves the model's generalization ability in business scenarios, and ensures the basic capabilities of the model while minimizing damage to its fundamental capabilities.

[0195] In one embodiment, when the computer device determines the importance of each parameter value in the task parameters during task execution based on the adjusted processing parameters, it can do so using the method described in Equation 3 above. That is, the computer device can first obtain the random noise g set for each parameter value of the task parameters. i,j Then, random noise with any parameter value can be used to adjust the processing parameters associated with any parameter value, resulting in adjusted processing parameters. These adjusted processing parameters can then be used as the significance of any parameter value during task execution. Based on the introduction of this random noise, the processing parameters α associated with each parameter value of the task can be adjusted. i,j A differentiable approximation is made so that the model parameters can be updated via backpropagation.

[0196] In other words, the adjusted processing parameter values ​​include a first value (a non-zero integer, such as 1 or other values) and a second value (0). When the processing parameter is the first value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as first importance. When the processing parameter is the second value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as second importance. Among these, the parameter values ​​with first importance are those that need to be retained using the first value; the parameter values ​​with second importance are those that need to be invalidated using the second value.

[0197] (ii) When the second execution result is the predicted output

[0198] When the second execution result is the predicted output of the fine-tuned neural network model, the computer device mainly calls the fine-tuned neural network model to identify and process the task instructions, thereby obtaining the output prediction based on the task instructions. Then, after the computer device calls the fine-tuned neural network model based on the task parameters and obtains the predicted output, it can use the obtained output prediction as the second execution result.

[0199] After obtaining the output prediction, the computer device can further use the difference between the output prediction and the task label to determine a third loss value. Then, following the direction of reducing the third loss value, it adjusts the processing parameters associated with each parameter value of the task parameters. Based on the adjusted processing parameters, it determines the importance of each parameter value in the task execution process. In one embodiment, the computer device can determine the cross-entropy loss based on the output prediction and the task label, using the obtained cross-entropy loss value as the third loss value. Alternatively, it can determine the mean squared error between the output prediction and the task label determination as the third loss value. In this embodiment, the determined third loss value is not limited.

[0200] When the computer device adjusts the processing parameters associated with each parameter value in the task parameters based on the third loss value, it can also, as mentioned above, adjust the processing parameters associated with each parameter value by combining the third loss value and the value sparsity based on the sparsity of the processing parameters associated with each parameter value in the task parameters.

[0201] In one embodiment, when a computer device performs parameter pruning on at least one parameter value of a task parameter according to its importance, since the importance of each parameter value in the task parameter is indicated by the processing parameters contained in the parameter mask, the computer device can first obtain the association relationship between each processing parameter in the parameter mask and each parameter value of the task parameter when performing parameter pruning on at least one parameter value of the task parameter according to its importance. The association relationship is that one processing parameter in the parameter mask is associated with one parameter value of the task parameter. Then, based on the association relationship, the processing parameters of the parameter mask can be used to perform multiplication operations on the corresponding parameter values ​​in the task parameter to perform parameter pruning on the task parameter. The parameter value after the multiplication operation is the task parameter after parameter pruning.

[0202] In one embodiment, the fine-tuned neural network model also includes pre-trained model parameters θ. preThe pre-trained model parameters are obtained after the model has been pre-trained. Therefore, in determining the importance of each parameter value in the task parameters, the computer device will freeze the pre-trained model parameters of the neural network model, as well as the task parameters of the fine-tuned neural network model, i.e., maintain the model parameters θ of the pre-trained model. pre With task parameter τ ft The parameters remain unchanged, but the parameter mask m, which represents the importance of each parameter value of the task parameter, is adjusted. The process of adjusting this parameter mask m is the same as the aforementioned process of adjusting the processing parameters associated with each parameter value of the task parameter. Therefore, after the computer device performs parameter pruning on at least one parameter value of the task parameter according to its importance, it can merge the parameter-pruned task parameters with the pre-trained model parameters to obtain the target neural network model.

[0203] In other words, based on the second execution result and the task label, the final importance of each parameter value in the task parameters obtained through training is: The target neural network model obtained after parameter pruning is denoted as . Model parameters of the target neural model Then it satisfies equation 8.

[0204]

[0205] Among them, in obtaining the target neural network model Subsequently, the target neural network model can be used to execute task instructions. The target execution model trained in this way not only retains the basic capabilities of the pre-trained large language model, but also effectively completes downstream tasks based on the task parameters. This effectively improves the effectiveness of training the execution model, allowing the neural network model to retain the previously learned model capabilities when continuously learning new tasks or data without needing to retrain the model.

[0206] In one embodiment, the number of business scenarios involved in fine-tuning the large model is n, and the number of business scenarios involved in parameter pruning of the task parameters is n. Both can be adjusted based on the number of task scenarios that the target neural network model is expected to adapt to. That is, at least one sample data is collected from different task scenarios that the target neural network model is expected to adapt to in order to participate in the fine-tuning and parameter pruning process of the task parameters, so that the trained target neural network model can adapt to different downstream task scenarios.

[0207] In this embodiment, when performing parameter pruning on the fine-tuned model parameters, the computer device can use task instructions for task execution. Based on the second execution result of the task instructions output by the fine-tuned neural network model and the task label, the importance of each parameter value in the task parameters during task execution is determined, and parameter pruning is further performed according to this importance. Specifically, the process of determining the importance of parameter values ​​in the task parameters based on the second execution result and task label involves constructing a loss function based on these results. This loss function is then used to adjust the processing parameters associated with the parameter values, thereby adjusting the importance corresponding to each parameter value. Then, based on the adjusted and determined importance, parameter pruning can be performed on the task parameters to obtain the final target neural network model, thus improving the effectiveness of training the neural network model.

[0208] Please see Figure 6 , Figure 6 This is a schematic diagram of a model processing device provided in an embodiment of this application. As shown in the figure, the model processing device may include an acquisition unit 601 and a processing unit 602.

[0209] The acquisition unit 601 is used to acquire task instructions and task tags of the task instructions in the business scenario, and the task instructions and task tags are used to train the neural network model.

[0210] Processing unit 602 is used to call the neural network model to perform task execution processing based on the task instruction, and obtain the first execution result of the task instruction;

[0211] The processing unit 602 is further configured to fine-tune the model parameters of the neural network model according to the first execution result of the task instruction and the corresponding task label, so as to obtain the fine-tuned model parameters.

[0212] The processing unit 602 is further configured to perform parameter pruning on the fine-tuned model parameters according to parameter pruning rules to obtain a target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

[0213] In one embodiment, the processing unit 602 is specifically used for:

[0214] From the fine-tuned model parameters, the task parameters of the fine-tuned neural network model when performing task execution are determined;

[0215] The task parameters are pruned according to the parameter pruning rules to obtain the target neural network.

[0216] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters. Fine-tuning the model parameters of the neural network model is fine-tuning the pre-trained model parameters. The processing unit 602 is specifically used for:

[0217] The difference between the fine-tuned model parameters and the pre-trained model parameters is calculated by performing a difference operation;

[0218] The difference is used as a task parameter for the fine-tuned neural network model when performing task execution.

[0219] In one embodiment, the task parameters include at least one parameter value; the processing unit 602 is specifically used for:

[0220] The importance of each parameter value in the task parameters during the task execution process is obtained, and the task parameters are pruned according to the importance to obtain the pruned task parameters.

[0221] The target neural network is determined based on the task parameters after parameter pruning.

[0222] In one embodiment, the fine-tuned neural network model further includes a parameter mask, which is used to mask the task parameters; the processing unit 602 is specifically used for:

[0223] The task parameters are masked using the parameter mask to obtain the masked task parameters;

[0224] Under the constraints of the task parameters after the masking process, the fine-tuned neural network model is invoked to perform task execution processing based on the task instructions, and a second execution result of the task instructions is obtained.

[0225] Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained.

[0226] In one embodiment, the task tag is a reference execution result after task execution processing based on the task instruction, and the reference execution result consists of T sequentially arranged tokens, where T is a positive integer greater than or equal to 1; the processing unit 602 is specifically used for:

[0227] The model is invoked to perform task execution processing based on the task instruction and the t-1 words of the reference execution result, to obtain the probability of the model outputting the t-th word of the reference execution result; where 1≤t≤T and are positive integers; the model includes: the neural network model, and a neural network model under the constraints of the task parameters after masking processing;

[0228] The probability of each word element output by the model is used as the corresponding execution result of the task instruction;

[0229] Wherein, when the model is the neural network model, the probability is the first execution result; when the model is a neural network model constrained by task parameters after masking, the probability is the second execution result.

[0230] In one embodiment, the processing unit 602 is specifically used for:

[0231] Based on the probability of each word output by the fine-tuned neural network model, determine the first loss value of the reference execution result output by the fine-tuned neural network model;

[0232] Following the direction of reducing the first loss value, the processing parameters associated with each parameter value of the task parameters are adjusted to obtain the adjusted processing parameters;

[0233] Based on the adjusted processing parameters, the importance of each parameter value in the task parameters during the task execution process is determined.

[0234] In one embodiment, the processing unit 602 is specifically used for:

[0235] Obtain the values ​​of the processing parameters associated with each parameter value of the task parameters, and perform sparsity calculation on the values ​​of each processing parameter to obtain the sparsity of the values ​​of the processing parameters associated with each parameter value.

[0236] The sparsity of the values ​​is used as the second loss value, and the first loss value and the second loss value are weighted and summed to obtain the target loss value;

[0237] The processing parameters associated with each parameter value of the task parameters are adjusted in the direction of reducing the target loss value.

[0238] In one embodiment, the processing unit 602 is specifically used for:

[0239] Obtain random noise set for each parameter value of the task parameters;

[0240] By using random noise with any parameter value set, the processing parameters associated with the parameter value are adjusted to obtain the adjusted processing parameters;

[0241] The adjusted processing parameter corresponding to any one of the parameter values ​​is taken as the importance of any one of the parameter values ​​in the task execution process.

[0242] In one embodiment, the adjusted processing parameter includes a first value and a second value;

[0243] When the processing parameter takes the first value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as first importance; when the processing parameter takes the second value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as second importance.

[0244] Among them, the parameter value with the highest importance is the parameter value that needs to be retained using the first value; the parameter value with the highest importance is the parameter value that needs to be invalidated using the second value.

[0245] In one embodiment, the importance of each parameter value in the task parameters during the task execution process is indicated by the processing parameters contained in the parameter mask; the processing unit 602 is specifically used for:

[0246] Obtain the association between each processing parameter in the parameter mask and each parameter value of the task parameter; wherein, the association is: one processing parameter in the parameter mask is associated with one parameter value of the task parameter;

[0247] Based on the aforementioned association, the processing parameters of the parameter mask are used to perform multiplication on the corresponding parameter values ​​in the task parameters, and the parameter values ​​after multiplication are used as the task parameters after parameter pruning.

[0248] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters; the processing unit 602 is specifically used for:

[0249] In determining the importance of each parameter value in the task parameters during the task execution process, the pre-trained model parameters and the task parameters are frozen.

[0250] After obtaining the task parameters after parameter pruning, the task parameters after parameter pruning and the pre-trained model parameters are merged to obtain the target neural network model.

[0251] In one embodiment, the number of business scenarios is one or more. When the number of business scenarios is at least two, the acquired task instructions and corresponding task tags under each business scenario include: the task instructions under each of the at least two business scenarios, and the task tags corresponding to the task instructions under each business scenario; the first execution result includes: the execution result obtained after the task instructions under each business scenario undergo task execution processing; the processing unit 602 is specifically used for:

[0252] Based on the execution results obtained after task execution processing of task instructions in each business scenario, and the corresponding task labels, the neural network model is fine-tuned.

[0253] In one embodiment, the acquisition unit 601 is further configured to acquire task instructions under the business scenario;

[0254] The processing unit 602 is further configured to invoke the target neural network model to perform task execution processing based on the task instruction, and obtain the target execution result of the task instruction.

[0255] In this embodiment, when training the neural network model, the acquisition unit 601 can first acquire task instructions and corresponding task labels from at least one business scenario. Then, the processing unit 602 can call the neural network model to perform task execution processing on the task instructions in the corresponding business scenario, and fine-tune the model parameters of the neural network model based on the obtained first execution result and the task label corresponding to the task instruction. Through this model fine-tuning method, the fine-tuned neural network model can recognize task instructions in the corresponding business scenario and perform related task execution processing. Furthermore, when the processing unit 602 fine-tunes the neural network model in multiple business scenarios, the fine-tuned neural network model can perform related task execution in different business scenarios, thus enabling the fine-tuned neural network model to adapt well to multiple different downstream tasks, thereby improving the adaptability of the neural network model. On the other hand, in order to ensure that the basic capabilities of the fine-tuned neural network model are not compromised, the processing unit 602 can further perform parameter pruning on the model parameters of the fine-tuned neural network model according to parameter pruning rules, thereby simplifying the values ​​of the fine-tuned model parameters. Based on the simplification of the model parameter values, the degree of deviation between the simplified model parameters and the pre-trained model parameters is reduced compared to the degree of deviation between the model parameters before value simplification. Therefore, the computer device can ensure the basic capabilities of the model while guaranteeing the downstream task execution capability of the neural network model, thus improving the training effectiveness of the neural network model.

[0256] According to one embodiment of this application, Figure 6 The modules in the model processing apparatus shown can be individually or entirely combined into one or more units, or some of these units can be further divided into multiple functionally smaller sub-units to achieve the same operation without affecting the technical effects of the embodiments of this application. The above modules are based on logical functional division. In practical applications, the function of one module can be implemented by multiple units, or the function of multiple modules can be implemented by one unit. In other embodiments of this application, the model processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.

[0257] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0258] According to one embodiment of this application, a computer program capable of executing the steps involved in the corresponding methods shown in the various embodiments of this application can be run on a general-purpose computer device (which may include processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM)) to construct a system as described in the embodiments of this application. Figure 6 The model processing apparatus shown. The computer program described above can be recorded on a computer-readable recording medium, and can be loaded into the computer device described above through the computer-readable recording medium and run therein.

[0259] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 7As shown, the computer device 1000 may include a processor 1001, a network interface 1004, and a memory 1005. In some embodiments, the computer device 1000 may also include a user interface 1003 and at least one communication bus 1002. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen and a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as at least one disk storage device. Optionally, the memory 1005 may also be at least one storage device located remotely from the aforementioned processor 1001. Figure 7 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.

[0260] exist Figure 7 In the computer device 1000 shown, the network interface 1004 provides network communication functionality; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application program stored in the memory 1005 to achieve:

[0261] Obtain task instructions and task tags for the business scenario; the task instructions and task tags are used to train the neural network model.

[0262] The neural network model is invoked to perform task execution processing based on the task instruction, and the first execution result of the task instruction is obtained;

[0263] Based on the first execution result of the task instruction and the corresponding task label, the model parameters of the neural network model are fine-tuned to obtain the fine-tuned model parameters;

[0264] The fine-tuned model parameters are pruned according to the parameter pruning rules to obtain the target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

[0265] In one embodiment, the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0266] From the fine-tuned model parameters, the task parameters of the fine-tuned neural network model when performing task execution are determined;

[0267] The task parameters are pruned according to the parameter pruning rules to obtain the target neural network.

[0268] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters. Fine-tuning the model parameters of the neural network model is essentially fine-tuning the pre-trained model parameters. The processor 1001 can also call the device control application stored in the memory 1005 to achieve the following:

[0269] The difference between the fine-tuned model parameters and the pre-trained model parameters is calculated by performing a difference operation;

[0270] The difference is used as a task parameter for the fine-tuned neural network model when performing task execution.

[0271] In one embodiment, the task parameters include at least one parameter value; the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0272] The importance of each parameter value in the task parameters during the task execution process is obtained, and the task parameters are pruned according to the importance to obtain the pruned task parameters.

[0273] The target neural network is determined based on the task parameters after parameter pruning.

[0274] In one embodiment, the fine-tuned neural network model further includes a parameter mask, which is used to mask the task parameters; the processor 1001 can also call the device control application stored in the memory 1005 to achieve the following:

[0275] The task parameters are masked using the parameter mask to obtain the masked task parameters;

[0276] Under the constraints of the task parameters after the masking process, the fine-tuned neural network model is invoked to perform task execution processing based on the task instructions, and a second execution result of the task instructions is obtained.

[0277] Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained.

[0278] In one embodiment, the task tag is a reference execution result after task execution processing based on the task instruction, and the reference execution result consists of T sequentially arranged tokens, where T is a positive integer greater than or equal to 1; the processor 1001 can also call the device control application stored in the memory 1005 to achieve the following:

[0279] The model is invoked to perform task execution processing based on the task instruction and the t-1 words of the reference execution result, to obtain the probability of the model outputting the t-th word of the reference execution result; where 1≤t≤T and are positive integers; the model includes: the neural network model, and a neural network model under the constraints of the task parameters after masking processing;

[0280] The probability of each word element output by the model is used as the corresponding execution result of the task instruction;

[0281] Wherein, when the model is the neural network model, the probability is the first execution result; when the model is a neural network model constrained by task parameters after masking, the probability is the second execution result.

[0282] In one embodiment, the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0283] Based on the probability of each word output by the fine-tuned neural network model, determine the first loss value of the reference execution result output by the fine-tuned neural network model;

[0284] Following the direction of reducing the first loss value, the processing parameters associated with each parameter value of the task parameters are adjusted to obtain the adjusted processing parameters;

[0285] Based on the adjusted processing parameters, the importance of each parameter value in the task parameters during the task execution process is determined.

[0286] In one embodiment, the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0287] Obtain the values ​​of the processing parameters associated with each parameter value of the task parameters, and perform sparsity calculation on the values ​​of each processing parameter to obtain the sparsity of the values ​​of the processing parameters associated with each parameter value.

[0288] The sparsity of the values ​​is used as the second loss value, and the first loss value and the second loss value are weighted and summed to obtain the target loss value;

[0289] The processing parameters associated with each parameter value of the task parameters are adjusted in the direction of reducing the target loss value.

[0290] In one embodiment, the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0291] Obtain random noise set for each parameter value of the task parameters;

[0292] By using random noise with any parameter value set, the processing parameters associated with the parameter value are adjusted to obtain the adjusted processing parameters;

[0293] The adjusted processing parameter corresponding to any one of the parameter values ​​is taken as the importance of any one of the parameter values ​​in the task execution process.

[0294] In one embodiment, the adjusted processing parameter includes a first value and a second value;

[0295] When the processing parameter takes the first value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as first importance; when the processing parameter takes the second value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as second importance.

[0296] Among them, the parameter value with the highest importance is the parameter value that needs to be retained using the first value; the parameter value with the highest importance is the parameter value that needs to be invalidated using the second value.

[0297] In one embodiment, the importance of each parameter value in the task parameters during the task execution process is indicated by the processing parameters contained in the parameter mask; the processor 1001 can also call the device control application stored in the memory 1005 to achieve:

[0298] Obtain the association between each processing parameter in the parameter mask and each parameter value of the task parameter; wherein, the association is: one processing parameter in the parameter mask is associated with one parameter value of the task parameter;

[0299] Based on the aforementioned association, the processing parameters of the parameter mask are used to perform multiplication on the corresponding parameter values ​​in the task parameters, and the parameter values ​​after multiplication are used as the task parameters after parameter pruning.

[0300] In one embodiment, the neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters; the processor 1001 can also call the device control application stored in the memory 1005 to achieve the following:

[0301] In determining the importance of each parameter value in the task parameters during the task execution process, the pre-trained model parameters and the task parameters are frozen.

[0302] After obtaining the task parameters after parameter pruning, the task parameters after parameter pruning and the pre-trained model parameters are merged to obtain the target neural network model.

[0303] In one embodiment, the number of business scenarios is one or more. When the number of business scenarios is at least two, the acquired task instructions and corresponding task tags under each business scenario include: the task instructions under each of the at least two business scenarios, and the task tags corresponding to the task instructions under each business scenario; the first execution result includes: the execution result obtained after the task instructions under each business scenario have undergone task execution processing; the processor 1001 can also call the device control application stored in the memory 1005 to achieve the following:

[0304] Based on the execution results obtained after task execution processing of task instructions in each business scenario, and the corresponding task labels, the neural network model is fine-tuned.

[0305] In one embodiment, the processor 1001 can also invoke the device control application stored in the memory 1005 to achieve the following:

[0306] Obtain the task instructions in the aforementioned business scenario;

[0307] The target neural network model is invoked to perform task execution processing based on the task instructions, thereby obtaining the target execution result of the task instructions.

[0308] It should be understood that the computer device 1000 described in the embodiments of this application can execute the model processing methods described in the embodiments of this application, and can also execute the methods described above. Figure 6 The description of the model processing apparatus in the corresponding embodiments will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated.

[0309] Furthermore, it should be noted that this application also provides a computer-readable storage medium storing a computer program. When a processor executes this computer program, it can perform the model processing methods described in the various embodiments of this application; therefore, they will not be repeated here. Additionally, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0310] As an example, the aforementioned computer program can be deployed and executed on a single computer device, or deployed and executed on multiple computer devices located in one location, or executed on multiple computer devices distributed across multiple locations and interconnected via a communication network. These multiple computer devices distributed across multiple locations and interconnected via a communication network can form a blockchain network.

[0311] The aforementioned computer-readable storage medium can be an internal storage unit of the computer device, such as a hard drive or memory. It can also be an external storage device, such as a plug-in hard drive, smart media card (SMC), secure digital card (SD) card, or flash card. Furthermore, the computer-readable storage medium can include both internal and external storage units of the computer device. This computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. It can also be used to temporarily store data that has been output or will be output.

[0312] This application provides a computer program product comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the model processing methods described in the embodiments of this application; therefore, these will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer-readable storage medium involved in this application, please refer to the description of the method embodiments of this application.

[0313] The terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the term "comprising," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, apparatus, product, or device that includes a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0314] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0315] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A model processing method, characterized in that, include: Obtain task instructions and task tags for the business scenario; the task instructions and task tags are used to train the neural network model. The neural network model is invoked to perform task execution processing based on the task instruction, and the first execution result of the task instruction is obtained; Based on the first execution result of the task instruction and the corresponding task label, the model parameters of the neural network model are fine-tuned to obtain the fine-tuned model parameters; The fine-tuned model parameters are pruned according to the parameter pruning rules to obtain the target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

2. The method as described in claim 1, characterized in that, The step of performing parameter pruning on the fine-tuned model parameters according to parameter pruning rules to obtain the target neural network model includes: From the fine-tuned model parameters, the task parameters of the fine-tuned neural network model when performing task execution are determined; The task parameters are pruned according to the parameter pruning rules to obtain the target neural network.

3. The method as described in claim 2, characterized in that, The neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters. Fine-tuning the model parameters of the neural network model is fine-tuning the pre-trained model parameters. The step of determining the task parameters of the fine-tuned neural network model for task execution from the fine-tuned model parameters includes: The difference between the fine-tuned model parameters and the pre-trained model parameters is calculated by performing a difference operation; The difference is used as a task parameter for the fine-tuned neural network model when performing task execution.

4. The method as described in claim 2, characterized in that, The task parameters include at least one parameter value; the step of performing parameter pruning on the task parameters according to the parameter pruning rules to obtain the target neural network includes: The importance of each parameter value in the task parameters during the task execution process is obtained, and the task parameters are pruned according to the importance to obtain the pruned task parameters. The target neural network is determined based on the task parameters after parameter pruning.

5. The method as described in claim 4, characterized in that, The fine-tuned neural network model further includes a parameter mask, which is used to mask the task parameters; obtaining the importance of each parameter value in the task parameters during task execution includes: The task parameters are masked using the parameter mask to obtain the masked task parameters; Under the constraints of the task parameters after the masking process, the fine-tuned neural network model is invoked to perform task execution processing based on the task instructions, and a second execution result of the task instructions is obtained. Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained.

6. The method as described in claim 1 or 5, characterized in that, The task tag is a reference execution result after the task is executed based on the task instruction. The reference execution result consists of T sequentially arranged words, where T is a positive integer greater than or equal to 1. The methods by which the calling model performs task execution processing based on the task instruction and obtains the corresponding execution result of the task instruction include: The model is invoked to perform task execution processing based on the task instruction and the t-1 words of the reference execution result, to obtain the probability of the model outputting the t-th word of the reference execution result; where 1≤t≤T and are positive integers; the model includes: the neural network model, and a neural network model under the constraints of the task parameters after masking processing; The probability of each word element output by the model is used as the corresponding execution result of the task instruction; Wherein, when the model is the neural network model, the probability is the first execution result; when the model is a neural network model constrained by task parameters after masking, the probability is the second execution result.

7. The method as described in claim 6, characterized in that, Based on the second execution result, the importance of each parameter value in the task parameters during the task execution process is obtained, including: Based on the probability of each word output by the fine-tuned neural network model, determine the first loss value of the reference execution result output by the fine-tuned neural network model; Following the direction of reducing the first loss value, the processing parameters associated with each parameter value of the task parameters are adjusted to obtain the adjusted processing parameters; Based on the adjusted processing parameters, the importance of each parameter value in the task parameters during the task execution process is determined.

8. The method as described in claim 7, characterized in that, The step of adjusting the processing parameters associated with each parameter value of the task parameters in the direction of reducing the first loss value includes: Obtain the values ​​of the processing parameters associated with each parameter value of the task parameters, and perform sparsity calculation on the values ​​of each processing parameter to obtain the sparsity of the values ​​of the processing parameters associated with each parameter value. The sparsity of the values ​​is used as the second loss value, and the first loss value and the second loss value are weighted and summed to obtain the target loss value; The processing parameters associated with each parameter value of the task parameters are adjusted in the direction of reducing the target loss value.

9. The method as described in claim 7, characterized in that, The step of determining the importance of each parameter value in the task parameters during the task execution process based on the adjusted processing parameters includes: Obtain random noise set for each parameter value of the task parameters; By using random noise with any parameter value set, the processing parameters associated with the parameter value are adjusted to obtain the adjusted processing parameters; The adjusted processing parameter corresponding to any one of the parameter values ​​is taken as the importance of any one of the parameter values ​​in the task execution process.

10. The method as described in claim 7, characterized in that, The adjusted processing parameters include a first value and a second value; When the processing parameter takes the first value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as first importance; when the processing parameter takes the second value, the importance of the task parameter associated with that processing parameter in the task execution process is determined as second importance. Among them, the parameter value with the highest importance is the parameter value that needs to be retained using the first value; the parameter value with the highest importance is the parameter value that needs to be invalidated using the second value.

11. The method as described in claim 4, characterized in that, The importance of each parameter value in the task parameters during the task execution process is indicated by the processing parameters contained in the parameter mask; the step of performing parameter pruning on the task parameters according to the importance to obtain the parameter-pruned task parameters includes: Obtain the association between each processing parameter in the parameter mask and each parameter value of the task parameter; wherein, the association is: one processing parameter in the parameter mask is associated with one parameter value of the task parameter; Based on the aforementioned association, the processing parameters of the parameter mask are used to perform multiplication on the corresponding parameter values ​​in the task parameters, and the parameter values ​​after multiplication are used as the task parameters after parameter pruning.

12. The method as described in claim 4, characterized in that, The neural network model is a pre-trained large model, and the model parameters of the pre-trained large model are the pre-trained model parameters; determining the target neural network based on the task parameters after parameter pruning includes: In determining the importance of each parameter value in the task parameters during the task execution process, the pre-trained model parameters and the task parameters are frozen. After obtaining the task parameters after parameter pruning, the task parameters after parameter pruning and the pre-trained model parameters are merged to obtain the target neural network model.

13. The method as described in claim 1, characterized in that, The number of business scenarios is one or more. When the number of business scenarios is at least two, the task instructions and corresponding task tags obtained under the business scenarios include: the task instructions under each of the at least two business scenarios, and the task tags corresponding to the task instructions under each business scenario; the first execution result includes: the execution result obtained after the task instructions under each business scenario have undergone task execution processing; The step of fine-tuning the model parameters of the neural network model based on the first execution result of the task instruction and the corresponding task label includes: Based on the execution results obtained after task execution processing of task instructions in each business scenario, and the corresponding task labels, the neural network model is fine-tuned.

14. A model processing device, characterized in that, include: The acquisition unit is used to acquire task instructions and task tags of the task instructions in the business scenario, and the task instructions and task tags are used to train the neural network model. The processing unit is used to call the neural network model to perform task execution processing based on the task instruction, and obtain the first execution result of the task instruction; The processing unit is further configured to fine-tune the model parameters of the neural network model based on the first execution result of the task instruction and the corresponding task label, so as to obtain the fine-tuned model parameters. The processing unit is further configured to perform parameter pruning on the fine-tuned model parameters according to parameter pruning rules to obtain a target neural network model; wherein, the target neural network model is used to perform task execution processing according to the task instructions in the business scenario.

15. A computer device, characterized in that, The system includes a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the method as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1 to 13.

17. A computer program product, characterized in that, The computer program product includes a computer program, the computer program including program instructions, which, when invoked by a processor, cause the processor to perform the method as described in any one of claims 1 to 13.