Model optimization method and apparatus, storage medium, and device
By jointly optimizing the search configuration information and operator arrangement of the AI model from multiple dimensions, combined operators are generated, which solves the problem that single optimization in the existing technology cannot meet diverse needs, and improves the overall performance and application adaptability of the model.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-19
- Publication Date
- 2026-03-27
AI Technical Summary
Existing AI model optimization platforms can only optimize from a single aspect and cannot meet the diverse needs of different application scenarios.
This paper provides a model optimization method that obtains search configuration information of multiple search terms, arranges multiple search operators to generate combined operators, and realizes multi-dimensional joint optimization of AI models, including hyperparameter search, network architecture search, data augmentation search, loss function search, and model compression strategy search.
It improves the overall performance of AI models, meets the performance requirements of different application scenarios, and enhances the accuracy and inference efficiency of the models.
Smart Images

Figure CN112529207B_ABST
Abstract
Description
[0001] The present application claims priority to the Chinese patent application No. 201910877331.6, filed on September 17, 2019, entitled "A method and system for automatically searching AI model", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the field of artificial intelligence (AI), and in particular, to a model optimization method and device, a storage medium and an equipment. BACKGROUND
[0003] With the increasingly wide application of AI models, different application scenarios have different performance requirements for AI models. For example, a face recognition model applied to the unlocking of a smart phone needs to achieve an accuracy of 99.2% and a small inference delay; and a model applied to object classification needs to have an accuracy higher than 95%. The performance of an AI model is strongly related to the structure of the AI model, the hyperparameters of the model, the training data or inference data, the loss function, and the like.
[0004] In order to obtain an AI model meeting the application requirements, various AI platforms are provided in the related art, which can perform hyperparameter search or network structure optimization on an initial network or a user-provided original model according to the user's requirements, so as to output an AI model meeting the user's requirements. However, these AI platforms only provide a single optimization function each time the AI model is optimized, i.e., only optimize the model from one aspect. SUMMARY
[0005] The present application provides a model optimization method, which can perform joint optimization of an initial AI model in multiple dimensions, so as to obtain an optimized model in a comprehensive space and improve the model performance. The technical solution is as follows:
[0006] In a first aspect, a model optimization method is provided, which includes: obtaining an original model of a user and search configuration information, the search configuration information including multiple search items, different search items representing different search categories of the search for optimization information of the original model; arranging multiple search operators according to the search configuration information to obtain a combined operator, each arranged search operator corresponding to a search item, the search operator representing an algorithm used to execute the corresponding search item; and optimizing the original model according to the combined operator to obtain an optimized model.
[0007] In the embodiment of the present application, the search configuration information containing multiple search items can be obtained at the same time, and then the search operators corresponding to the multiple search items are arranged according to the search configuration information to obtain a combination operator. In this way, the original model can be simultaneously optimized according to the combination operator corresponding to the multiple search items. That is, the embodiment of the present application can realize joint optimization of multiple dimensions of the original model to obtain an optimized model in a comprehensive space, thereby improving the performance of the model.
[0008] Optionally, the multiple search items in the search configuration information can include at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search.
[0009] The hyperparameter search refers to searching for hyperparameters that meet the original model in a certain search space through a hyperparameter search algorithm. Hyperparameters, also known as hyperparameters, are parameters in an AI model (for example, a neural network model) that cannot be obtained through model training, such as learning rate, iteration number, and the like. Network architecture search refers to searching for a network architecture that meets user requirements in a given search space based on evolutionary algorithms, reinforcement learning, and differentiable networks. Network architecture represents the basic structure of an AI model. Data augmentation search refers to searching for a data augmentation strategy that meets user requirements according to a specified data set, and then processing samples in the data set through the data augmentation strategy. The data augmentation strategy is an algorithm for preprocessing training data, test data, or inference data. Training, testing, or inference of an AI model using the processed samples in the data set can make the AI model perform better. Loss function search refers to searching for a loss function that meets user requirements in a given search space. The loss function is used for model optimization when training the original model. Optimizer search refers to searching for an optimizer that meets the requirements in a given search space. Subsequently, learning of model parameters through the optimizer can make the performance of the AI model better. Model compression strategy search refers to searching for a strategy for model compression in a given search space to achieve compression and pruning of the AI model.
[0010] Optionally, the implementation process of arranging multiple search operators according to the search configuration information to obtain a combination operator can be: determining the operation order, operation times, or comprehensive search space at each operation of the multiple search operators according to the search configuration information; and generating the combination operator according to the operation order, operation times, or comprehensive search space at each operation of the multiple search operators.
[0011] The comprehensive search space refers to a search space obtained by fusing search spaces corresponding to different search items, or refers to respective search spaces obtained after search spaces corresponding to different search items influence each other. In the embodiments of the present application, a final combination operator is obtained by determining the operation sequence, operation times and comprehensive search space at each operation of the plurality of search operators, so that the optimization information of the original model can be searched in the comprehensive search space when the original model is optimized according to the combination operator. That is, the embodiments of the present application do not search in a single search space corresponding to a search item, but search in the comprehensive search space according to the combination operator, which is equivalent to searching for optimization information of the model in the comprehensive search space. Therefore, the model optimized according to the obtained optimization information is also an optimized model in the comprehensive search space, and the performance of the optimized model is improved.
[0012] Optionally, the search configuration information further includes search item information and a search mode, wherein each search item corresponds to respective search item information, and the search mode is used to represent a principle followed when the original model is optimized.
[0013] The search item information includes some information used when searching the corresponding search item, for example, the search algorithm and the search space of the corresponding search item, and the search space defines the search range when searching the corresponding search item. The search mode includes any one of an accuracy mode, a speed mode, an economic mode and a resource mode.
[0014] In the embodiments of the present application, the selected combination operator is limited by the search configuration information and the search mode, so that the optimization result or process of the model is more in line with the user requirements.
[0015] Optionally, the search configuration information is obtained by input or selection of a user on a graphical user interface (GUI).
[0016] Optionally, before the original model is optimized according to the combination operator, the resource consumption of optimizing the original model can be estimated according to the combination operator, and resource scheduling is performed for the operation of optimizing the original model according to the resource consumption.
[0017] That is, the embodiments of the present application can realize automatic scheduling of resources according to the resource consumption when the combination operator is operated and the resource usage of the combination operator itself.
[0018] Optionally, the search configuration information is acquired, and an evaluation index is also acquired, the evaluation index representing a performance target that should be reached after the original model is optimized; accordingly, when the original model is optimized according to the combination operator, optimization information search can be performed in the comprehensive search space according to the combination operator, the original model is optimized according to the optimization information, an optimized model is obtained, and the performance of the optimized model meets the evaluation index.
[0019] In the embodiment of the application, by setting the evaluation index, an optimized model with performance meeting the requirements can be output. The evaluation index can include any one or more of the following indexes: accuracy of the model, loss of the model, precision of the model, and recall rate of the model. Of course, other evaluation indexes can also be used, for example, user-defined indexes, which are not limited in the embodiment of the application.
[0020] In a second aspect, the application further provides another model optimization method, which includes: providing a configuration interface to a user, the configuration interface including a search item list for the user to select; acquiring an original model and search configuration information, the search configuration information including a plurality of search items selected by the user in the search item list, different search items representing different search categories of optimization information search of the original model; optimizing the original model according to the search configuration information; and providing the user with an optimized model.
[0021] In the embodiment of the application, joint search is performed according to a plurality of search items, which realizes joint optimization of multiple dimensions of the original model at the same time, and improves the performance of the model. In addition, a configuration interface can be provided to the user, and the user can select a plurality of search items to be searched to meet the user's demand for joint search of different search items.
[0022] Optionally, the plurality of search items selected by the user in the search item list include at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search. The meaning of each search item can be referred to the related description in the first aspect, which is not repeated here.
[0023] Optionally, the configuration interface further includes a search item information configuration page and a search mode configuration page, and the search configuration information further includes search item information and a search mode configured by the user in the configuration interface.
[0024] Optionally, the search mode represents a principle followed when the original model is optimized, and the search mode includes any one of precision mode, speed mode, economy mode, and resource mode.
[0025] Optionally, when optimizing the original model according to the search configuration information, first, a plurality of search operators can be arranged according to the search configuration information to obtain a combined operator; then, the original model is optimized according to the combined operator.
[0026] The combined operator represents an operator generated after determining the operation order, operation times, and comprehensive search space at each operation of each search operator or each part in each search operator. The comprehensive search space refers to a search space obtained by fusing different search spaces corresponding to different search items, or refers to the search space of each search item obtained after different search spaces corresponding to different search items influence each other. Optimizing the original model according to the combined operator can search for optimization information of the original model in the comprehensive search space, thereby obtaining a better solution in the comprehensive space and improving the performance of the model.
[0027] Optionally, the implementation process of arranging a plurality of search operators according to the search configuration information to obtain a combined operator can be: determining the operation order, operation times, or comprehensive search space at each operation of the plurality of search operators according to the search configuration information; and generating the combined operator according to the operation order, operation times, or comprehensive search space at each operation of the plurality of search operators.
[0028] Optionally, before optimizing the original model according to the combined operator, the resource consumption of optimizing the original model can also be estimated according to the combined operator; and resource scheduling is performed for the operation of optimizing the original model according to the resource consumption.
[0029] In a third aspect, the present application also provides a model optimization device, which comprises: a configuration module configured to obtain an original model of a user and search configuration information, wherein the search configuration information comprises a plurality of search items, and different search items represent different search categories of optimization information search of the original model; an operator arrangement module configured to arrange a plurality of search operators according to the search configuration information to obtain a combined operator, wherein each arranged search operator corresponds to a search item, and a search operator represents an algorithm used for performing a corresponding search item; and a multi-element search module configured to optimize the original model according to the combined operator to obtain an optimized model.
[0030] Optionally, the plurality of search items comprise at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search.
[0031] Optionally, the operator arrangement module is specifically configured to: determine, according to the search configuration information, an operation sequence, an operation number, and a comprehensive search space at each operation of the plurality of search operators; and generate the combined operator according to the operation sequence, the operation number, and the comprehensive search space at each operation of the plurality of search operators.
[0032] Optionally, the search configuration information further includes search item information and a search mode, wherein each search item corresponds to respective search item information, and the search mode is used to represent a principle followed when the original model is optimized.
[0033] Optionally, the search mode includes any one of an accuracy mode, a speed mode, an economic mode, and a resource mode.
[0034] Optionally, the search configuration information is input or selected by a user on a graphical user interface (GUI).
[0035] Optionally, the model optimization apparatus further includes a resource management module configured to: estimate resource consumption for optimizing the original model according to the combined operator; and perform resource scheduling for an operation of optimizing the original model according to the resource consumption.
[0036] Optionally, the configuration module of the model optimization apparatus is further configured to obtain an evaluation index representing a performance target to be achieved after the original model is optimized; and the multi-element search module is specifically configured to: search for optimization information in a comprehensive search space according to the combined operator, optimize the original model according to the optimization information, and obtain an optimized model, wherein a performance of the optimized model satisfies the evaluation index.
[0037] Optionally, the evaluation index includes any one or more of the following indexes: accuracy of a model, loss of a model, precision of a model, and recall rate of a model.
[0038] In a fourth aspect, the present application further provides another model optimization apparatus, which includes: a configuration module configured to provide a configuration interface to a user, the configuration interface including a search item list for the user to select; an original model and search configuration information, the search configuration information including a plurality of search items selected by the user from the search item list, different search items representing different search categories for searching for optimization information of the original model; a multi-element search module configured to optimize the original model according to the search configuration information; and a feedback module configured to provide an optimized model to the user.
[0039] Optionally, the multiple search terms selected by the user in the search term list include at least two of a hyperparameter search, a network architecture search, a data augmentation search, a loss function search, an optimizer search, and a model compression strategy search.
[0040] Optionally, the configuration interface further includes a search term information configuration page and a search mode configuration page, and the search configuration information further includes search term information and a search mode configured by the user in the configuration interface.
[0041] Optionally, the search mode is used to represent a principle followed when optimizing the original model, and the search mode includes any one of an accuracy mode, a speed mode, an economic mode, and a resource mode.
[0042] Optionally, the multi-element search module is specifically configured to: according to the search configuration information, arrange multiple search operators to obtain a combined operator; and according to the combined operator, optimize the original model.
[0043] Optionally, the multi-element search module is specifically configured to: according to the search configuration information, determine an operation sequence, an operation number, or a comprehensive search space at each operation of the multiple search operators; and according to the operation sequence, the operation number, or the comprehensive search space at each operation of the multiple search operators, generate the combined operator.
[0044] Optionally, the model optimization apparatus further includes a resource management module, which is configured to: according to the combined operator, estimate resource consumption for optimizing the original model; and according to the resource consumption, perform resource scheduling for an operation of optimizing the original model.
[0045] In a fifth aspect, the present application further provides a computing device, which includes a processor and a memory in its structure, the memory is used to store a program supporting the computing device to execute the model optimization method provided in the first aspect or the second aspect, and store data involved in the model optimization method provided in the first aspect or the second aspect. The processor executes the program stored in the memory to execute the method provided in the first aspect or the second aspect and the optional implementation manner thereof. The computing device can further include a communication bus for establishing a connection between the processor and the memory.
[0046] In a sixth aspect, the present application further provides a computer readable storage medium, which stores instructions, when the instructions are run on a computer, the computer executes the model optimization method provided in the first aspect or the second aspect and the optional implementation manner thereof.
[0047] In a seventh aspect, the present application also provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the model optimization method of the first aspect or the second aspect.
[0048] The technical effects obtained by the second aspect, the third aspect, the fourth aspect, the fifth aspect, the sixth aspect and the seventh aspect are similar to the technical effects obtained by the corresponding technical means in the first aspect, and thus are not described herein.
[0049] The technical scheme provided by the present application has at least the following beneficial effects:
[0050] In the embodiments of the present application, the search configuration information containing multiple search terms can be obtained at the same time, and then the search operators corresponding to the multiple search terms are arranged according to the search configuration information to obtain a combination operator. In this way, the original model can be simultaneously optimized according to the combination operator corresponding to the multiple search terms. That is, the embodiments of the present application can realize joint optimization of multiple dimensions of the original model, so as to obtain an optimized model in a comprehensive space and improve the performance of the model. BRIEF DESCRIPTION OF DRAWINGS
[0051] Figure 1 FIG. 1 is a structural schematic diagram of a model optimization device provided by an embodiment of the present application;
[0052] Figure 2 FIG. 2 is a deployment schematic diagram of a model optimization device provided by an embodiment of the present application;
[0053] Figure 3 FIG. 3 is an application schematic diagram of a model optimization device provided by an embodiment of the present application;
[0054] Figure 4 FIG. 4 is another deployment schematic diagram of a model optimization device provided by an embodiment of the present application;
[0055] Figure 5 FIG. 5 is a structural schematic diagram of a computing device provided by an embodiment of the present application;
[0056] Figure 6 FIG. 6 is a flowchart of a model optimization method provided by an embodiment of the present application;
[0057] Figure 7 FIG. 7 is a schematic diagram of a configuration interface provided by an embodiment of the present application;
[0058] Figure 8 FIG. 8 is a schematic diagram of another configuration interface provided by an embodiment of the present application;
[0059] Figure 9 FIG. 9 is a schematic diagram of an output interface of an optimized model provided by an embodiment of the present application;
[0060] Figure 10 is a flowchart of a method for automatic resource scheduling according to a combination operator provided by an embodiment of the present application;
[0061] Figure 11 is a flowchart of another model optimization method provided by an embodiment of the present application;
[0062] Figure 12 is a structural schematic diagram of a computer system provided by an embodiment of the present application. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0064] Before explaining the embodiments of the present application in detail, the application scenarios involved in the embodiments of the present application will be introduced.
[0065] At present, AI models have been widely applied in fields such as image recognition, video analysis, speech recognition, natural language translation, automatic driving control, etc. An AI model represents a mathematical algorithm that can learn the characteristics of data through training and can be used for inference. There are many different types of AI models in the industry, for example: a neural network model is a typical AI model. A neural network model is a mathematical computing model that simulates the structure and function of a biological neural network (the central nervous system of animals). A neural network model can include multiple computing layers with different functions, each layer including parameters and computing formulas. According to the difference of computing formulas or functions, different computing layers in the neural network model have different names, for example: a layer that performs convolutional computation is called a convolutional layer, which can be used for feature extraction on input images. For the sake of brevity, some expressions in the embodiments of the present application refer to AI models as models.
[0066] With the increasing application of AI models, the performance requirements for AI models are also increasing. For example: the performance of a neural network model is closely related to the selection of hyperparameters of the neural network model, the design of the network architecture, the training samples, etc. How to optimize the original AI model from multiple aspects to obtain an AI model with higher performance is the focus of the industry.
[0067] Based on this, in order to improve the performance of the AI model, after the developer writes the original model, the developer can use the optimization method provided in the embodiments of the present application to perform joint search on the original model, such as hyperparameter search, network architecture search, data augmentation search, etc., to obtain optimization information of the original model, and then optimize the original model in terms of hyperparameters, network architecture, training samples, loss function, optimizer, model compression strategy, etc. according to the optimization information. The original model refers to the initial AI model that has not been optimized in performance, and the original model can be represented in the form of code.
[0068] In addition, it should be noted that hyperparameter search refers to searching for hyperparameters that meet the original model in a certain search space through a hyperparameter search algorithm. It should be understood that hyperparameters, also known as hyperparameters, are parameters in an AI model (for example: a neural network model) that cannot be obtained through model training, such as learning rate, number of iterations, etc. The setting of hyperparameters has a great influence on the performance of the AI model. Network architecture search refers to searching for a network architecture that meets the user's requirements in a given search space based on evolutionary algorithms, reinforcement learning, and differentiable networks. Network architecture represents the basic structure of the AI model. Data augmentation search refers to searching for a data augmentation strategy that meets the user's requirements according to a specified data set, and then processing the samples in the data set through the data augmentation strategy. The data augmentation strategy is an algorithm used to preprocess training data, test data, or inference data. Training, testing, or inference of the AI model on the processed samples in the data set can make the AI model perform better. Loss function search refers to searching for a loss function that meets the user's requirements in a given search space. The loss function is used for model optimization when training the original model. Optimizer search refers to searching for an optimizer that meets the requirements in a given search space. Subsequently, learning of model parameters is performed through the optimizer, which can make the performance of the AI model better. Model compression strategy search refers to searching for a strategy for model compression in a given search space to achieve compression and pruning of the AI model.
[0069] The embodiments of the present application provide a model optimization method, which is executed by a model optimization device. The functions of the model optimization device can be realized by a software system, or by a hardware device, or by a combination of a software system and a hardware device.
[0070] When the model optimization device is a software device, referring to Figure 1 The model optimization device 100 can be logically divided into multiple modules, each module can have different functions, and the functions of each module are realized by the processor in the computing device reading and executing the instructions in the memory. The structure of the computing device can be as follows Figure 5The computing device 500 is shown. Exemplarily, the model optimization apparatus can include a configuration module 101, an operator arrangement module 102, a multi-element search module 103, and a storage module 104. In a specific implementation manner, the model optimization apparatus 100 can perform the content described in steps 601-603 and steps 1001-1002 described below, or perform the content described in steps 1101-1104 and steps 1001-1002 described below. It should be noted that the embodiments of the present application only exemplarily divide the structure and function modules of the model optimization apparatus 100, but do not make any limitation on the specific division.
[0071] The configuration module 101 is configured to obtain a user's original model and search configuration information. The user's original model can be uploaded by the user or stored on other apparatuses or devices. The search configuration information can include a plurality of search items configured by the user, and each search item represents a category of optimization information for searching the original model. For example, the plurality of search items can be hyperparameter search and network architecture search, and then represent hyperparameter optimization information and network architecture optimization information for searching the original model. Alternatively, the plurality of search items can further include data augmentation search, loss function search, optimizer search, model compression strategy search, and the like, which are not limited in the embodiments of the present application. In some possible implementation manners, the search configuration information can further include search item information and a search mode, each search item information corresponds to each search item, and each search item information includes a search space corresponding to the corresponding search item. The search mode can include any one of an accuracy mode, a speed mode, an economic mode, and a resource mode.
[0072] The operator arrangement module 102 is configured to be in communication connection with the configuration module 101, the storage module 104, and the multi-element search module 103, receive the search configuration information sent by the configuration module 101, and receive a plurality of search operators sent by the storage module 104. According to the search configuration information, the plurality of search operators are arranged to obtain a combined operator.
[0073] It should be noted that the storage module 104 can store a plurality of search operators, such as a hyperparameter search operator, a network architecture search operator, a data augmentation search operator, a loss function search operator, an optimizer search operator, a model compression strategy search operator, and a user-defined search operator. Among them, the search operator refers to an algorithm for implementing the corresponding search, or in other words, the search operator is a method for searching the optimization information corresponding to the corresponding search item. For example, the hyperparameter search operator refers to a search algorithm for implementing hyperparameter search, that is, a method for searching hyperparameters; the network architecture search operator refers to a search algorithm for implementing network architecture search, that is, a method for searching network architecture.
[0074] After receiving the search configuration information sent by the configuration module 101, the operator arrangement module 102 can obtain the operator corresponding to each search term from the storage module 104 according to the search terms included in the search configuration information. For example, when the search terms included in the search configuration information are hyperparameter search and network architecture search, the operator arrangement module 102 can obtain the hyperparameter search operator and the network architecture search operator from the storage module 104 according to the search terms. Then, the operator arrangement module 102 can arrange the obtained operators to generate a combined operator. The combined operator represents an operator generated after determining the operation order, operation times, and comprehensive search space at each operation of each part between multiple search operators or each search operator. After generating the combined operator, the operator arrangement module 102 can send the combined operator to the multi-element search module 103.
[0075] Optionally, the storage module 104 can include multiple search operators corresponding to each search term. Different search operators represent different search methods of optimization information corresponding to the same search term. For example, for the search term network architecture search, the storage module 104 can store the network architecture search operator A, the network architecture search operator B, and the network architecture search operator C. For the case that multiple search operators correspond to the same search term, one of the search operators can be selected according to the user's original model or search term information and search mode.
[0076] The multi-element search module 103 is in communication connection with the operator arrangement module 102 and the configuration module 101. The multi-element search module 103 receives the combined operator sent by the operator arrangement module 102 and the user's original model sent by the configuration module 101. Then, the multi-element search module 103 can optimize the user's original model according to the combined operator.
[0077] Optionally, the model optimization apparatus 100 can further include a resource scheduling module 105. The resource scheduling module 105 is in communication connection with the operator arrangement module 102 and the multi-element search module 103. The resource scheduling module 105 can receive the combined operator determined by the operator arrangement module 102, estimate the resource consumption for optimizing the original model according to the combined operator, and then schedule resources for the multi-element search module 103 to perform the operation of optimizing the original model according to the resource consumption.
[0078] Optionally, the model optimization apparatus 100 can further include a feedback module 106. The feedback module 106 is in communication connection with the multi-element search module 103. The feedback module 106 can feed back the search result of the multi-element search module 103 and the optimized model to the user.
[0079] In addition, in some possible cases, some of the modules in the above-mentioned model optimization device 100 can be merged into one module. For example, the operator arrangement module 102 and the multivariate search module 103 can be merged into an optimization module, that is, the optimization module combines the functions of the operator arrangement module 102 and the multivariate search module 103.
[0080] In the embodiments of this application, the model optimization device 100 described above can be flexibly deployed. For example, the model optimization device 100 can be deployed in a cloud environment. A cloud environment is an entity that provides cloud services to users using basic resources under the cloud computing model, and a cloud environment includes cloud data centers and cloud service platforms.
[0081] A cloud data center encompasses a large amount of basic resources (including computing, storage, and network resources) owned by a cloud service provider. The computing resources within a cloud data center can be a large number of computing devices (e.g., servers). The model optimization device 100 can be a software device deployed on servers or virtual machines within the cloud data center. This software device can be used to optimize AI models and can be deployed in a distributed manner across multiple servers, multiple virtual machines, or a combination of virtual machines and servers. For example, as... Figure 2 As shown, the model optimization device 100 is deployed in a cloud environment. Client 110 can send the original model uploaded by the user to the model optimization device 100, or other non-client devices 120 can send their own generated or stored original models to the model optimization device 100. After receiving the original model, the model optimization device 100 can arrange multiple search operators according to the search configuration information to obtain a combined operator, and then optimize the original model according to the combined operator to obtain the optimized model. The optimized model is then fed back to client 110 or other non-client devices 120.
[0082] For example, Figure 3 This is a schematic diagram illustrating one application of the model optimization device 100 in this application, such as... Figure 3 As shown, the model optimization device 100 can be deployed by a cloud service provider in a cloud data center. The cloud service provider abstracts the functions provided by the model optimization device into a cloud service, and the cloud service platform allows users to consult and purchase this cloud service. After purchasing this cloud service, users can use the model optimization service provided by the model optimization device 100 in the cloud data center. The model optimization device can also be deployed by tenants in the computing resources of the cloud data center rented by the tenants. The tenants purchase computing resource cloud services provided by the cloud service provider through the cloud service platform, and run the model optimization device 100 on the purchased computing resources, enabling the model optimization device 100 to optimize AI models.
[0083] Optionally, the model optimization apparatus 100 can also be a software apparatus running on an edge computing device in an edge environment or one or more edge computing devices in an edge environment. The edge environment refers to a set of devices in a certain application scenario, including one or more edge computing devices, wherein the one or more edge computing devices can be a computing device in a data center or a computing device of multiple data centers. When the model optimization apparatus 100 is a software apparatus, the model optimization apparatus 100 can be distributedly deployed on multiple edge computing devices or centrally deployed on an edge computing device. For example, as shown in Figure 4 the model optimization apparatus 100 is distributedly deployed on the edge computing device 130 included in the data center of a certain enterprise, and the client 140 in the enterprise can send the original model to the model optimization apparatus 100. Optionally, the client 140 can also send search configuration information to the model optimization apparatus 100. After receiving the original model, the model optimization apparatus 100 can arrange multiple search operators according to the search configuration information to obtain a combined operator, and then optimize the original model according to the combined operator to obtain an optimized model, and feed back the optimized model to the client 140.
[0084] When the model optimization apparatus is a hardware device, the model optimization apparatus can be a computing device in any environment, for example, it can be the aforementioned edge computing device, or the aforementioned computing device in the cloud environment. Figure 5 FIG. 1 is a structural schematic diagram of a computing device 500 provided by an embodiment of the present application. The computing device 500 includes a processor 501, a communication bus 502, a memory 503, and at least one communication interface 504.
[0085] The processor 501 can be a general central processing unit (CPU), an application-specific integrated circuit (ASIC), a graphics processing unit (GPU), or any combination thereof. The processor 501 can include one or more chips, and the processor 501 can include an AI accelerator, for example, a neural processing unit (NPU).
[0086] The communication bus 502 can include a path for transmitting information between various components (e.g., the processor 501, the memory 503, and the communication interface 504) of the computing device 500.
[0087] The memory 503 can be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disk storage, a magnetic disk storage or other magnetic storage devices, or any other medium capable of storing desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to this. The memory 503 can exist independently and be connected to the processor 501 through the communication bus 502. The memory 503 can also be integrated with the processor 501. The memory 503 can store computer instructions, and when the computer instructions stored in the memory 503 are executed by the processor 501, the model optimization method of the present application can be implemented. In addition, the memory 503 can also store data required by the processor in the process of executing the above method, as well as intermediate data and / or result data generated.
[0088] The communication interface 504 uses any transceiver device to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
[0089] In a specific implementation, as an embodiment, the processor 501 can include one or more CPUs.
[0090] In a specific implementation, as an embodiment, the computer device can include multiple processors. Each of these processors can be a single-CPU processor or a multi-CPU processor. The processor herein can refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0091] Next, the model optimization method provided by the embodiments of the present application is introduced.
[0092] Figure 6 is a flowchart of a model optimization method provided by an embodiment of the present application. The model optimization method can be executed by the model optimization device 100 described above, see Figure 6The method comprises the following steps:
[0093] Step 601: Obtain a user's original model and search configuration information, the search configuration information comprising a plurality of search items, different search items representing different categories of optimization information search for the original model.
[0094] In the embodiments of the present application, the user's original model can be uploaded by the user in the form of code. That is, the model optimization device can receive the original model uploaded by the user in the form of code. Alternatively, the original model can also be obtained by the model optimization device from other devices according to a specified storage path, or the original model can also be stored in other devices and sent to the model optimization device by the other devices. In addition, the search configuration information can be input or selected by the user on the GUI.
[0095] In a possible implementation, the model optimization device can provide a configuration interface for the user, which can include an original model configuration item and a search configuration information option. The user can input the storage path of the original model in the original model configuration item. The model optimization device can obtain the original model according to the storage path and configure the search configuration information through the search configuration information option.
[0096] It should be noted that the search configuration information option can include a search item list. For example, as shown in FIG. 6, the search configuration information option can include a search item list, which can include a search item 1, a search item 2, a search item 3, a search item 4, and a search item 5. Figure 7As shown, the search item list includes a plurality of selectable search items, each of which represents a category of information search for optimizing the original model. For example, the search item list can include hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, model compression strategy search, etc. Among them, the hyperparameter search refers to searching for hyperparameters that meet the original model in a given search space. The network architecture search refers to searching for a network architecture that meets the user's requirements in a given search space. The data augmentation search refers to searching for a data augmentation strategy that meets the user's requirements on a specified data set, and then processing the samples in the data set through the data augmentation strategy. The data augmentation strategy is an algorithm for preprocessing training data, test data or inference data. Training, testing or inference of the AI model on the processed samples in the data set can make the performance of the AI model better. The loss function search refers to searching for a loss function that meets the user's requirements in a given search space. The optimizer search refers to searching for an optimizer that meets the requirements in a given search space. Subsequently, learning the model parameters through the optimizer can make the performance of the AI model better. The model compression strategy search refers to searching for a strategy for model compression in a given search space to achieve compression and pruning of the model. Optionally, when the user selects a plurality of search items in the search item list on the GUI interface, the interface also provides a search item information configuration list. In the search item information configuration list, the user can configure one or more search item information corresponding to the corresponding search item. The search item information includes some information used when searching for the corresponding search item, for example, the one or more search item information can include the search algorithm and the search space of the corresponding search item, etc. The search space defines the search range when searching for the corresponding search item. For example, as shown in Figure 7 When the hyperparameter search and the network architecture search are selected, the interface can display the search item information configuration list corresponding to the hyperparameter search and the search item information configuration list corresponding to the network architecture search. Among them, the search item information configuration list corresponding to the hyperparameter search includes the search algorithm configuration item, the parameter name configuration item and the parameter range configuration item of the hyperparameter search, and the parameter range configuration item is equivalent to the search space configuration item corresponding to the hyperparameter search. The search item information configuration list corresponding to the network architecture search includes the default structure configuration item, the search space configuration item and the delay setting configuration item of the network architecture. It should be noted that Figure 7 In some possible implementation manners, the search item information configuration list corresponding to the selected search item can include less or more search item information.
[0097] Optionally, referring to Figure 8The search configuration information item can also include a search mode and an evaluation index. The search mode is used to represent a principle followed when optimizing the original model. The search mode can include an accuracy mode, a speed mode, an economic mode, and a resource mode. The accuracy mode indicates that the model optimization is performed with the model accuracy as the target. The speed mode indicates that the model optimization is performed with the satisfaction of a certain optimization speed as the target. The economic mode indicates that the model optimization is performed with the minimum cost required by the user as the target. The resource mode indicates that the model optimization is performed with the minimum resource consumed by the model optimization device as the target.
[0098] The evaluation index mainly refers to a performance index of the optimized model. When the index of the model after optimization reaches the set evaluation index, the optimization can be stopped. For example, the evaluation index can be one or more of the accuracy of the model, the loss of the model, the precision of the model, the recall rate, or the like, or the evaluation index can be a user-defined index, which is not limited in the embodiments of the present application.
[0099] The evaluation index can usually be used alone as a condition for stopping the model optimization to output the optimized model. For example, when the evaluation index is the precision of the model, if the precision of the optimized model reaches the evaluation index during the optimization of the original model, the optimization can be stopped and the optimized model can be output. Alternatively, the evaluation index can be affected by the search mode, and the model optimization device can determine when to stop the optimization to output the optimized model in combination with the search mode and the evaluation index. For example, assuming that the evaluation index set by the user is the lower limit of the precision of the model, if the user also selects the accuracy mode, when the precision of the optimized model reaches the lower limit of the precision of the model during the optimization of the original model, the model optimization device can continue to optimize the model to further improve the precision of the model, because the user also selects the accuracy mode and the accuracy mode pursues higher model accuracy. However, if the user selects the speed mode, the optimization can be stopped and the optimized model can be immediately output after the first model with the precision greater than the evaluation index is obtained, because the optimization speed is pursued.
[0100] When the user completes the configuration, the model optimization device can obtain the original model uploaded by the user and the configured search configuration information.
[0101] It should be noted that the above are only some possible search configuration information options given in the embodiments of the present application, and among the above search configuration information options, some search configuration information is optional for the user, for example, the search mode and the evaluation index. In addition, according to actual needs, more or less search configuration information options can be included in the configuration interface, for example, the evaluation index can not be included in the configuration interface, and a default evaluation index is given by the model optimization apparatus. For another example, the configuration interface can further include an operator arrangement manner option, which can represent the arrangement manner of the plurality of search operators. The embodiments of the present application do not limit this.
[0102] It should be noted that the original model uploaded by the user can be code written by the user without any adaptive modification for the model optimization apparatus. The user only needs to perform simple configuration through the above configuration interface, and the model optimization apparatus can optimize the original model through subsequent steps without code modification according to platform requirements, thereby reducing the user usage threshold. Alternatively, the user can also add declaration information in the code file of the original model, and the declaration information can indicate the content to be searched. Alternatively, the declaration information can further include the evaluation index and other configuration information.
[0103] In another possible implementation, the model optimization apparatus can directly receive the original model in the form of code uploaded by the user and a configuration file, and the configuration file can include the search configuration information of the user.
[0104] In this implementation, the user can directly write the search configuration information into the configuration file. After receiving the configuration file, the model optimization apparatus can obtain the search configuration information in the configuration file by parsing the configuration file. The content included in the search configuration information is as described above, and the embodiments of the present application do not repeat it here. The configuration file can support multiple file formats, such as yaml, xml, txt, and the like, and the embodiments of the present application do not limit this.
[0105] Step 602: According to the search configuration information, the plurality of search operators are arranged to obtain a combined operator, and each arranged search operator corresponds to a search item. The search operator represents an algorithm used to perform the corresponding search item.
[0106] In the embodiments of the present application, the model optimization apparatus can store search operators corresponding to different search items. The search operator is an algorithm for searching optimization information corresponding to the search item. For example, a hyperparameter search operator corresponding to hyperparameter search, a network architecture search operator corresponding to network architecture search, and a data enhancement search operator corresponding to data enhancement search.
[0107] In a possible implementation, after obtaining the search configuration information, the model optimization apparatus can obtain a plurality of search operators corresponding to a plurality of search items included in the search configuration information, and then arrange the plurality of search operators, that is, determine a manner in which the plurality of search operators are combined and run. For example, the model optimization apparatus can determine, according to a search mode included in the search configuration information and search item information corresponding to each search item, an operation sequence, an operation number, and / or a comprehensive search space at each operation of the plurality of search operators, and then generate a combined operator.
[0108] For example, when the plurality of search items are hyperparameter search and network architecture search, the model optimization apparatus can obtain a hyperparameter search operator according to the hyperparameter search, and obtain a network architecture search operator according to the network architecture search.
[0109] After obtaining the plurality of search operators, the model optimization apparatus can determine, according to the search mode and the search item information included in the search configuration information, an operation sequence, an operation number, and a search space at each operation of the plurality of search operators. The search space at each operation can be different, and the search spaces include a comprehensive search space. The comprehensive search space can refer to a search space obtained by fusing search spaces corresponding to different search items, or can refer to respective search spaces obtained by influencing each other.
[0110] As an example, assuming that the user selects hyperparameter search and network architecture search as the search items, and selects speed mode as the search mode, the combined operator obtained by the model optimization apparatus after arranging the hyperparameter search operator and the network architecture search operator can be as follows:
[0111] (1) Through the network architecture search operator, a plurality of network structures of the original model uploaded by the user in the form of code are generated.
[0112] (2) Through the hyperparameter search operator, the search space and other parameters in the search item information of the hyperparameter search configured by the user are used to perform hyperparameter search on each network structure of the plurality of network structures obtained in (1), to obtain a search result. The search result includes a corresponding candidate hyperparameter searched for each network structure.
[0113] (3) Through the network architecture search operator, the search result obtained in (2) is evaluated, and a target structure with the best effect is selected from the search result.
[0114] (4) searching the target structure again in the comprehensive search space by the hyperparameter search operator to obtain the target hyperparameters corresponding to the target structure with the evaluation index meeting the reference evaluation index. The comprehensive search space refers to a search space obtained by combining the search space corresponding to the network architecture search and the search space corresponding to the hyperparameter search, or the comprehensive search space refers to a search space obtained by adjusting the search space of the search item information included in the hyperparameter search according to the network architecture search result and the hyperparameter search result. The reference evaluation index can be the evaluation index configured by the user, and in the case where the user does not configure the evaluation index, the evaluation index can be a default evaluation index.
[0115] As another example, assuming that the search items selected by the user are the hyperparameter search, the network architecture search and the data enhancement search, and the selected search mode is the precision mode, the combined operator obtained by the model optimization apparatus after arranging the hyperparameter search operator, the network architecture search operator and the data enhancement search operator can be:
[0116] (1) searching the data enhancement strategy in the search space corresponding to the data enhancement search in the specified data set by the data enhancement search operator, and performing data enhancement processing on the training samples in the specified data set by the searched data enhancement strategy.
[0117] (2) calling the hyperparameter search operator in the outer layer and calling the network architecture search operator in the inner layer, searching in the specified comprehensive search space through double-loop to obtain a plurality of groups of search results, each group of search results including a network architecture and corresponding hyperparameters. It should be noted that the specified comprehensive search space is obtained by combining the search space of the hyperparameter search and the search space of the network architecture search, and the specified comprehensive search space changes according to the result of each layer of loop. In the process of searching, the model can be trained and tested by the data set enhanced in the above (1) to obtain the evaluation index corresponding to each group of search results.
[0118] (3) selecting the results corresponding to the evaluation index ranked in the top N from the plurality of groups of search results obtained in the above (2) and outputting.
[0119] As can be seen, in the embodiments of the present application, when searching in multiple search items, the model optimization apparatus can realize joint optimization in multiple dimensions by arranging the search operators, and in the process of searching, the search spaces of the multiple search items affect or are integrated with each other, so that the model optimized by the combined operator obtained by the arrangement will be an optimized model in the joint search space formed by the multiple search dimensions, thereby improving the performance of the optimized model.
[0120] It should be noted that the above is the implementation of the combination operator given by the embodiments of the present application, which is used to explain the process of arranging the plurality of search operators corresponding to the search terms to obtain the combination operator. According to different search terms, the arrangement of the search operators can be completely different, and the embodiments of the present application do not limit this.
[0121] In the above implementation, the model optimization apparatus can arrange the plurality of search operators in real time according to the search configuration information to obtain the combination operator. Alternatively, in some other possible implementation, the model optimization apparatus can arrange the search operators corresponding to different search terms in advance to obtain different combination operators, and test the characteristics of the different combination operators when optimizing the model, for example, the precision of model optimization through a certain combination operator is relatively high, the speed of optimization through another combination operator is relatively fast, etc. The model optimization apparatus can store the combination search terms, the corresponding combination operators and the characteristics of the combination operators. For example, for the combination search term of hyperparameter search and network architecture search, it corresponds to combination operator 1, and the characteristic corresponding to combination operator 1 is high precision. In addition, the combination search term can also correspond to combination operator 2, and the characteristic corresponding to combination operator 2 is fast speed. In this case, when the model optimization apparatus obtains the search configuration information, it can first match the same combination search term from the above correspondence according to the plurality of search terms included in the search configuration information, and then determine the combination operator whose characteristic matches the search mode from the combination operators corresponding to the combination search term according to the search mode included in the search configuration information. After finding the matching combination operator, the search space in each operation of the combination operator can be configured according to the search term information in the search configuration information.
[0122] Step 603: optimizing the original model according to the combination operator to obtain an optimized model.
[0123] After obtaining the combination operator, the model optimization apparatus can optimize the original model through the combination operator.
[0124] For example, the model optimization apparatus can search for optimization information in the comprehensive search space according to the combination operator, and optimize the original model according to the searched optimization information to obtain an optimized model. The performance of the optimized model meets the evaluation index set by the user or the default evaluation index.
[0125] The model optimization apparatus can sequentially execute each operator in the combined operator according to the order in which each operator is executed to search in the comprehensive search space to obtain optimization information of the original model corresponding to the plurality of search items. For example, when the search items are hyperparameter search and network architecture search, the optimization information includes hyperparameter optimization information and network architecture optimization information of the original model. The optimization information can be information that can directly replace the corresponding content in the original model, for example, can be a hyperparameter that directly replaces the hyperparameter of the original model. Alternatively, it can also be difference information for changing the corresponding content in the original model, for example, it can be difference data of the hyperparameter, so that the difference data can be added to the hyperparameter of the original model to optimize the hyperparameter of the original model.
[0126] After obtaining the optimization information, the model optimization apparatus can optimize the original model according to the optimization information to obtain an optimized model. Then, the model optimization apparatus can output the optimized model. Optionally, the model optimization apparatus can also output the optimization information corresponding to each search item and the performance indicators, such as accuracy and inference latency, of the optimized model. The model optimization apparatus can output the above content in the form of a GUI or an interface file.
[0127] For example, referring to Figure 9 When the search items selected by the user are hyperparameter search and network architecture search, after obtaining the optimized model, the storage path of the optimized model, the optimization information corresponding to the hyperparameter search (i.e., the searched hyperparameter), the optimization information corresponding to the network architecture search (i.e., the searched network architecture), and the accuracy and inference latency of the optimized model can be displayed on the GUI.
[0128] In some possible implementation manners, the model optimization apparatus can obtain a plurality of optimized models that satisfy the set evaluation indicators during the search process. In this case, the model optimization apparatus can sort the plurality of optimized models according to the performance indicators from large to small, and then output the optimized models with the top N performance indicators. Similarly, the optimization information of each search item corresponding to each optimized model and the performance indicators can also be output at the same time as the optimized models.
[0129] In the embodiments of the present application, the search configuration information including the plurality of search items can be obtained at the same time, and then the search operators corresponding to the plurality of search items are arranged according to the search configuration information to obtain the combined operator. In this way, the original model can be simultaneously optimized according to the combined operator. That is, the embodiments of the present application can realize joint optimization of multiple dimensions of the original model at the same time, so as to obtain an optimized model in the comprehensive space and improve the performance of the model.
[0130] The implementation process of optimizing the model is introduced in the above embodiments. Alternatively, in the embodiments of the present application, the model optimization apparatus can also automatically schedule the computing resources according to the combined operator before optimizing the model.
[0131] Exemplarily, referring to Figure 10 which shows a flowchart of automatically scheduling resources according to the combined operator, the process includes the following steps:
[0132] Step 1001: According to the combined operator, the resource consumption of optimizing the original model is estimated.
[0133] The model optimization apparatus can estimate the total resource consumption, the peak computing resource, the fluctuation, and the duration of the peak computing resource of the combined operator according to the computing resources required by each operator in the combined operator, which can reflect the resource consumption in the process of optimizing the original model.
[0134] Alternatively, in the embodiments of the present application, the model optimization apparatus can also obtain the resource consumption of other optimization jobs in parallel with the optimization of the original model in addition to the resource consumption in the process of optimizing the original model.
[0135] Step 1002: According to the resource consumption, the operation of optimizing the original model is scheduled.
[0136] After estimating the resource consumption of optimizing the original model, the model optimization apparatus can obtain the current computing resource usage parameters, such as determining the currently used computing resources, the remaining computing resources, and the resources that can be released in the process of optimizing the original model. Then, the model optimization apparatus can allocate corresponding computing resources for the operation of each operator in the combined operator in the optimization process of the original model according to the resource consumption of optimizing the original model and the current computing resource usage parameters.
[0137] It should be noted that in the embodiments of the present application, the model optimization apparatus can be deployed with a resource management model for resource allocation, which can be obtained by learning the running parameters and resource running feedback data of each optimization using a deep learning algorithm, and the running parameters and resource running feedback data of each optimization can be shared by the model optimization apparatus in different networks. After obtaining the resource consumption of optimizing the original model and the current computing resource usage parameters, the model optimization apparatus can input these two parameters into the resource management model, obtain resource allocation data through the resource management model, and then allocate corresponding computing resources for the optimization of the original model according to the resource allocation data.
[0138] Optionally, when the model optimization apparatus also obtains the resource consumption of other optimization jobs in parallel with the optimization of the original model, the model optimization apparatus can further optimize the computing resources according to the resource consumption of the original model optimization and the resource consumption of the other optimization jobs in parallel.
[0139] The model optimization apparatus can also optimize the computing resources by adjusting the steps of the concurrent jobs according to the resource consumption of the original model optimization and the resource consumption of the other optimization jobs in parallel.
[0140] For example, taking the second combination operator shown in the foregoing step 602 as an example, it is assumed that the parallel optimization of two different original models is performed by using the combination operator. The resource consumption of steps 1 and 3 in the combination operator is relatively large, and the resource consumption of other steps is relatively small. When the optimization jobs of the two models are concurrently performed, according to the resource consumption calculation in the search step, the time is staggered to match the large resource consumption steps with the small resource consumption steps, and the steps are adjusted, for example, steps 1 and 2 in one of the jobs can be exchanged.
[0141] Alternatively, the model optimization apparatus can also optimize the computing resources by adjusting the resource consumption of the steps of a single job according to the resource consumption of the original model optimization and the resource consumption of the other optimization jobs in parallel.
[0142] For example, when the computing resources are less or multiple requests are sent to the model optimization apparatus at the same time, the resource consumption of a single job is reduced, for example, the number of concurrent training in the network architecture search or hyperparameter search of a single job is reduced, on the premise of meeting the user demand, that is, the resource configuration of the sub-jobs in a single search step is dynamically adjusted.
[0143] Therefore, in the embodiments of the present application, the model optimization apparatus can realize automatic scheduling of resources according to the resource consumption of the combination operator when the model optimization apparatus performs calculation and the resource usage of the model optimization apparatus itself, and the model optimization apparatus can realize optimization of resources by adjusting the steps of concurrent jobs or by adjusting the resource consumption of a single job according to the resource consumption of multiple optimization jobs concurrently performed.
[0144] The above embodiments mainly introduce the implementation process of the model optimization apparatus 100 for optimizing the original model, and next, the implementation process of the model optimization method is introduced from the perspective of the interaction between the user and the model optimization apparatus 100. For example, referring to Figure 11 The method includes the following steps:
[0145] Step 1101: A configuration interface is provided to the user, and the configuration interface includes a search item list for the user to select.
[0146] In the embodiment of the present application, the model optimization apparatus can send the related information of the configuration interface to the client corresponding to the user, and the client can display the configuration interface to provide the configuration interface to the user for configuration of the related information.
[0147] The implementation of the configuration interface can refer to the configuration interface introduced in the embodiment shown in Figure 6 The embodiment of the present application will not be described here again.
[0148] Step 1102: Obtain the original model and search configuration information, the search configuration information including multiple search items selected by the user in the search item list, and different search items representing different search categories of the original model.
[0149] In the embodiment of the present application, the model optimization apparatus can obtain the configuration information such as the search item configured by the user in the configuration interface, and in addition, for the information such as the evaluation index not configured by the user in the configuration interface, the model optimization apparatus can obtain the default configuration set in advance.
[0150] In addition, regarding the implementation process of obtaining the original model, the model optimization apparatus can obtain the original model according to the storage path configured by the user in the configuration interface, or receive the original model directly uploaded by the user through the client, or obtain the original model from other devices. The specific obtaining method can refer to the method of obtaining the original model in the embodiment shown in Figure 6 The representation of the original model can also refer to the introduction in the embodiment shown in Figure 6 The embodiment of the present application will not be described here again.
[0151] Step 1103: Optimize the original model according to the search configuration information.
[0152] After obtaining the search configuration information, the model optimization apparatus can arrange multiple search operators according to the search configuration information to obtain a combined operator, and optimize the original model according to the combined operator to obtain an optimized model.
[0153] The implementation process of arranging multiple search operators according to the search configuration information to obtain a combined operator, and optimizing the original model according to the combined operator can refer to the related introduction of steps 602 and 603 in the embodiment shown in Figure 6 The embodiment of the present application will not be described here again.
[0154] Step 1104: Provide the optimized model to the user.
[0155] After obtaining the optimized model, the model optimization apparatus can feed back the optimized model to the client. Optionally, the model optimization apparatus can also feed back the optimization information corresponding to each search item and the performance indicators, such as the accuracy rate and inference delay, of the optimized model to the client. The model optimization apparatus can output the above content to the client in the form of a GUI or an interface file. Figure 9
[0156] In some possible implementation manners, the model optimization apparatus can obtain multiple optimized models satisfying the set evaluation indicators during the search process. In this case, the model optimization apparatus can sort the multiple optimized models according to the performance indicators from large to small, and then feed back the optimized models with the performance indicators ranked in the top N positions to the client. Similarly, the optimization information corresponding to each search item and the performance indicators of each optimized model can also be fed back at the same time.
[0157] In the embodiments of the present application, the model optimization apparatus obtains the original model and the search configuration information, and performs joint search of the optimization information of the original model according to the multiple search items included in the search configuration information, so as to realize joint optimization of multiple dimensions of the original model and improve the performance of the model. The model optimization apparatus can provide a configuration interface for the user, and the user can configure the search information such as the search item and the search mode in the configuration interface according to the user's own needs, so as to meet different optimization needs of the user, which is flexible and easy to operate, and reduces the use burden of the user.
[0158] It should be noted that, in the embodiments of the present application, the model optimization apparatus can also use the resource scheduling method in the embodiments shown in Figure 10 to realize automatic scheduling and optimization of resources before optimizing the original model, and the embodiments of the present application will not be repeated here.
[0159] The embodiments of the present application also provide a model optimization apparatus 100 as shown in Figure 1 The modules and functions included in the model optimization apparatus 100 are as described above, and will not be repeated here.
[0160] In some embodiments, the configuration module 101 in the model optimization apparatus 100 is configured to perform step 601 in the foregoing embodiments. The operator arrangement module 102 is configured to perform step 602 in the foregoing embodiments. The multi-element search module 103 is configured to perform step 603 in the foregoing embodiments.
[0161] Optionally, the model optimization apparatus 100 can also include a resource scheduling module 105, which can be configured to perform steps 1001 and 1002 in the foregoing embodiments.
[0162] In some other embodiments, the configuration module 101 in the model optimization apparatus 100 is configured to perform the step 1101 and the step 1102 in the foregoing embodiments, the operator arrangement module 102 and the multi-element search module 103 can be combined into one optimization module, which can be configured to perform the step 1103 in the foregoing embodiments, and the feedback module 106 is configured to perform the step 1104 in the foregoing embodiments.
[0163] The embodiments of the present application also provide a computing device 500 as shown in Figure 5 The processor 501 in the computing device 500 reads a set of computer instructions stored in the memory 503 to perform the foregoing model optimization method.
[0164] Since the modules in the model optimization apparatus 100 provided by the embodiments of the present application can be distributedly deployed on multiple computers in the same environment or different environments, the present application also provides a computing device (which can also be referred to as a computer system) as shown in Figure 12 The computer system includes multiple computers 1200, each computer 1200 has the same or similar structure as the computing device 500 in the foregoing Figure 5 , and details are not repeated here.
[0165] Each computer 1200 is connected to each other through a communication network. Any one or more of the foregoing configuration module 101, operator arrangement module 102, multi-element search module 103, resource scheduling module 105 and feedback module 106 is run on each computer 1200. Any computer 1200 can be a computer (for example: a server) in a cloud data center, or an edge computer, or a terminal computing device.
[0166] The descriptions of the processes corresponding to the foregoing figures each have their own focuses, and the parts not described in detail in a certain process can be referred to the related descriptions of other processes.
[0167] In the foregoing embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product for implementing the model optimization includes one or more computer instructions for model optimization. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions according to the embodiments of the present application are generated, or all or part of the processes or functions according to the embodiments of the present application are generated. Figure 6 and Figure 10 The foregoing descriptions of the processes or functions according to the embodiments of the present application are generated, or all or part of the processes or functions according to the embodiments of the present application are generated. Figure 11 and Figure 10 The foregoing descriptions of the processes or functions according to the embodiments of the present application are generated, or all or part of the processes or functions according to the embodiments of the present application are generated.
[0168] The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in or transferred from one computer-readable storage medium to another computer-readable storage medium, such as from one website site, computer, server, or data center to another website site, computer, server, or data center, through wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium or data storage device that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital versatile disc (DVD)), or a semiconductor medium (e.g., solid state disk (SSD)), etc.
[0169] A person of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by program to instruct related hardware, and the program can be stored in a computer-readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0170] The above is an embodiment provided by the present application, and is not used to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A model optimization method, characterized in that, The method includes: Obtain the original model and search configuration information. The search configuration information includes multiple search terms, which represent different search categories for searching optimization information for the original model. The multiple search terms include at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search. The original model is a model used to perform at least one task, including image recognition, video analysis, and speech recognition. Based on the search configuration information, the operation order, number of operations, and search space for each operation of multiple search operators are determined. The search space for each operation includes a comprehensive search space, which is a search space obtained by fusing the search spaces corresponding to different search terms, or, the comprehensive search space is a search space obtained by adjusting the search space corresponding to at least one search term to the search space corresponding to another search term. Based on the operation order, number of operations, and comprehensive search space of the multiple search operators, a combination operator is generated. Each search operator corresponds to a search term, and the search operator represents the algorithm used to execute the corresponding search term. The original model is optimized based on the combined operator to obtain the optimized model.
2. The method according to claim 1, characterized in that, The search configuration information also includes: search item information and search mode, wherein each search item corresponds to its own search item information, and the search mode is used to indicate the principles followed when optimizing the original model.
3. The method according to claim 2, characterized in that, The search modes include any one of the following: accuracy mode, speed mode, economy mode, and resource mode.
4. The method according to any one of claims 1-3, characterized in that, The search configuration information is obtained by the user through input or selection on the graphical user interface (GUI).
5. The method according to any one of claims 1-3, characterized in that, Before optimizing the original model based on the combined operator, the method further includes: Based on the combined operator, the resource consumption for optimizing the original model is estimated; Based on the resource consumption, resource scheduling is performed to optimize the original model.
6. The method according to any one of claims 1-3, characterized in that, The method further includes: Obtain evaluation metrics, which represent the performance targets that should be achieved after optimizing the original model; The step of optimizing the original model according to the combined operator to obtain the optimized model includes: The optimization information is searched in the comprehensive search space according to the combined operator, and the original model is optimized according to the optimization information to obtain the optimized model. The performance of the optimized model meets the evaluation index.
7. The method according to claim 6, characterized in that, The evaluation metrics include any one or more of the following metrics: model accuracy, model loss, model precision, and model recall.
8. A model optimization method, characterized in that, The method includes: Provide a configuration interface to the user, the configuration interface including a list of search terms for the user to select; Obtain the original model and search configuration information. The search configuration information includes multiple search terms selected by the user in the search term list. Different search terms represent different search categories for searching optimization information for the original model. The multiple search terms selected by the user in the search term list include at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search. The original model is a model used to perform at least one task including image recognition, video analysis, and speech recognition. Based on the search configuration information, the operation order, number of operations, and search space for each operation of multiple search operators are determined. The search space for each operation includes a comprehensive search space, which is a search space obtained by fusing the search spaces corresponding to different search terms, or, the comprehensive search space is a search space obtained by adjusting the search space corresponding to at least one search term to the search space corresponding to another search term. Based on the operation order, number of operations, and comprehensive search space of the multiple search operators, a combination operator is generated. Each search operator corresponds to a search term, and the search operator represents the algorithm used to execute the corresponding search term. The original model is optimized based on the combined operator. The optimized model is provided to the user.
9. The method according to claim 8, characterized in that, The configuration interface also includes a search item information configuration page and a search mode configuration page. The search configuration information also includes the search item information and search mode configured by the user on the configuration interface.
10. The method according to claim 9, characterized in that, The search mode is used to represent the principle followed when optimizing the original model. The search mode includes any one of the following: accuracy mode, speed mode, economy mode, and resource mode.
11. The method according to any one of claims 8-10, characterized in that, Before optimizing the original model based on the combined operator, the method further includes: Based on the combined operator, the resource consumption for optimizing the original model is estimated; Based on the resource consumption, resource scheduling is performed to optimize the original model.
12. A model optimization device, characterized in that, The device includes: The configuration module is used to obtain the user's original model and search configuration information. The search configuration information includes multiple search terms, which represent different search categories for searching optimization information for the original model. The multiple search terms include at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search. The original model is a model used to perform at least one task, including image recognition, video analysis, and speech recognition. The operator orchestration module is used to determine the operation order, number of operations, and search space for each operation of multiple search operators based on the search configuration information. The search space for each operation includes a comprehensive search space, which is a search space obtained by merging the search spaces corresponding to different search terms, or, the comprehensive search space is a search space obtained by adjusting the search space corresponding to at least one search term to the search space corresponding to another search term. Based on the operation order, number of operations, and comprehensive search space of the multiple search operators, a combination operator is generated. Each search operator corresponds to a search term, and the search operator represents the algorithm used to execute the corresponding search term. The multivariate search module is used to optimize the original model based on the combined operators to obtain the optimized model.
13. The apparatus according to claim 12, characterized in that, The search configuration information also includes: search item information and search mode, wherein each search item corresponds to its own search item information, and the search mode is used to indicate the principles followed when optimizing the original model.
14. The apparatus according to claim 13, characterized in that, The search modes include any one of the following: accuracy mode, speed mode, economy mode, and resource mode.
15. The apparatus according to any one of claims 12-14, characterized in that, The search configuration information is obtained by the user through input or selection on the graphical user interface (GUI).
16. The apparatus according to any one of claims 12-14, characterized in that, The device further includes: a resource management module, the resource management module being used for: Based on the combined operator, the resource consumption for optimizing the original model is estimated; Based on the resource consumption, resource scheduling is performed to optimize the original model.
17. The apparatus according to any one of claims 12-14, characterized in that, The configuration module is also used to obtain evaluation indicators, which represent the performance targets that should be achieved after optimizing the original model. The multivariate search module is further configured to perform optimization information search in the comprehensive search space based on the combination operator, optimize the original model based on the optimization information, and obtain an optimized model, wherein the performance of the optimized model meets the evaluation index.
18. The apparatus according to claim 17, characterized in that, The evaluation metrics include any one or more of the following metrics: model accuracy, model loss, model precision, and model recall.
19. A model optimization device, characterized in that, The device includes: A configuration module is used to provide a configuration interface to the user, the configuration interface including a list of search terms for the user to select; to obtain the original model and search configuration information, the search configuration information including multiple search terms selected by the user in the search term list, different search terms representing different search categories for optimization information search of the original model, the multiple search terms selected by the user in the search term list including at least two of hyperparameter search, network architecture search, data augmentation search, loss function search, optimizer search, and model compression strategy search, the original model being a model for performing at least one task including image recognition, video analysis, and speech recognition; An optimization module is used to determine the operation order, number of operations, and search space for each operation of multiple search operators based on the search configuration information. The search space includes a comprehensive search space, which is a search space obtained by fusing the search spaces corresponding to different search terms, or a search space obtained by adjusting the search space corresponding to at least one search term to the search space corresponding to another search term. Based on the operation order, number of operations, and comprehensive search space of the multiple search operators, a combination operator is generated, where each search operator corresponds to a search term and represents the algorithm used for the corresponding search term. The original model is then optimized based on the combination operator. The feedback module is used to provide the optimized model to the user.
20. The apparatus according to claim 19, characterized in that, The configuration interface also includes a search item information configuration page and a search mode configuration page. The search configuration information also includes the search item information and search mode configured by the user on the configuration interface.
21. The apparatus according to claim 20, characterized in that, The search mode is used to represent the principle followed when optimizing the original model. The search mode includes any one of the following: accuracy mode, speed mode, economy mode, and resource mode.
22. The apparatus according to any one of claims 19-21, characterized in that, The device further includes: a resource management module, the resource management module being used for: Based on the combined operator, the resource consumption for optimizing the original model is estimated; Based on the resource consumption, resource scheduling is performed to optimize the original model.
23. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program code, which, when executed by a computing device, performs the method according to any one of claims 1 to 7 or 8 to 11.
24. A computing device, characterized in that, The computing device includes a processor and a memory, the memory being used to store a set of computer instructions, wherein when the processor executes the set of computer instructions, the computing device performs the method of any one of claims 1 to 7 or 8 to 11.