Model optimization method and device, computing device and storage medium

By performing a complete training and iterative pruning operation on the machine learning model, and updating parameters by combining the loss functions of the original model and the pruned model, the problem of model pruning complexity and stability in the existing technology is solved, and the model is efficient and lightweight. Quantification and adaptability.

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

Patent Information

Application Number
CN202210218441.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-07
Publication Date
2024-09-27
Estimated Expiration
2042-03-07

AI Technical Summary

Technical Problem

The pruning process of existing machine learning models is complex and requires repeated training, making it difficult to meet the requirements for model stability and high efficiency in application scenarios such as advertising recommendations, especially when data updates are rapid.

Method used

By conducting a complete training of the model to be optimized, retaining the complete parameters of the original model, and performing pruning operations based on the updated original model in each iteration, combining the loss functions of the original model and the pruned model to determine the target loss function, and updating iteratively Model parameters until preset conditions are met.

Benefits of technology

It achieves improved model performance while ensuring the lightweight of the model, reduces the complexity of the pruning process, adapts to the incremental training requirements in online application scenarios, and improves the computational efficiency and stability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114580632B
    Figure CN114580632B
Patent Text Reader

Abstract

A model optimization method and device, a computing device, a storage medium and a program product are disclosed. The model optimization method includes: inputting training data into a model to be optimized to obtain a first output; performing a pruning operation on the model to be optimized to obtain a pruned model; inputting training data into the pruned model to obtain a second output; determining a first loss based on the first output and determining a second loss based on the second output; determining a target loss of the model to be optimized based on at least the first loss and the second loss; and iteratively updating parameters of the model to be optimized based on the target loss of the model to be optimized until the target loss of the model to be optimized meets a preset condition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically to a model optimization method and apparatus, a computing device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development and progress of computer technology and artificial intelligence technology, machine learning has been widely studied and applied in many fields, resulting in the emergence of various machine learning models. However, in the face of higher and higher model performance requirements and the increase in the complexity of the problem, the structure of machine learning models, especially deep learning models (such as deep neural network (DNN) models), has become more and more complex. On the other hand, in application fields such as advertising recommendation (such as coarse ranking), it is usually required that machine learning models are lightweight and computationally efficient to reduce the amount of calculation and network resources while ensuring the necessary performance, thereby achieving a balance between performance and efficiency. Therefore, in order to improve the computing speed of the machine learning model, it is necessary to compress the model (such as pruning) to remove redundancy in the model, simplify the structure of the model, reduce complexity, and improve the efficiency of the model.

[0003] In the model pruning process of related technologies, in order to obtain the performance that may be lost due to the pruning operation, it is usually necessary to repeatedly train the pruned model. This process is very complicated and error-prone, and does not meet the requirements of online application scenarios such as advertising recommendation for model stability and high efficiency, as well as the requirements for incremental training of models due to rapid data updates. Summary of the invention

[0004] The present application provides a model optimization method and apparatus, a computing device, a computer-readable storage medium, and a computer program product, which are expected to alleviate, mitigate, or even eliminate some or all of the above-mentioned problems and other possible problems.

[0005] According to one aspect of the present application, a model optimization method is proposed, including: inputting training data into a model to be optimized to obtain a first output; performing a pruning operation on the model to be optimized to obtain a pruned model; inputting training data into the pruned model to obtain a second output; determining a first loss based on the first output and determining a second loss based on the second output; determining a target loss of the model to be optimized based on at least the first loss and the second loss; and iteratively updating parameters of the model to be optimized based on the target loss of the model to be optimized until the target loss of the model to be optimized meets a preset condition.

[0006] In some embodiments, determining the target loss of the model based on at least the first loss and the second loss includes: determining a third loss based on a difference between the first output and the second output, and determining the target loss of the model based on the first loss, the second loss, and the third loss.

[0007] In some embodiments, determining the target loss of the model based on the first loss, the second loss, and the third loss includes: determining the target loss of the model based on the sum of the first loss, the second loss, and the third loss.

[0008] In some embodiments, the output of the model is a probability distribution, and determining the third loss based on the difference between the first output and the second output includes: determining the third loss based on a relative entropy between the first output and the second output.

[0009] In some embodiments, the model to be optimized includes a first sub-model, wherein inputting training data into the model to be optimized to obtain a first output includes: inputting training data into the first sub-model to obtain a first sub-output; determining the first output based at least on the first sub-output, wherein pruning the model to be optimized to obtain a pruned model includes: pruning the first sub-model based on the absolute value of at least a portion of the parameters in the first sub-model to obtain a second sub-model; determining the pruned model based at least on the second sub-model, and wherein inputting training data into the pruned model to obtain a second output includes: inputting training data into the second sub-model to obtain a second sub-output; determining the second output based at least on the second sub-output.

[0010] In some embodiments, the model includes a third sub-model, wherein determining the first output based at least on the first sub-output includes: inputting the training data into the third sub-model to obtain the third sub-output, determining the first output based on the first sub-output and the third sub-output, and wherein determining the second output based at least on the second sub-output includes: determining the second output based on the second sub-output and the third sub-output.

[0011] In some embodiments, determining the first output based on the first sub-output and the third sub-output includes: determining the first output based on the sum of the first sub-output and the third sub-output, and / or wherein determining the second output based on the second sub-output and the third sub-output includes: determining the second output based on the sum of the second sub-output and the third sub-output.

[0012] In some embodiments, the pruning of the first sub-model based on the absolute value of at least a portion of the parameters in the first sub-model to obtain the second sub-model includes: determining the number N of parameters to be pruned according to a preset pruning percentage and the total number of parameters in the first sub-model, where N is a positive integer; sorting the parameters in the first sub-model from small to large according to the absolute value to obtain a parameter sequence; and pruning the first sub-model based on the first N parameters in the parameter sequence to obtain the second sub-model.

[0013] In some embodiments, the preset pruning percentage is 100%.

[0014] In some embodiments, the first sub-model comprises a nonlinear machine learning model and the third sub-model comprises a linear machine learning model.

[0015] In some embodiments, the first sub-model comprises a deep neural network model.

[0016] In some embodiments, the model comprises a click-through rate prediction model.

[0017] In some embodiments, determining a first loss based on the first output and determining a second loss based on the second output includes: determining the first loss based on a cross entropy of the first output and a label corresponding to the training data; and determining the second loss based on a cross entropy of the second output and the label.

[0018] In some embodiments, the preset condition includes that the target loss of the model to be optimized converges to or is less than a preset loss threshold.

[0019] According to another aspect of the present application, a model optimization device is proposed, comprising: a first input module, configured to input training data into a model to be optimized to obtain a first output; a pruning module, configured to perform a pruning operation on the model to be optimized to obtain a pruned model; a second input module, configured to input training data into the pruned model to obtain a second output; a first determination module, configured to determine a first loss based on the first output and a second loss based on the second output; a second determination module, configured to determine a target loss of the model to be optimized based on at least the first loss and the second loss; and an update module, configured to iteratively update parameters of the model to be optimized based on the target loss of the model to be optimized until the target loss of the model to be optimized meets a preset condition.

[0020] According to another aspect of the present application, a computing device is proposed, comprising: a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor is prompted to execute a model optimization method according to some embodiments of the present application.

[0021] According to another aspect of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed, the model optimization method according to some embodiments of the present application is implemented.

[0022] According to another aspect of the present application, a computer program product is provided, including a computer program, which implements the steps of the model optimization method according to some embodiments of the present application when executed by a processor.

