A method, device, electronic device and storage medium for training an agent model
By training the agent model, including the task control main model and sub-model, the problem of difficulty in developing neural network models is solved, and the effect of users to easily generate the required models is achieved.
Patent Information
- Application Number
- CN202411127809.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2044-08-15
AI Technical Summary
In the prior art, the development of neural network models is difficult, and users need to understand enough knowledge related to artificial intelligence, resulting in a complex development process.
Training agent models, including task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model, generate the neural network model required by the user through feature extraction and parameter analysis, and optimize the training process using loss values and characterization information.
It reduces the difficulty of developing neural network models, enables users to easily generate the required models, and improves the accuracy and flexibility of model generation.
Smart Images

Figure CN119623562B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, electronic device, and storage medium for training an agent model. Background Art
[0002] With the continuous development of artificial intelligence technology, various neural network models have been widely used in various scenarios. However, developing neural network models requires users to have sufficient knowledge of artificial intelligence, which makes the development of neural network models more difficult.
[0003] In order to reduce the difficulty of developing neural network models, a proxy model for generating neural network models can be trained, so that users can use the above proxy model to conveniently generate the required neural network model.
[0004] In view of this, it is necessary to provide a model training solution to train the above-mentioned proxy model. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a proxy model training method, apparatus, electronic device, and storage medium to train a proxy model that can easily generate the neural network model required by the user. The specific technical solution is as follows:
[0006] According to one aspect of an embodiment of the present application, a method for training an agent model is provided, wherein the agent model includes: a task control main model, a data preparation sub-model, a model training sub-model, and a model evaluation sub-model, and the method includes:
[0007] Extract features from training samples to obtain feature sequences;
[0008] Inputting the first data including the feature sequence into the task master control main model for demand analysis and generating data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results. If it is not the first round of training, the first data also includes: parameter analysis results generated by the data preparation sub-model, model training sub-model, and model evaluation sub-model;
[0009] Inputting the second data including the data preparation task into the data preparation sub-model for parameter analysis and generating model training data based on the analysis results, wherein, if it is not the first round of training, the second data also includes a previous demand analysis result, where the previous demand analysis result is the result of the demand analysis performed by the task master control main model in the previous round of training;
[0010] Inputting the third data including the model training task into the model training sub-model for parameter analysis and training the basic network model indicated by the model training task based on the analysis result to obtain the target network model. If it is not the first round of training, the third data also includes the prior demand analysis result;
[0011] Inputting the fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and evaluating the target network model based on the analysis results, if it is not the first round of training, the fourth data also includes the prior demand analysis results;
[0012] A loss value obtained by training based on the feature sequence is obtained, and parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model are adjusted based on the loss value.
[0013] In one embodiment of the present application, the proxy model further includes: a model publishing sub-model;
[0014] The step of inputting the first data including the feature sequence into the task master control main model for demand analysis and generating data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results includes:
[0015] Inputting the first data including the feature sequence into the task master control main model to perform demand analysis and generating data preparation tasks, model training tasks, model evaluation tasks and model release tasks based on the analysis results;
[0016] If it is not the first round of training, the first data also includes: parameter analysis results of the model release sub-model in the previous round of training;
[0017] The method further comprises:
[0018] If the target network model passes the evaluation, the fifth data including the model publishing task is input into the model publishing sub-model for parameter parsing and a model deployment file of the target network model is generated based on the parsing result.
[0019] In one embodiment of the present application, obtaining a loss value for training based on the feature sequence includes:
[0020] Obtaining a first loss value for training the task master control main model based on the feature sequence;
[0021] Obtaining a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task;
[0022] Based on the training time of this round, first representation information representing the training optimization direction is obtained;
[0023] Based on the accuracy of the proxy model, a second representation information representing the training optimization direction is obtained;
[0024] Based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information, and the second representation information, a loss value for training based on the feature sequence is determined.
[0025] In one embodiment of the present application, the first model is trained in the following manner to obtain a target loss value, wherein the first model is: the task master control main model, the data preparation sub-model, the model training sub-model, or the model evaluation sub-model, and the target loss value is: the first loss value, the second loss value, the third loss value, or the fourth loss value:
[0026] Obtaining the predicted probability corresponding to the parsing result obtained by the first model in this round of training based on the completed training;
[0027] The target loss value is determined based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability.
[0028] In one embodiment of the present application, determining the target loss value based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability includes:
[0029] The target loss value is determined according to the following expression:
[0030]
[0031] Wherein, T is the length of the feature sequence, x t is the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence, y t For the first model pair x t The truth value of the result obtained by performing the analysis.
[0032] In one embodiment of the present application, obtaining first characterization information characterizing a training optimization direction based on the training duration of the current round includes:
[0033] If the training duration of this round is greater than the preset minimum training duration, determining first characterization information representing the training optimization direction based on the training duration of this round and the minimum training duration;
[0034] If the training duration of this round is not greater than the minimum training duration, it is determined that the first representation information is a first preset value.
[0035] In one embodiment of the present application, determining the loss value for training based on the feature sequence based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information, and the second representation information includes:
[0036] The loss value for training based on the feature sequence is determined by the following expression:
[0037] L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +λ1L T +λ2L P
[0038] Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first characterization information, L P is the second representation information, and γ1, γ2, γ3, λ1 and λ2 are hyperparameters.
[0039] In one embodiment of the present application, the training samples include generation requirement samples and log samples for the neural network model;
[0040] The log samples include: logs that record model training tasks and / or task parameters during the training of the neural network model.
[0041] In one embodiment of the present application, the generating requirement sample includes at least one of the following information:
[0042] The requirement description information of the neural network model, wherein the modality of the requirement description information includes: voice and / or text;
[0043] Reference data of the requirement description information, wherein the modality of the reference data is different from the modality of the requirement description information;
[0044] An optimization hint instruction for instructing the neural network model to generate a role of an agent.
[0045] According to another aspect of an embodiment of the present application, a proxy model training device is provided, wherein the proxy model includes: a task control main model, a data preparation sub-model, a model training sub-model, and a model evaluation sub-model, and the device includes:
[0046] Feature extraction module, used to extract features from training samples and obtain feature sequences;
[0047] A first data input module is configured to input first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results. If it is not the first round of training, the first data also includes: parameter analysis results generated by the data preparation sub-model, model training sub-model, and model evaluation sub-model;
[0048] A second data input module inputs the second data including the data preparation task into the data preparation sub-model for parameter analysis and generates model training data based on the analysis results. If it is not the first round of training, the second data also includes a previous demand analysis result, where the previous demand analysis result is the result of the demand analysis performed by the task master control main model in the previous round of training;
[0049] A third data input module is configured to input the third data including the model training task into the model training sub-model for parameter analysis and train the basic network model indicated by the model training task based on the analysis result to obtain a target network model. If it is not the first round of training, the third data also includes the analysis result of the prior demand;
[0050] a fourth data input module, configured to input fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and to evaluate the target network model based on the analysis results. If it is not the first round of training, the fourth data also includes the analysis results of the prior requirements;
[0051] The loss value acquisition module is used to obtain the loss value of the training based on the feature sequence, and adjust the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model based on the loss value.
[0052] In one embodiment of the present application, the proxy model also includes: a model release sub-model; the first data input module is specifically used to input the first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, model evaluation tasks and model release tasks based on the analysis results; if it is not the first round of training, the first data also includes: the parameter analysis results of the model release sub-model in the previous round of training; the device also includes: a fifth data input module, which is used to input the fifth data including the model release task into the model release sub-model for parameter analysis if the target network model passes the evaluation and generate the model deployment file of the target network model based on the analysis results.
[0053] In one embodiment of the present application, the loss value acquisition module includes: a main model loss value acquisition unit, which is used to obtain a first loss value for training the task master control main model based on the feature sequence; a sub-model loss value acquisition unit, which is used to obtain a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task; a first representation information acquisition unit, which is used to obtain first representation information representing the training optimization direction based on the training time of this round; a second representation information acquisition unit, which is used to obtain second representation information representing the training optimization direction based on the accuracy of the proxy model; a loss value determination unit, which is used to determine the loss value for training based on the feature sequence based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information and the second representation information.
[0054] In one embodiment of the present application, the loss value acquisition module is specifically used to train the first model in the following manner to obtain a target loss value, wherein the first model is: the task master control main model, the data preparation sub-model, the model training sub-model or the model evaluation sub-model, and the target loss value is: the first loss value, the second loss value, the third loss value or the fourth loss value: obtain the predicted probability corresponding to the parsing result obtained by the first model in this round of training based on the completed training; determine the target loss value based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability.
[0055] In one embodiment of the present application, the loss value obtaining module is specifically configured to determine the target loss value according to the following expression:
[0056]
[0057] Wherein, T is the length of the feature sequence, x tis the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence, y t For the first model pair x t The truth value of the result obtained by performing the analysis.
[0058] In one embodiment of the present application, the first characterization information obtaining unit is specifically used to determine the first characterization information characterizing the training optimization direction based on the training time of this round and the minimum training time if the training time of this round is greater than the preset minimum training time; if the training time of this round is not greater than the minimum training time, determine that the first characterization information is a first preset value.
[0059] In one embodiment of the present application, the loss value determining unit is specifically configured to determine the loss value for training based on the feature sequence according to the following expression:
[0060] L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +λ1L T +λ2L P
[0061] Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first characterization information, L P is the second representation information, γ1, γ2, γ3, λ1 and λ2 are hyperparameters;
[0062] In one embodiment of the present application, the training samples include generation requirement samples and log samples for the neural network model; wherein, the log samples include: logs that record model training tasks and / or task parameters during the training process of the neural network model.
[0063] In one embodiment of the present application, the generated requirement sample includes at least one of the following information: requirement description information of the neural network model, wherein the modality of the requirement description information includes: voice and / or text; reference data of the requirement description information, wherein the modality of the reference data is different from the modality of the requirement description information; and optimization prompt instructions for indicating the role of the neural network model generation agent.
[0064] According to another aspect of the embodiments of the present application, an electronic device is provided, including:
[0065] Memory for storing computer programs;
[0066] The processor is configured to implement any of the above-mentioned agent model training methods when executing a program stored in the memory.
[0067] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned agent model training methods is implemented.
[0068] According to another aspect of the embodiments of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-described agent model training methods.
[0069] Beneficial effects of the embodiments of the present application:
[0070] As can be seen from the above, the proxy model training method provided in the embodiment of the present application is applied, and feature sequences are used to train the task master control main model and sub-models including the data preparation sub-model, the model training sub-model and the model evaluation sub-model in the proxy model. In addition, in the case of non-first round of training, the data input to the task master control main model also includes the parameter parsing results of the sub-model in the previous round of training, and the data input to the sub-model also includes the parameter parsing results of the task master control main model in the previous round of training, so that the task master control main model and the sub-model can learn the semantic parsing results of other models from each other and establish semantic associations between models. Therefore, the task master control main model and the sub-model in the proxy model can better parse the input data requirements, understand the user's model generation requirements, and perform data preparation, model training and model evaluation based on the input data to obtain the target network model. In this way, a proxy model that can conveniently generate the neural network model required by the user can be trained.
[0071] Of course, it is not necessary to achieve all the advantages described above at the same time when implementing any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0072] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0073] Figure 1a A schematic diagram of the structure of an agent model provided in an embodiment of the present application;
[0074] Figure 1b A schematic diagram of the structure of another proxy model provided in an embodiment of the present application;
[0075] Figure 2 A schematic diagram of reference data provided for an embodiment of the present application;
[0076] Figure 3 A flow chart of a proxy model generation method provided in an embodiment of the present application;
[0077] Figure 4 A flowchart of a method for obtaining a loss value provided in an embodiment of the present application;
[0078] Figure 5 A schematic diagram of the structure of an agent model generation device provided in an embodiment of the present application;
[0079] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0080] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of this application.
[0081] The following describes the execution subject of the embodiment of the present application.
[0082] The solution provided in the embodiments of this application can be applied to electronic devices such as desktop computers, laptops, tablet computers, and servers, and can also be applied to model training platforms for model training. For ease of description, the execution entity of the agent model training method provided in the embodiments of this application is collectively referred to as a model training platform.
[0083] The following describes the proxy model provided in the embodiments of the present application.
[0084] In one embodiment of the present application, see Figure 1aA schematic diagram of the structure of a proxy model is provided. The proxy model includes: a task control main model, a data preparation sub-model, a model training sub-model, and a model evaluation sub-model.
[0085] In another embodiment of the present application, see Figure 1b A schematic diagram of the structure of another proxy model is provided. The proxy model includes: a task control main model, a data preparation sub-model, a model training sub-model, a model evaluation sub-model, and a model release sub-model.
[0086] Among them, the task control main model, data preparation sub-model, model training sub-model, model evaluation sub-model and model release sub-model in the above-mentioned agent model can all be models built based on LLM (Large Language Model).
[0087] The concepts involved in the embodiments of the present application are explained below.
[0088] 1. Training Samples
[0089] In one case, the training samples may include generation requirement samples for the neural network model.
[0090] In another case, the training samples may include generation requirement samples and log samples for the neural network model.
[0091] 1. Generate demand samples
[0092] The generation requirement sample includes at least one of the following information:
[0093] (1) Requirement description information of the neural network model.
[0094] Specifically, the requirement description information may include at least one of the following information: information describing the model function requirements of the neural network model required by the user, information describing the basic network model type requirements, information describing the model accuracy requirements, and information describing the model deployment platform requirements. For example, the information describing the model function requirements may include: "Generate a neural network model that can recognize cats", and the information describing the basic network model type requirements may include: "A neural network model based on YOLOv5 (a basic network model for object detection models) is required", etc.
[0095] The modalities of the requirement description information include voice and / or text. Users can instruct the agent model to generate the desired neural network model by inputting natural language information. If the requirement description information input by the user is voice, speech recognition can be performed on the voice to obtain text information of the requirement description in the voice modality.
[0096] In this way, users can
[0097] (2) Reference data for requirement description information.
[0098] The modality of the reference data is different from that of the demand description information. Specifically, the modality of the reference data of the demand description information can be images and / or videos. Figure 2 A schematic diagram of reference data is provided. When the requirement description information of the neural network model includes "generating a neural network model that can recognize cats", the reference data of the requirement description information may include the following: Figure 2 The image shown. Figure 2 If the image depicted is an indoor environment, the neural network model generation agent can train the cat recognition neural network model for indoor environments, improving the accuracy of the generated cat recognition neural network model in indoor environments. Alternatively, the reference data for the user-provided requirement description information can also be cats in outdoor environments, which can improve the accuracy of the generated cat recognition neural network model in outdoor environments. This allows the agent model to more accurately understand the user's requirements for the neural network model.
[0099] (3) Optimization hint instructions for instructing the neural network model to generate the role of the agent.
[0100] Specifically, the optimization prompt instruction may include a role definition for the neural network model generation agent. For example, the optimization prompt instruction may include "You are a model training engineer responsible for training the detection model. You understand the current deep learning framework and need to pay attention to the model convergence speed."
[0101] As can be seen from the above, the neural network model generation agent can parse the user's natural language instructions, and can generate a neural network model that meets the user's needs by obtaining the natural language instructions corresponding to the voice information and / or text information input by the user. It can be seen that it is more convenient for users to generate models based on natural language voice input and / or text input, and the generated agent model can be used by users to generate neural network models that meet their needs. In addition, by obtaining reference data of the demand description information of different modalities input by the user, the trained agent model can understand the user's needs for the neural network model from data of multiple modalities, and can more accurately determine the user's needs and improve the accuracy of the trained agent model. According to the optimization prompt instructions input by the user, the agent model can generate a model according to a role that better meets the user's needs, so that the user can flexibly input the optimization prompt instructions of the role according to his own needs, so that the user can generate the model more conveniently and flexibly based on the agent model.
[0102] 2. Log sample
[0103] The log sample includes: a log recording the model training tasks and / or task parameters during the training of the neural network model. The training process of the neural network model can be a process of manually training the model using existing technology.
[0104] Log samples can be obtained by recording the training process of neural network models for various functions according to various learning paradigms. For example, various learning paradigms may include model distillation training, self-supervised learning, semi-supervised learning, and transfer learning. The neural network models for various functions may include the following: classification, object detection, data generation, data prediction, and natural language processing.
[0105] Among them, the task parameters may include the call data and corresponding hyperparameters of each component used for model training during each model training task, the called interface and interface return value data, the loss convergence data of the model training, the model training time, the model performance data obtained by training, etc.
[0106] In the proxy model Figure 1a In the case of the provided model, the model training tasks included in the log sample may include: logs of data preparation tasks, model training tasks, and model evaluation tasks and / or logs of task parameters.
[0107] In the proxy model Figure 1b In the case of a provided model, the model training tasks included in the log sample may include: logs of data preparation tasks, model training tasks, model evaluation tasks, and model release tasks, and / or logs of task parameters. The model release task logs and / or task parameter logs may be recorded during the process of manually generating a model deployment file for the trained neural network model and manually deploying the neural network model to a designated platform.
[0108] From the above, it can be seen that using the logs that record model training tasks and / or task parameters during the training of the neural network model as training samples can enable the proxy model to learn the intermediate tasks and intermediate parameters in the training process of the neural network model, thereby improving the accuracy of the training proxy model and improving the effect of the trained proxy model.
[0109] 2. Data Preparation Tasks and Data Preparation Sub-Models
[0110] Data preparation tasks can include subtasks such as data retrieval, data deduplication, data diagnosis, data labeling, data cleaning, and data augmentation. Furthermore, data preparation tasks also include data type information. For example, the task master control model can generate the data type information required for the data preparation task based on the model function requirements of the neural network model in the requirement description information. For example, if the model function requirement is "a model for identifying cats," the data type information may include cat image data.
[0111] The trained data preparation sub-model can execute data preparation tasks to obtain model training data. For example, if the data preparation task includes a data retrieval sub-task, the data preparation sub-model can perform tag retrieval based on cross-modal tags corresponding to text, image, audio, and video data in the database, or it can also perform retrieval based on data features. If the data preparation task includes a data deduplication sub-task, the data preparation sub-model can perform data deduplication according to a preset data deduplication method.
[0112] 3. Model training tasks and model training sub-models
[0113] The model training task may include the basic network model and training task parameters for training the neural network model required by the user. For example, the task master control main model can determine the basic network model of the neural network model based on the information describing the model function requirements of the neural network model in the requirement description information. The task master control main model can also determine the corresponding training task parameters based on the requirement description information and the functions of the neural network model required by the user. For example, the training task parameters include: the learning rate, sampling strategy and training paradigm adopted for model training. For example, the sampling strategy may include: random sampling or balanced sampling, etc. The training paradigm may include: model distillation training, self-supervised learning, semi-supervised learning and transfer learning, etc. The learning rate may be 0.001.
[0114] The trained model training sub-model executes the model training task to train the base network model. During model training, the model training sub-model can obtain further model training parameters based on the model training task, such as the stopping condition and optimizer for model training. The training data obtained by the data preparation sub-model is then used to train the base model specified by the model training task.
[0115] IV. Model Evaluation Task and Model Evaluation Sub-Model
[0116] The task master control model can determine the model function parameters based on the model function requirements of the neural network model in the requirement description information. The task master control model can determine the model accuracy requirement information based on the model accuracy requirement information in the requirement description information.
[0117] The trained evaluation sub-model can select the target evaluation tool according to the model function parameters in the model evaluation task, and call the target evaluation tool to evaluate the target network model according to the evaluation mode in the model evaluation task.
[0118] 5. Model Release Tasks and Model Release Sub-Models
[0119] The model release task may include information about the platform to be deployed and model optimization parameters. The task master control model can determine the required model optimization operations for the neural network model based on the information about the platform to be deployed described in the requirement description or the obtained information about the platform to be deployed. For example, the information about the platform to be deployed may include information describing the device performance of the platform to be deployed and information about the chip corresponding to the platform.
[0120] The trained model publishing sub-model performs model optimization operations such as quantization and pruning on the target network model based on the platform information to be deployed, model optimization operation parameters, and structural information of the target network model in the model publishing task. The target network model after the model optimization operation is then format converted to obtain the model deployment file.
[0121] Below Figure 1a Taking the proxy model shown as an example, the proxy model training method provided in the embodiment of the present application is explained.
[0122] In one embodiment of the present application, see Figure 3 A flow chart of a proxy model generation method is provided, wherein the method includes the following steps S301-S306.
[0123] Step S301: extract features from training samples to obtain feature sequences.
[0124] In one implementation, the training platform can perform feature encoding on the training samples to obtain a feature sequence. For example, the training samples can be feature encoded using a token (a serialization method).
[0125] Specifically, when the training sample includes the requirements description information of the neural network model, the reference data of the requirements description information, the optimization prompt instructions for indicating the role of the neural network model generation agent, and the log sample, since the modality of the reference data of the requirements description information is different from the modality of the requirements description information, a multimodal feature extractor can be used to feature encode the reference data, such as CLIP (a feature extractor). For the data in the training sample other than the reference data, the same feature extractor can be used for feature encoding, such as Bert (a feature extractor).
[0126] For example, the process of extracting features from training samples can be expressed by the following expression.
[0127] F1=embedding1{D1}
[0128] F2=embedding1{D2}
[0129] F3=embedding2{D3}
[0130] F4=embedding1{D4}
[0131] Among them, D1 is a log sample, D2 is the requirement description information of the neural network model, D3 is the reference data of the requirement description information, and D4 is an optimization prompt instruction for instructing the neural network model to generate the role of the agent. F1 is the encoded log sample, F2 is the encoded requirement description information of the neural network model, F3 is the reference data of the encoded description information, and F4 is the encoded optimization prompt instruction for instructing the neural network model to generate the role of the agent. Embedding1 represents a feature encoding method, and embedding2 represents feature encoding using a multimodal feature extractor.
[0132] Step S302: inputting the first data including the feature sequence into the task master control main model for demand analysis and generating data preparation tasks, model training tasks and model evaluation tasks based on the analysis results.
[0133] If it is not the first round of training, the first data also includes: parameter analysis results generated by the data preparation sub-model, model training sub-model and model evaluation sub-model.
[0134] The task master control main model analyzes the semantic information of the first data based on natural language processing, and generates the above-mentioned data preparation tasks, model training tasks and model evaluation tasks based on the analyzed semantic information.
[0135] In which, when the training sample includes a generation requirement sample and a log sample, the first data may include features corresponding to the log sample and features corresponding to at least one of the following information in the generation requirement sample: requirement description information of the neural network model, reference data of the requirement description information, and optimization prompt instructions for indicating the role of the neural network model generation agent.
[0136] For example, in a case where it is not the first round of training and the first data includes features corresponding to the log sample and features corresponding to the requirement description information of the neural network model in the generated requirement sample and the reference data of the requirement description information, the task master control model built based on the LLM can be expressed by the following expression:
[0137] Mg=LLMg(F1,F2,F3,Ol)
[0138] Among them, Mg is the main task control model, and Ol is the parameter analysis results generated by the data preparation sub-model, model training sub-model and model evaluation sub-model.
[0139] Alternatively, in the case where it is not the first round of training and the first data includes features corresponding to the log sample and features corresponding to the requirement description information of the neural network model in the generated requirement sample and the reference data of the requirement description information, the task master control model constructed based on the LLM can be expressed by the following expression:
[0140] Mg=LLMg(F1,F4,Ol)
[0141] Step S303: input the second data including the data preparation task into the data preparation sub-model for parameter analysis and generate model training data based on the analysis results.
[0142] If it is not the first round of training, the second data also includes the previous demand analysis result, and the previous demand analysis result is: the result of demand analysis performed by the task master control main model in the previous round of training.
[0143] In which, when the training sample includes a generation requirement sample and a log sample, the second data may include, in addition to the data preparation task,: features corresponding to the log sample and features corresponding to at least one of the following information in the generation requirement sample: requirement description information of the neural network model, reference data of the requirement description information, and optimization prompt instructions for indicating the role of the neural network model generation agent.
[0144] Step S304: input the third data including the model training task into the model training sub-model for parameter analysis and train the basic network model indicated by the model training task based on the analysis result to obtain the target network model.
[0145] If it is not the first round of training, the third data also includes the results of prior demand analysis.
[0146] Among them, the third data is similar to the second data, the difference is that the third data includes model training tasks, and the second data includes data preparation tasks, which will not be described in detail here.
[0147] Step S305: input the fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and evaluate the target network model based on the analysis results.
[0148] If it is not the first round of training, the fourth data also includes the results of the previous demand analysis.
[0149] The fourth data is similar to the second data, except that the third data includes model evaluation tasks, while the second data includes data preparation tasks, which will not be detailed here.
[0150] The following is an example of the data preparation sub-model, model training sub-model and model evaluation sub-model in steps S303-S304.
[0151] For example, in a case other than the first round of training, where the input data includes features corresponding to log samples, the requirement description information of the neural network model in the generated requirement sample, and features corresponding to the reference data of the requirement description information, the sub-model built based on the LLM can be expressed by the following expression:
[0152] Ml i =LLMg(F1,F2,F3,Og i-1 )
[0153] Among them, Ml i is the sub-model corresponding to the i-th round of training, Og i-1 The result of the requirement analysis of the task master control model in the i-1th round of training. The sub-models include the data preparation sub-model, model training sub-model, and model evaluation sub-model. The input data corresponding to each sub-model are: second data, third data, and fourth data respectively. For example, Ml i Can include Ml1 i 、Ml2 i and Ml3 i , Ml1 i Prepare submodels, Ml2 for data i Train sub-models, Ml3 for the model i Evaluate submodels for the model.
[0154] Alternatively, in a case other than the first round of training, where the input data includes features corresponding to log samples, the requirement description information of the neural network model in the generated requirement sample, and features corresponding to the reference data of the requirement description information, the sub-model built based on the LLM can be expressed by the following expression:
[0155] Ml i =LLMg(F1,F4,Og i-1 )
[0156] Step S306: Obtain the loss value of the training based on the feature sequence, and adjust the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model based on the loss value.
[0157] The implementation of step S306 is described in the following embodiments and will not be described in detail here.
[0158] As can be seen from the above, the proxy model training method provided in the embodiment of the present application is applied, and feature sequences are used to train the task master control main model and sub-models including the data preparation sub-model, the model training sub-model and the model evaluation sub-model in the proxy model. In addition, in the case of non-first round of training, the data input to the task master control main model also includes the parameter parsing results of the sub-model in the previous round of training, and the data input to the sub-model also includes the parameter parsing results of the task master control main model in the previous round of training, so that the task master control main model and the sub-model can learn the semantic parsing results of other models from each other and establish semantic associations between models. Therefore, the task master control main model and the sub-model in the proxy model can better parse the input data requirements, understand the user's model generation requirements, and perform data preparation, model training and model evaluation based on the input data to obtain the target network model. In this way, a proxy model that can conveniently generate the neural network model required by the user can be trained.
[0159] Below Figure 1b Taking the proxy model shown as an example, the proxy model training method provided in the embodiment of the present application is explained.
[0160] In one embodiment of the present application, the proxy model further includes: a model publishing sub-model.
[0161] The above-mentioned step S302 of generating tasks can be implemented as follows: the training platform inputs the first data including the feature sequence into the task master control main model for demand analysis and generates data preparation tasks, model training tasks, model evaluation tasks, and model release tasks based on the analysis results. If it is not the first round of training, the first data also includes: the parameter analysis results of the model release sub-model in the previous round of training;
[0162] exist Figure 3 The provided embodiment also includes the following steps: if the target network model passes the evaluation, the fifth data containing the model release task is input into the model release sub-model for parameter parsing and a model deployment file of the target network model is generated based on the parsing results.
[0163] Among them, the fifth data is similar to the second data, the difference is that the fifth data includes model publishing tasks, and the second data includes data preparation tasks, which will not be detailed here.
[0164] Similarly, in the case where it is not the first round of training and the fifth data includes the features corresponding to the log sample and the requirements description information of the neural network model in the generated requirements sample and the features corresponding to the reference data of the requirements description information, the model release sub-model built based on LLM can be expressed by the following expression:
[0165] Ml4 i =LLMg(F1,F2,F3,Ogi-1 )
[0166] Among them, Ml4 i Publish the sub-model for the model corresponding to the i-th round of training.
[0167] Alternatively, in the case where it is not the first round of training and the input data includes features corresponding to log samples, requirement description information of the neural network model in the generated requirement sample, and features corresponding to reference data of the requirement description information, the model release sub-model built based on LLM can be expressed by the following expression:
[0168] Ml4 i =LLMg(F1,F4,Og i-1 )
[0169] As can be seen from the above, by training a proxy model that includes a model publishing sub-model, such a proxy model can generate a model deployment file for the target network model that has passed the evaluation. In this way, the user can use the model deployment file to directly deploy the target network model, further simplifying the user's operation and enabling the user to deploy the target network model more conveniently.
[0170] The following describes the method for obtaining the loss value in step S306.
[0171] In one embodiment of the present application, see Figure 4 A flowchart of a method for obtaining a loss value is provided, wherein the method includes the following steps S401-S405.
[0172] Step S401: Obtain a first loss value for training the task master control main model based on the feature sequence.
[0173] Step S402: Obtain a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task.
[0174] The implementation of steps S401-S402 is described below.
[0175] In one implementation, the first model is trained to obtain a target loss value according to the following steps A, wherein the first model is: a task control main model, a data preparation sub-model, a model training sub-model, or a model evaluation sub-model, and the target loss value is: a first loss value, a second loss value, a third loss value, or a fourth loss value:
[0176] Step A: Obtain the predicted probability corresponding to the parsing result obtained by the first model in the current round of training based on the completed training. Determine the target loss value based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability.
[0177] Specifically, for each feature in the feature sequence, the predicted probability corresponding to the analysis result obtained by the first model based on the completed training for the feature is recorded. The predicted probability can be expressed as follows:
[0178] P θ (x t |x1,x2,...,x t-1 )
[0179] Among them, x t is the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence.
[0180] Then, after obtaining the predicted probability corresponding to each feature in the feature sequence, the predicted probabilities can be summed to obtain the target loss value. Specifically, the target loss value can be determined according to the following expression:
[0181]
[0182] Among them, T is the length of the feature sequence, y t For the first model pair x t The true value of the result obtained by parsing, y tThe training process log data and user request data recorded in the preset model training process. Specifically, the preset model training process is a process of manually training a neural network model of user requirements based on the generated requirements in the user request data, and it is necessary to train the neural network model for each function according to each learning paradigm. In this way, using the training process log data and user request data recorded in the above-mentioned preset model training process as the true value of the proxy model training can enable the proxy model to learn the characteristics of the log data in the training process of the neural network model for each function according to each learning paradigm, and can also enable the proxy model to learn the relationship between the characteristics of the user request data and the log data in the training process, thereby enabling the proxy model to simulate the above-mentioned preset model training process according to the user request data and perform training on behalf of the neural network model of user requirements.
[0183] In addition, the first model, the target loss value, and the input data correspond to each other. For example, when the first model is the task control main model, the input data is the first data, and the target loss value is the first loss value. When the first model is the data preparation submodel, the input data is the second data, and the target loss value is the second loss value. When the first model is the model training submodel, the input data is the third data, and the target loss value is the third loss value. When the first model is the model evaluation submodel, the input data is the fourth data, and the target loss value is the fourth loss value.
[0184] In this way, based on the above expression, the target loss value corresponding to the first model can be calculated more accurately, thereby improving the accuracy of the loss value obtained by training based on the feature sequence and improving the effect of the trained proxy model.
[0185] In addition, when the proxy model includes a model release sub-model, the fifth loss value of the model release sub-model trained based on the model release task can also be obtained, and the fifth loss value can also be obtained according to the above step A. The first model also includes: the model release sub-model, and the corresponding target loss value is: the fifth loss value, and the input data is the fifth data.
[0186] It can be seen that the predicted probability of each round of training is obtained by parsing the first model based on the completed training. In this way, the first model can learn the characteristics of the input data of multiple rounds of training, and the combination of the context information of the samples in multiple rounds of training can improve the effect of the proxy model.
[0187] Step S403: Based on the training duration of this round, first characterization information characterizing the training optimization direction is obtained.
[0188] In one implementation, if the training duration of the current round is greater than a preset minimum training duration, first characterization information representing the training optimization direction is determined based on the training duration of the current round and the minimum training duration. If the training duration of the current round is not greater than the minimum training duration, the first characterization information is determined to be a first preset value.
[0189] The first representation information represents the training optimization direction of the trained time toward the minimum training time.
[0190] Specifically, when the training duration is greater than the preset minimum training duration, the mean absolute error between the training duration and the minimum training duration can be calculated as the first characterization information representing the training optimization direction. For example, the first characterization information can be obtained by the following expression:
[0191]
[0192] Among them, L T is the first representation information, b is the minimum training time, and CurrentTime is the training time.
[0193] In this way, the training duration can be controlled to be closer to the minimum training duration. By controlling the model training duration, the efficiency of model training can be improved.
[0194] Step S404: Based on the accuracy of the proxy model, obtain second representation information representing the training optimization direction.
[0195] Specifically, the second representation information can be obtained by the following expression:
[0196] L p =MAE(L p ,1)
[0197] Among them, L p is the second representation information.
[0198] In this way, second representation information representing the training optimization direction for improving the accuracy of the proxy model can be obtained. Based on such second representation information, the accuracy of the proxy model can be constrained to improve the accuracy of the proxy model.
[0199] Step S405: Determine a loss value for training based on the feature sequence based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information, and the second representation information.
[0200] Specifically, the training platform determines the loss value for feature sequence-based training according to the following expression:
[0201] L=L Mg +γ1L Ml1 +γ2L Ml2+γ3L Ml3 +λ1L T +λ2L P
[0202] Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first representation information, L P is the second representation information, γ1, γ2, γ3, λ1 and λ2 are hyperparameters.
[0203] This expression allows for more accurate calculation of the loss value for feature sequence-based training, improving the effectiveness of the trained proxy model. Furthermore, it allows for parameter adjustments for each sub-model within the proxy model, adjusting the training duration and proxy model accuracy requirements individually, increasing training flexibility. Furthermore, it allows for flexible optimization for scenarios in different domains, improving the robustness of the proxy model.
[0204] In addition, when the proxy model includes a model publishing sub-model, step S405 can be implemented in the following manner: based on the first loss value, the second loss value, the third loss value, the fourth loss value, the fifth loss value, the first representation information and the second representation information, determine the loss value for training based on the feature sequence.
[0205] Specifically, the training platform determines the loss value for feature sequence-based training according to the following expression:
[0206] L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +γ4L Ml4 +λ1L T +λ2L P
[0207] Among them, L Ml4 is the fifth loss value, and γ4 is a hyperparameter.
[0208] It can be seen from the above that the obtained loss value not only includes the loss values of the main model and each sub-model, but also determines the loss value of training based on the feature sequence according to the first representation information obtained based on the training time and the second representation information obtained based on the accuracy of the proxy model. Based on such loss value, the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model are adjusted, which can make the trained proxy model take into account the training time and the accuracy of the proxy training model, thereby reducing the training time of the proxy training model and improving the accuracy of the proxy training model.
[0209] Corresponding to the above-mentioned agent model training, an embodiment of the present application provides an agent model training device.
[0210] In one embodiment of the present application, see Figure 5 A schematic diagram of the structure of a proxy model generation device is provided. The proxy model includes: a task control main model, a data preparation sub-model, a model training sub-model, and a model evaluation sub-model. The above device includes:
[0211] The feature extraction module 501 is used to extract features from the training samples to obtain a feature sequence;
[0212] The first data input module 502 is configured to input the first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results. If it is not the first round of training, the first data also includes: parameter analysis results generated by the data preparation sub-model, model training sub-model, and model evaluation sub-model;
[0213] The second data input module 503 is configured to input the second data including the data preparation task into the data preparation sub-model for parameter analysis and generate model training data based on the analysis results. If it is not the first round of training, the second data also includes the previous demand analysis results, which are the results of the demand analysis performed by the task master control main model in the previous round of training;
[0214] A third data input module 504 is configured to input the third data including the model training task into the model training sub-model for parameter analysis and train the basic network model indicated by the model training task based on the analysis result to obtain a target network model. If it is not the first round of training, the third data also includes the results of the previous demand analysis;
[0215] A fourth data input module 505 is configured to input the fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and to evaluate the target network model based on the analysis results. If it is not the first round of training, the fourth data also includes the results of the previous demand analysis;
[0216] The loss value acquisition module 506 is used to obtain the loss value of training based on the feature sequence, and adjust the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model based on the loss value.
[0217] As can be seen from the above, the proxy model training method provided in the embodiment of the present application is applied, and feature sequences are used to train the task master control main model and sub-models including the data preparation sub-model, the model training sub-model and the model evaluation sub-model in the proxy model. In addition, in the case of non-first round of training, the data input to the task master control main model also includes the parameter parsing results of the sub-model in the previous round of training, and the data input to the sub-model also includes the parameter parsing results of the task master control main model in the previous round of training, so that the task master control main model and the sub-model can learn the semantic parsing results of other models from each other and establish semantic associations between models. Therefore, the task master control main model and the sub-model in the proxy model can better parse the input data requirements, understand the user's model generation requirements, and perform data preparation, model training and model evaluation based on the input data to obtain the target network model. In this way, a proxy model that can conveniently generate the neural network model required by the user can be trained.
[0218] In one embodiment of the present application, the proxy model also includes: a model release sub-model; the first data input module is specifically used to input the first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, model evaluation tasks and model release tasks based on the analysis results; if it is not the first round of training, the first data also includes: the parameter analysis results of the model release sub-model in the previous round of training; the device also includes: a fifth data input module, which is used to input the fifth data including the model release task into the model release sub-model for parameter analysis if the target network model passes the evaluation and generate a model deployment file of the target network model based on the analysis results.
[0219] As can be seen from the above, by training a proxy model that includes a model publishing sub-model, such a proxy model can generate a model deployment file for the target network model that has passed the evaluation. In this way, the user can use the model deployment file to directly deploy the target network model, further simplifying the user's operation and enabling the user to deploy the target network model more conveniently.
[0220] In one embodiment of the present application, the loss value acquisition module 506 includes: a main model loss value acquisition unit, which is used to obtain a first loss value for training the task master control main model based on the feature sequence; a sub-model loss value acquisition unit, which is used to obtain a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task; a first representation information acquisition unit, which is used to obtain first representation information representing the training optimization direction based on the training time of this round; a second representation information acquisition unit, which is used to obtain second representation information representing the training optimization direction based on the accuracy of the proxy model; a loss value determination unit, which is used to determine the loss value for training based on the feature sequence based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information and the second representation information.
[0221] It can be seen from the above that the obtained loss value not only includes the loss values of the main model and each sub-model, but also determines the loss value of training based on the feature sequence according to the first representation information obtained based on the training time and the second representation information obtained based on the accuracy of the proxy model. Based on such loss value, the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model are adjusted, which can make the trained proxy model take into account the training time and the accuracy of the proxy training model, thereby reducing the training time of the proxy training model and improving the accuracy of the proxy training model.
[0222] In one embodiment of the present application, the loss value acquisition module 506 is specifically used to train the first model in the following manner to obtain a target loss value, wherein the first model is: a task master control main model, a data preparation sub-model, a model training sub-model or a model evaluation sub-model, and the target loss value is: a first loss value, a second loss value, a third loss value or a fourth loss value: obtaining the predicted probability corresponding to the parsing result obtained by the first model in this round of training based on the completed training; determining the target loss value based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability.
[0223] It can be seen that the predicted probability of each round of training is obtained by parsing the first model based on the completed training. In this way, the first model can learn the characteristics of the input data of multiple rounds of training, and the combination of the context information of the samples in multiple rounds of training can improve the effect of the proxy model.
[0224] In one embodiment of the present application, the loss value obtaining module 506 is specifically configured to determine the target loss value according to the following expression:
[0225]
[0226] Among them, T is the length of the feature sequence, x t is the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence, y t For the first model pair x t The truth value of the result obtained by performing the analysis.
[0227] In this way, based on the above expression, the target loss value corresponding to the first model can be calculated more accurately, thereby improving the accuracy of the loss value obtained by training based on the feature sequence and improving the effect of the trained proxy model.
[0228] In one embodiment of the present application, the first characterization information obtaining unit is specifically used to determine the first characterization information characterizing the training optimization direction based on the training time of this round and the minimum training time if the training time of this round is greater than the preset minimum training time; if the training time of this round is not greater than the minimum training time, determine that the first characterization information is a first preset value.
[0229] In this way, the training duration can be controlled to be closer to the minimum training duration. By controlling the model training duration, the efficiency of model training can be improved.
[0230] In one embodiment of the present application, the loss value determining unit is specifically configured to determine the loss value for training based on the feature sequence according to the following expression:
[0231] L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +λ1L T +λ2L P
[0232] Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first representation information, L P is the second representation information, γ1, γ2, γ3, λ1 and λ2 are hyperparameters.
[0233] This expression allows for more accurate calculation of the loss value for feature sequence-based training, improving the effectiveness of the trained proxy model. Furthermore, it allows for parameter adjustments for each sub-model within the proxy model, adjusting the training duration and proxy model accuracy requirements individually, increasing training flexibility. Furthermore, it allows for flexible optimization for scenarios in different domains, improving the robustness of the proxy model.
[0234] In one embodiment of the present application, the training samples include generation requirement samples and log samples for the neural network model; wherein the log samples include: logs that record model training tasks and / or task parameters during the training of the neural network model.
[0235] From the above, it can be seen that using the logs that record model training tasks and / or task parameters during the training of the neural network model as training samples can enable the proxy model to learn the intermediate tasks and intermediate parameters in the training process of the neural network model, thereby improving the accuracy of the training proxy model and improving the effect of the trained proxy model.
[0236] In one embodiment of the present application, generating a requirement sample includes at least one of the following information: requirement description information of a neural network model, wherein the modality of the requirement description information includes: voice and / or text; reference data of the requirement description information, wherein the modality of the reference data is different from the modality of the requirement description information; and optimization prompt instructions for indicating the role of the neural network model generation agent.
[0237] As can be seen from the above, the neural network model generation agent can parse the user's natural language instructions, and can generate a neural network model that meets the user's needs by obtaining the natural language instructions corresponding to the voice information and / or text information input by the user. It can be seen that it is more convenient for users to generate models based on natural language voice input and / or text input, and the generated agent model can be used by users to generate neural network models that meet their needs. In addition, by obtaining reference data of the demand description information of different modalities input by the user, the trained agent model can understand the user's needs for the neural network model from data of multiple modalities, and can more accurately determine the user's needs and improve the accuracy of the trained agent model. According to the optimization prompt instructions input by the user, the agent model can generate a model according to a role that better meets the user's needs, so that the user can flexibly input the optimization prompt instructions of the role according to his own needs, so that the user can generate the model more conveniently and flexibly based on the agent model.
[0238] In the technical solution of this application, the operations involved in obtaining, storing, using, processing, transmitting, providing and disclosing user personal information are all carried out with the user's authorization.
[0239] The present application also provides an electronic device, such as Figure 6 Shown, including:
[0240] Memory 601, used for storing computer programs;
[0241] The processor 602 is configured to implement any of the agent model training methods in the above embodiments when executing the program stored in the memory 601 .
[0242] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other via the communication bus.
[0243] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0244] The communication interface is used for communication between the above electronic device and other devices.
[0245] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0246] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0247] In another embodiment provided in the present application, a computer-readable storage medium is also provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned agent model training methods are implemented.
[0248] In another embodiment provided by the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the agent model training methods in the above embodiments.
[0249] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state drive (SSD).
[0250] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0251] Each embodiment in this specification is described in a related manner. Similar portions between the various embodiments can be referenced to each other. Each embodiment focuses on the differences between the other embodiments. In particular, the method, apparatus, electronic device, storage medium, and computer program product embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For related portions, reference can be made to the descriptions of the method embodiments.
[0252] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application are included in the scope of protection of the present application.
Claims
1. A method for training an agent model, characterized in that: The proxy model includes: a task master control main model, a data preparation sub-model, a model training sub-model and a model evaluation sub-model. The method includes: Extract features from training samples to obtain feature sequences; Wherein, the training samples include: generation requirement samples for the neural network model; The modalities of the requirement description information of the neural network model included in the generated requirement sample include: voice and / or text; and / or The modalities of the reference data of the requirement description information of the neural network model included in the generation requirement sample include: images and / or videos; Inputting the first data including the feature sequence into the task master control main model for demand analysis and generating a data preparation task, a model training task, and a model evaluation task based on the analysis results, wherein, if it is not the first round of training, the first data also includes: parameter analysis results generated by the data preparation sub-model, the model training sub-model, and the model evaluation sub-model, wherein the task master control main model performs demand analysis on the first data based on natural language processing; Inputting the second data including the data preparation task into the data preparation sub-model for parameter analysis and generating model training data based on the analysis results, wherein, if it is not the first round of training, the second data also includes a previous demand analysis result, where the previous demand analysis result is the result of the demand analysis performed by the task master control main model in the previous round of training; Inputting the third data including the model training task into the model training sub-model for parameter analysis and training the basic network model indicated by the model training task based on the analysis result to obtain the target network model. If it is not the first round of training, the third data also includes the prior demand analysis result; Inputting the fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and evaluating the target network model based on the analysis results, if it is not the first round of training, the fourth data also includes the prior demand analysis results; A loss value obtained by training based on the feature sequence is obtained, and parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model are adjusted based on the loss value.
2. The method according to claim 1, characterized in that The proxy model also includes: a model publishing sub-model; The step of inputting the first data including the feature sequence into the task master control main model for demand analysis and generating data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results includes: Inputting the first data including the feature sequence into the task master control main model to perform demand analysis and generating data preparation tasks, model training tasks, model evaluation tasks and model release tasks based on the analysis results; If it is not the first round of training, the first data also includes: parameter analysis results of the model release sub-model in the previous round of training; The method further comprises: If the target network model passes the evaluation, the fifth data including the model publishing task is input into the model publishing sub-model for parameter parsing and a model deployment file of the target network model is generated based on the parsing result.
3. The method according to claim 1, characterized in that The obtaining of a loss value for training based on the feature sequence includes: Obtaining a first loss value for training the task master control main model based on the feature sequence; Obtaining a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task; Based on the training time of this round, first representation information representing the training optimization direction is obtained; Based on the accuracy of the proxy model, a second representation information representing the training optimization direction is obtained; Based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information, and the second representation information, a loss value for training based on the feature sequence is determined.
4. The method according to claim 3, characterized in that The first model is trained in the following manner to obtain a target loss value, wherein the first model is: the task master control main model, the data preparation sub-model, the model training sub-model, or the model evaluation sub-model, and the target loss value is: the first loss value, the second loss value, the third loss value, or the fourth loss value: Obtaining the predicted probability corresponding to the parsing result obtained by the first model in this round of training based on the completed training; The target loss value is determined based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability.
5. The method according to claim 4, characterized in that The determining the target loss value based on the predicted probability corresponding to the parsing result obtained by the first model in the completed training and the obtained predicted probability includes: The target loss value is determined according to the following expression: Wherein, T is the length of the feature sequence, x t is the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence, y t For the first model pair x t The truth value of the result obtained by performing the analysis.
6. The method according to claim 3, characterized in that The obtaining of first characterization information representing the training optimization direction based on the training duration of the current round includes: If the training duration of this round is greater than the preset minimum training duration, determining first characterization information representing the training optimization direction based on the training duration of this round and the minimum training duration; If the training duration of this round is not greater than the minimum training duration, it is determined that the first representation information is a first preset value.
7. The method according to claim 3, characterized in that The determining, based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information, and the second representation information, a loss value for training based on the feature sequence includes: The loss value for training based on the feature sequence is determined by the following expression: L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +λ1L T +λ2L P Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first characterization information, L P is the second representation information, and γ1, γ2, γ3, λ1 and λ2 are hyperparameters.
8. The method according to any one of claims 1 to 7, characterized in that The training samples include generation requirement samples and log samples for the neural network model; The log samples include: logs that record model training tasks and / or task parameters during the training of the neural network model.
9. The method according to claim 8, characterized in that The generation requirement sample includes at least one of the following information: The requirement description information of the neural network model, wherein the modality of the requirement description information includes: voice and / or text; Reference data of the requirement description information, wherein the modality of the reference data is different from the modality of the requirement description information; An optimization hint instruction for instructing the neural network model to generate a role of an agent.
10. A proxy model training device, characterized in that: The proxy model includes: a task control main model, a data preparation sub-model, a model training sub-model and a model evaluation sub-model, and the device includes: Feature extraction module, used to extract features from training samples and obtain feature sequences; Wherein, the training samples include: generation requirement samples for the neural network model; The modalities of the requirement description information of the neural network model included in the generated requirement sample include: voice and / or text; and / or The modalities of the reference data of the requirement description information of the neural network model included in the generation requirement sample include: images and / or videos; a first data input module, configured to input first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, and model evaluation tasks based on the analysis results; if it is not the first round of training, the first data also includes parameter analysis results generated by the data preparation sub-model, model training sub-model, and model evaluation sub-model; wherein the task master control main model performs demand analysis on the first data based on natural language processing; A second data input module inputs the second data including the data preparation task into the data preparation sub-model for parameter analysis and generates model training data based on the analysis results. If it is not the first round of training, the second data also includes a previous demand analysis result, where the previous demand analysis result is the result of the demand analysis performed by the task master control main model in the previous round of training; A third data input module is configured to input the third data including the model training task into the model training sub-model for parameter analysis and train the basic network model indicated by the model training task based on the analysis result to obtain a target network model. If it is not the first round of training, the third data also includes the analysis result of the prior demand; a fourth data input module, configured to input fourth data including the model evaluation task into the model evaluation sub-model for parameter analysis and to evaluate the target network model based on the analysis results. If it is not the first round of training, the fourth data also includes the analysis results of the prior requirements; The loss value acquisition module is used to obtain the loss value of the training based on the feature sequence, and adjust the parameters of the task control main model, data preparation sub-model, model training sub-model and model evaluation sub-model based on the loss value.
11. The device according to claim 10, characterized in that The proxy model also includes: a model release sub-model; the first data input module is specifically used to input the first data including the feature sequence into the task master control main model for demand analysis and generate data preparation tasks, model training tasks, model evaluation tasks and model release tasks based on the analysis results; if it is not the first round of training, the first data also includes: the parameter analysis results of the model release sub-model in the previous round of training; the device also includes: a fifth data input module, which is used to input the fifth data including the model release task into the model release sub-model for parameter analysis if the target network model passes the evaluation and generate the model deployment file of the target network model based on the analysis results.
12. The device according to claim 10, characterized in that The loss value acquisition module includes: a main model loss value acquisition unit, which is used to obtain a first loss value for training the task master control main model based on the feature sequence; a sub-model loss value acquisition unit, which is used to obtain a second loss value for training the data preparation sub-model based on the data preparation task, a third loss value for training the model training sub-model based on the model training task, and a fourth loss value for training the model evaluation sub-model based on the model evaluation task; a first representation information acquisition unit, which is used to obtain first representation information representing the training optimization direction based on the training time of this round; a second representation information acquisition unit, which is used to obtain second representation information representing the training optimization direction based on the accuracy of the proxy model; a loss value determination unit, which is used to determine the loss value for training based on the feature sequence based on the first loss value, the second loss value, the third loss value, the fourth loss value, the first representation information and the second representation information.
13. The device according to claim 12, characterized in that The loss value acquisition module is specifically used to train the first model in the following manner to obtain a target loss value, wherein the first model is: the task master control main model, the data preparation sub-model, the model training sub-model or the model evaluation sub-model, and the target loss value is: the first loss value, the second loss value, the third loss value or the fourth loss value: obtain the predicted probability corresponding to the analytical result obtained by the first model in this round of training based on the completed training; determine the target loss value based on the predicted probability corresponding to the analytical result obtained by the first model in the completed training and the obtained predicted probability.
14. The device according to claim 13, characterized in that The loss value obtaining module is specifically configured to determine the target loss value according to the following expression: Wherein, T is the length of the feature sequence, x t is the tth feature in the feature sequence, P θ (x t |x1,x2,...,x t-1 ) is the first model in (x1,x2,...,x t-1 ) based on x t The predicted probability obtained by analysis, x1 is the first feature in the feature sequence, x2 is the second feature in the feature sequence, x t-1 is the t-1th feature in the feature sequence, y t For the first model pair x t The truth value of the result obtained by performing the analysis.
15. The device according to claim 12, characterized in that The first characterization information obtaining unit is specifically configured to determine, if the training duration of the current round is greater than the preset minimum training duration, first characterization information characterizing the training optimization direction based on the training duration of the current round and the minimum training duration; If the training duration of this round is not greater than the minimum training duration, it is determined that the first representation information is a first preset value.
16. The device according to claim 12, characterized in that The loss value determining unit is specifically configured to determine the loss value for training based on the feature sequence according to the following expression: L=L Mg +γ1L Ml1 +γ2L Ml2 +γ3L Ml3 +λ1L T +λ2L P Among them, L Mg is the first loss value, L Ml1 is the second loss value, L Ml2 is the third loss value, L Ml3 is the fourth loss value, L T is the first characterization information, L P is the second representation information, and γ1, γ2, γ3, λ1 and λ2 are hyperparameters.
17. The device according to any one of claims 10 to 16, characterized in that The training samples include generation requirement samples and log samples for the neural network model; wherein the log samples include: logs that record model training tasks and / or task parameters during the training process of the neural network model.
18. The device according to claim 17, characterized in that The generated requirement sample includes at least one of the following information: requirement description information of the neural network model, wherein the modality of the requirement description information includes: voice and / or text; reference data of the requirement description information, wherein the modality of the reference data is different from the modality of the requirement description information; and optimization prompt instructions for indicating the role of the neural network model generation agent.
19. An electronic device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the method according to any one of claims 1 to 9 when executing a program stored in a memory.
20. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
AI model customization method, electronic equipment and computer readable storage medium
CN114610271A
Model training and task processing method, device and system, equipment and storage medium
CN115759229A
Multi-task model training method, information recommendation method, apparatus, and device
WO2024040869A1