A model optimization method, device, equipment, storage medium, and program product

By encapsulating the model operators of the deep learning model and configuring the search space training, the problem of high consumption of computing resources in the optimization process of the deep learning model is solved, and a more efficient and universal model optimization method is realized, which can be quickly deployed in different application scenarios. .

CN114492765BActive Publication Date: 2024-09-13TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210171877.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2024-09-13
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

In the existing technology, the deep learning model optimization process consumes a lot of computing resources, and the model optimization process has poor versatility, making it difficult to quickly deploy it to different application scenarios.

Method used

By encapsulating the model operators in the model to be optimized, the dynamically changing super model is determined, and the super model is trained based on the configuration search space to obtain a converged super model, thereby reducing the consumption of computing resources during model optimization and improving versatility.

Benefits of technology

It achieves the generation of models with better prediction effects or efficiency in one training, reduces the consumption of computing resources during model optimization, and improves the versatility of model optimization, allowing deep learning models to be deployed in different application scenarios more quickly.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492765B
    Figure CN114492765B
Patent Text Reader

Abstract

The present application provides a model optimization method, device, equipment, storage medium, and program product; the embodiments of the present application can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and vehicle-mounted, and involve artificial intelligence technology; the method includes: obtaining the model to be optimized and the control parameters; by encapsulating the model operator in the model to be optimized, determining the super model corresponding to the model to be optimized; wherein the spatial structure of the super model is dynamically changing; determining the configuration search space corresponding to the model to be optimized based on the model operator and the control parameters; the model operator includes at least: a network layer in the model to be optimized; based on the configuration search space and the model to be optimized, training the super model to obtain the converged super model corresponding to the model to be optimized; searching the optimized model corresponding to the model to be optimized from the converged super model. Through the present application, the consumption of computing resources during model optimization can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular to a model optimization method, device, equipment, storage medium, and program product. Background Art

[0002] Due to its excellent feature extraction and feature generalization capabilities, deep learning models are often used as the core supporting technology of artificial intelligence and are applied to various scenarios. In order to make the deep learning model have better prediction effect or prediction efficiency, the trained deep learning model is usually optimized, and then the optimized deep learning model is deployed to the application scenario. However, in the related technology, the optional model during model optimization consumes huge computing resources when it is generated, which leads to the problem of high computing resource consumption in the model optimization process. Summary of the invention

[0003] The embodiments of the present application provide a model optimization method, apparatus, device, computer-readable storage medium, and program product, which can reduce the consumption of computing resources during model optimization.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides a model optimization method, including:

[0006] Obtaining a model to be optimized and control parameters; the model to be optimized is a trained model;

[0007] Determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized; wherein the spatial structure of the super model changes dynamically;

[0008] Determine the configuration search space corresponding to the model to be optimized according to the model operator and the control parameter; the model operator includes at least: a network layer in the model to be optimized;

[0009] Based on the configuration search space and the model to be optimized, the super model is trained to obtain a converged super model corresponding to the model to be optimized;

[0010] An optimization model corresponding to the model to be optimized is obtained by searching from the converged super model.

[0011] The present application embodiment provides a model optimization device, including:

[0012] A data acquisition module, used to acquire a model to be optimized and control parameters; the model to be optimized is a trained model;

[0013] A data encapsulation module, used to determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized; wherein the spatial structure of the super model changes dynamically;

[0014] A space configuration module, used to determine the configuration search space corresponding to the model to be optimized according to the model operator and the control parameter; the model operator includes at least: a network layer in the model to be optimized;

[0015] A model training module, used for training the super model based on the configuration search space and the model to be optimized to obtain a converged super model corresponding to the model to be optimized;

[0016] The model search module is used to search for the optimization model corresponding to the model to be optimized from the converged super model.

[0017] In some embodiments of the present application, the data encapsulation module is also used to divide the model operators of the model to be optimized into multiple operator sets according to the connection relationship between the model operators in the model to be optimized; determine the corresponding encapsulation variables for each of the operator sets; use the encapsulation variables to encapsulate the model operators in each of the operator sets to obtain the encapsulation operators corresponding to the model operators in each of the operator sets; the spatial structure of the encapsulation operators is dynamic; and determine the model obtained by splicing the encapsulation operators as the super model corresponding to the model to be optimized.

[0018] In some embodiments of the present application, the data encapsulation module is also used to determine the output operator corresponding to the model operator based on the connection relationship between the model operators in the model to be optimized; the input data of the output operator is the output data of the model operator; using the output operator, the model operators of the model to be optimized are divided into multiple operator sets; wherein, the model operators in the same operator set have the same output operator.

[0019] In some embodiments of the present application, the data encapsulation module is further used to fuse the encapsulation variable with the output channel number of the model operator in each of the operator sets to obtain the encapsulation operator corresponding to the model operator of each of the operator sets.

[0020] In some embodiments of the present application, the model optimization device also includes: an operator merging module; the operator merging module is used to parse the convolution layer of the model to be optimized and the subsidiary network layer corresponding to the convolution layer from the model to be optimized after obtaining the model to be optimized and the control parameters, and before determining the super model corresponding to the model to be optimized by encapsulating the model operator; wherein the subsidiary network layer includes at least: a pooling layer and an activation layer; the convolution layer and the subsidiary network layer corresponding to the convolution layer are merged into the model operator of the model to be optimized.

[0021] In some embodiments of the present application, the control parameters include: multiple sub-model configuration parameters; the spatial configuration module is also used to use the multiple sub-model configuration parameters to adjust the spatial structure parameters of each model operator respectively, and obtain multiple updated structure parameters corresponding to each model operator; the search space formed by the multiple updated structure parameters corresponding to each model operator is determined as the configuration search space corresponding to the model to be optimized.

[0022] In some embodiments of the present application, the model training module is also used to determine a copy of the model to be optimized as a teacher model; perform the following processing through iteration i, 1≤i≤N, N is the total number of iterations: sample the configuration search space for the i-th time to obtain the i-th model configuration information; use the i-th model configuration information to create a sub-model corresponding to the i-th model configuration information from the super-model; based on the teacher model, train the sub-model to obtain a convergent sub-model corresponding to the i-th model configuration information; when the iteration i is completed, determine the set of convergent sub-models corresponding to the N model configuration information as the convergent super-model.

[0023] In some embodiments of the present application, the model training module is also used to determine the training loss value corresponding to the i-th model configuration information based on the first prediction result of the sub-model on the acquired training data, the second prediction result of the teacher model on the training data, and the label information of the training data; using the training loss value corresponding to the i-th model configuration information, adjust the parameters of the sub-model, and when the parameter adjustment is completed, obtain the converged sub-model corresponding to the i-th model configuration information.

[0024] In some embodiments of the present application, the model training module is also used to perform a difference calculation on the first prediction result of the training data by the sub-model and the label information of the training data to obtain a first difference value; perform a difference calculation on the first prediction result of the training data by the sub-model and the second prediction result of the training data by the teacher model to obtain a second difference value; and determine the fusion result of the first difference information and the second difference information as the training loss value.

[0025] In some embodiments of the present application, the model search module is also used to screen a sub-model whose prediction accuracy is the same as that of the model to be optimized from the convergent super model as an initial compression model; and to search for a sub-model whose prediction speed is greater than that of the model to be optimized from the initial compression model as the optimization model corresponding to the model to be optimized.

[0026] In some embodiments of the present application, the model search module is also used to screen a sub-model whose prediction speed is the same as the prediction speed of the model to be optimized from the converged super model as an initial tuning model; and to search for a sub-model whose prediction accuracy is greater than the prediction accuracy of the model to be optimized from the initial tuning model as the optimization model corresponding to the model to be optimized.

[0027] The present application provides a model optimization device, including:

[0028] A memory for storing executable instructions;

[0029] The processor is used to implement the model optimization method provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0030] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the model optimization method provided in the embodiment of the present application.

[0031] An embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the model optimization method provided in the embodiment of the present application.

[0032] The embodiments of the present application have the following beneficial effects: the model optimization device first determines that the number of channels of the model operator is a super model that is dynamically variable, and then trains the super model by configuring the search space and the model to be optimized, so that a converged super model that can be used to search for prediction effects or prediction efficiency is obtained through only one training, thereby reducing the number of times optional models are generated, and thus reducing the computing resources consumed during model optimization. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 It is a flowchart of model structure search;

[0034] Figure 2 It is a schematic diagram of the architecture of the model optimization system provided in the embodiment of the present application;

[0035] Figure 3 The embodiment of this application provides Figure 1 A schematic diagram of the structure of the server in FIG.

[0036] Figure 4 It is a flow chart of the model optimization method provided in the embodiment of the present application;