[0023] In the model optimization method and device according to some embodiments of the present application, first, the optimized model is obtained by training the original model to be optimized, so that the complete parameters of the original model are retained, so that it is suitable for model pruning involving incremental training. Secondly, in the model optimization method and device according to some embodiments of the present application, during the model optimization (i.e., training) process, at each iteration, a pruning operation is performed based on the updated original model to obtain a corresponding pruning model, and the target loss function of the model is determined according to the first loss function based on the original model and the second loss function based on the pruning model. The target loss function obtained in this way comprehensively considers the performance loss of the original model and the performance loss of the corresponding pruning model, so that the pruning model (i.e., the optimized model) corresponding to the trained original model obtained thereby is effectively improved (through the above-mentioned model training) under the premise of ensuring that it is lightweight relative to the original model (due to pruning). Thirdly, in the model optimization method and device according to some embodiments of the present application, the optimized model of the original model (i.e., the pruning model corresponding to the trained original model) is obtained only through a complete model training process, without the need to repeatedly train the model multiple times, which reduces the complexity of the pruning process, thereby further adapting to incremental training requirements such as in online application scenarios.

[0024] These and other aspects of the application will be apparent from and elucidated with reference to the embodiments described hereinafter. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The various aspects, features and advantages of the present application will be readily understood from the following detailed description and accompanying drawings, in which:

[0026] Figure 1 Schematically illustrates an example network structure of a machine learning model according to the related art;

[0027] Figure 2 Schematically illustrates an example network structure of a pruned model according to the related art;

[0028] Figure 3 An example implementation environment of a model optimization method according to some embodiments of the present application is schematically shown;

[0029] Figure 4 An example interface schematically illustrates an application scenario of a model optimization method according to some embodiments of the present application;

[0030] Figure 5a A flowchart of a model optimization method according to some embodiments of the present application is schematically shown;

[0031] Figure 5b A flowchart of a model optimization method according to some embodiments of the present application is schematically shown;

[0032] Figure 5c The schematic diagram shows a principle diagram of a model optimization method according to some embodiments of the present application;

[0033] Figure 6a A flowchart of a model optimization method according to some embodiments of the present application is schematically shown;

[0034] Figure 6b The schematic diagram shows a principle diagram of a model optimization method according to some embodiments of the present application;

[0035] Figure 6c The schematic diagram shows a principle diagram of a model optimization method according to some embodiments of the present application;

[0036] Figure 7 An example block diagram schematically shows a model optimization device according to some embodiments of the present application; and

[0037] Figure 8 An example block diagram of a computing device according to some embodiments of the present application is schematically shown.

[0038] It should be noted that the above drawings are merely schematic and illustrative and are not necessarily drawn to scale. DETAILED DESCRIPTION

[0039] Several embodiments of the present application will be described in more detail below with reference to the accompanying drawings so that those skilled in the art can implement the present application. The present application can be embodied in many different forms and purposes and should not be limited to the embodiments described herein. These embodiments are provided to make the present application comprehensive and complete, and to fully convey the scope of the present application to those skilled in the art. The embodiments do not limit the present application.

[0040] It will be understood that, although the terms first, second, third, etc. may be used to describe various elements, components and / or parts in this article, these elements, components and / or parts should not be limited by these terms. These terms are only used to distinguish one element, component or part from another element, component or part. Therefore, the first element, component or part discussed below may be referred to as the second element, component or part without departing from the teaching of the application.

[0041] The terms used herein are only for the purpose of describing specific embodiments and are not intended to limit the application. As used herein, the singular forms "one", "one" and "the" are intended to also include plural forms, unless the context clearly indicates otherwise. It will be further understood that the terms "include" and / or "comprise" specify the existence of the features, integral bodies, steps, operations, elements and / or parts when used in this specification, but do not exclude the existence of one or more other features, integral bodies, steps, operations, elements, parts and / or their groups or add one or more other features, integral bodies, steps, operations, elements, parts and / or their groups. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.

[0042] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art to which this application belongs. It will be further understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and / or this specification, and will not be interpreted in an idealized or overly formal sense, unless explicitly defined as such herein.

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

[0044] 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, teaching learning, active learning and other technologies.

[0045] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, 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.

[0046] Figure 1 An example network structure 100 of a machine learning model according to the related art is schematically shown. Figure 1 As shown, the network structure 100 of the related art model mainly consists of four parts: an embedding layer 101, a linear module 102, a DNN (deep neural network) module 103, and an output unit 104. Figure 1 As shown, during the training or prediction process of the model 100, the sparse features are first input into the embedding layer 101 to be converted into feature vectors that can be directly read by the model; optionally, Figure 1 As shown, the sparse features can also be directly input into the linear module 102. Figure 1 As shown, the linear module 102 has a "memory" capability, which is used to learn low-order cross features between features, where the low-order cross features may include first-order and second-order features; the DNN module 103 can be used to learn high-order cross features between features, and has a "generalization" capability. Finally, as Figure 1 As shown, the final output result of the model 100 is obtained by fusing the low-order and high-order cross-results of each module in the output unit 104. Figure 1 The model network structure 100 shown can be applicable to the project recommendation field, such as the DeepFM model. In the recommendation field model, the sparse features can include, for example, unique ID features of user profiles, project profiles, and context features. Obviously, the main computational effort of the above model 100 is concentrated in the DNN module 103, because Figure 1 As shown in Figure 2, the DNN module involves many parameters, complex calculation methods, and huge amount of calculation. Figure 1 The machine learning model shown in the related art is difficult to adapt to application fields with high requirements on model performance, such as advertising recommendation (e.g., coarse ranking). Therefore, model compression (e.g., pruning) is imperative. That is, while ensuring the necessary performance, the machine learning model is lightweight and computationally efficient to reduce the amount of computation and network resources, thereby achieving a balance between performance and efficiency.

[0047] Figure 2 The exemplary network structure 200 of the pruned model according to the related art is schematically shown. It is difficult to select an optimal sparse network from a dense over-parameterized model using pruning technology. Figure 2 As shown, Model 200 with Figure 1 Compared with the model 100, the structure is basically the same, and the main difference is that the pruned DNN module is Figure 1 The DNN module 103 is simplified compared to the previous one. However, Figure 2 The formation process of the pruning model 200 shown in the related art (i.e., the entire pruning process) is very complicated, and the specific steps include: first, training the original model to provide a good initialization model; then pruning to remove redundant weights (for example, setting parameters less than a certain percentage threshold to 0) to obtain a pruned model; after pruning, training the pruned model (in order to give the wrongly pruned weights a chance to become active again) to obtain a trained pruned model; then, based on the trained pruned model, pruning-training-pruning again, ..., and so on, until the pruned model meets the preset requirements.

[0048] Since the pruning process according to the related art requires repeated training of the model, the pruning process is very complicated and prone to errors. In addition, since all parameters of the original (dense) model to be optimized are not saved during the training process, but the parameters are continuously updated during each training process, it does not meet the incremental training requirements in online application scenarios such as advertising recommendation (e.g., coarse ranking of recommended items).

