Model generation method and device, electronic equipment and storage medium
By comparing the functional modules of different models and replacing the functional nodes in the model, the problem of limited processing capabilities of large models in the existing technology is solved, the efficiency and accuracy of the model are improved, and it is suitable for a variety of business scenarios.
Patent Information
- Application Number
- CN202410133535.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-30
- Publication Date
- 2024-09-17
AI Technical Summary
In the existing technology, you can only choose one large model for the same business scenario. The processing effect is limited by the processing capabilities of the large model, and it lacks flexibility and efficiency.
Compare the advantages and disadvantages of similar business function modules in different models by burying points, replace the function nodes in the model to improve processing efficiency and accuracy, and generate the target data processing model.
The overall efficiency and accuracy of the model are improved, and the processing capability is enhanced by calling better functional modules, which is suitable for a variety of business scenarios.
Smart Images

Figure CN118656606A
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a model generation method, device, electronic device and storage medium. Background Art
[0002] With the continuous development of artificial intelligence technology, large models can be applied to more and more business scenarios for prediction or recognition. At present, for the same business scenario, there are usually many different types of large models to choose from. For example, for the business scenario of face recognition, many face recognition models with different parameters have been developed. For another example, for the business scenario of task classification, many different types of task classification models have also been developed.
[0003] For the same business scenario, a single large model is selected from multiple available large models for processing in a selective manner, and the processing effect is limited by the processing capacity of the large model itself. Therefore, how to obtain a data processing model with strong processing capacity has become one of the hot research issues in the field of artificial intelligence. Summary of the invention
[0004] The present application provides a model generation method, device, electronic device and storage medium to improve the processing efficiency and accuracy of the model.
[0005] In a first aspect, the present application provides a model generation method, the method comprising:
[0006] In the process of training the first data processing model using the training data, a first tracking point execution result generated by the first function node for the tracking point event is obtained; the first function node is deployed in the first data processing model;
[0007] In the process of training the second data processing model using the training data, a second tracking point execution result generated by the second function node for the tracking point event is obtained; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business;
[0008] When the execution result of the second embedding point is better than the execution result of the first embedding point, the first function node in the first data processing model is replaced with the second function node in the second data processing model, and the target data processing model is generated according to the replacement result.
[0009] In a second aspect, the present application provides a model generation device, comprising:
[0010] an acquisition module, adapted to acquire a first tracking point execution result generated by a first function node for a tracking point event in a process of training a first data processing model using training data; the first function node is deployed in the first data processing model;
[0011] The acquisition module is adapted to acquire a second tracking point execution result generated by the second function node for the tracking point event in the process of training the second data processing model using the training data; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business;
[0012] A replacement module is suitable for replacing the first function node in the first data processing model with the second function node in the second data processing model when the execution result of the second embedding point is better than the execution result of the first embedding point, and generating a target data processing model according to the replacement result.
[0013] In a third aspect, the present application provides an electronic device comprising: at least one processor; at least one memory; and one or more I / O interfaces connected between the processor and the memory; wherein the memory stores one or more computer programs that can be executed by at least one processor, and the one or more computer programs are executed by at least one processor so that the at least one processor can execute the above-mentioned model generation method.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned model generation method when executed by a processor / processing core.
[0015] In the method provided in the present application, in the process of training the first data processing model with training data, the first buried point execution result generated by the first function node in the first data processing model for the buried point event is obtained; and in the process of training the second data processing model with training data, the second buried point execution result generated by the second function node in the second data processing model for the above-mentioned buried point event is obtained; then, when the second buried point execution result is better than the first buried point execution result, the first function node in the first data processing model is replaced with the second function node in the second data processing model, thereby generating a target data processing model according to the replacement result. It can be seen that this method can compare the advantages and disadvantages of the functional modules corresponding to the same business functions in different models horizontally through the buried point method, so that the functional modules corresponding to the same business functions in the second data processing model can be called in the first data processing model, thereby improving the overall efficiency and accuracy of the model.
[0016] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings. In the accompanying drawings:
[0018] Figure 1 A flow chart of a model generation method provided in an embodiment of the present application;
[0019] Figure 2 A flowchart of a model generation method provided for a specific example of the present application;
[0020] Figure 3 A block diagram of a model generation device provided in an embodiment of the present application;
[0021] Figure 4 A block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to enable those skilled in the art to better understand the technical solution of the present application, the exemplary embodiments of the present application are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0023] In the absence of conflict, the embodiments of the present application and the features therein may be combined with each other.
[0024] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0025] The terms used herein are only used to describe specific embodiments and are not intended to limit the present application. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect.
[0026] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined herein.
[0027] The model generation method according to the embodiment of the present application can be executed by an electronic device such as a terminal device or a server. The terminal device can be a vehicle-mounted device, a user equipment (UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, etc. The server can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing cloud computing services. The method can be implemented by a processor calling a computer program stored in a memory.
[0028] In the related art, for the same business scenario, only a single large model can be selected from multiple available large models for processing in a selective manner. It can be seen that the above processing method is not flexible enough, and the processing effect is limited by the processing capacity of the large model itself. In order to solve the above problems, in this application, a model generation method is proposed, which can horizontally compare the advantages and disadvantages of functional modules corresponding to similar business functions in different models through a point-burying method, so that the functional modules corresponding to similar business functions in the second data processing model can be called in the first data processing model, thereby improving the overall efficiency and accuracy of the model.
[0029] Figure 1 A flowchart of a model generation method for a punctuation prediction model provided in an embodiment of the present application. Figure 1 , the method comprising:
[0030] Step S110: in the process of training the first data processing model by using the training data, obtaining the first tracking point execution result generated by the first function node for the tracking point event; the first function node is deployed in the first data processing model.
[0031] The first data processing model can also be called a basic model. The present application can improve the first data processing model to obtain a target data processing model with better effect. Specifically, the first data processing model is used to implement various types of data processing. The present application does not limit the specific type and function of the first data processing model.
[0032] The first function node deployed in the first data processing model is a node for implementing a preset business function, which can be a layer in a multi-layer model, a module in a multi-module model, or a function or a class in a model. In short, the present application does not limit the specific form of the function node.
[0033] The tracking event is used to obtain the execution result of the corresponding functional node. Among them, the tracking location of the tracking event can be set flexibly. For example, the tracking can be performed in the code of the first functional node. The event parameters of the tracking event are used to characterize the event reporting logic and reporting content of the tracking event. For example, the event parameters of the tracking event are used to characterize the following execution logic: when the first functional node executes the corresponding business function, the node execution result, node execution time and other related information of the first functional node are obtained, and the first tracking execution result is obtained according to the node execution result and node execution time of the first functional node. It can be seen that the first tracking execution result is used to characterize the execution status corresponding to the tracking event in the first functional node.
[0034] It can be seen that in step S110, by deploying a tracking event for the first functional node, it is possible to obtain the first tracking execution result generated by the first functional node for the tracking event during the process of training the first data processing model using training data.
[0035] Step S120: In the process of training the second data processing model using the training data, a second tracking point execution result generated by the second function node for the tracking point event is obtained; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business.
[0036] Among them, the second data processing model can also be called a candidate model. The present application can graft all or part of the functional nodes in the candidate model onto the first data processing model, thereby improving the execution efficiency of the first data processing model.
[0037] Among them, the second functional node in the second data processing model is a node used to implement the same type of business (that is, the business function of the second functional node is the same or similar to that of the first functional node). Specifically, it can be a layer in a multi-layer model, or a module in a multi-module model, or a function or a class in the model.
[0038] Correspondingly, the tracking event set in the second function node is the same as the tracking event set in the first function node, and both are used to obtain the execution result of the corresponding function node. However, it should be noted that the tracking event set in the second function node is the same as the tracking event set in the first function node, which mainly means that the event function is the same. However, considering the differences in node code and implementation method between the second function node and the first function node, the tracking event set in the second function node and the tracking event set in the first function node may have some differences in event deployment method, event deployment parameters, and result reporting method.
[0039] The tracking event in the second function node can be deployed by tracking in the code of the second function node. The event parameters of the tracking event in the second function node are used to characterize the event reporting logic and reporting content of the tracking event. For example, the event parameters of the tracking event in the second function node are used to characterize the following execution logic: when the second function node executes the corresponding business function, the node execution result, node execution time and other related information of the second function node are obtained, and the second tracking execution result is obtained according to the node execution result and node execution time of the second function node. It can be seen that the second tracking execution result is used to characterize the execution status corresponding to the tracking event in the second function node.
[0040] Step S130: When the second tracking point execution result is better than the first tracking point execution result, the first function node in the first data processing model is replaced with the second function node in the second data processing model, and the target data processing model is generated according to the replacement result.
[0041] Specifically, the second tracing point execution result is compared with the first tracing point execution result, wherein the time-consuming data contained in the execution results can be compared, and the execution result with short time consumption is better than the execution result with long time consumption; the accuracy data contained in the execution results can also be compared, and the execution result with high accuracy is better than the execution result with low accuracy.
[0042] If the execution result of the second tracking point is better than the execution result of the first tracking point, the first function node in the first data processing model is replaced with the second function node in the second data processing model, thereby generating a target data processing model. The specific replacement process may be: modifying the code logic of the first function node in the first data processing model according to the code logic corresponding to the second function node in the second data processing model. Alternatively, the replacement process may also be: adding a calling interface in the first data processing model to call the second function node in the second data processing model through the calling interface, thereby achieving the effect of replacing the first function node in the first data processing model with the second function node in the second data processing model.
[0043] It can be seen that this method can compare the advantages and disadvantages of functional modules corresponding to similar business functions in different models through the point-burying method, so that the functional modules corresponding to similar business functions in the second data processing model can be called in the first data processing model, thereby improving the overall efficiency and accuracy of the model.
[0044] In this embodiment, the first buried point execution result and the second buried point execution result can be obtained during the training process of the model, and then the replaced target data processing model can be obtained based on the comparison result of the two. In addition, it should be noted that the replaced target data processing model can be a model that has been trained or a model that has not been trained and still needs to be trained. This application does not limit the specific implementation details. For example, the first buried point execution result or the second buried point execution result can be the execution result of a preset number of iterations. Correspondingly, if the first buried point execution result or the second buried point execution result is the execution result of the last iteration, then the target data processing model obtained at this time belongs to a model that has been trained and can be used directly; if the first buried point execution result or the second buried point execution result is the result of an iteration in the training process, then the target data processing model obtained at this time belongs to a model that has not been trained and still needs to be trained.
[0045] In addition, those skilled in the art may also make various modifications and variations to the above embodiments:
[0046] In an optional implementation, the method further includes: obtaining node attribute information of the functional node; wherein the functional node includes at least one of a first functional node and a second functional node; determining the event type according to the node attribute information; and configuring a buried event that matches the event type. It can be seen that the event type of the buried event can be determined according to the node attributes of the functional node. Since the buried event is used to verify the performance differences between the functional nodes in different models corresponding to the same type of business, the specific event type of the buried event can be determined according to the specific business indicators of the type of business (such as execution time, execution efficiency, and recognition rate). The method of determining the event type according to the node attribute information can ensure that the event type of the buried event matches the corresponding node business characteristics.
[0047] The node attribute information includes at least one of the following: node function information, node execution round information, node execution batch information, and node accuracy information. The node function information is used to characterize the specific functions of the node, such as word vector characterization function, loss value calculation function, similarity comparison function, prediction function, etc. The node execution round information is used to characterize the information corresponding to the function node in a specific execution round (epoch). Epoch refers to the training process of passing all samples in the training data set once (and only once). In an epoch, the training algorithm inputs all samples into the model in a set order for forward propagation, loss calculation, back propagation, and parameter update. An epoch usually contains multiple steps. The node execution batch information is used to characterize the information corresponding to the function node in a specific execution batch (batch). Batch means a group of samples input into the model at one time. In the training process of the neural network, the training data is often a lot. Therefore, the training data can be divided into multiple batches, and then the samples of each batch are input into the model in batches for forward propagation, loss calculation, back propagation, and parameter update. The node accuracy information is used to characterize the accuracy requirement or loss value requirement of the function node execution.
[0048] Among them, the event type of the buried point event may include at least one of the following: a node function type corresponding to the node function information, a round type corresponding to the node execution round information, a batch type corresponding to the node execution batch information, and a loss value type corresponding to the node accuracy information.
[0049] Among them, the round-type tracking event is used to obtain the round execution results of the first function node and / or the second function node in any execution round. This type of event type of tracking event is used to obtain the round execution results of the function node in one or more specified execution rounds. For example, assuming there are N epochs, accordingly, a tracking point can be set after each epoch of the function node, and the output information is the execution result data of the function node in the corresponding round.
[0050] The batch type tracking event is used to obtain the batch execution results of the first function node and / or the second function node in any execution batch. This type of tracking event is used to obtain the batch execution results of the function node in a specified execution batch. For example, each epoch can be divided into multiple batches, and tracking can be performed in each batch of the function node to output the execution result data of the function node in the corresponding batch.
[0051] The buried event of the loss value type is used to obtain the loss value of the loss function in the first function node and / or the second function node. Among them, the buried event of this type of event is used to calculate the loss value of the loss function. For example, loss calculation is performed in each batch, and buried events can be performed in the loss calculation code of each batch to obtain the loss value calculation result. Among them, the execution result with a small loss value is better than the execution result with a large loss value.
[0052] The buried events of the function node type are used to obtain the execution results of the business functions implemented by the first function node and / or the second function node. Among them, the specific type of the function node type is determined according to the specific business functions implemented by the function node. For example, the function node type can be a word vector type. Correspondingly, the buried events of the word vector type are used to obtain the word vector representation results of the word vector module in the first function node and / or the second function node. Among them, the buried events of this type of event are used to determine the representation results of the word vector. For example, this type of event can obtain the word vector representation of each text in each batch. In specific implementation, in most task classification models, intent recognition models and other models, word vectors need to be represented. Accordingly, the execution results with high accuracy of word vector representation are better than the execution results with low accuracy of word vector representation.
[0053] Among them, the event types of the above-mentioned multiple buried events can correspond to the node attribute information. For example, when the node attribute information is the node execution round information, the event type of the corresponding buried event can be the round type. Correspondingly, through the buried event of the round type, the execution of the node in each execution round can be accurately characterized. For another example, when the node attribute information is the node execution batch information, the event type of the corresponding buried event can be the batch type. Correspondingly, through the buried event of the batch type, the execution of the node in each execution batch can be accurately characterized. For another example, when the node attribute information is the node precision information, the event type of the corresponding buried event can be the loss value type. Correspondingly, through the buried event of the loss value type, the precision information of the node can be accurately characterized. For another example, when the node attribute information is the node function information, the event type of the corresponding buried event can be the word vector type. Correspondingly, through the buried event of the word vector type, the word vector representation of the node can be accurately characterized. In addition, when the node function information is other types of functions, the event type of the buried event can also be flexibly adjusted to an event type that matches the node function.
[0054] It can be seen that since the event type of the embedded event can be determined according to the node attributes of the functional node, it can ensure that the embedded event is more closely matched with the node attributes of the functional node, thereby obtaining the execution status of the functional node more accurately and reliably.
[0055] In addition, the above four types of buried point events can correspond to different buried point levels respectively. For example, the round type buried point event corresponds to the first buried point level (i.e., the largest buried point level, or the buried point level with the coarsest granularity); the batch type buried point event corresponds to the second buried point level (or the buried point level with a slightly coarser granularity); the loss value type buried point event corresponds to the third buried point level (or the buried point level with a finer granularity); the node function type buried point event corresponds to the fourth buried point level (or the buried point level with a finer granularity). In addition, in actual situations, a buried point event corresponding to the fifth buried point level (or the buried point level with the finest granularity) can also be set according to actual needs. The event type of the buried point event of the fifth buried point level can be a word vector representation type, which is used to obtain multi-dimensional fine-grained features of word vectors in specific representation links. For example, word vector representation can be divided into many layers. Therefore, if it is necessary to perform tracking at the fifth layer, tracking can be set for the positions corresponding to the static word vector representation, dynamic word vector representation, position representation, sentence representation, and attention representation, respectively, to achieve more fine-grained monitoring processing.
[0056] In addition, in order to obtain better tracking results and achieve more comprehensive monitoring, corresponding types of tracking events can be set for the above-mentioned multiple tracking levels to improve the accuracy and reliability of result comparison.
[0057] Similarly, the second event type corresponding to the second node attribute information can be determined based on the second node attribute information of the second function node in the second data processing model, and a second buried event matching the second event type can be configured for the second function node; wherein the first event type is the same as the second event type. It can be seen that the event type of the second buried event configured for the second function node in the second data processing model is the same as the event type of the first buried event configured for the first function node in the first data processing model, thereby ensuring that the event information obtained for the two models is of the same level and granularity, so as to achieve horizontal comparison.
[0058] In an optional implementation, in order to take advantage of the strengths of multiple models and improve the grafting effect of the first data processing model, the number of second data processing models can be multiple. Accordingly, when the second embedding point execution result is better than the first embedding point execution result, the first function node in the first data processing model can be replaced with the second function node in the second data processing model in the following manner: respectively compare the second embedding point execution result of each second data processing model with the first embedding point execution result, select at least one model from the multiple second data processing models as the grafting model according to the comparison result, and replace the first function node in the first data processing model with the second function node in the grafting model. For example, in one implementation, the number of second data processing models is N, and accordingly, the number of second embedding point execution results is N, that is, one second data processing model corresponds to one second embedding point execution result. When the second embedding point execution result is better than the first embedding point execution result, the first function node in the first data processing model is replaced by the second function node in the second data processing model in the following manner: for each second data processing model, the second embedding point execution result of the second data processing model is compared with the first embedding point execution result to obtain a comparison result; according to the N comparison results, M second models are selected from the N second data processing models as grafted models, and the first function node in the first data processing model is replaced by the second function node in the grafted model to obtain M candidate models. Wherein, N and M are both natural numbers, and M is less than N.
[0059] Normally, M can be equal to 1. Accordingly, the candidate model can be directly used as the target data processing model. However, in some business scenarios, the number of M may be multiple. In this case, M target data processing models can be directly obtained based on the M candidate models. Alternatively, a model can be selected from the M candidate models, and the target data processing model can be obtained based on the selected model. In the latter method, in order to facilitate screening, it can be implemented in the following way: for each candidate model, the second functional node in the candidate model processes the test data and obtains the buried point test execution result; according to the buried point test execution results of the M candidate models, a model is selected from the M candidate models as the target data processing model. It can be seen that in the above method, the same batch of test data is input into each candidate model respectively, and the second functional node in each candidate model is used to process the input test data. Accordingly, the buried point test execution result returned by the second functional node in each candidate model during the processing process is obtained, and the buried point test execution result is used to characterize the processing result of the second functional node in the candidate model when processing the test data, such as processing delay, processing accuracy, etc. Correspondingly, according to the execution results of the embedded point tests of the M candidate models, a model with better execution results is selected from the M candidate models as the target data processing model.
[0060] In addition, the number of the above-mentioned first functional nodes can be multiple, and correspondingly, the number of the second functional nodes can also be multiple. In the above, one functional node is mainly used as an example for explanation. In actual situations, the above processing can be performed separately for multiple functional nodes. Among them, each functional node can be replaced by the replacement method mentioned above. In addition, when the number of functional nodes is multiple and the number of second data processing models is also multiple, when replacing each functional node, several candidate models can be selected from multiple second data processing models by the method mentioned above, and a model can be selected from several candidate models as the target data processing model.
[0061] In an optional implementation, the first function node includes: a plurality of first function sub-nodes; and the buried point event may include: a plurality of buried point sub-events corresponding to the first function sub-node, and the first buried point execution result includes: a plurality of first buried point execution sub-results corresponding to the buried point sub-event. Correspondingly, the second function node includes: a plurality of second function sub-nodes; and the second buried point execution result includes: a plurality of second buried point execution sub-results corresponding to the buried point sub-event. It can be seen that in this method, the function node is further divided into a plurality of sub-nodes, and the buried point event further includes a plurality of sub-events, so that the execution of the corresponding sub-node can be monitored through each sub-event, and then the sub-node is used as the minimum replacement unit to achieve a more flexible model grafting effect. In this method, each second buried point execution sub-result is compared with the corresponding first buried point execution sub-result, and for any second buried point execution sub-result that is better than the first buried point execution sub-result, the second function sub-node corresponding to the second buried point execution sub-result is determined, and the corresponding first function sub-node in the first data processing model is replaced with the second function sub-node. For example, assuming that the first data processing model and the second data processing model both include three functional sub-nodes, if the second tracking point execution sub-result corresponding to the second functional sub-node in the second data processing model is better than the first tracking point execution sub-result corresponding to the second functional sub-node in the first data processing model, the second functional sub-node in the first data processing model is replaced with the second functional sub-node in the second data processing model.
[0062] In addition, in the case where the function node includes multiple function sub-nodes, the number of the second data processing models can also be multiple. At this time, for each function sub-node, a better sub-node can be selected from the sub-nodes corresponding to the multiple second data processing models for replacement. For example, assuming that the first data processing model and the second data processing model both include three function sub-nodes, and the number of the second data processing models is multiple, including the second data processing model a, the second data processing model b, and the third model c, assuming that for the first function sub-node, the execution result of the second data processing model b is better; for the second function sub-node, the execution result of the second data processing model c is better; for the third function sub-node, the execution result of the second data processing model a is better, then the first function sub-node in the first data processing model is replaced with the first function sub-node in the second data processing model b, the second function sub-node in the first data processing model is replaced with the second function sub-node in the second data processing model c, and the third function sub-node in the first data processing model is replaced with the third function sub-node in the second data processing model a. In the above manner, it is possible to learn from the strengths of multiple sub-nodes of multiple models and improve the first data processing model to the greatest extent.
[0063] In an optional implementation, when replacing the first function node in the first data processing model with the second function node in the second data processing model, it can be implemented by calling an interface and / or calling a function. Specifically, a first calling function is set for the node input interface of the first function node; wherein the first calling function is used to call the second function node in the second data processing model, so that when there is input data in the first function node, the second function node is instructed to replace the first function node to process the input data by calling the first calling function, so that the second function node in the second data processing model replaces the first function node in the first data processing model. wherein the node input interface of the first function node is used to provide input data to the first function node for processing by the first function node. through the first calling function, the second function node in the second data processing model can be called at the link where the input data should be provided to the first function node, so that the input data that should be provided to the first function node is provided to the second function node. In addition, a second calling function is set for the node output interface of the first function node; wherein the second calling function is used to obtain the output data of the second function node in the second data processing model, so as to use the output data of the second function node in the second data processing model as the output result of the first function node in the first data processing model. wherein the node output interface of the first function node is used to output the calculation result of the first function node to the next function node, and accordingly, through the second calling function, the content that should have been output by the first function node can be output by the second function node, thereby achieving the purpose of replacing the first function node with the second function node. this method does not require major changes to the code logic in the first data processing model, and only requires setting calling functions on the input interface and output interface of the first function node, which can simplify the cost of model replacement and achieve rapid replacement of different function nodes between multiple models.
[0064] In an optional implementation, the above-mentioned first data processing model, second data processing model and target data processing model are used to implement intent recognition processing, or task classification prediction, etc. The present application does not limit the specific application scenarios of the first data processing model and the second data processing model. The first data processing model and the second data processing model can be models for implementing various business scenarios such as face recognition, intent recognition, voice quality inspection, classification prediction, etc. In addition, the above-mentioned first functional node may include at least one of the following: a word vector representation node, a loss function calculation node, etc. In short, the present application does not limit the node type and implementation method of the first functional node, and those skilled in the art can flexibly select the first functional node according to business needs.
[0065] For ease of understanding, the specific implementation details of the above embodiment are described in detail below using a specific example:
[0066] Large Model refers to a deep neural network model with millions or billions of parameters. This model can perform complex processing and task processing on large-scale data after a special training process. At present, multiple large models with similar functions cannot learn from each other and can only run independently. In order to improve the execution effect of large models and facilitate mutual learning between multiple large models, this example provides a tracking analysis framework (also called model grafting framework). With the help of this framework, the advantages and disadvantages of multiple models can be determined by tracking, so as to obtain a more preferred model by model grafting. In this example, the model training or reasoning path can be returned in real time at the key nodes, and the return results of all nodes can be compared to summarize the characteristics of each large model. In addition, a model grafting framework is proposed to integrate the advantages and features of other large models into the basic model to achieve mutual learning and optimization between models. Among them, tracking means tracking, and by returning or printing the relevant data of each node of the model, the whole process of model operation can be tracked and traced back, so as to understand the operation details of the key functional nodes.
[0067] Figure 2 FIG. 4 shows a flow chart of the model generation method in this example. Figure 2 As shown, the specific steps include:
[0068] Step S201: Determine a first data processing model and a second data processing model.
[0069] Among them, the first data processing model is the basic model mentioned above, and the second data processing model is also called the model to be grafted. Specifically, a visual configuration interface can be provided in the model grafting framework, and the configuration interface may include a first data processing model selection entry and a second data processing model selection entry, so as to flexibly select a first data processing model and one or more second data processing models from multiple large models supported by the framework. For example, a user can trigger a first data processing model selection instruction through the first data processing model selection entry, and trigger a second data processing model selection instruction through the second data processing model selection entry. Correspondingly, the model grafting framework parses the corresponding instructions and determines the first data processing model and the second data processing model selected by the user based on the instruction parameters contained therein. Among them, the number of second data processing models can be multiple.
[0070] Step S202: configure a first tracking event for a first functional node in a first data processing model, and configure a second tracking event for a second functional node in a second data processing model.
[0071] Among them, the first function node and the second function node are used to implement the same type of business functions and belong to the same type of nodes. In addition, the first function node and the second function node may further include multiple sub-nodes. In short, the number and type of sub-nodes contained in the first function node and the second function node and the number and type of corresponding buried point sub-events are mutually corresponding.
[0072] During specific implementation, the node quantity and node name of the first function node and the second function node may be automatically determined by the model grafting framework, or may be customized by the user through event configuration instructions.
[0073] In addition, the first buried event and the second buried event are the same type of events. In fact, the first buried event and the second buried event belong to the same buried event, but the deployment locations of the events are different, which are deployed in the first functional node and the second functional node respectively.
[0074] Step S203: Obtain a first burying point execution result of a first burying point event corresponding to a first functional node in a first data processing model; and obtain a second burying point execution result of a second burying point event corresponding to a second functional node in a second data processing model.
[0075] Among them, in order to facilitate the horizontal comparison between multiple models, the same training data (such as corpus data) is input into the first data processing model and the second data processing model respectively, and training is performed according to the longest number of training rounds to obtain the execution results of the embedded points generated during the training process.
[0076] Step S204: Compare the second burying point execution result with the first burying point execution result.
[0077] In specific implementation, when there are multiple sub-nodes and the tracking point execution result further includes multiple sub-results, all the tracking point execution sub-results can be obtained in order, and a comparative analysis can be performed on each group of tracking point execution sub-results to obtain the comparison results between the models.
[0078] Step S205: When the second tracking point execution result is better than the first tracking point execution result, the first function node in the first data processing model is replaced with the second function node in the second data processing model, and the target data processing model is generated according to the replacement result.
[0079] Specifically, we can analyze the functional nodes that lead to different execution effects of different models, determine the accuracy, precision, recall and other indicators of each model based on the execution results of the corresponding functional nodes, and then select the model with better execution results based on these indicators.
[0080] In specific implementation, the basic model (i.e., the first data processing model) can be used as a benchmark, and the functional nodes with better performance in the model to be grafted (i.e., one or more second data processing models) can be used to replace the corresponding similar functional nodes in the basic model in parallel. The replacement method can be: the output of the second functional node in the second data processing model is directly written into the corresponding position in the first data processing model as the input of the next functional node.
[0081] Among them, the effects of multiple models to be grafted can be compared, and the model with better model effect when the number of training rounds is small is selected as the current optimal model to be grafted.
[0082] Step S206: If there are multiple target data processing models, a tracking event is further set in each target data processing model to obtain the tracking execution result of each target data processing model during the execution process, and at least one better target data processing model is selected from the multiple target data processing models to implement business processing through the better target data processing model.
[0083] Specifically, when there are multiple target data processing models, the same batch of test corpus data can be simultaneously input into multiple grafted target data processing models, and the tracking point execution results returned by each target data processing model during the execution process can be obtained. By comparing multiple tracking point execution results, a better target data processing model can be selected from multiple target data processing models for business processing.
[0084] For example, assume that the basic model is model_mx, which includes three functional nodes, namely node 1, node 2 and node 3. There are three models to be grafted, namely model_a, model_b, and model_c, and each model to be grafted also includes three functional nodes, namely node 1, node 2 and node 3. By comparing the basic model with the three models to be grafted, it is found that at node 1, the performance of the model_a model is the best among the four models. Therefore, node 1 in the basic model is replaced by node 1 in the model_a model; at node 2, the performance of the model_b model is the best among the four models. Therefore, node 2 in the basic model is replaced by node 2 in the model_b model; at node 3, the performance of model_a, model_b, and model_c is the same, and all are better than model_mx. Therefore, node 3 in the basic model can be replaced by node 3 in the model_a, model_b, and model_c models, respectively, to obtain three target data processing models. It can be seen that in the above method, three combined grafting models are obtained.
[0085] Accordingly, in order to select a better model from the three target data processing models, all the execution results of the embedded points returned in each target data processing model can be integrated in order, and the differences of each model can be compared, analyzed and summarized one by one to form a comparative conclusion of the model reasoning capabilities.
[0086] In summary, this example proposes a large model reasoning framework based on model grafting technology, which can compare the grafting effects of different large models, and can summarize and analyze the comparison of model effects from a micro level. For example, the traditional method can only understand the final performance results between different models (such as numerical comparisons of precision and recall), while this example achieves the output of each link of reasoning for the same text by embedding points in the model reasoning process, that is, from the micro level of each link, the details of the reasoning of different models on the same text are compared, and the word vector representation, loss calculation, parameters after each batch, and parameters after each epoch of the same text can be micro-insighted, and then the models can be replaced with each other at the minimum granularity of functional nodes (even functional sub-nodes), which greatly improves the flexibility of the model.
[0087] Figure 3 A block diagram of a model generation device for a punctuation prediction model provided in an embodiment of the present application. Figure 3 , the model generating device 30 comprises:
[0088] The acquisition module 31 is adapted to acquire a first tracking point execution result generated by a first function node for a tracking point event in a process of training a first data processing model using training data; the first function node is deployed in the first data processing model;
[0089] The acquisition module 31 is adapted to acquire a second tracking point execution result generated by a second function node for the tracking point event in a process of training a second data processing model using the training data; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business;
[0090] The replacement module 32 is suitable for replacing the first function node in the first data processing model with the second function node in the second data processing model when the execution result of the second embedding point is better than the execution result of the first embedding point, and generating a target data processing model according to the replacement result.
[0091] In an optional implementation, the device further includes:
[0092] A configuration module, adapted to obtain node attribute information of a functional node; the functional node includes at least one of the first functional node and the second functional node;
[0093] Determine the event type according to the node attribute information;
[0094] Configure tracking events that match the event type.
[0095] In an optional implementation, the node attribute information includes at least one of the following: node function information, node execution round information, node execution batch information, and node accuracy information;
[0096] The event type includes at least one of the following:
[0097] The node function type corresponding to the node function information, the round type corresponding to the node execution round information, the batch type corresponding to the node execution batch information, and the loss value type corresponding to the node accuracy information;
[0098] The round-type tracking event is used to obtain the round execution result of the first function node and / or the second function node in any execution round;
[0099] The batch type of tracking event is used to obtain the batch execution result of the first function node and / or the second function node in any execution batch; wherein one execution round includes multiple execution batches;
[0100] The buried event of the loss value type is used to obtain the loss value of the loss function in the first function node and / or the second function node;
[0101] The buried event of the node function type is used to obtain the execution result of the business function implemented by the first function node and / or the second function node.
[0102] In an optional implementation, the number of the second data processing models is N, the number of the second embedding point execution results is N, and one second data processing model corresponds to one second embedding point execution result; the replacement module is specifically adapted to: for each second data processing model, comparing the second embedding point execution result of the second data processing model with the first embedding point execution result to obtain a comparison result; selecting M second models from the N second data processing models as grafted models based on the N comparison results, replacing the first functional node in the first data processing model with the second functional node in the grafted model, and obtaining M candidate models.
[0103] Among them, for each candidate model, the second functional node in the candidate model processes the test data to obtain the embedded test execution result; according to the embedded test execution results of the M candidate models, a model is selected from the M candidate models as the target data processing model.
[0104] In an optional implementation, the replacement module is specifically adapted to:
[0105] A first calling function is set for the node input interface of the first function node; wherein the first calling function is used to call the second function node in the second data processing model, so that the second function node in the second data processing model replaces the first function node in the first data processing model;
[0106] A second calling function is set for the node output interface of the first function node; wherein the second calling function is used to obtain the output data of the second function node in the second data processing model, so as to use the output data of the second function node in the second data processing model as the output result of the first function node in the first data processing model.
[0107] In an optional implementation, the first data processing model, the second data processing model and the target data processing model are used to implement intent recognition processing or task classification prediction; wherein the first functional node includes at least one of the following: a word vector representation node and a loss function calculation node.
[0108] The specific structure and working principle of each of the above modules can be referred to the description of the corresponding part of the method embodiment, which will not be repeated here.
[0109] Figure 4 A block diagram of an electronic device provided in an embodiment of the present application. Figure 4 The electronic device 50 includes: at least one processor 501; at least one memory 502; and one or more I / O interfaces 503, connected between the processor 501 and the memory 502; wherein the memory 502 stores one or more computer programs that can be executed by at least one processor 501, and the one or more computer programs are executed by at least one processor 501 so that the at least one processor 501 can execute the above-mentioned model generation method.
[0110] The embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored, wherein the computer program implements the above-mentioned model generation method when executed by the processor / processing core. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0111] An embodiment of the present application also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned model generation method.
[0112] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).
[0113] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
[0114] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0115] The computer program instructions for performing the operation of the present application can be assembler instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions can be executed completely on a user's computer, partially on a user's computer, executed as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet). In some embodiments, by using the state information of a computer-readable program instruction to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute a computer-readable program instruction, thereby realizing various aspects of the present application.
[0116] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0117] Various aspects of the present application are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0118] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0119] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0120] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can also be executed in the opposite order sometimes, depending on the function involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a dedicated hardware-based system that performs the function or action of the specification, or can be realized by a combination of special-purpose hardware and computer instructions.
[0121] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present application as set forth in the appended claims.
Claims
1. A model generation method, characterized in that: include: In the process of training the first data processing model using the training data, obtaining a first tracking point execution result generated by the first function node for the tracking point event; The first function node is deployed in the first data processing model; In the process of training the second data processing model using the training data, a second tracking point execution result generated by the second function node for the tracking point event is obtained; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business; When the execution result of the second embedding point is better than the execution result of the first embedding point, the first function node in the first data processing model is replaced with the second function node in the second data processing model, and the target data processing model is generated according to the replacement result.
2. The method according to claim 1, characterized in that The method further comprises: Acquire node attribute information of a function node; the function node includes at least one of the first function node and the second function node; Determine the event type according to the node attribute information; Configure tracking events that match the event type.
3. The method according to claim 2, characterized in that The node attribute information includes at least one of the following: node function information, node execution round information, node execution batch information, and node accuracy information; Event types include at least one of the following: The node function type corresponding to the node function information, the round type corresponding to the node execution round information, the batch type corresponding to the node execution batch information, and the loss value type corresponding to the node accuracy information; The round-type tracking event is used to obtain the round execution result of the first function node and / or the second function node in any execution round; The batch type of tracking event is used to obtain the batch execution result of the first function node and / or the second function node in any execution batch; wherein one execution round includes multiple execution batches; The buried event of the loss value type is used to obtain the loss value of the loss function in the first function node and / or the second function node; The buried event of the node function type is used to obtain the execution result of the business function implemented by the first function node and / or the second function node.
4. The method according to any one of claims 1 to 3, characterized in that: The number of the second data processing models is N, the number of the second buried point execution results is N, and one second data processing model corresponds to one second buried point execution result; when the second buried point execution result is better than the first buried point execution result, replacing the first function node in the first data processing model with the second function node in the second data processing model includes: For each second data processing model, compare the second embedding execution result of the second data processing model with the first embedding execution result to obtain a comparison result; According to the N comparison results, M second models are selected from the N second data processing models as grafting models, and the first function node in the first data processing model is replaced by the second function node in the grafting model to obtain M candidate models.
5. The method according to claim 4, characterized in that Generating a target data processing model according to the replacement result includes: For each candidate model, the second function node in the candidate model processes the test data to obtain the execution result of the embedded test; According to the execution results of the embedding test of the M candidate models, a model is selected from the M candidate models as the target data processing model.
6. The method according to any one of claims 1 to 3, characterized in that: The replacing the first function node in the first data processing model with the second function node in the second data processing model includes: A first calling function is set for the node input interface of the first function node; wherein the first calling function is used to call the second function node in the second data processing model, so that when the first function node has input data, the second function node is instructed to process the input data instead of the first function node by calling the first calling function; A second calling function is set for the node output interface of the first function node; wherein the second calling function is used to obtain the output data of the second function node in the second data processing model, so as to use the output data of the second function node in the second data processing model as the output result of the first function node in the first data processing model.
7. The method according to any one of claims 1 to 3, characterized in that: The first data processing model, the second data processing model and the target data processing model are used to implement intent recognition processing or classification prediction; wherein, the first functional node includes at least one of the following: a word vector representation node, a loss function calculation node.
8. A model generation device, characterized in that: include: An acquisition module, adapted to acquire a first tracking point execution result generated by a first function node for a tracking point event in a process of training a first data processing model using training data; The first function node is deployed in the first data processing model; The acquisition module is adapted to acquire a second tracking point execution result generated by the second function node for the tracking point event in the process of training the second data processing model using the training data; the second function node is deployed in the second data processing model; wherein the first function node and the second function node are used to implement the same type of business; A replacement module is suitable for replacing the first function node in the first data processing model with the second function node in the second data processing model when the execution result of the second embedding point is better than the execution result of the first embedding point, and generating a target data processing model according to the replacement result.
9. An electronic device, characterized in that: include: at least one processor; and at least one memory; The memory stores one or more computer programs executable by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the model generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the computer program implements the model generation method according to any one of claims 1 to 7.