[0037] Figure 5 is another flow chart of the model optimization method provided in the embodiment of the present application;

[0038] Figure 6 is a schematic diagram comparing the model to be optimized and the super model provided in the embodiment of the present application;

[0039] Figure 7 It is another flow chart of the model optimization method provided in the embodiment of the present application;

[0040] Figure 8 is a schematic diagram of a training super model provided in an embodiment of the present application;

[0041] Fig. 9 It is a schematic diagram of the process of model structure compression provided by an embodiment of the present application;

[0042] Fig.10 It is a schematic diagram of the process of model structure search provided by an embodiment of the present application;

[0043] Fig.11 It is a schematic diagram of the process of model structure compression and model structure search provided in an embodiment of the present application;

[0044] Fig.12 is a schematic diagram of the topological structure of the input model provided in the embodiment of the present application;

[0045] Fig.13 is a schematic diagram of knowledge distillation provided in an embodiment of the present application;

[0046] Fig.14 This is a comparison diagram of the super-resolution reconstruction effects of the input model and the compression model provided in the embodiment of the present application;

[0047] Fig.15 This is another comparison diagram of the super-resolution reconstruction effects of the input model and the compression model provided in the embodiment of the present application. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0049] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0050] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0052] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0053] 1) Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0054] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operating / interactive systems, mechatronics and other technologies. Artificial intelligence software technologies mainly include computer vision technology, speech processing technology, natural language processing technology, as well as machine learning / deep learning, autonomous driving, smart transportation and other major directions.

[0055] 2) Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies.

[0056] 3) Deep Learning (DL) is a research branch of machine learning. Through multi-layer processing, deep learning combines low-level features into more abstract high-level representations or features to discover distributed feature representations of data. Typical deep learning models include Convolutional Neural Network (CNN) model, Deep Belief Nets (DBN) model and Stacked Auto-Encoder Network model.

[0057] 4) Model optimization: optimize the deep learning model that has been trained, so that the deep learning model can improve its prediction effect such as classification accuracy and recognition accuracy, or improve its prediction efficiency such as the number of parameters and computing time.

[0058] Model optimization is generally achieved by searching for a model with better prediction effect while keeping the prediction efficiency unchanged within the range of optional models, or by searching for a model with better prediction efficiency while keeping the prediction effect unchanged.

[0059] 5) Model structure search refers to optimizing the deep learning model so that the prediction efficiency of the deep learning model remains unchanged and the prediction effect is improved. Model structure search specifically searches for neural network structures and is a technology that automatically designs neural network structures. Compared with manually designed neural network structures, automatically designed neural network structures often have better performance when facing fixed data set training methods.

[0060] Figure 1 This is a flow chart of the model structure search process. Figure 1First, search for a network structure 1-3 from the search space 1-1 according to the search strategy 1-2, and then use the performance evaluation strategy 1-4 to evaluate the network structure. When the evaluation fails 1-5, search for the network structure in the search space 1-1 again according to the search strategy 1-2.

[0061] 6) Model parameter compression is a technology that miniaturizes deep learning models while maintaining the model's prediction effect as much as possible. In other words, through model parameter compression, the parameters and calculation amount of the deep learning model can be reduced, the reasoning speed of the deep model can be improved, and the reasoning cost of the deep learning model can be reduced without losing the prediction effect of the deep learning model.

[0062] Generally speaking, deep learning models that have not undergone model parameter compression will consume a lot of computing and memory resources. If deep learning models are to be applied to business scenarios, in order not to affect the user experience, model parameter compression must be performed to reduce the number of parameters in the deep learning model.

[0063] 7) Search space, which defines the set of neural network structures that can be searched, that is, the range of models that can be selected when defining model optimization.

[0064] 8) Search strategy, which defines how to find the optimal model in the search space during model optimization.

[0065] 9) Performance evaluation strategy, which defines how to evaluate the performance of the searched model.

[0066] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as smart home, smart wearable devices, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, drones, robots, smart medical care, smart customer service, Internet of Vehicles, automatic driving, smart transportation, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.

[0067] Due to its excellent feature extraction and feature generalization capabilities, deep learning models are often used as the core supporting technology of artificial intelligence and are applied to various scenarios. In order to make the deep learning model have better prediction effect or prediction efficiency, the trained deep learning model is usually optimized and then deployed to the application scenario.

[0068] In the related art, model optimization is achieved by searching for a model with better prediction effect or prediction efficiency from the optional models, and each of the optional models needs to be trained, so that multiple model training processes are required to obtain the optional models. However, the training process of each model consumes huge computing resources, so that the generation process of the optional models during model optimization needs to consume huge computing resources, which also makes the model optimization process have the problem of large computing resource consumption.

[0069] In addition, in related technologies, model optimization is often designed for specific tasks, such as compressing models for medical image segmentation scenarios, or searching for the optimal model for quantization bit width, which makes it difficult to quickly deploy and apply model optimization to other scenarios, making model optimization less versatile. At the same time, in related technologies, model structure compression and model structure search in model optimization often require separate model training, that is, model structure compression and model structure search cannot be completed at one time, making model optimization less efficient.

[0070] The embodiments of the present application provide a model optimization method, apparatus, device, computer-readable storage medium, and program product, which can reduce the consumption of computing resources during model optimization. The exemplary application of the model optimization device provided by the embodiments of the present application is described below. The model optimization device provided by the embodiments of the present application can be implemented as various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), etc. It can also be implemented as a server, and can also be a device cluster composed of servers and terminals in real time. Below, an exemplary application of the model optimization device when it is implemented as a server will be described.

[0071] See also Figure 2 , Figure 2 This is a schematic diagram of the architecture of the model optimization system provided in the embodiment of the present application. To support a model optimization application, in the model optimization system 100, the terminal 400 (terminal 400-1 and terminal 400-2 are shown as examples) is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. In the model optimization system 100, a database 500 is also provided to provide data support to the server 200. It should be noted that the database 500 can be independent of the server 200, or it can be configured in the server 200. Figure 1 The database 500 is independent of the server 200.

[0072] The terminal 400 - 1 is used to receive user operations on the graphical interface 410 - 1 , specify the model to be optimized and the control parameters for adjusting the spatial structure of the model to be optimized, and send the model to be optimized and the control parameters to the server 200 through the network 300 .

[0073] The server 200 is used to obtain the model to be optimized and the control parameters, wherein the model to be optimized is a trained model; by encapsulating the model operator in the model to be optimized, the super model corresponding to the model to be optimized is determined; wherein the spatial structure of the super model changes dynamically; according to the model operator and the control parameters, the configuration search space corresponding to the model to be optimized is determined, wherein the model operator includes at least: a network layer in the model to be optimized; based on the configuration search space and the model to be optimized, the super model is trained to obtain a converged super model; the optimization model corresponding to the model to be optimized is searched from the converged super model, the model optimization is completed, and the obtained optimization model is sent to the terminal 400-2.

[0074] The terminal 400 - 2 is used to receive user operations on the graphical interface 410 - 2 and call the optimization model to implement reasoning operations such as image classification.

[0075] In some embodiments, the server 200 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a smart home appliance, a car terminal, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present invention.

[0076] See also Figure 3 , Figure 3 The embodiment of this application provides Figure 1 The structural diagram of the server (model optimization device) in Figure 3 The server 200 shown includes: at least one processor 210, a memory 250, at least one network interface 220 and a user interface 230. The various components in the server 200 are coupled together via a bus system 240. It is understood that the bus system 240 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 240 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 240 is not described in detail. Figure 3 Various buses are labeled as bus system 240 .

[0077] The processor 210 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0078] The user interface 230 includes one or more output devices 231 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 230 also includes one or more input devices 232, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0079] The memory 250 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 250 may optionally include one or more storage devices that are physically remote from the processor 210.

[0080] The memory 250 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 250 described in the embodiments of the present application is intended to include any suitable type of memory.

[0081] In some embodiments, memory 250 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0082] Operating system 251, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0083] A network communication module 252, used to reach other computing devices via one or more (wired or wireless) network interfaces 220, exemplary network interfaces 220 include: Bluetooth, Wireless Fidelity (Wi-Fi), and Universal Serial Bus (USB);

[0084] a presentation module 253 for enabling presentation of information via one or more output devices 231 (e.g., display screen, speaker, etc.) associated with the user interface 230 (e.g., a user interface for operating peripherals and displaying content and information);

[0085] The input processing module 254 is used to detect one or more user inputs or interactions from one of the one or more input devices 232 and translate the detected inputs or interactions.