[0049] In view of the problems that the pruning process of the machine learning model described above is complicated (such as multiple repeated training of the model) and does not meet the requirements of incremental training, the present application provides a model optimization method. The model optimization method according to some embodiments of the present application is based on the following concept: first, the model optimization or pruning is completed by (once) training the original model to be optimized to obtain an optimized model (i.e., the final pruned model), that is, the model optimization method can essentially be considered as a model training method; secondly, during the model training or optimization process, at each iteration, a pruning operation is performed based on the updated original model to obtain a corresponding pruned model (i.e., the pruned model shares some parameters of the original model); thirdly, during the training process, both the original model loss and the pruned model loss are referred to, and the parameters are iteratively updated until the model target loss meets the preset conditions.

[0050] In this way, since the model optimization method according to the present application is actually equivalent to the training method of the original model, the complete parameters of the original model are retained, so that it is suitable for incremental training (such as required for application scenarios such as rough ranking of project recommendations); at the same time, the optimized model of the original model (that is, the pruned model corresponding to the trained original model) is obtained through only one complete model training process. Furthermore, in the model optimization (that is, training) process according to the present application, at each iteration, a pruning operation is performed based on the updated original model to obtain the corresponding pruned model (that is, the pruned model shares some parameters of the original model), so there is no need to train the model separately after each pruning. In addition, the target loss function of the model is determined based on the first loss function based on the original model and the second loss function based on the pruned model, so that in the process of iteratively updating the model parameters based on the target loss function, it is ensured that both the performance loss of the original model (i.e., the performance loss caused by the parameters) and its corresponding pruning loss (the performance loss caused by the pruning operation) are gradually reduced until they tend to be stable or meet the preset requirements, so that the pruned model (i.e., the optimized model) corresponding to the original model obtained after training is effectively improved (through the above model training) under the premise of ensuring that it is lightweight relative to the pre-optimization model (due to pruning). On the one hand, since the pruned model actually shares some parameters of the corresponding original model at each iteration, the performance loss caused by the pruned model parameters is reduced synchronously with the performance loss of the original model. On the other hand, the gradual reduction of the pruning loss also promotes the gradual improvement of the performance of the pruned model.

[0051] Before describing the embodiments of the present application in detail, some related concepts are first explained for the sake of clarity.

[0052] 1. Pruning: refers to a machine learning technique and a way to compress machine learning models. The goal is to develop smaller and more efficient machine learning models (such as deep neural networks). Pruning can include weight pruning, neuron pruning, or other unit pruning. The pruned model runs faster while ensuring appropriate performance, reducing the computational cost of training the network, which is particularly critical when deploying the model to mobile phones or other edge devices.

[0053] 2. Click-Through-Rate (CTR): This is a commonly used term in Internet advertising. It refers to the click-through rate of online advertising (image advertising / text advertising / keyword advertising / ranking advertising / video advertising, etc.), that is, the actual number of clicks on the advertisement (strictly speaking, the number of clicks that reach the target page) divided by the number of impressions of the advertisement.

[0054] 3. KL divergence: Kullback-Leibler divergence or information divergence, also known as relative entropy, is an asymmetric measure of the difference between two probability distributions. In information theory, relative entropy is equivalent to the difference between the Shannon entropy of two probability distributions.

[0055] 4. Area Under Curve (AUC): It is defined as the area under the ROC curve (Receiver Operating Characteristic Curve) and the coordinate axis. The value of this area will not be greater than 1. Since the ROC curve is generally above the straight line y=x, the AUC value usually ranges between 0.5 and 1. The closer the AUC is to 1.0, the higher the authenticity of the detection method.

[0056] Figure 3 An example implementation environment 300 of the model optimization method according to some embodiments of the present application is schematically shown. Figure 3 As shown, the implementation environment 300 may include a terminal device 310, and may optionally include one or more servers 320, and a network 330 for connecting the terminal device 310 and the server 320. In some embodiments, the terminal device 310 may be used to implement the model optimization method according to the present application. For example, the terminal device 310 may be deployed with corresponding programs or instructions for executing the various methods provided in the present application. Optionally, the server 320 and the terminal device 310 may also cooperate with each other to implement the various methods according to the present application. In some embodiments, one or more servers 320 may also be used alone to implement the model optimization method according to the present application.

[0057] The terminal device 310 can be any type of mobile computing device, including a mobile computer (e.g., a personal digital assistant (PDA), a laptop computer, a notebook computer, a tablet computer, a netbook, etc.), a mobile phone (e.g., a cellular phone, such as a Figure 3 The terminal device 310 may be a mobile device such as a smart phone, a wearable computing device (such as a smart watch, a head-mounted device, including smart glasses, etc.) or other types of mobile devices. In some embodiments, the terminal device 310 may also be a fixed computing device, such as a desktop computer, a game console, a smart TV, etc.

[0058] The server 320 may be a single server or a server cluster, or may be a cloud server or cloud server cluster that can provide 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. It should be understood that the servers mentioned herein are typically server computers with large amounts of memory and processor resources, but other embodiments are also possible.

[0059] Examples of network 330 include a local area network (LAN), a wide area network (WAN), a personal area network (PAN), and / or a combination of communication networks such as the Internet. Server 320 and terminal device 310 may include at least one communication interface (not shown) capable of communicating through network 330. Such a communication interface may be one or more of the following: any type of network interface (e.g., a network interface card (NIC)), a wired or wireless (such as an IEEE 802.11 wireless LAN (WLAN)) interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth® interface, or a wireless (such as a Wi-Fi® interface). TM Interface, Near Field Communication (NFC) interface, etc.

[0060] like Figure 3As shown, the terminal device 310 may include a display screen 311 and a terminal application 312 that can interact with the terminal user via the display screen 311. The terminal device 310 may, for example, interact with the server 320 via the network 330, for example, send data to it or receive data from it. The terminal application 312 may be a local application, a web page (Web) application, or a small program (LiteApp, such as a mobile phone small program, WeChat small program) as a lightweight application. In the case where the terminal application 312 is a local application that needs to be installed, the terminal application 312 can be installed in the terminal device 310. In the case where the terminal application 312 is a Web application, the terminal application 312 can be accessed through a browser. In the case where the terminal application 312 is a small program, the terminal application 312 can be directly opened on the terminal device 310 by searching for relevant information of the terminal application 312 (such as the name of the terminal application 312, etc.), scanning a graphic code of the terminal application (such as a barcode, a QR code, etc.), etc., without installing the terminal application 312.

[0061] Figure 4 An example interface 400 of an example application scenario of a model optimization method according to some embodiments of the present application is schematically shown. The model optimization method according to some embodiments of the present application can be applied to, for example, Figure 4 In application scenarios such as the recommended items shown in the figure, the example interface 400 can be used to optimize the machine learning model related to the recommended items. For example, the example interface 400 can be presented on a user's terminal device such as a mobile phone, a tablet computer, a car navigation device, a smart watch, etc., so that the user can view the recommended items. Figure 3 On the display screen 311 of the terminal device 310 shown.

[0062] like Figure 4 As shown in , the example interface 400 of the application scenario of the model optimization method according to some embodiments of the present application may include a recommended item display area 410, which can display various recommended items, such as messages pushed by subscription accounts in WeChat subscription account recommendation scenarios, information about preferred items of store owners / accounts, etc. The title and detailed information of each recommended item (for example, graphic information of the subscription account push message) can be presented in the display area 410. Here, the recommended items are recommended items selected from the candidate recommended items using the model optimized using the model optimization method of the present application. In addition, according to the actual application scenario requirements, the example interface 400 may also alternatively or additionally include other elements or areas.

[0063] It should be understood that the example interface 400 is merely exemplary. In fact, different interfaces can be designed according to actual needs, or recommendations for items can be presented in the form of voice broadcast, text broadcast, etc.

[0064] Figure 5a Schematically shows a flowchart 500a of a model optimization method according to some embodiments of the present application. In some embodiments, the model optimization method according to the present application can be Figure 3 The server 320 or the terminal device 310 is shown to be executed. In other embodiments, the model optimization method according to the present application can also be executed by the server 320 and the terminal device 310 in combination. Figure 5b A flowchart 500b of a model optimization method according to some embodiments of the present application is schematically shown. Figure 5c Schematically shows the Figure 5a and Figure 5b Flowcharts 500a and 500b in the figure correspond to the principle diagram of model optimization according to some embodiments of the present application.

[0065] like Figure 5a As shown, the model optimization method according to some embodiments of the present application may include steps S510 to S560. Steps S510 to S560 are described in detail below:

[0066] At S510 , training data is input into the model to be optimized to obtain a first output.

[0067] According to the concept of the present application, the optimization or pruning of the model can be achieved by training the original model to be optimized, so it is necessary to obtain training data first. The model training data is related to the specific model to be optimized. For example, in a machine learning model for project recommendation application scenarios, the training data may include one-hot type ID features including user profiles, project profiles, and context features.

[0068] In one embodiment, the model to be optimized 501 may be a linear machine learning model or a nonlinear machine learning model, such as a click-through rate (CTR) prediction model; or it may include multiple different sub-models or modules, such as an FM model and a DNN model. In the case where the model to be optimized 501 includes multiple sub-models, the step of inputting the training data into the model to be optimized 501 to obtain the first output may include inputting the training data into each sub-model to obtain multiple sub-outputs, and then determining the first output based on the multiple sub-outputs, or the training data may be input only into the sub-model to be pruned (such as a DNN with higher complexity) to determine the first output based on its sub-outputs (i.e., the outputs of other lightweight models other than the DNN are not considered, thereby reducing the amount of calculation).

[0069] At S520, a pruning operation is performed on the model to be optimized to obtain a pruned model.

[0070] Model pruning is a way of model compression, so the model pruning process can also be called a compression or simplification process. As those skilled in the art understand, pruning includes but is not limited to weight pruning, neuron pruning, and other unit pruning. In this article, weight pruning can be used, which can achieve high sparsity and computational acceleration without calling a special library. Optionally, other structured pruning methods, such as neuron pruning, etc. can also be used. Figure 5c As shown, the model to be optimized 501 is processed by pruning operation to obtain a pruned model 504, wherein the specific weight pruning method and strategy can be based on the importance of the model weight or parameter for pruning. For example, the pruning operation on the model to be optimized can be performed according to the absolute value of the parameter to determine which parameters in the model to be optimized are pruned, because the absolute value reflects the importance of the parameter in the model to a certain extent. More specifically, several parameters with the smallest absolute value, such as the smallest 100 parameters, or the smallest N parameters can be pruned in the model to be optimized 501, where N is determined based on a preset pruning percentage or a pruning ratio n%. For example, the model to be optimized includes 1000 parameters, wherein the preset pruning percentage is 50% (i.e., n=50), then the number of pruned parameters N=1000*50%=500.

[0071] In one embodiment, pruning the model to be optimized to obtain a pruned model may include: presetting a pruning percentage, combining the total number of parameters in the model to be optimized, determining the number N of parameters to be pruned, where N is a positive integer; sorting the parameters in the model to be optimized from small to large according to their absolute values ​​to obtain a parameter sequence; and pruning the model to be optimized based on the first N parameters in the parameter sequence to obtain a pruned model. Since the parameters with smaller absolute values ​​in the model parameters are often less important or play a smaller role in the model, pruning these parameters will have less impact on the accuracy and performance of the model.

[0072] In one embodiment, the preset pruning percentage or ratio can be pre-set according to the specific situation (such as a specific application scenario, etc.), for example, it can be set to any value between 30% and 100%. As understood by those skilled in the art, the pruning percentage or ratio is not limited to the above-mentioned values. When the model to be optimized includes multiple sub-models, the preset pruning percentage or ratio can be set to the extreme case of 100%, that is, one or more sub-models (such as a deep neural network DNN) are completely pruned, as long as at least one sub-model is left. For example, in the case where the model to be optimized includes linear and nonlinear machine learning sub-models, the model structure can be simplified by pruning the non-linear sub-model, so that only the linear sub-model part needs to be calculated during prediction, which can further significantly reduce the amount of calculation during prediction.

[0073] At S530 , the training data is input into the pruning model to obtain a second output.

[0074] The pruned model contains fewer parameters, so the amount of calculation is reduced. Figure 5c As shown in , after the same training data as in step S510 is input into the pruned model 504, a second output 505 predicted by the pruned model is obtained. It is worth noting that the complete parameters of the model to be optimized 501 and the parameters of the pruned model 504 after pruning it are retained at the same time. The pruned model 504 shares some parameters of the original model 501. The second output 505 is used to calculate the pruning loss (i.e., the second loss 507 in the following text), so that the pruning loss is combined with the model loss (i.e., the first loss 506) to determine the target loss.

[0075] At S540 , a first loss 506 is determined based on the first output 502 and a second loss 507 is determined based on the second output 505 .

[0076] In supervised machine learning, the loss function can be determined by the difference between the output result obtained by inputting the training data into the model and the label corresponding to the training data, so as to iteratively update the parameters to make the model output as close to the label as possible. Step S540 may include: calculating the cross entropy loss function between the first output 502 and the true label in the training data set as the first loss; calculating the cross entropy loss function between the second output and the true label in the training data set as the second loss.

[0077] At S550 , a target loss of the model to be optimized is determined based on at least the first loss 506 and the second loss 507 .

[0078] In one embodiment, determining the target loss of the model based at least on the first loss 506 and the second loss 507 is achieved by adding the first loss 506 and the second loss 507. The target loss represents the loss of the entire model, that is, simultaneously satisfying that the first output 502 of the model to be optimized 501 is as close to the true label as possible, and the second output 505 of the pruned network 504 is as close to the true label as possible. The target loss function obtained in this way comprehensively considers the performance loss of the model to be optimized 501 and the performance loss of the corresponding pruned model, so that in the process of iteratively updating the model parameters based on the target loss function, it is ensured that both the original model performance loss (i.e., the performance loss caused by the parameters) and its corresponding pruning loss (the performance loss caused by the pruning operation) are gradually reduced until they tend to be stable or meet the preset requirements.

[0079] At S560, based on the target loss of the model to be optimized 501, the parameters of the model to be optimized are iteratively updated until the target loss of the model to be optimized meets a preset condition.

[0080] After obtaining the target loss, the parameters can be updated based on the target loss, and then the model to be optimized based on the updated parameters repeatedly iterates and executes steps S510-S550 until the target loss of the model to be optimized meets the preset optimization end condition, such as being stable or less than a certain threshold. In this way, since the target loss is based on the first loss of the model to be optimized (i.e., performance loss) and the second loss of the corresponding pruned model (i.e., pruning loss), the performance of the optimized model obtained by training (i.e., the pruned model corresponding to the final trained model to be optimized) is effectively improved while ensuring that it is lightweight relative to the original model.

[0081] In some embodiments, the preset condition may include that the target loss of the model to be optimized converges or is less than a preset loss threshold.

[0082] exist Figure 5a In the model optimization method according to some embodiments of the present application, first, the optimized model is obtained by training the original model to be optimized, so that the complete parameters of the original model are retained, which is suitable for model pruning involving incremental training. Secondly, in the model optimization method and device of some embodiments of the present application, during the model optimization (i.e., training) process, at each iteration, a pruning operation is performed based on the updated original model to obtain a corresponding pruning model, and the target loss function of the model is determined according to the first loss function based on the original model and the second loss function based on the pruning model. The target loss function obtained in this way comprehensively considers the performance loss of the original model and the performance loss of the corresponding pruning model, so that the pruning model (i.e., the optimized model) corresponding to the trained original model obtained thereby is effectively improved (through the above-mentioned model training) under the premise of ensuring that it is lightweight relative to the original model (due to pruning). Thirdly, in the model optimization method and device according to some embodiments of the present application, the optimized model of the original model (i.e., the pruning model corresponding to the trained original model) is obtained only through a complete model training process, without the need to repeatedly train the model multiple times, which reduces the complexity of the pruning process, thereby further adapting to incremental training requirements such as in online application scenarios.

[0083] like Figure 5b As shown in , in one embodiment, method 500b may replace step S550 in method 500a with steps S550a and S550b.

[0084] At step S550a , a third loss 508 is determined based on a difference between the first output 502 and the second output 505 .

[0085] In some embodiments, the difference between the first output 502 and the second output 505 can be determined according to the data type of the output results of the two. Generally, the first output 502 and the second output 505 can usually be binary classification probabilities (i.e., probability distributions), so the difference can be achieved by calculating the relative entropy (e.g., KL divergence) between the first output 502 and the second output 505.

[0086] In step S550b, the target loss of the model to be optimized is determined based on the first loss 506, the second loss 507, and the third loss 508.

[0087] In one embodiment, determining the target loss of the model to be optimized based on the first loss 506, the second loss 507, and the third loss 508 includes: determining the target loss of the model based on the sum of the first loss 506, the second loss 507, and the third loss 508. Thus, the target loss represents the loss of the entire model, that is, simultaneously satisfying that the first output 502 of the model to be optimized 501 is as close to the true label as possible, the second output 505 of the pruned model pruning network 504 is as close to the true label as possible, and the first output 502 and the second output 505 are as close as possible.

[0088] The above-mentioned model optimization method simultaneously retains the complete parameters of the model to be optimized 501 and the parameters of the pruned model 504 after pruning it (removing the n% of the parameters with the smallest absolute value) during the training process. In the prediction process, it is not necessary to calculate the complete model to be optimized 501, thereby greatly reducing the amount of calculation. The complete parameters of the model to be optimized 501 are retained, which can meet the requirements of incremental training. A strategy of judging whether to prune according to the absolute value of the parameters is adopted to simplify most of the calculation amount in the model (the first sub-model). Specifically, in each hidden layer of the first sub-model, the n% of the parameters with the smallest absolute value will be pruned. The part with the smallest absolute value in the parameters also has the smallest effect on the network, so it has the smallest impact on the accuracy and effectiveness of the model prediction. It is ensured that the effectiveness of the rough-line model after pruning is close to or equal to that of the initial complex rough-line model. By establishing a reasonable loss function, an efficient and elegant model optimization method is achieved. The first loss in the target loss makes the output of the first sub-model as consistent as possible with the training data label, the second loss makes the output of the second sub-model as consistent as possible with the training data label, and the third loss makes the output of the first sub-model and the pruned second sub-model as consistent as possible. This model optimization method only needs one training and does not need to be repeatedly trained, so that complex models such as DNN can be pruned into lightweight models under the requirements of incremental training. In the case of extreme pruning, only the linear part of the model to be optimized is used for prediction, and the time consumed for prediction has been significantly reduced. At the same time, the overall prediction effect is less affected and can be ignored. In this way, only one training is required and no repeated training is required. The amount of calculation and the time consumed for calculation are greatly reduced while maintaining the model effect and performance, thereby meeting the efficiency and performance requirements of the model in online application scenarios such as recommended projects, thereby meeting the user's good experience requirements while maximizing the display benefits of recommended projects.

[0089] Figure 6a The flowchart of the model optimization method 600a according to some embodiments of the present application is schematically shown. Figure 6a As shown, except for Figure 5a In addition to the same steps S540-S560, the model optimization method according to some embodiments of the present application may further include sub-steps S510a~S510b of step S510, sub-steps S520a and S520b of step S520, and sub-steps S530a~S530b of step S530. Figure 6b Schematically shows the Figure 6a Schematic diagram 600b corresponding to the model optimization method 600a according to some embodiments of the present application.

[0090] In one embodiment, the method 600a further includes steps S510a and S510b.

[0091] At step S510a, training data is input into the first sub-model 601 to obtain a first sub-output.

[0092] At step S510b, a first output 602 is determined based on at least the first sub-output.

[0093] In one embodiment, the model to be optimized 609 only includes the first sub-model 601. In this case, the first output may only include the first sub-output.

[0094] In another embodiment, Figure 6b As shown in the dashed box, the model to be optimized 609 also includes a third sub-model 603 in addition to the first sub-model 601. For example, the third sub-model 603 can be a linear machine learning model, which is used to learn low-order cross (first-order and second-order) features between training data features and has "memory" capabilities. Specifically, the linear machine learning model may include a first linear machine learning model for learning first-order features between training data features and a second linear machine learning model for learning second-order features between training data features. In this embodiment, the method 600a also includes step S510c, inputting the training data into the third sub-model 603 to obtain a third sub-output. The method 600a also includes step S510d, determining the first output 602 based on the first sub-output and the third sub-output. Optionally, determining the first output based on the first sub-output and the third sub-output includes determining the first output 602 based on the sum of the first sub-output and the third sub-output. The first output 602 is typically a binary probability.

[0095] In one embodiment, the method 600a further includes steps S520a and S520b.

[0096] At step S520a, the first submodel 601 is pruned based on the absolute value of at least a portion of the parameters in the first submodel 601 to obtain the second submodel 604. Specifically, the pruning percentage for the parameters in the first submodel 601 is preset, and the number N of parameters to be pruned is determined in combination with the total number of parameters in the model, where N is a positive integer; the parameters in the first submodel 601 are sorted from small to large according to the absolute value to obtain a parameter sequence; based on the first N parameters in the parameter sequence, the first submodel 601 is pruned to obtain the second submodel 604.

[0097] At step S520b, the pruned model 610 is determined based on at least the second sub-model 604. In some embodiments, the pruned model 610 may include only the second sub-model 604.

[0098] In other embodiments, Figure 6bAs shown in the dashed box, the pruned model 610 may also include other sub-models besides the second sub-model 604. The other sub-models included in the model may be pruned by a similar pruning method, and the pruned model may be determined based on the second sub-model 604 and the other pruned models.

[0099] In one embodiment, the method 600a further includes steps S530a and S530b.

[0100] At step S530a, the training data is input into the second sub-model 604 to obtain a second sub-output.

[0101] At step S530b, a second output 605 is determined based on at least the second sub-output.

[0102] In one embodiment, the second output 605 is equal to the second sub-output.

[0103] In one embodiment, the model to be optimized 609 also includes a third sub-model 603. And the method 600a also includes step S530c, determining the second output based on the second sub-output and the third sub-output. The third sub-output is calculated in the above step S510c by inputting the training data into the third sub-model 603. As described above, the third sub-model 603 can be a linear machine learning model, which is used to learn the low-order cross (first-order and second-order) features between the training data features and has "memory" capabilities. When the model to be optimized 609 includes a third sub-model for calculating the linear features of the training data, the training data is first input into the third sub-model to obtain the third sub-output. Then the second output 605 is determined based on the second sub-output and the third sub-output. Optionally, based on the second sub-output t Determining the second output 605 from the third sub-output includes: determining the second output 605 based on the sum of the second sub-output and the third sub-output. The second output 605 is usually a binary probability.

[0104] The description of steps S540-S560 is the same as Figure 5a The above is similar to the above, so I will not repeat it here.

[0105] In one embodiment, the first sub-model may adopt a deep neural network DNN model. The computational complexity of the model to be optimized is mainly concentrated in the DNN model part because the DNN model contains a large number of hidden layers, many neurons and a large number of parameters. Therefore, pruning the DNN model is more profitable. In one embodiment, the second sub-model may adopt a Wide&FM model, which includes a first linear machine learning model (Wide model) for learning first-order features between training data features and a second linear machine learning model (FM model) for learning second-order features between training data features. As understood by those skilled in the art, the first sub-model may adopt other machine learning network models, and the second sub-model may be other models for calculating linear features of data.

[0106] Figure 6c The schematic diagram 600c of the model optimization method according to some embodiments of the present application is shown. FIG600c shows the situation under extreme pruning conditions. Figure 6b Compared with the network structure shown in Figure 6c , the first submodel 601 is completely removed, which corresponds to the limit case where the preset pruning percentage or ratio of the first submodel in the model to be optimized is 100%, that is, the first submodel (such as the deep neural network DNN) is completely pruned, so that the model to be optimized after pruning only includes the structure of the model to be optimized except the first submodel, that is, the third submodel 603. At this time, Figure 6c The second output 605 shown only relates to the third sub-output of the third sub-model 603. This further significantly reduces the amount of calculation.

[0107] like Figure 6c As shown, the network structure corresponds to the following method steps: inputting training data into the first sub-model 601 to obtain a first sub-output; inputting the training data into the third sub-model 603 to obtain a third sub-output; determining the first output 602 based on the first sub-output and the third sub-output; determining the first loss 606 based on the first output 602 and the corresponding labels of the training data; determining the second loss 607 based on the second output 605 and the corresponding labels of the training data; determining the target loss based on the first loss 606 and the second loss 607, and iteratively updating the parameters of the model to be optimized based on the target loss of the model to be optimized until the target loss of the model to be optimized meets the preset conditions.

[0108] Alternatively, if Figure 6c As shown, a third loss 608 may also be determined based on the difference between the first loss 606 and the second loss 607 , and a target loss may be determined based on the first loss 606 , the second loss 607 , and the third loss 608 .

[0109] In the case where the model to be optimized includes the first sub-model, the pruning percentage is pre-set, and the number of parameters to be pruned N is determined in combination with the total number of parameters in the model, where N is a positive integer; the parameters in the first sub-model are sorted from small to large according to the absolute value to obtain a parameter sequence; based on the first N parameters in the parameter sequence, the first sub-model is pruned to obtain the second sub-model. In the case of extreme pruning, the preset pruning percentage is 100%. Extreme pruning greatly reduces the amount of calculation and speeds up the calculation time of prediction in the recommendation model. At the same time, the performance is significantly improved compared to the case where the linear model is directly used without training.

[0110] Table 1 schematically shows a comparison of the effects of the related technology model and the optimized model obtained according to the model optimization method of some embodiments of the present application. The model optimization method proposed in the present application has been rigorously proved by experiments that the optimized model obtained according to the model optimization method of some embodiments of the present application is compressed or lightweight, and the accuracy or performance is not reduced. In Table 1, for example, the related technology model 1 can be a Wide&FM model, the related technology model 2 can be a DeepFM model, and the optimized model obtained according to the model optimization method of the present application can be optimized for the related technology model 2. In Table 1, when the preset pruning percentage n%=100%, the optimized model according to some embodiments of the present application will become an extreme pruning model. Experiments show that when the extreme pruning model according to some embodiments of the present application is applied to online coarse ranking modules such as project recommendation, the recommendation time of the model is significantly reduced.

[0111] Table 1

[0112]

[0113] In an example, the computational effort of the extreme pruning model is analyzed as follows:

[0114] Set 30 feature groups, the embedding size is 128, the DNN-dims is 512-256-128-64, the average feature ID of each instance is 400, the number of parameters of the model to be optimized is 30*30+30+128*30+30+256*400+256*30+128*30*512+512*256+256*128+128*64+64=2253156, the number of parameters of the model after completely pruning the DNN in the model to be optimized (i.e., the extreme pruning model) is 30*30+30+128*30+30+256*400+256*30+128*30=118720, and the amount of computation is reduced by nearly 95%.

[0115] Figure 7 An example block diagram of a model optimization device 700 according to some embodiments of the present application is schematically shown. Figure 7As shown, the model optimization device 700 includes: a first input module 710, configured to input training data into the model to be optimized to obtain a first output; a pruning module 720, configured to perform a pruning operation on the model to be optimized to obtain a pruned model; a second input module 730, configured to input training data into the pruned model to obtain a second output; a first determination module 740, configured to determine a first loss based on the first output and a second loss based on the second output; a second determination module 750, configured to determine a target loss of the model to be optimized based on at least the first loss and the second loss; an updating module 760, configured to iteratively update the parameters of the model to be optimized based on the target loss of the model to be optimized until the target loss of the model to be optimized meets a preset condition.

[0116] First, the above-mentioned model optimization device obtains an optimized model (i.e., the final pruned model) by training the original model to be optimized, thereby retaining the complete parameters of the original model, so that it is suitable for incremental training (required for application scenarios such as rough ranking of item recommendations). Secondly, in the model optimization method and device of some embodiments of the present application, during the model optimization (i.e., training) process, at each iteration, a pruning operation is performed based on the updated original model to obtain a corresponding pruning model (i.e., the pruning model shares some parameters of the original model), and at the same time, the target loss function of the model is determined according to a first loss function based on the original model and a second loss function based on the pruning model. The target loss function obtained in this way comprehensively considers the performance loss of the original model and the performance loss of the corresponding pruning model, so that in the process of iteratively updating the model parameters based on the target loss function, it is ensured that both the performance loss of the original model (i.e., the performance loss caused by the parameters) and its corresponding pruning loss (the performance loss caused by the pruning operation) are gradually reduced until they tend to be stable or meet the preset requirements, so that the pruning model (i.e., the optimized model) corresponding to the trained original model obtained in this way is effectively improved in performance (through the above-mentioned model training) under the premise of ensuring that it is lightweight relative to the model before optimization (due to pruning) (on the one hand, since at each iteration, the pruning model actually shares some parameters of the corresponding original model, the performance loss caused by the pruning model parameters is synchronously reduced with the performance loss of the original model, and on the other hand, the gradual reduction of the pruning loss also prompts the performance of the pruned model to be gradually improved). Again, in the model optimization methods and devices according to some embodiments of the present application, the optimized model of the original model (i.e., the pruned model corresponding to the trained original model) is obtained through only one complete model training process (i.e., the original model is trained, and the parameters are updated by referring to the loss of the original model and the loss of the model after pruning), without the need to repeatedly train the model multiple times, thereby reducing the complexity of the pruning process, thereby further adapting to incremental training requirements in scenarios such as online applications.

[0117] Figure 8 An example block diagram of a computing device 800 according to some embodiments of the present application is schematically shown. The computing device 800 may represent a device for implementing the various means or modules described herein and / or performing the various methods described herein. The computing device 800 may be, for example, a server, a desktop computer, a laptop computer, a tablet, a smart phone, a smart watch, a wearable device, or any other suitable computing device or computing system, which may include various levels of devices ranging from full-resource devices with a large amount of storage and processing resources to low-resource devices with limited storage and / or processing resources. In some embodiments, the above description of the computing device 800 may be a computer system that can be used to implement the various means or modules described herein and / or perform the various methods described herein. Figure 7 The described model optimization apparatus 700 may be implemented in one or more computing devices 800 , respectively.

[0118] like Figure 8 As shown, the example computing device 800 includes a processing system 801, one or more computer-readable media 802, and one or more I / O interfaces 803 that are communicatively coupled to each other. Although not shown, the computing device 800 may also include a system bus or other data and command transmission system that couples various components to each other. The system bus may include any one or combination of different bus structures, such as a memory bus or memory controller, a peripheral bus, a universal serial bus, and / or a processor or local bus that utilizes any of a variety of bus architectures. Alternatively, other components such as control and data lines may also be included.

[0119] Processing system 801 represents the functionality of performing one or more operations using hardware. Thus, processing system 801 is illustrated as including hardware elements 804 that may be configured as processors, functional blocks, and the like. This may include other logic devices implemented in hardware as application specific integrated circuits or formed using one or more semiconductors. Hardware elements 804 are not limited by the materials from which they are formed or the processing mechanisms employed therein. For example, a processor may be composed of (multiple) semiconductors and / or transistors (e.g., electronic integrated circuits (ICs)). In such a context, processor executable instructions may be electronic executable instructions.

[0120] The computer-readable medium 802 is illustrated as including a memory / storage device 805. The memory / storage device 805 represents a memory / storage device associated with one or more computer-readable media. The memory / storage device 805 may include volatile media (such as random access memory (RAM)) and / or non-volatile media (such as read-only memory (ROM), flash memory, optical disk, magnetic disk, etc.). The memory / storage device 805 may include fixed media (e.g., RAM, ROM, fixed hard drive, etc.) and removable media (e.g., flash memory, removable hard drive, optical disk, etc.). Exemplarily, the memory / storage device 805 can be used to store the various data mentioned in the above embodiments, such as training data, etc. The computer-readable medium 802 can be configured in various other ways as further described below.

[0121] One or more I / O (input / output) interfaces 803 represent functions that allow a user to enter commands and information into the computing device 800 and also allow information to be displayed to the user and / or sent to other components or devices using various input / output devices. Examples of input devices include keyboards, cursor control devices (e.g., mice), microphones (e.g., for voice input), scanners, touch functions (e.g., capacitive or other sensors configured to detect physical touch), cameras (e.g., visible or invisible wavelengths (such as infrared frequencies) can be used to detect motion that does not involve touch as gestures), network cards, receivers, and the like. Examples of output devices include display devices, speakers, printers, tactile response devices, network cards, transmitters, and the like. Exemplarily, in the embodiments described above, users can input through the input interfaces on their respective terminal devices to initiate requests and record audio and / or video, etc., and can view recommended items through output interfaces, such as watching videos or listening to audio, etc.

[0122] The computing device 800 also includes a model optimization strategy 806. The model optimization strategy 806 can be stored in the memory / storage device 805 as a computing program instruction, or can be hardware or firmware. The model optimization strategy 806 can be implemented together with the processing system 801, etc. Figure 7 The entire functions of each module of the model optimization device 700 are described.

[0123] Various techniques may be described herein in the general context of software, hardware, elements, or program modules. Typically, these modules include routines, programs, objects, elements, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The terms "module," "function," etc., as used herein, generally represent software, firmware, hardware, or a combination thereof. The features of the techniques described herein are platform-independent, meaning that these techniques can be implemented on a variety of computing platforms with a variety of processors.

[0124] An implementation of the described modules and techniques may be stored on or transmitted across some form of computer-readable media. Computer-readable media may include various media accessible by computing device 800. By way of example and not limitation, computer-readable media may include “computer-readable storage media” and “computer-readable signal media”.

[0125] In contrast to a simple signal transmission, carrier wave, or signal itself, "computer-readable storage medium" refers to a medium and / or device capable of persistently storing information, and / or a tangible storage device. Therefore, a computer-readable storage medium refers to a non-signal-bearing medium. Computer-readable storage media include hardware such as volatile and non-volatile, removable and non-removable media and / or storage devices implemented in a method or technology suitable for storing information (such as computer-readable instructions, data structures, program modules, logic elements / circuits, or other data). Examples of computer-readable storage media may include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical storage device, hard disk, cassette, magnetic tape, magnetic disk storage device or other magnetic storage device, or other storage device, tangible medium, or article of manufacture suitable for storing desired information and accessible by a computer.

[0126] "Computer readable signal media" refers to signal bearing media that is configured to send instructions to the hardware of computing device 800, such as via a network. Signal media typically can embody computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, data signal, or other transmission mechanism. Signal media also includes any information transfer media. By way of example and not limitation, signal media include wired media such as a wired network or direct connection and wireless media such as acoustic, RF, infrared, and other wireless media.

[0127] As previously described, hardware elements 804 and computer-readable media 802 represent instructions, modules, programmable device logic, and / or fixed device logic implemented in hardware form, which in some embodiments can be used to implement at least some aspects of the technology described herein. Hardware elements can include integrated circuits or systems on a chip, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), complex programmable logic devices (CPLDs), and other implementations in silicon or components of other hardware devices. In this context, hardware elements can be used as processing devices for executing program tasks defined by instructions, modules, and / or logic embodied by hardware elements, as well as hardware devices for storing instructions for execution, such as the computer-readable storage media described previously.