[0086] In some embodiments, the model optimization device provided in the embodiments of the present application can be implemented in software. Figure 3 The model optimization device 255 stored in the memory 250 is shown, which can be software in the form of a program and a plug-in, etc., including the following software modules: a data acquisition module 2551, a data encapsulation module 2552, a space configuration module 2553, a model training module 2554, a model search module 2555 and an operator merging module 2556. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0087] In some embodiments, the server can implement the model optimization method provided in the embodiments of the present application by running a computer program. For example, the computer program can be a native program or software module in the operating system; it can be a native application (APP, Application), that is, a program that needs to be installed in the operating system to run, such as a model optimization APP; it can also be a small program, that is, a program that can be run only by downloading it to a browser environment; it can also be a small program that can be embedded in any APP. In short, the above-mentioned computer program can be an application, module or plug-in in any form.

[0088] The embodiments of the present application can be applied to various scenarios such as cloud technology, artificial intelligence, smart transportation, and vehicle-mounted. Below, the model optimization method provided by the embodiments of the present application will be described in combination with the exemplary application and implementation of the model optimization device provided by the embodiments of the present application.

[0089] See also Figure 4 , Figure 4 This is a flow chart of the model optimization method provided in the embodiment of the present application, which will be combined with Figure 4 The steps shown are explained.

[0090] S101, obtaining the model to be optimized and the control parameters.

[0091] The embodiment of the present application is implemented in the scenario of optimizing the trained model, for example, structural compression of the trained image classification model, or searching for a model with better prediction effect for the trained image classification model. In the embodiment of the present application, the model optimization device can start the model optimization process by responding to the operating instructions of the staff, or at a fixed time. When the model optimization process starts, the model optimization device will first obtain the deep learning model to be optimized, that is, obtain the model to be optimized, and obtain the control parameters at the same time. Among them, the control parameters are used to determine the configuration search space corresponding to the model to be optimized.

[0092] It should be noted that the model to be optimized is a trained model, that is, the model to be optimized is a deep learning model that has been designed and trained for the business scenario. The model to be optimized can be a convolutional neural network model, an artificial neural network model, a recurrent neural network model, etc., and the embodiments of the present application are not limited here.

[0093] It is understandable that the control parameter can be specified by the staff or automatically generated by the model optimization device according to the structure of the model to be optimized. For example, the control parameter can be determined based on the ratio of the minimum number of channels to the maximum number of channels in the model to be optimized, or the ratio of the number of channels of each network layer to the total number of channels can be determined as the control parameter.

[0094] In the embodiment of the present application, the number of control parameters may not be unique, that is, there may be multiple control parameters for the same model to be optimized.

[0095] S102: Determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized.

[0096] The model optimization device encapsulates each model operator in the model to be optimized, and splices the encapsulated model operators according to the original order of each model operator, so as to obtain the super model corresponding to the model to be optimized.

[0097] It should be noted that the spatial structure of the super model changes dynamically. That is to say, the model optimization device encapsulates the model operator and replaces the fixed values ​​such as the number of channels, width or height of the model operator with unknown encapsulation variables, or fuses the unknown encapsulation variables with the number of channels, width or height of the model operator, so that the number of channels, width or height of the model operator changes from the original fixed value to a value that changes dynamically with the change of the variable (it can also be understood that the shape of the model operator changes dynamically). Therefore, the super model formed by the model operator with dynamically changeable number of channels, width or height can itself be regarded as a collection of dynamic models.

[0098] In an embodiment of the present application, the model optimization device can realize the encapsulation of the model operator by fusing an unknown encapsulation variable to the spatial structure parameters of each model operator of the model to be optimized, so that the dynamic change range of the number of channels of the model operator corresponds to the value range of the encapsulation variable.

[0099] S103: Determine the configuration search space corresponding to the model to be optimized based on the model operator and the control parameters.

[0100] The model optimization device first determines the changes that can be made to each model operator of the model to be optimized based on the model operators and control parameters in the model to be optimized, and then uses configuration parameters to represent the changes that can be made to each model operator, and obtains the configuration parameter range that can be selected by each model operator. These configuration parameter ranges are concentrated in the same search space (such as vector space), and the configuration search space of the model to be optimized can be obtained.

[0101] It should be noted that the model operator is a network structure with complete functions in the model to be optimized, for example, network layers such as convolutional layers and pooling layers (a single neuron in a network layer cannot have complete functions and is therefore not a model operator). Of course, in some embodiments, the model operator can also be a combination of multiple network layers as a functional unit, such as a feature encoder formed by connecting an embedding layer, a convolutional layer, etc. In this case, the feature encoder is a model operator. That is to say, in the embodiment of the present application, the model operator includes at least: a network layer in the model to be optimized.

[0102] It should be noted that determining the configuration search space is actually to determine specific optional values ​​for the unknown encapsulated variables corresponding to each model operator, so that in the subsequent training process, these optional values ​​can be used to concretize the encapsulated model operators into variant operators, thereby realizing the concretization of the super model into sub-models.

[0103] For example, when the model to be optimized has three model operators, namely Conv1, Conv2 and Conv3, and the number of channels is Channel1, Channel2 and Channel3 respectively, the model optimization device encapsulates these three model operators, which can be to fuse the unknown encapsulation variables of the number of channels of these three model operators, thereby obtaining Super1Channel1, Super2Channel2 and Super3Channel3, and the configuration search space is used to specify specific optional ratio ranges for Super1, Super2 and Super3, for example, Super1 can choose [0.1, 0.5], Super2 can choose [0.8, 1], Super3 can choose [0.6, 1.0], etc. In this way, by sampling the configuration search space, the channel number configuration of each model operator of the concrete sub-model can be determined, thereby clarifying the configuration of the sub-model.

[0104] It is understandable that the execution order of S102 and S103 will not affect the training of the super model. Therefore, in some embodiments, the model optimization device may also execute S103 first and then execute S102, or execute S102 and S103 at the same time, which is not limited to the embodiments of the present application.

[0105] S104: Based on the configuration search space and the model to be optimized, the super model is trained to obtain a converged super model corresponding to the model to be optimized.

[0106] After obtaining the configuration search space and the super model, the model optimization device will simultaneously perform model training on the super model based on the configuration search space and the model to be optimized, so that the model parameters of the super model converge until the training end conditions are met, such as the number of iterations reaches a certain level, or the accuracy of the super model reaches a certain level, to obtain a converged super model.

[0107] It should be noted that the model optimization device trains the super model, which is actually training a set of dynamic models derived from the model to be optimized. Therefore, only one training is needed to obtain a converged super model that can select a better prediction effect or prediction efficiency than the original model to be optimized. There is no need to train all optional models separately, thereby reducing the computing resources required for model training.

[0108] In some embodiments of the present application, the model optimization device can generate a specific sub-model from the super-model based on the channel configuration parameters sampled from the configuration search space, and then in each iteration of training, constrain the parameter update process of different sub-models by performing knowledge distillation on the model to be optimized until the number of iterations is reached, and the obtained sub-model set is determined as a converged super-model.

[0109] In other embodiments of the present application, the model optimization device may first determine the variant of each model operator from the super model based on the configuration search space, and then use the variant of each model operator to replace each model operator in the model to be optimized in turn (only one variant is replaced at a time), so as to re-fine-tune the model to be optimized with the variant of the model operator added to obtain the trained variant of the model operator, and then determine the set of sub-models generated by the trained variant as the converged super model.

[0110] S105. Search and obtain an optimization model corresponding to the model to be optimized from the converged super model.

[0111] After obtaining the converged super model, the model optimization device can search for a sub-model with the highest prediction effect and prediction efficiency from the converged super model according to given constraints, given indicator standards, or by random selection, as the optimization model, or search for a sub-model that meets the conditions of the business scenario as the optimization model. In this way, the model optimization process for the model to be optimized is completed.

[0112] It can be understood that compared with the related art that requires multiple model training processes to obtain an optional model, in the embodiment of the present application, the model optimization device first determines that the number of channels of the model operator is a dynamically variable super model, and then uses the configuration search space and the model to be optimized to train the super model, so that only through one training, it is possible to obtain a converged super model that can be used to search for prediction effects or better prediction efficiency, thereby reducing the number of times the optional models are generated, and thus reducing the computing resources consumed during model optimization.

[0113] based on Figure 4 , see Figure 5 , Figure 5 It is another flow chart of the model optimization method provided by the embodiment of the present application. In some embodiments of the present application, by encapsulating the model operator in the model to be optimized, determining the super model corresponding to the model to be optimized, that is, the specific implementation process of S102, can include: S1021-S1024, as follows:

[0114] S1021. Divide the model operators of the model to be optimized into multiple operator sets according to the connection relationship between the model operators in the model to be optimized.