[0128] The aforementioned combination may also be used to implement various techniques and modules described herein. Therefore, software, hardware or program modules and other program modules may be implemented as one or more instructions and / or logic embodied on some form of computer-readable storage medium and / or by one or more hardware elements 804. The computing device 800 may be configured to implement specific instructions and / or functions corresponding to the software and / or hardware modules. Therefore, for example, by using a computer-readable storage medium and / or hardware element 804 of a processing system, a module may be implemented as a module executable by the computing device 800 as software, at least in part, in hardware. Instructions and / or functions may be executed / operable by, for example, one or more computing devices 800 and / or processing systems 801 to implement the techniques, modules and examples described herein.

[0129] The techniques described herein may be supported by these various configurations of computing device 800 and are not limited to the specific examples of the techniques described herein.

[0130] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer program. For example, an embodiment of the present application provides a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing at least one step in the method embodiment of the present application.

[0131] In some embodiments of the present application, one or more computer-readable storage media are provided, on which computer-readable instructions are stored, and the computer-readable instructions, when executed, implement the model optimization method according to some embodiments of the present application. The various steps of the model optimization method described in some embodiments of the present application can be converted into computer-readable instructions through programming, thereby storing them in a computer-readable storage medium. When such a computer-readable storage medium is read or accessed by a computing device or a computer, the computer-readable instructions therein are executed by a processor on the computing device or the computer to implement the method described in some embodiments of the present application.

[0132] In the description of this specification, the description of the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradicting each other.

[0133] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code that includes one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the optional embodiments of the present application includes additional implementations in which functions may not be performed in the order shown or discussed (including in a substantially simultaneous manner or in reverse order depending on the functions involved), which should be understood by technicians in the technical field to which the embodiments of the present application belong.

[0134] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0135] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combinational logic gate circuit, a programmable gate array (Programmable Gate Array), a field programmable gate array (Field Programmable Gate Array), etc.

[0136] A person skilled in the art may understand that all or part of the steps of the above-mentioned embodiment method may be completed by hardware associated with program instructions, and the program may be stored in a computer-readable storage medium, which, when executed, includes executing one or a combination of the steps of the method embodiment.

[0137] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0138] It is understandable that in the specific implementation of this application, user operation behavior data, etc. are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

Claims

1. A project recommendation model optimization method, comprising: Acquire training data for an item recommendation model and a corresponding recommendation result label, wherein the training data includes unique-hot type ID features including user profiles, item profiles, and context features, and the recommendation result label includes graphic and text information of the recommended item; input the training data into the item recommendation model to be optimized to obtain a first recommendation result, wherein the item recommendation model to be optimized includes a first sub-model; Performing a pruning operation on the item recommendation model to be optimized to obtain a pruned item recommendation model; Inputting the training data into the pruned item recommendation model to obtain a second recommendation result; Determine a first loss based on the first recommendation result and the recommendation result label and determine a second loss based on the second recommendation result and the recommendation result label; Determining a target loss of the item recommendation model to be optimized based at least on the first loss and the second loss; Based on the target loss of the item recommendation model to be optimized, the parameters of the item recommendation model to be optimized are iteratively updated until preset conditions are met. The step of inputting the training data into the item recommendation model to be optimized to obtain a first recommendation result includes: Inputting the training data into the first sub-model to obtain a first sub-recommendation result; determining a first recommendation result based at least on the first sub-recommendation result, The step of performing a pruning operation on the item recommendation model to be optimized to obtain a pruned item recommendation model includes: Pruning the first sub-model based on the absolute values ​​of at least a portion of the parameters in the first sub-model to obtain a second sub-model; determining the pruned item recommendation model based at least on the second sub-model, and The step of inputting the training data into the pruned item recommendation model to obtain a second recommendation result includes: Inputting the training data into the second sub-model to obtain a second sub-recommendation result; A second recommendation result is determined based at least on the second sub-recommendation result.