[0115] The connection relationship between model operators is the topological structure of the model to be optimized. The model optimization device uses the connection relationship between model operators to determine which model operators must keep the same spatial structure, thereby dividing the model operators whose spatial structures must remain associated (for example, the same) into the same operator set. When the model optimization device determines the corresponding operator set for each model operator of the model to be optimized, multiple operator sets can be obtained.

[0116] It can be understood that each operator set may include at least one model operator.

[0117] S1022. For each operator set, determine a corresponding encapsulation variable.

[0118] The model optimization device determines the corresponding encapsulation variables based on the operator set. In this way, the model operators with the same spatial structure share the same encapsulation variable, thereby ensuring that even if the number of channels of the model operators needs to change later, the change in the number of channels of these model operators is consistent.

[0119] S1023. Encapsulate the model operators in each operator set using encapsulation variables to obtain encapsulation operators corresponding to the model operators in each operator set.

[0120] The model optimization device uses encapsulation variables to encapsulate the model operators in the corresponding operator set, which means using unknown encapsulation variables to fuzzy the spatial structure parameters of the model operator, such as the number of channels, height or width, so that it is converted from a certain value to an uncertain and dynamically variable value. Therefore, the spatial structure of the encapsulation operator is dynamic.

[0121] For example, when the encapsulated variable of a certain operator set is an unknown quantity x and the number of channels (a type of spatial structure parameter) of the model operators contained therein is 8, the model optimization device changes the number of channels of the model operators in the operator set to 8x.

[0122] S1024. Determine the model obtained by splicing the encapsulation operators as the super model corresponding to the model to be optimized.

[0123] The model optimization device will encapsulate the operators and splice them according to the original connection order of the operators in the model to be optimized. The resulting model is the super model. In other words, the spatial structure of each encapsulated operator in the super model is an unknown quantity and is dynamically variable. Later, a specific sub-model can be generated according to the sampled configuration parameters.

[0124] It is understandable that, since the spatial structure of each encapsulation operator of the super model is unknown, it can be regarded as being transformed within a certain range. Therefore, the super model can also be regarded as a collection of models composed of different spatial structures.

[0125] For example, Figure 6 It is a comparative schematic diagram of the model to be optimized and the super model provided in the embodiment of the present application. The spatial structure of the model to be optimized 6-1 is fixed, and the number of neurons (spatial structure parameter) of each network layer (model operator) has only one value, while the super model 6-2 can generate different sub-models according to different model configurations. Different sub-models have different numbers of neurons in the same network layer. It can be seen that the spatial structure of the super model is dynamically variable.

[0126] In an embodiment of the present application, the model optimization device can group the model operators according to the connection relationship between the model operators, and then determine the same encapsulation variable for the model operators in the same group to ensure that the spatial structure of the model operators in the same group is the same in subsequent changes.

[0127] In some embodiments of the present application, the model operators of the model to be optimized are divided into multiple operator sets according to the connection relationship between the model operators in the model to be optimized, that is, the specific implementation process of S1021 may include: S1021a-S1021b, as follows:

[0128] S1021a. Determine the output operator corresponding to the model operator according to the connection relationship between the model operators in the model to be optimized.

[0129] In the embodiment of the present application, the input data of the output operator is the output data of the model operator. The model optimization device first analyzes the connection relationship of the model operators to clarify which model operator each model operator is subsequently connected to, so as to determine the next-level model operator for each model operator, which is the output operator.

[0130] In some embodiments, when the model to be optimized is a residual network, there will be a skip connection structure in the model to be optimized (that is, the input of a certain model operator is the output of two non-adjacent model operators before it), so that the model optimization device can determine multiple corresponding output operators for some model operators.

[0131] S1021b. Using the output operator, divide the model operators of the model to be optimized into multiple operator sets.

[0132] The model optimization device divides the model operators with the same output operator into the same operator set, and establishes their respective corresponding operator sets for the model operators without the same output operator (the elements in the operator set can only contain one model operator at this time). In this way, the model optimization device can determine the operator set to which each model operator belongs, so that when all model operators are divided, multiple operator sets are obtained. That is to say, in the embodiment of the present application, the model operators in the same operator set have the same output operator.

[0133] For example, when the output operators of model operator a are model operator b and model operator d, the output operator of model operator b is model operator c, and the output operator of model operator c is model operator d, the model optimization device will classify model operator a and model operator c into the same operator set, and create an operator set separately for model operator c. Thus, the model optimization device can obtain multiple operator sets.

[0134] In an embodiment of the present application, the model optimization device can determine the output operator of each model operator based on the connection relationship between the model operators, and then group each model operator based on whether there is an intersection among the output operators of different model operators, so as to facilitate the subsequent determination of the corresponding encapsulation variables based on the operator set, thereby ensuring that the pattern operators that must remain connected in the spatial structure share the same encapsulation variable.

[0135] In some embodiments of the present application, the spatial structure parameter includes: the number of output channels. At this time, the model operators in each operator set are encapsulated using encapsulation variables to obtain the encapsulation operators corresponding to the model operators of each operator set, that is, the specific implementation process of S1023 may include: S1023a, as follows:

[0136] S1023a. Fuse the encapsulated variable with the output channel number of the model operator in each operator set to obtain the encapsulated operator corresponding to the model operator of each operator set.

[0137] When the spatial structure parameters include the number of output channels of the model operator, the model optimization device completes the fuzzification of the model operators contained in each operator set by fusing the encapsulated variables corresponding to each operator set with the model operator, so as to realize the encapsulation of the number of output channels of the model operators contained in each operator set. The model operator that encapsulates the number of output channels is the encapsulated operator corresponding to the model operator.

[0138] In an embodiment of the present application, the model optimization device can use encapsulation variables to encapsulate the number of output channels of the model operator, so that the change in the number of output channels of the model operator in each operator set remains consistent.

[0139] based on Figure 4 , see Figure 7 , Figure 7 It is another flow chart of the model optimization method provided by the embodiment of the present application. In some embodiments of the present application, after obtaining the model to be optimized and the control parameters, by encapsulating the model operators in the model to be optimized and before determining the super model corresponding to the model to be optimized, that is, after S101 and before S102, the method may also include: S106-S107, as follows:

[0140] S106. Analyze and obtain the convolutional layer of the model to be optimized and the subsidiary network layer corresponding to the convolutional layer from the model to be optimized.

[0141] The model optimization device analyzes the network layer of the model to be optimized to determine the convolution layer in the model to be optimized, as well as the network layers before the convolution layer. Generally speaking, in the convolutional neural network, a pooling layer for dimensionality reduction processing of the output features of the convolution layer and an activation layer for activation processing are set after the convolution layer. Therefore, the pooling layer and activation layer connected after each convolution layer can be regarded as the subsidiary network layer corresponding to each convolution layer (the convolution layer and its corresponding subsidiary network layer often appear as a processing module in the convolutional neural network). In this way, the model optimization device can extract the convolution layer and the subsidiary network layer corresponding to the convolution layer from the model to be optimized. It can be seen that the subsidiary network layer includes at least: a pooling layer and an activation layer.

[0142] S107. Merge the convolutional layer and the subsidiary network layer corresponding to the convolutional layer into a model operator of the model to be optimized.

[0143] The model optimization device combines the convolution layer and the subsidiary network layer corresponding to the convolution layer into a model operator, and after completing the operation on all convolution layers, different model operators of the model to be optimized can be obtained.

[0144] In an embodiment of the present application, the model optimization device packages each convolutional layer and the network layer used to process the output features of each convolutional layer into a model operator to facilitate subsequent encapsulation of the model operator.

[0145] In some embodiments of the present application, the control parameters include: a plurality of sub-model configuration parameters, so that, according to the model operator to be optimized and the control parameters, the configuration search space corresponding to the model to be optimized is determined, that is, the specific implementation process of S103 may include: S1031-S1032, as follows:

[0146] S1031. Using multiple sub-model configuration parameters, adjust the spatial structure parameters of each model operator respectively to obtain multiple updated structure parameters corresponding to each model operator.

[0147] The model optimization device fuses the spatial structure parameters of each model operator, such as the number of output channels or the number of input channels, with multiple sub-model configuration parameters, respectively, so as to adjust the spatial structure parameters of each model operator by fusing the sub-model configuration parameters. It is understandable that one sub-model configuration parameter will adjust the spatial structure parameters of each model operator once to obtain an updated structure parameter. Thus, after adjusting the spatial structure parameters of each model operator respectively using multiple sub-model configuration parameters, the model optimization device can obtain multiple updated structure parameters for each model operator.

[0148] S1032. Determine a search space formed by a plurality of updated structural parameters corresponding to each model operator as a configuration search space corresponding to the model to be optimized.