2. The method of claim 1, wherein determining the target loss of the item recommendation model to be optimized based at least on the first loss and the second loss comprises: determining a third loss based on a difference between the first recommendation result and the second recommendation result, The target loss of the item recommendation model to be optimized is determined based on the first loss, the second loss, and the third loss.

3. The method of claim 2, wherein determining the target loss of the item recommendation model to be optimized based on the first loss, the second loss, and the third loss comprises: Based on the sum of the first loss, the second loss and the third loss, a target loss of the item recommendation model to be optimized is determined.

4. The method of claim 2, wherein the first recommendation result and the second recommendation result are probability distributions, and the determining the third loss based on the difference between the first recommendation result and the second recommendation result comprises: The third loss is determined based on the relative entropy between the first recommendation result and the second recommendation result.

5. The method according to claim 1, wherein the item recommendation model to be optimized includes a third sub-model, The determining of the first recommendation result at least based on the first sub-recommendation result comprises: Input the training data into the third sub-model to obtain a third sub-recommendation result, Based on the first sub-recommendation result and the third sub-recommendation result, determining a first recommendation result, and The determining of the second recommendation result at least based on the second sub-recommendation result comprises: A second recommendation result is determined based on the second sub-recommendation result and the third sub-recommendation result.

6. The method of claim 5, wherein determining the first recommendation result based on the first sub-recommendation result and the third sub-recommendation result comprises: Determine a first recommendation result based on the sum of the first sub-recommendation result and the third sub-recommendation result, and / or The determining of the second recommendation result based on the second sub-recommendation result and the third sub-recommendation result includes: determining the second recommendation result based on the sum of the second sub-recommendation result and the third sub-recommendation result.

7. The method of claim 1, wherein pruning the first sub-model based on the absolute values ​​of at least a portion of parameters in the first sub-model to obtain the second sub-model comprises: Determine the number N of parameters to be pruned according to a preset pruning percentage and the total number of parameters in the first sub-model, where N is a positive integer; Arrange the parameters in the first sub-model in ascending order according to their absolute values ​​to obtain a parameter sequence; Based on the first N parameters in the parameter sequence, the first sub-model is pruned to obtain the second sub-model. The method according to claim 7 , wherein the preset pruning percentage is 100%.

9. The method of claim 5, wherein the first sub-model comprises a nonlinear machine learning model and the third sub-model comprises a linear machine learning model.

10. The method of claim 9, wherein the first sub-model comprises a deep neural network model.

11. The method according to claim 9 or 10, wherein the item recommendation model to be optimized comprises a click-through rate prediction model.

12. The method of claim 1, wherein determining a first loss based on the first recommendation result and the recommendation result label and determining a second loss based on the second recommendation result and the recommendation result label comprises: Determine a first loss based on a cross entropy between the first recommendation result and the recommendation result label; as well as A second loss is determined based on a cross entropy between the second recommendation result and the recommendation result label.

13. The method of claim 1, wherein the preset condition includes that the target loss of the item recommendation model to be optimized converges to or is less than a preset loss threshold.

14. A project recommendation model optimization device, comprising: An acquisition module configured to acquire training data for an item recommendation model and a corresponding recommendation result label, wherein the training data includes a unique-hot type ID feature including a user profile, an item profile, and a context feature, and the recommendation result label includes graphic and text information of the recommended item; A first input module is configured to input the training data into the to-be-optimized item recommendation model to obtain a first recommendation result, wherein the to-be-optimized item recommendation model includes a first sub-model, wherein inputting the training data into the to-be-optimized item recommendation model to obtain the first item recommendation result comprises: inputting the training data into the first sub-model to obtain a first sub-recommendation result, and determining the first recommendation result based at least on the first sub-recommendation result; A pruning module, configured to perform a pruning operation on the item recommendation model to be optimized to obtain a pruned item recommendation model, wherein the pruning operation on the item recommendation model to be optimized to obtain the pruned item recommendation model comprises: pruning the first sub-model based on the absolute value of at least a part of the parameters in the first sub-model to obtain a second sub-model, and determining the pruned item recommendation model based at least on the second sub-model; a second input module configured to input the training data into the pruned item recommendation model to obtain a second recommendation result, wherein the inputting the training data into the pruned item recommendation model to obtain the second recommendation result comprises: inputting the training data into a second sub-model to obtain a second sub-recommendation result, and determining the second recommendation result based at least on the second sub-recommendation result; A first determination module configured to determine a first loss based on a first recommendation result and the recommendation result label and to determine a second loss based on a second recommendation result and the recommendation result label; A second determination module, configured to determine a target loss of the item recommendation model to be optimized based at least on the first loss and the second loss; An updating module is configured to iteratively update the parameters of the item recommendation model to be optimized based on the target loss of the item recommendation model to be optimized until a preset condition is met.

15. A computing device comprising: Memory and processor, A computer program is stored in the memory, and when the computer program is executed by the processor, the processor is prompted to perform the method according to any one of claims 1 to 13.

16. A computer-readable storage medium storing computer-readable instructions, wherein the computer-readable instructions implement the method according to any one of claims 1 to 13 when executed.

17. A computer program product comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 13.