[0149] The model optimization device determines each updated structural parameter corresponding to each model operator as a search vector, and uses multiple search vectors to form a search space, which is the configuration search space corresponding to the model to be optimized.

[0150] In an embodiment of the present application, the model optimization device will use multiple sub-model configuration parameters to adjust the spatial structure parameters of each model operator respectively, and use multiple updated structure parameters corresponding to each model operator to form a search space, thereby obtaining a configuration search space that can be used for subsequent configuration parameter sampling.

[0151] In some embodiments of the present application, based on the configuration search space and the model to be optimized, the super model is trained to obtain a converged super model corresponding to the model to be optimized, that is, the specific implementation process of S104 may include: S1041-S1045, as follows:

[0152] S1041. Determine the copy of the model to be optimized as the teacher model.

[0153] The model optimization device copies the model to be optimized to generate a copy of the model to be optimized, and uses the generated copy as a teacher model in subsequent training.

[0154] Next, the processing from S1042 to S1044 is performed through iteration i, where 1≤i≤N, and N is the total number of iterations:

[0155] S1042. Perform the i-th sampling on the configuration search space to obtain the i-th model configuration information.

[0156] When training a supermodel, the model optimization device will sample from the configuration search space at each iteration of training to obtain the model configuration information corresponding to the sampling. The model configuration information gives the spatial structure configuration of the submodel to be created from the supermodel, such as the number of output channels, the size of the convolution kernel, etc.

[0157] S1043. Using the i-th model configuration information, create a sub-model corresponding to the i-th model configuration information from the super-model.

[0158] After obtaining the model configuration information obtained for each sampling, the model optimization device will use the model configuration information to visualize the super model information, that is, to take the specific changes in the spatial structure given in the model configuration information, and assign the encapsulation variables of each encapsulation operator, so that the encapsulation variables change from unknown quantities to definite values. In this way, a sub-model can be determined according to the model configuration information, that is, a sub-model corresponding to the model configuration information obtained for each sampling can be obtained.

[0159] For example, when the model configuration information indicates that the number of output channels of a certain model operator is 0.25 times the number of original channels, the model optimization device uses 0.25 to assign a value to the encapsulated variable, thereby visualizing the encapsulated operator of the model operator and obtaining a variant of the model operator. After all encapsulated operators of the super model are processed according to the model configuration information, a sub-model corresponding to the model configuration information can be obtained.

[0160] S1044. Based on the teacher model, the sub-model is trained to obtain a converged sub-model corresponding to the i-th model configuration information.

[0161] The model optimization device uses the model to be optimized to guide the training of the sub-model, that is, the parameter information of the model to be optimized is used as prior information and introduced into the parameter update of the sub-model, which can not only improve the generalization performance of the sub-model, but also improve the training speed of the sub-model. When the i-th iteration is completed, the model optimization device will obtain the converged sub-model corresponding to the i-th model configuration information.

[0162] When i is iterated to N, the process of S1045 is performed.

[0163] S1045. When iteration on i is completed, a set of convergent sub-models corresponding to the N model configuration information is determined as a convergent super-model.

[0164] When the model optimization device completes the iteration of i, that is, i iterates to N, and completes the training of the sub-model corresponding to the Nth model configuration information, the model optimization device will use the convergent sub-models corresponding to the N model configuration information to form a set, and determine the set as a convergent super model. In other words, the convergent super model is equivalent to the set of convergent sub-models.

[0165] It can be understood that the number of iterations can be equal to the size of the configuration search space, or can be manually set, which is not limited in the embodiments of the present application.

[0166] For example, Figure 8 Schematic diagram of the training super model provided by the embodiment of the present application. At the t-1th iteration 8-1, the tth iteration 8-2 and the t+1th iteration 8-3, the model optimization device will sample from the configuration search space 8-4 to obtain the model configuration information 8-5 corresponding to the t-1th iteration 8-1, the model configuration information 8-6 corresponding to the t-1th iteration 8-2 and the model information 8-7 corresponding to the t+1th iteration 8-3. Then, in the respective processes of the t-1th iteration 8-1, the tth iteration 8-2 and the t+1th iteration 8-3, the sub-model 8-9 corresponding to the t-1th iteration 8-1, the sub-model 8-10 corresponding to the t-2nd iteration and the sub-model 8-11 corresponding to the t+1th iteration 8-3 will be generated from the super model 8-8. Afterwards, at each iteration, the model optimization device will use the teacher model 8-13 to guide the parameter update 8-12 process of the sub-model 8-9, the sub-model 8-10 and the sub-model 8-11, until the t+1th iteration 8-3 is completed, and the set composed of the sub-model 8-9, the sub-model 8-10 and the sub-model 8-11 is determined as a converged super model.

[0167] In the embodiment of the present application, the model optimization device will create a sub-model from the super-model at each iteration, and use the copy generated by the copy of the model to be optimized to guide the training of the sub-model to obtain a convergent sub-model, thereby completing an iterative update of the super-model. When the iteration is completed, a convergent super-model can be obtained. In other words, the embodiment of the present application only needs one training to complete the update of the super-model and obtain a convergent super-model that can perform model search, thereby reducing the computing resources consumed during model optimization.

[0168] In some embodiments of the present application, based on the teacher model, the sub-model is trained to obtain the converged sub-model corresponding to the i-th model configuration information, that is, the specific implementation process of S1044, which may include: S1044a-S1044b, as follows:

[0169] S1044a, based on the first prediction result of the sub-model on the acquired training data, the second prediction result of the teacher model on the training data, and the label information of the training data, determine the training loss value corresponding to the i-th model configuration information.

[0170] The model optimization device inputs the acquired training data into the sub-model corresponding to the i-th model configuration information, and determines the prediction result of the sub-model on the training data as the first prediction result. At the same time, the model optimization device inputs the training data into the teacher model, and determines the prediction result output by the teacher model as the second prediction result. Then, the model optimization device calculates the loss value using the first prediction result, the second prediction result, and the label information of the training data, so that the training loss value corresponding to the i-th model configuration information can be obtained.

[0171] S1044b. Using the training loss value corresponding to the i-th model configuration information, adjust the parameters of the sub-model, and when the parameter adjustment is completed, obtain the converged sub-model corresponding to the i-th model configuration information.

[0172] Next, the model optimization device will backpropagate the calculated loss value in the sub-model corresponding to the i-th model configuration information to update and adjust the parameters in the sub-model. When the adjustment is completed, the model optimization device can obtain the converged sub-model corresponding to the i-th model configuration information.

[0173] In some embodiments of the present application, based on the first prediction result of the sub-model on the acquired training data, the second prediction result of the teacher model on the training data, and the label information of the training data, the training loss value corresponding to the i-th model configuration information is determined, that is, the specific implementation process of S1044a may include: S201-203, as follows:

[0174] S201, performing difference calculation on a first prediction result of the sub-model for training data and label information of the training data to obtain a first difference value.

[0175] S202, performing a difference calculation on the first prediction result of the sub-model on the training data and the second prediction result of the teacher model on the training data to obtain a second difference value.

[0176] The model optimization device performs difference calculation on the first prediction result of the sub-model for the training data, the label information of the training data and the second prediction result, so as to obtain a first difference value and a second difference value.

[0177] S203: Determine a fusion result of the first difference information and the second difference information as a training loss value.

[0178] Next, the model optimization device may fuse the first difference information and the second difference information by weighted summation, or fuse the first difference information and the second difference information by multiplication, and use the fusion result obtained after the fusion as the final training loss value.

[0179] It is understandable that when the model optimization device weights the first difference information and the second difference information, the weighted weight may be a hyperparameter set in advance.

[0180] In an embodiment of the present application, the model optimization device can integrate the second prediction result calculated by the teacher model for the training data into the training loss value, so as to use the parameter information of the teacher model as prior knowledge when training the sub-model through the training loss value, so as to improve the generalization ability and training speed of the sub-model.

[0181] In some embodiments of the present application, searching from the converged super model to obtain an optimization model corresponding to the model to be optimized, that is, a specific implementation process of S105, may include: S1051-S1052, as follows:

[0182] S1051. From the converged super model, select a sub-model whose prediction accuracy is the same as that of the model to be optimized as the initial compression model.

[0183] S1052. Search, from the initial compression model, a model whose prediction speed is greater than the prediction speed of the model to be optimized, as the optimization model corresponding to the model to be optimized.

[0184] The model optimization device first selects the sub-models whose prediction accuracy is at the same level as the model to be optimized from the converged super-model as the initial compression model, and then searches for the sub-models whose prediction speed is faster than the model to be optimized from the initial compression model, and determines the searched sub-models as the final optimization model. In this way, the model structure compression of the model to be optimized can be achieved.

[0185] It is understandable that the initial compression model may include at least one sub-model whose prediction accuracy is the same as that of the model to be optimized, and does not specifically refer to one sub-model. Of course, in other embodiments, the initial compression model may also be a sub-model whose prediction accuracy is within the difference range with the prediction accuracy to be optimized.

[0186] Of course, in some embodiments of the present application, searching for an optimization model corresponding to the model to be optimized from the convergent super model, that is, the specific implementation process of S105, may also include: S1053-S1054, as follows:

[0187] S1053. From the converged super model, select a sub-model whose prediction speed is the same as the prediction speed of the model to be optimized as the initial tuning model.

[0188] S1054. Search, from the initial tuning model, a sub-model whose prediction accuracy is greater than the prediction accuracy of the model to be optimized, as the optimization model corresponding to the model to be optimized.

[0189] The model optimization device can also select a sub-model whose preset speed is at the same level as the model to be optimized as an initial tuning model, and search for a sub-model with a higher prediction accuracy than the model to be optimized from the initial tuning model, and use the sub-model as the optimization model. In this way, the model structure search of the model to be optimized can be realized.

[0190] It is understandable that the initial tuning model may include at least one sub-model whose prediction speed is the same as the prediction speed of the model to be optimized, and does not specifically refer to one sub-model. Of course, in other embodiments, the initial tuning model may also be a sub-model whose prediction speed difference value is within the difference range with the prediction speed to be optimized.

[0191] In an embodiment of the present application, the model optimization device can utilize the same convergent super model to simultaneously realize model structure compression and model structure search of the model to be optimized, thereby eliminating the need to perform model training separately for model structure compression and model structure search, thereby making the model optimization more versatile and easier to deploy in actual application scenarios.

[0192] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0193] The server of the embodiment of the present application is implemented in the scenario of model structure compression and model structure search for a deep learning model that has completed training.

[0194] It should be noted that compressing the model structure of a deep learning model (model to be optimized) means reducing the model reasoning time for a given model while maintaining the prediction effect to obtain a compressed model (optimized model).

[0195] Fig. 9 This is a schematic diagram of the process of model structure compression provided by the embodiment of the present application. Model structure compression means searching 9-1 for a new model A2 for model A1 (which has been trained), where the inference time of model A1 is T and the accuracy is P%, and the inference time of model A2 is 0.5T and the accuracy is P%.

[0196] Model structure search for deep learning models is to improve the prediction effect of the model for a given model while keeping the inference time unchanged, so as to obtain a model with better performance (optimized model).

[0197] Fig.10This is a schematic diagram of the process of model structure search provided by the embodiment of the present application. Model structure search refers to the model B3 to be improved, training a larger model B1 by 10-1, and then searching 10-2 from B1 to the optimal model B2. Among them, the reasoning time of B3 is T, and the accuracy is P%; the reasoning time of B1 is T+m, and the accuracy is (P+n)%; the reasoning time of B2 is T, and the accuracy is (P+n)%.

[0198] Fig.11 Schematic diagram of the process of model structure compression and model structure search provided by the embodiment of the present application. Fig.11 , the process may include the following steps:

[0199] S301, obtaining relevant information. The relevant information includes: inputting a model 11-1 (comprising three convolutional layers, namely, convolutional layer 11-11 to convolutional layer 11-13), determining a search space 11-2 and an evaluation function 11-3.

[0200] Assume that the input model is M W (model to be optimized), where W is the set of learnable parameters of model M, W = {w i} i=1,…,l , l is the input model M W The number of convolutional layers (model operators), is the parameter tensor of the i-th convolutional layer, out i and in i are the number of output channels and input channels of the i-th convolutional layer, respectively, and k i is the size of the convolution kernel. It should be noted that the input model M W It is a trained model waiting to be optimized or compressed. It can be a model for classification tasks or a model for super-resolution reconstruction tasks.

[0201] The search space (configuration search space) is determined based on the artificially set configuration hyperparameter set (control parameters) and the number of channels of the convolution layer (spatial structure parameters of the model operator). The search space is represented by S = {s i} i=1,..n , n is the size of the search space. Among them, each configuration in the search space and Here's i It can be understood as an l-dimensional integer vector corresponding to the number of convolutional layers. Generally speaking, due to the influence of the topological structure of the deep learning model itself, s i The length of may be less than l. In the search space S, the i-th configuration s iThe space that the j-th element (i.e., the j-th convolutional layer) can choose depends on the set of hyperparameters A = [a1%, ..., a m %] (multiple sub-model configuration parameters), so the size of the search space S is n = m l .s i It is a configuration combination of sub-models that can be used after the input model is encapsulated into a super-model, where each element corresponds to a related set of output channels of the convolutional layer parameters, such as s i ∈{0.25out i ,0.5out i ,0.75out i ,out i}(multiple update structure parameters).

[0202] The performance evaluation function is a different evaluation method specified according to different tasks. For example, for a classification task, the classification accuracy and the corresponding test set can be specified to form an evaluation function. The evaluation function is used to evaluate the effect of the sub-model generated from the super-model.

[0203] S302: Perform structural analysis on the input model.

[0204] Deep learning models usually have a certain topological structure, and the input model is no exception, in which there can be connections between two non-adjacent convolutional layers.

[0205] For example, Fig.12 It is a schematic diagram of the topological structure of the input model provided in the embodiment of the present application. The input model 12-1 includes four convolutional layers, namely convolutional layers 12-11 to 12-14, wherein the output of convolutional layer 12-11 is connected to the inputs of convolutional layer 12-12 and convolutional layer 12-14, the output of convolutional layer 12-12 is connected to the input of convolutional layer 12-13, and the output of convolutional layer 12-13 is connected to the input of convolutional layer 12-14.

[0206] based on Fig.12 The topology shown, the server can represent the input model as (Con stands for convolutional layer). Since they are all connected, there is a relationship between equations (1) to (3):

[0207] out1=in2 (1)

[0208] out1=out3 (2)

[0209] out1=in4 (3)

[0210] Among them, equations (1) and (3) are the natural results of the layering of the deep learning model structure, while equation (2) is the constraint brought by the skip connection structure in the input model, indicating that the number of output channels of Conv1 and Conv3 must be consistent. Therefore, in the configuration of the search space, Conv1 and Conv3 share a control parameter. Based on this, the server will parse the input model and obtain three groups (operator sets), namely {{Conv1, Conv3}, {Conv2}, {Conv4}} (it can be seen that the model operators in the same operator set have the same output operators). If a sub-model configuration s = {0.25out1, 0.5out2, 0.75out4} is given, then the server will encapsulate the obtained super model to generate a new sub-model. Among them, the number of output channels of Conv1 and Conv3 is the same, both of which are generated by s1 1 =0.25out1. In other words, the server performs structural analysis on the input model, that is, groups the convolution operators (similar to the convolution layer) according to the topological structure of the input model. The convolution layers in each group share a control parameter in a configuration of the search space (it can be seen that each operator set has a corresponding encapsulated variable, and the control parameter is used to assign a value to the encapsulated variable). The control parameters of the convolution layer sampling in different groups are different.

[0211] S303: Encapsulate the convolution operator obtained by parsing into an encapsulation operator.

[0212] The server encapsulates the operators of the input model according to the operator groups {{Conv1, Conv3}, {Conv2}, {Conv4}} obtained by structural analysis of the input model, and obtains the corresponding encapsulated operators {{Super1Conv1, Super1Conv3}, {Super2Conv2}, {Super3Conv4}} (the encapsulated operators corresponding to the model operators of each operator set), Super1 to Super3 are encapsulated parameters (encapsulated variables), and the encapsulated model is the super model Super_M. Fig.11 The super model 11-4 includes a packaging operator 11-41, a packaging operator 11-42 and a packaging operator 11-43.

[0213] The super model Super_M can generate different sub-models Sub_M according to different configurations in the search space, that is, the configuration of the search space and the sub-model are one-to-one corresponding. It can be seen from this that the super model is a dynamic collection of models. If there are four different sub-model configuration parameters, four different sub-models can be obtained from the super model. This property of the super model is essentially brought by the encapsulation operator. The difference between the encapsulation operator and the ordinary convolution operator is that the input and output channel dimensions of the encapsulation operator can be changed dynamically during training and inference. Each sub-model of the super model shares the parameters of the corresponding position of the super model. In this way, the effect of the sub-model can be improved and the convergence speed of the sub-model can be accelerated.

[0214] S304, copy the input model to obtain the teacher model.

[0215] exist Fig.11 In FIG. 1 , the structure of the teacher model 11-5 is the same as that of the input model 11-1, which is formed by the convolutional layer 11-11 to the convolutional layer 11-13. The main function of the teacher model is to constrain the optimization process of learning features of different sub-models through knowledge distillation.

[0216] Among them, knowledge distillation is a transfer learning method for deep learning models. Its purpose is to add the parameter information of the teacher model as prior information to the parameter update of the sub-model during the training process of the sub-model, so that the sub-model has better generalization ability and reasoning effect. In this way, while improving the effect of the sub-model, the consistency of the features of different sub-models can be maintained (different sub-models have different network structures. If there is no teacher model feature as a constraint, different sub-models will be optimized in different directions, making it difficult for the super model to converge to the optimal effect or even unable to converge).

[0217] For example, Fig.13 Schematic diagram of knowledge distillation provided in the embodiment of the present application. The server uses three different model configurations to create three different sub-models from the super model Super_M, namely sub-model 13-1, sub-model 13-2 and sub-model 13-3, and then during training, the parameter information in the teacher model 13-5 is introduced as prior information into the parameter update of the three sub-models through knowledge distillation 13-4.

[0218] S305: Train the super model until convergence.

[0219] The server needs to first set the hyperparameter set A=[a1%,...,a m %] and adjust the number of input channels of each convolution layer of the input model to obtain the optional configuration information of each convolution layer (multiple updated structure parameters corresponding to each model operator), thereby determining the search space.

[0220] At each iteration of training, the server samples the search space and obtains the sub-model configuration s t (model configuration information), according to s t Get the corresponding sub-model Sub_M from the super-model Super_M t (the sub-model corresponding to the model configuration information), and then use the data of this iteration (training data) to train the sub-model Sub_M t Perform forward reasoning and back propagation, and update the sub-model Sub_M according to the back propagation gradient t The parameters of the sub-model are used to complete one iteration of the sub-model. t It is a subset of the super model Super_M. Completing an iteration of a sub-model means completing an iteration of the super model Super_M. In addition, in each iteration, the teacher model is used to guide all sub-models Sub_M. t Optimization. Fig.11 In the figure, the training of the sub-model 11-6 by the teacher model 11-5 is taken as an example to illustrate the super-model training process, wherein the sub-model 11-6 is obtained by assigning the encapsulation parameters of the encapsulation operator 11-41 and the encapsulation operator 11-43 to 0.5, and assigning the encapsulation parameter of the encapsulation operator 11-42 to 0.8.

[0221] S306: Perform model search on the trained converged super model.

[0222] After the training is completed, the server can obtain a converged super model Super_M, which is equivalent to a set of converged sub-models. The server can search for a model with better performance from the super model by exhaustive or partitioning according to the given evaluation function 11-3, that is, Fig.11 The optimal sub-model 11-7 in the model structure search is completed, or a model with shorter reasoning time is searched from the super model, that is, Fig.11 The compression model 11-8 in the figure completes the model compression.

[0223] Below, taking the super-resolution reconstruction task as an example, the effect of the model optimization method provided in the embodiment of the present application is explained.

[0224] After the input model obtains the corresponding compression model through the model optimization method of the embodiment of the present application, the server will use the input model and the compression model to perform super-resolution reconstruction on the same image, and compare the reconstruction effects and performance indicators during reconstruction.

[0225] Fig.14This is a comparison diagram of the super-resolution reconstruction effects of the input model and the compression model provided in the embodiment of the present application. Among them, image 14-1 is obtained by super-resolution reconstruction based on the input model, and image 14-2 is obtained by super-resolution reconstruction based on the compression model. By comparing image 14-1 and image 14-2, it can be seen that there is almost no difference in the effect of super-resolution reconstruction between the input model and the compression model.

[0226] Fig.15 This is another comparison diagram of the super-resolution reconstruction effects of the input model and the compression model provided in the embodiment of the present application. Among them, image 15-1 is obtained by super-resolution reconstruction based on the input model, and image 15-2 is obtained by super-resolution reconstruction based on the compression model. There is almost no difference in the effect of super-resolution reconstruction between image 15-1 and image 15-2.

[0227] Table 1 is a comparison of super-resolution reconstruction performance indicators of the input model and the compression model provided in the embodiments of the present application.

[0228] Table 1

[0229]

[0230] As can be seen from Table 1, compared with the input model, the memory usage of the compression model in the super-resolution reconstruction task is reduced by 58%, the required calculation amount is reduced by 64%, the number of parameters is reduced by 64%, and the peak signal-to-noise ratio (PSNR) is only reduced by 0.5%, which is almost unchanged. This shows that the compression model is almost the same as the input model in the effect of super-resolution reconstruction, but requires less computing resources.

[0231] It is understandable that in the embodiments of the present application, the training data involves relevant data such as the user's photos. When the embodiments of the present application are applied to specific products or technologies, the user's permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0232] The following is a description of an exemplary structure of the model optimization device 255 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 3 As shown, the software modules stored in the model optimization device 255 of the memory 250 may include:

[0233] The data acquisition module 2551 is used to acquire the model to be optimized and the control parameters; the model to be optimized is a trained model;

[0234] A data encapsulation module 2552 is used to determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized; wherein the spatial structure of the super model changes dynamically;

[0235] The space configuration module 2553 is used to determine the configuration search space corresponding to the model to be optimized according to the model operator and the control parameter; the model operator includes at least: a network layer in the model to be optimized;

[0236] A model training module 2554 is used to train the super model based on the configuration search space and the model to be optimized to obtain a converged super model corresponding to the model to be optimized;

[0237] The model search module 2555 is used to search for the optimization model corresponding to the model to be optimized from the converged super model.

[0238] In some embodiments of the present application, the data encapsulation module 2552 is also used to divide the model operators of the model to be optimized into multiple operator sets based on the connection relationship between the model operators in the model to be optimized; determine the corresponding encapsulation variables for each of the operator sets; use the encapsulation variables to encapsulate the model operators in each of the operator sets to obtain the encapsulation operators corresponding to the model operators in each of the operator sets; the spatial structure of the encapsulation operators is dynamic; and determine the model obtained by splicing the encapsulation operators as the super model corresponding to the model to be optimized.

[0239] In some embodiments of the present application, the data encapsulation module 2552 is also used to determine the output operator corresponding to the model operator based on the connection relationship between the model operators in the model to be optimized; the input data of the output operator is the output data of the model operator; using the output operator, the model operators of the model to be optimized are divided into multiple operator sets; wherein, the model operators in the same operator set have the same output operator.

[0240] In some embodiments of the present application, the spatial structure parameters include: the number of output channels; the data encapsulation module 2552 is also used to fuse the encapsulation variables with the number of output channels of the model operator in each of the operator sets to obtain the encapsulation operator corresponding to the model operator of each of the operator sets.

[0241] In some embodiments of the present application, the model optimization device 255 also includes: an operator merging module 2556; the operator merging module 2556 is used to parse the convolution layer of the model to be optimized and the subsidiary network layer corresponding to the convolution layer from the model to be optimized after obtaining the model to be optimized and the control parameters, and before determining the super model corresponding to the model to be optimized by encapsulating the model operator; wherein the subsidiary network layer includes at least: a pooling layer and an activation layer; the convolution layer and the subsidiary network layer corresponding to the convolution layer are merged into the model operator of the model to be optimized.

[0242] In some embodiments of the present application, the control parameters include: multiple sub-model configuration parameters; the spatial configuration module 2553 is also used to use the multiple sub-model configuration parameters to adjust the spatial structure parameters of each model operator respectively, and obtain multiple updated structure parameters corresponding to each model operator; the search space formed by the multiple updated structure parameters corresponding to each model operator is determined as the configuration search space corresponding to the model to be optimized.

[0243] In some embodiments of the present application, the model training module 2554 is also used to determine a copy of the model to be optimized as a teacher model; perform the following processing through iteration i, 1≤i≤N, N is the total number of iterations: sample the configuration search space for the i-th time to obtain the i-th model configuration information; use the i-th model configuration information to create a sub-model corresponding to the i-th model configuration information from the super model; based on the teacher model, train the sub-model to obtain a convergent sub-model corresponding to the i-th model configuration information; when the iteration i is completed, determine the set of convergent sub-models corresponding to the N model configuration information as the convergent super-model.

[0244] In some embodiments of the present application, the model training module 2554 is also used to determine the training loss value corresponding to the i-th model configuration information based on the first prediction result of the sub-model on the acquired training data, the second prediction result of the teacher model on the training data, and the label information of the training data; using the training loss value corresponding to the i-th model configuration information, adjust the parameters of the sub-model, and when the parameter adjustment is completed, obtain the converged sub-model corresponding to the i-th model configuration information.

[0245] In some embodiments of the present application, the model training module 2554 is also used to perform a difference calculation on the first prediction result of the training data by the sub-model and the label information of the training data to obtain a first difference value; perform a difference calculation on the first prediction result of the training data by the sub-model and the second prediction result of the training data by the teacher model to obtain a second difference value; and determine the fusion result of the first difference information and the second difference information as the training loss value.

[0246] In some embodiments of the present application, the model search module 2555 is also used to screen a sub-model whose prediction accuracy is the same as the prediction accuracy of the model to be optimized from the convergent super model as the initial compression model; and to search for a sub-model whose prediction speed is greater than the prediction speed of the model to be optimized from the initial compression model as the optimization model corresponding to the model to be optimized.

[0247] In some embodiments of the present application, the model search module 2555 is also used to screen a sub-model whose prediction speed is the same as the prediction speed of the model to be optimized from the converged super model as an initial tuning model; and to search for a sub-model whose prediction accuracy is greater than the prediction accuracy of the model to be optimized from the initial tuning model as the optimization model corresponding to the model to be optimized.

[0248] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the model optimization method described above in the embodiment of the present application.

[0249] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein executable instructions are stored. When the executable instructions are executed by a processor, the processor will execute the model optimization method provided by the present application embodiment, for example, Figure 4 The model optimization method is shown.

[0250] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0251] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0252] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0253] As an example, executable instructions may be deployed to be executed on one computing device (model optimization device), or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.

[0254] To summarize, through the embodiments of the present application, the model optimization device first determines that the number of channels of the model operator is a super model that is dynamically variable, and then uses the configuration search space and the model to be optimized to train the super model, so that only through one training, it is possible to obtain a converged super model that can be used to search for prediction effects or prediction efficiency with better results, thereby reducing the number of times optional models are generated, and thus reducing the computing resources consumed during model optimization; using the same converged super model, the model structure compression and model structure search of the model to be optimized are simultaneously realized, thereby eliminating the need to perform model training for model structure compression and model structure search separately, making the model optimization more versatile and easier to deploy in actual application scenarios.

[0255] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A model optimization method, characterized in that: The model optimization method comprises: Obtaining a model to be optimized and control parameters; the model to be optimized is a trained image classification model; Determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized; wherein the spatial structure of the super model changes dynamically; Determine the configuration search space corresponding to the model to be optimized according to the model operator and the control parameter; the model operator includes at least: a network layer in the model to be optimized; Based on the configuration search space and the model to be optimized, the super model is trained to obtain a converged super model corresponding to the model to be optimized; An optimization model corresponding to the model to be optimized is obtained by searching from the converged super model.

2. The method according to claim 1, characterized in that The step of encapsulating the model operators in the model to be optimized to determine the super model corresponding to the model to be optimized includes: According to the connection relationship between the model operators in the model to be optimized, the model operators of the model to be optimized are divided into multiple operator sets; For each of the operator sets, determining a corresponding encapsulation variable; The model operator in each of the operator sets is encapsulated by using the encapsulation variable to obtain the encapsulation operator corresponding to the model operator in each of the operator sets; the spatial structure of the encapsulation operator is dynamic; The model obtained by splicing the encapsulation operator is determined as the super model corresponding to the model to be optimized.

3. The method according to claim 2, characterized in that The dividing the model operators of the model to be optimized into a plurality of operator sets according to the connection relationship between the model operators in the model to be optimized includes: According to the connection relationship between the model operators in the model to be optimized, the output operator corresponding to the model operator is determined; the input data of the output operator is the output data of the model operator; The model operators of the model to be optimized are divided into a plurality of operator sets by using the output operator; wherein the model operators in the same operator set have the same output operator.

4. The method according to claim 2, characterized in that: The encapsulating the model operator in each of the operator sets by using the encapsulation variable to obtain the encapsulation operator corresponding to the model operator in each of the operator sets includes: The encapsulated variable is fused with the output channel number of the model operator in each of the operator sets to obtain the encapsulated operator corresponding to the model operator in each of the operator sets.

5. The method according to any one of claims 2 to 4, characterized in that: After obtaining the model to be optimized and the control parameters, and before encapsulating the model operators in the model to be optimized and determining the super model corresponding to the model to be optimized, the method further includes: From the model to be optimized, parse and obtain the convolution layer of the model to be optimized, and the subsidiary network layer corresponding to the convolution layer; wherein the subsidiary network layer at least includes: a pooling layer and an activation layer; The convolutional layer and the subsidiary network layer corresponding to the convolutional layer are merged into the model operator of the model to be optimized.

6. The method according to any one of claims 1 to 4, characterized in that: The control parameters include: a plurality of sub-model configuration parameters; the configuration search space corresponding to the model to be optimized is determined according to the model operator and the control parameters, including: Using the plurality of sub-model configuration parameters, the spatial structure parameters of each of the model operators are adjusted respectively to obtain a plurality of updated structure parameters corresponding to each of the model operators; A search space formed by a plurality of the updated structural parameters corresponding to each of the model operators is determined as the configuration search space corresponding to the model to be optimized.

7. The method according to any one of claims 1 to 4, characterized in that: The step of training the super model based on the configuration search space and the model to be optimized to obtain a converged super model corresponding to the model to be optimized includes: Determine the copy of the model to be optimized as a teacher model; The following processing is performed by iterating i, , N is the total number of iterations: Sampling the configuration search space for an i-th time to obtain an i-th model configuration information; Using the i-th model configuration information, creating a sub-model corresponding to the i-th model configuration information from the super-model; Based on the teacher model, the sub-model is trained to obtain a converged sub-model corresponding to the i-th model configuration information; When iteration for i is completed, a set of the convergent sub-models corresponding to the N model configuration information is determined as the convergent super-model.

8. The method according to claim 7, characterized in that The training of the sub-model based on the teacher model to obtain a converged sub-model corresponding to the i-th model configuration information includes: Determine a training loss value corresponding to the i-th model configuration information based on a first prediction result of the sub-model on the acquired training data, a second prediction result of the teacher model on the training data, and label information of the training data; The parameters of the sub-model are adjusted using the training loss value corresponding to the i-th model configuration information, and when the parameter adjustment is completed, the converged sub-model corresponding to the i-th model configuration information is obtained.

9. The method according to claim 8, characterized in that The determining, based on the first prediction result of the sub-model on the acquired training data, the second prediction result of the teacher model on the training data, and the label information of the training data, a training loss value corresponding to the i-th model configuration information includes: Performing difference calculation on the first prediction result of the training data and the label information of the training data according to the sub-model to obtain a first difference value; Performing a difference calculation on the first prediction result of the sub-model on the training data and the second prediction result of the teacher model on the training data to obtain a second difference value; A fusion result of the first difference value and the second difference value is determined as the training loss value.

10. The method according to any one of claims 1 to 4, characterized in that: The step of searching from the convergent super model to obtain an optimization model corresponding to the model to be optimized comprises: From the converged super model, selecting a sub-model whose prediction accuracy is the same as that of the model to be optimized as an initial compression model; From the initial compression model, a sub-model whose prediction speed is greater than the prediction speed of the model to be optimized is searched as the optimization model corresponding to the model to be optimized.

11. The method according to any one of claims 1 to 4, characterized in that: The step of searching from the convergent super model to obtain an optimization model corresponding to the model to be optimized comprises: From the converged super model, selecting a sub-model whose prediction speed is the same as that of the model to be optimized as an initial tuning model; From the initial tuning model, a sub-model whose prediction accuracy is greater than the prediction accuracy of the model to be optimized is searched as the optimization model corresponding to the model to be optimized.

12. A model optimization device, characterized in that: The model optimization device comprises: A data acquisition module, used to acquire the model to be optimized and control parameters; the model to be optimized is a trained image classification model; A data encapsulation module, used to determine a super model corresponding to the model to be optimized by encapsulating the model operators in the model to be optimized; wherein the spatial structure of the super model changes dynamically; A space configuration module, used to determine the configuration search space corresponding to the model to be optimized according to the model operator and the control parameter; the model operator includes at least: a network layer in the model to be optimized; A model training module, used for training the super model based on the configuration search space and the model to be optimized to obtain a converged super model corresponding to the model to be optimized; The model search module is used to search for the optimization model corresponding to the model to be optimized from the converged super model.

13. A model optimization device, characterized in that: The model optimization device comprises: A memory for storing executable instructions; A processor is used to implement the model optimization method described in any one of claims 1 to 11 when executing the executable instructions stored in the memory.

14. A computer-readable storage medium storing executable instructions, characterized in that: When the executable instructions are executed by a processor, the model optimization method described in any one of claims 1 to 11 is implemented.

15. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the model optimization method according to any one of claims 1 to 11 is implemented.