A neural network distillation method and apparatus
By using a combination of biased and unbiased datasets in neural network training and selecting a highly adaptive distillation method, the bias of the student model is reduced, and the output accuracy and generalization ability are improved, thus solving the problem of inaccurate output of the student network.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-24
- Publication Date
- 2026-03-24
AI Technical Summary
In existing technologies, there is a bias when training the student network, which leads to inaccurate output results. Furthermore, the accuracy of the student network is limited by the accuracy of the teacher network and cannot be further improved.
By acquiring biased and unbiased datasets, the teacher model is trained using the unbiased dataset, and appropriate distillation methods are selected based on different data features to guide the training of the student model. These methods include alternating between biased and unbiased datasets, setting confidence levels, introducing unobserved datasets, and weighted merging of labels, thereby reducing the bias of the student model.
It improves the output accuracy of neural networks, enhances generalization ability, adapts to different scenarios, has a lower bias in output results, and provides more accurate recommendations.
Smart Images

Figure CN116249991B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of artificial intelligence, and in particular to a neural network distillation method and device. BACKGROUND
[0002] Knowledge distillation is a model compression technology that distills the feature representation "knowledge" learned by a complex and powerful network and transfers it to a network with small parameters and weak learning ability. Knowledge distillation can transfer the knowledge of one network to another network, and the two networks can be homogeneous or heterogeneous. The method is to first train a teacher network, and then use the output of the teacher network to train a student network.
[0003] However, the training set for training the student network may have bias, which can easily lead to inaccurate output results of the student network. Moreover, when the teacher network guides the student network, the accuracy of the student network is limited by the accuracy of the teacher network, and the output accuracy of the student network cannot be improved greatly. Therefore, how to obtain a network with more accurate output has become a problem to be solved. SUMMARY
[0004] The embodiments of the present application provide a neural network distillation method and device for providing a neural network with lower output bias, improving the output accuracy of the neural network, and selecting a suitable distillation method according to different scenarios, and having strong generalization ability.
[0005] Therefore, the first aspect of the present application provides a neural network distillation method, which comprises: first, obtaining a sample set, the sample set comprising a biased data set and an unbiased data set, the biased data set comprising biased samples, and the unbiased data set comprising unbiased samples, and generally, the data amount of the biased data set is greater than that of the unbiased data set; then, determining a first distillation method according to the data characteristics of the sample set, in which the teacher model is obtained by training the unbiased data set, and the student model is obtained by training the biased data set; then, training the first neural network according to the first distillation method based on the biased data set and the unbiased data set, to obtain an updated first neural network.
[0006] Therefore, in the present application, the unbiased samples included in the unbiased data set can be used to guide the knowledge distillation process of the first neural network, so that the updated first neural network can output unbiased results, correct the input samples, and improve the output accuracy of the first neural network. In addition, in the neural network distillation method provided by the present application, a distillation method matched with the data characteristics of the sample set can be selected, and different distillation methods can be used for different scenarios to adapt to different scenarios and improve the generalization ability of knowledge distillation of the neural network. Different knowledge distillation methods are selected under different conditions to maximize the benefit of knowledge distillation.
[0007] In a possible implementation, the first distillation method is selected from a plurality of preset distillation methods, and the plurality of distillation methods include at least two distillation methods in which the guidance method of the teacher model to the student model is different.
[0008] Therefore, in the present application, different distillation methods can be used for different scenarios to adapt to different scenarios and improve the generalization ability of knowledge distillation of the neural network. Different knowledge distillation methods are selected under different conditions to maximize the benefit of knowledge distillation.
[0009] In a possible implementation, the samples in the biased data set and the unbiased data set include input features and actual labels, and the first distillation method is to perform distillation based on the input features of the samples in the sample set.
[0010] In the present application, the unbiased data set can guide the knowledge distillation process of the model of the biased data set in the form of samples, so that the bias degree of the output of the updated first neural network obtained is lower.
[0011] In a possible implementation, based on the biased data set and the unbiased data set, the first neural network is trained according to the first distillation method to obtain an updated first neural network, which can include: alternately using the biased data set and the unbiased data set to train the first neural network to obtain the updated first neural network, wherein in one alternation process, the batch training times of the first neural network using the biased data set for training and the batch training times of the first neural network using the unbiased data set for training are in a preset ratio, and the sample includes input features as the input of the first neural network. Therefore, in the present application, the biased data set and the unbiased data set can be alternately used for training, and the first neural network trained using the biased data set can be corrected using the samples in the unbiased data set, so that the bias degree of the output of the updated first neural network is lower.
[0012] In a possible implementation, when the preset ratio is 1, a difference between the first regular term and the second regular term is added in the loss function of the first neural network, the first regular term is a parameter obtained by training the first neural network using samples included in the unbiased data set, and the second regular term is a parameter obtained by training the first neural network using samples included in the biased data set.
[0013] Therefore, in the implementation of the present application, the first neural network can be trained in an alternating manner of 1:1 of the biased data set and the unbiased data set, and the first neural network trained using the biased data set is corrected using samples in the unbiased data set, so that the bias degree of the output of the updated first neural network is lower.
[0014] In a possible implementation, the first neural network is trained in the first distillation manner based on the biased data set and the unbiased data set to obtain the updated first neural network, which can include: setting a confidence for a sample in the biased data set, the confidence being used to represent the bias degree of the sample; training the first neural network based on the biased data set, the confidence of the sample in the biased data set, and the unbiased data set to obtain the updated first neural network, and the sample includes an input feature as an input of the first neural network when the first neural network is trained.
[0015] In the implementation of the present application, the confidence representing the bias degree of the sample can be set to learn the bias degree of the sample when the neural network is trained, so as to reduce the bias degree of the output result of the updated neural network.
[0016] In a possible implementation, the samples included in the biased data set and the unbiased data set include input features and actual labels, the first distillation manner is to perform distillation based on predicted labels of samples included in the unbiased data set, the predicted labels are output by the updated second neural network for the samples in the unbiased data set, and the updated second neural network is obtained by training the second neural network using the unbiased data set.
[0017] Therefore, in the implementation of the present application, the first neural network can be distilled by the predicted labels of the samples included in the unbiased data set, that is, the predicted labels of the samples in the unbiased data set output by the teacher model can be used to guide the learning model, so that the updated first neural network obtains an output result with a lower bias degree under the guidance of the predicted labels output by the teacher model.
[0018] In a possible implementation, the sample set further includes an unobserved data set including a plurality of unobserved samples; and the training of the first neural network based on the biased data set and the unbiased data set according to the first distillation manner to obtain the updated first neural network can include: training the first neural network based on the biased data set to obtain a trained first neural network, and training the second neural network based on the unbiased data set to obtain an updated second neural network; collecting a plurality of samples from the sample set to obtain an auxiliary data set; and using the auxiliary data set, taking the predicted label of the sample in the data set as a constraint, updating the trained first neural network to obtain the updated first neural network, and the predicted label of the sample in the auxiliary data set is output by the updated second neural network.
[0019] In the implementation, the unobserved data set can be introduced, so as to reduce the bias of the biased data set in the training process of the first neural network, and the output result of the finally obtained first neural network has a lower bias degree.
[0020] In a possible implementation, the training of the first neural network based on the biased data set and the unbiased data set according to the first distillation manner to obtain the updated first neural network includes: training the second neural network based on the unbiased data set to obtain an updated second neural network; outputting the predicted label of the sample in the biased data set by the updated second neural network; weighting and merging the predicted label of the sample and the actual label of the sample to obtain a merged label of the sample; and training the first neural network using the merged label of the sample to obtain the updated first neural network.
[0021] In the implementation, the predicted label of the sample and the actual label of the sample can be weighted and merged to guide the training of the first neural network by the unbiased data set, so that the output result of the finally obtained first neural network has a lower bias degree.
[0022] In a possible implementation, the data characteristics of the sample set include a first ratio, the first ratio being a ratio between a sample quantity of the unbiased data set and a sample quantity of the biased data set, and the first distillation manner can be determined according to the data characteristics of the sample set, which can include: selecting a first distillation manner matched with the first ratio from a plurality of distillation manners.
[0023] Therefore, in the implementation, the first distillation manner can be selected according to the ratio between the sample quantity of the unbiased data set and the sample quantity of the biased data set, so that different scenarios of the ratio between the sample quantity of the unbiased data set and the sample quantity of the biased data set can be adapted.
[0024] In a possible implementation, the first distillation manner includes training a teacher model based on the features extracted from the unbiased data set, obtaining a trained teacher model, and performing knowledge distillation on a student model by using the trained teacher model and the biased data set.
[0025] Therefore, in the embodiments of the present application, the teacher model can be trained based on the features extracted from the unbiased data set, so as to obtain a teacher model with lower bias and better stability, and on this basis, the output result of the student model guided by the teacher model has lower bias.
[0026] In a possible implementation, the training of the first neural network based on the biased data set and the unbiased data set in the first distillation manner can include: filtering input features of part of samples from the unbiased data set by using a preset algorithm, which can be a deep global balancing regression (DGBR) algorithm; training a second neural network based on the input features of the part of samples to obtain an updated second neural network; using the updated second neural network as a teacher model, the first neural network as a student model, and performing knowledge distillation on the first neural network by using the biased data set to obtain an updated first neural network.
[0027] Therefore, in the embodiments of the present application, the stable features of the unbiased data set can be calculated, and the second neural network can be trained based on the stable features to obtain an updated second neural network with lower bias and better robustness, and the updated second neural network can be used as a teacher model, the first neural network can be used as a student model, and the first neural network can be distilled by using the biased data set, so as to obtain an updated first neural network with lower bias.
[0028] In a possible implementation, the data features of the sample set include the number of feature dimensions, and the determination of the first distillation manner based on the data features of the sample set can include: selecting a first distillation manner matching the number of feature dimensions from a plurality of distillation manners.
[0029] Therefore, in the embodiments of the present application, the feature distillation manner can be selected according to the number of feature dimensions included in the unbiased data set and the biased data set, so as to adapt to a scenario with a larger number of feature dimensions, and obtain a student model with lower bias.
[0030] In a possible implementation, the training of the first neural network in the first distillation manner based on the biased data set and the unbiased data set to obtain the updated first neural network can include: updating the second neural network by using the unbiased data set to obtain an updated second neural network; using the updated second neural network as a teacher model and the first neural network as a student model, and performing knowledge distillation on the first neural network by using the biased data set to obtain the updated first neural network.
[0031] Therefore, in the implementation of the present application, the teacher model can be trained by using the unbiased data set by using the conventional neural network knowledge distillation process, the output bias degree of the teacher model is reduced, and the student model is distilled by using the biased data set through the teacher model, so as to reduce the output bias degree of the student model.
[0032] In a possible implementation, the data characteristics of the sample set determine the first distillation manner, which can include: the data characteristics of the sample set include a second ratio, the second ratio of the number of positive samples and the number of negative samples included in the unbiased data set is calculated, and the first distillation manner matched with the second ratio is selected from the plurality of distillation manners; or the data characteristics of the sample set include a third ratio, the third ratio of the number of positive samples and the number of negative samples included in the biased data set is calculated, and the first distillation manner matched with the third ratio is selected from the plurality of distillation manners.
[0033] Therefore, in the implementation of the present application, the conventional model structure-based distillation manner can be selected by using the positive and negative sample ratio in the unbiased data set or the biased data set, so as to adapt to the scene of the positive and negative sample ratio in the unbiased data set or the biased data set.
[0034] In a possible implementation, the types of samples included in the biased data set and the types of samples included in the unbiased data set are different.
[0035] Therefore, in the implementation of the present application, the types of samples included in the biased data set and the types of samples included in the unbiased data set are different, which means that the samples included in the biased data set and the samples included in the unbiased data set belong to different fields of data, so that different fields of data can be used for guidance and training, so that the updated first neural network can output data of different fields from the input data, such as in the recommendation scene, cross-field recommendation can be realized.
[0036] In a possible implementation, after obtaining the updated first neural network, the method can further include: obtaining at least one sample of the target user; taking the at least one sample as an input of the updated first neural network, and outputting at least one label of the target user, the at least one label being used to construct a user portrait of the target user, and the user portrait being used to determine a sample matched with the target user.
[0037] Therefore, in the implementation of the present application, one or more labels of a user can be output by the updated first neural network, and a representative feature of the user can be determined according to the one or more labels, so as to construct a user portrait of a target user, which is used to describe the target user, thereby in a subsequent recommendation scenario, a sample matched with the target user can be determined by the user portrait.
[0038] In a second aspect, the present application provides a recommendation method, including:
[0039] obtaining information of a target user and information of a candidate recommendation object; inputting the information of the target user and the information of the candidate recommendation object into a recommendation model, and predicting a probability that the target user has an operation action on the candidate recommendation object; wherein the recommendation model is obtained by training a first neural network using a biased data set and an unbiased data set in a sample set in a first distillation manner, the biased data set includes biased samples, the unbiased data set includes unbiased samples, the first distillation manner is determined according to data characteristics of the sample set, the samples in the biased data set include information of a first user, information of a first recommendation object, and actual labels, the actual labels of the samples in the unbiased data set are used to indicate whether the first user has an operation action on the first recommendation object, the samples in the unbiased data set include information of a second user, information of a second recommendation object, and actual labels, and the actual labels of the samples in the unbiased data set are used to indicate whether the second user has an operation action on the second recommendation object.
[0040] The recommendation model is obtained by training a teacher model using unbiased data, and a student model trained using biased data is guided by the teacher model, so that a recommendation model with low output bias can be used to recommend a matched recommendation object for a user, so that the recommendation result is more accurate, and the user experience is improved.
[0041] In a possible implementation, the unbiased data set is obtained in a case where a probability of displaying a candidate recommendation object in a candidate recommendation object set is the same, and the second recommendation object is a candidate recommendation object in the candidate recommendation object set.
[0042] In a possible implementation, the unbiased data set is obtained in a case where the candidate recommended objects in the candidate recommended object set have the same probability of being displayed, including: the samples in the unbiased data set are obtained in a case where the candidate recommended objects in the candidate recommended object set are randomly displayed to the second user; or the samples in the unbiased data set are obtained in a case where the second user searches for the second recommended object.
[0043] In a possible implementation, the samples in the unbiased data set belong to the data of the source domain, and the samples in the biased data set belong to the data of the target domain.
[0044] In a third aspect, the present application provides a recommendation method, characterized in that comprising: displaying a first interface, the first interface comprising a learning list of at least one application program, a first application program learning list in the learning list of the at least one application program comprising at least one option, and an option in the at least one option being associated with an application program; perceiving a first operation of a user on the first interface; and in response to the first operation, opening or closing a cross-domain recommendation function of the first application program in the application programs associated with the part or all options in the first application program learning list.
[0045] According to the scheme in the embodiments of the present application, by migrating and sharing knowledge (for example, user interest preferences) between different domains, the user interaction history records of the source domain and the target domain are both included in learning, so that the recommendation model can better learn the user's preferences, the recommendation model can also well fit the user's interest preferences in the target domain, the user is recommended with recommended results conforming to his interests, cross-domain recommendation is achieved, and the cold start problem is alleviated.
[0046] In a possible implementation, the one or more recommended objects are determined by inputting the information of the user and the information of the candidate recommended object into the recommendation model to predict a probability of the user having an operation action on the candidate recommended object.
[0047] In a possible implementation, the recommendation model is obtained by training the first neural network using the biased data set and the unbiased data set in the sample set according to a first distillation manner, the biased data set includes biased samples, the unbiased data set includes unbiased samples, the first distillation manner is determined according to data characteristics of the sample set, the samples in the biased data set include information of a first user and information of a first recommended object and an actual label, the actual label of the sample in the unbiased data set is used to indicate whether the first user has an operation action on the first recommended object, the samples in the unbiased data set include information of a second user and information of a second recommended object and an actual label, and the actual label of the sample in the unbiased data set is used to indicate whether the second user has an operation action on the second recommended object.
[0048] In a fourth aspect, the present application provides a neural network distillation apparatus having the function of implementing the neural network distillation method of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0049] In a fifth aspect, the present application provides a recommendation apparatus having the function of implementing the recommendation method of the second aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0050] In a sixth aspect, the present application provides an electronic device having the function of implementing the recommendation method of the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0051] In a seventh aspect, the present application provides a neural network distillation apparatus, including a processor and a memory, wherein the processor and the memory are interconnected through a circuit, and the processor invokes program codes in the memory to execute functions related to processing in the neural network distillation method of any one of the first aspect.
[0052] In an eighth aspect, the present application provides a recommendation apparatus, including a processor and a memory, wherein the processor and the memory are interconnected through a circuit, and the processor invokes program codes in the memory to execute functions related to processing in the recommendation method of any one of the second aspect.
[0053] In a ninth aspect, the present application provides an electronic device, including a processor and a memory, wherein the processor and the memory are interconnected through a circuit, and the processor invokes program codes in the memory to execute functions related to processing in the recommendation method of any one of the third aspect.
[0054] In a tenth aspect, the present application provides a neural network distillation apparatus, which can also be referred to as a digital processing chip or a chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is used to execute functions related to processing in the first aspect or any one of the optional implementation manners of the first aspect.
[0055] In an eleventh aspect, an embodiment of the present application provides a recommendation device, which can also be referred to as a digital processing chip or a chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is configured to perform functions related to processing in the second aspect or any optional implementation manner of the second aspect.
[0056] In a twelfth aspect, an embodiment of the present application provides an electronic device, which can also be referred to as a digital processing chip or a chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is configured to perform functions related to processing in the third aspect or any optional implementation manner of the third aspect.
[0057] In a thirteenth aspect, an embodiment of the present application provides a computer readable storage medium, which includes instructions. When the instructions are run on a computer, the computer is caused to perform the method in the first aspect, any optional implementation manner of the first aspect, the second aspect, any optional implementation manner of the second aspect, the third aspect, or any optional implementation manner of the third aspect.
[0058] In a fourteenth aspect, an embodiment of the present application provides a computer program product including instructions. When the instructions are run on a computer, the computer is caused to perform the method in the first aspect, any optional implementation manner of the first aspect, the second aspect, any optional implementation manner of the second aspect, the third aspect, or any optional implementation manner of the third aspect. BRIEF DESCRIPTION OF DRAWINGS
[0059] Figure 1 An artificial intelligence subject framework schematic diagram for application of the present application;
[0060] Figure 2 A system architecture schematic diagram provided by the present application;
[0061] Figure 3 A convolutional neural network structure schematic diagram provided by an embodiment of the present application;
[0062] Figure 4 Another convolutional neural network structure schematic diagram provided by an embodiment of the present application;
[0063] Figure 5 Another system architecture schematic diagram provided by the present application;
[0064] Figure 6 A flowchart of a neural network distillation method provided by the present application;
[0065] Figure 7 A click rate and recommendation position relationship schematic diagram provided by the present application;
[0066] Figure 8 A schematic diagram of a neural network distillation architecture provided for the present application;
[0067] Figure 9 A schematic diagram of another neural network distillation architecture provided for the present application;
[0068] Figure 10 A schematic diagram of another neural network distillation architecture provided for the present application;
[0069] Figure 11 A flowchart of a recommendation method provided for the present application;
[0070] Figure 12 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0071] Figure 13 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0072] Figure 14 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0073] Figure 15 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0074] Figure 16 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0075] Figure 17 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0076] Figure 18 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0077] Figure 19 A schematic diagram of an application scenario of the recommendation method provided for the present application;
[0078] Figure 20 A flowchart of another recommendation method provided for the present application;
[0079] Figure 21 A structural schematic diagram of a neural network distillation device provided for the present application;
[0080] Figure 22 A structural schematic diagram of a recommendation device provided for the present application;
[0081] Figure 23 A structural schematic diagram of an electronic device provided for the present application;
[0082] Figure 24A schematic diagram of another neural network distillation apparatus provided in this application
[0083] Figure 25 A schematic diagram of another recommended device provided in this application;
[0084] Figure 26 A schematic diagram of the structure of another electronic device provided in this application;
[0085] Figure 27 This is a schematic diagram of a chip structure provided in this application. Detailed Implementation
[0086] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0087] The training set processing method provided in this application can be applied to artificial intelligence (AI) scenarios. AI is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results. In other words, artificial intelligence is a branch of computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine that can react in a way similar to human intelligence. Artificial intelligence studies the design principles and implementation methods of various intelligent machines, enabling them to have the functions of perception, reasoning, and decision-making. Research in the field of artificial intelligence includes robotics, natural language processing, computer vision, decision-making and reasoning, human-computer interaction, recommendation and search, and fundamental AI theories.
[0088] First, the overall workflow of the artificial intelligence system is described; please refer to [link / reference]. Figure 1 , Figure 1 The diagram illustrates a structural framework for artificial intelligence (AI). The framework is further elaborated below along two dimensions: the "Intelligent Information Chain" (horizontal axis) and the "IT Value Chain" (vertical axis). The "Intelligent Information Chain" reflects a series of processes from data acquisition to processing. For example, it could be the general process of intelligent information perception, intelligent information representation and formation, intelligent reasoning, intelligent decision-making, and intelligent execution and output. In this process, data undergoes a condensation process of "data—information—knowledge—wisdom." The "IT Value Chain" reflects the value that AI brings to the information technology industry, from the underlying infrastructure of human intelligence and information (provided and processed through technological means) to the industrial ecosystem of the system.
[0089] (1) Infrastructure
[0090] Infrastructure provides computing power support for artificial intelligence systems, enables communication with the outside world, and realizes support through the underlying platform. Communication with the outside world through sensors; computing power is provided by intelligent chips (CPU, NPU, GPU, ASIC, FPGA, etc. Hardware acceleration chips); the underlying platform includes distributed computing framework and network-related platform support and support, which can include cloud storage and computing, interconnection network, etc. For example, sensors and external communication obtain data, which are provided to intelligent chips in the distributed computing system provided by the underlying platform for calculation.
[0091] (2) Data
[0092] The data of the upper layer of the infrastructure is used to represent the data source in the field of artificial intelligence. Data involves graphics, images, speech, text, and also involves Internet of Things data of traditional devices, including business data of existing systems and sensing data such as force, displacement, liquid level, temperature, and humidity.
[0093] (3) Data processing
[0094] Data processing usually includes data training, machine learning, deep learning, search, reasoning, decision making, etc.
[0095] Among them, machine learning and deep learning can model, extract, preprocess, and train symbolic and formalized intelligent information.
[0096] Reasoning refers to the process of simulating human intelligent reasoning methods in computers or intelligent systems, using formalized information to perform machine thinking and solve problems according to reasoning control strategies, and the typical function is search and matching.
[0097] Decision making refers to the process of decision making after intelligent information is reasoned, which usually provides classification, sorting, prediction, etc.
[0098] (4) General capabilities
[0099] After data is processed as mentioned above, some general capabilities can be formed based on the results of data processing, such as algorithms or a general system, for example, translation, text analysis, computer vision processing, speech recognition, image recognition, etc.
[0100] (5) Intelligent products and industry applications
[0101] Intelligent products and industry applications refer to products and applications of artificial intelligence systems in various fields, which are encapsulations of overall solutions of artificial intelligence, and realize application landing by productizing intelligent information decision-making. The application fields mainly include intelligent terminals, intelligent transportation, intelligent medical treatment, automatic driving, and safe city, etc.
[0102] The embodiments of the present application relate to a large number of related applications of neural networks. In order to better understand the scheme of the embodiments of the present application, the related terms and concepts of the neural networks that may be involved in the embodiments of the present application are introduced as follows.
[0103] (1) Neural network
[0104] The neural network can be composed of neural units. The neural unit can refer to an operation unit with x s and intercept 1 as inputs. The output of the operation unit can be as shown in formula (1-1):
[0105]
[0106] Wherein, s = 1, 2, … n, n is a natural number greater than 1, W s is the weight of x s , b is the bias of the neural unit. f is the activation function of the neural unit, which is used to introduce non-linear characteristics into the neural network to convert the input signal in the neural unit into the output signal. The output signal of the activation function can be used as the input of the next convolutional layer. The activation function can be a sigmoid function. The neural network is a network formed by connecting a plurality of the above single neural units, that is, the output of one neural unit can be the input of another neural unit. The input of each neural unit can be connected to the local receptive field of the previous layer to extract the features of the local receptive field. The local receptive field can be a region composed of a plurality of neural units.
[0107] (2) Deep neural network
[0108] The deep neural network (DNN) is also called a multi-layer neural network, which can be understood as a neural network with multiple intermediate layers. According to the position of different layers, the neural network in the DNN can be divided into three categories: input layer, intermediate layer, and output layer. Generally, the first layer is the input layer, the last layer is the output layer, and the number of intermediate layers is the intermediate layer. The layers are fully connected, that is, any neuron of the i-th layer is connected to any neuron of the i+1-th layer.
[0109] (3) Convolutional neural network
[0110] A convolutional neural network (CNN) is a deep neural network with a convolutional structure. A CNN contains a feature extractor composed of convolutional layers and sub-sampling layers, which can be regarded as filters. A convolutional layer refers to a layer of neurons in a CNN that performs convolutional processing on an input signal. In a convolutional layer of a CNN, a neuron can be connected to only a portion of the neurons in the adjacent layer. A convolutional layer typically contains several feature planes, each of which can be composed of a number of rectangularly arranged neural units. The neural units in the same feature plane share weights, which are referred to as convolution kernels. The shared weights can be understood as being independent of the manner and position of extracting image information. The convolution kernels can be initialized in the form of a matrix of random size, and the convolution kernels can obtain reasonable weights through learning in the training process of the CNN. In addition, the shared weights directly reduce the connections between the layers of the CNN and reduce the risk of overfitting. For example, the structure of a CNN can refer to the structures shown in Figure 3 and Figure 4 .
[0111] (4) A recurrent neural network (RNN) is used to process sequence data. In a traditional neural network model, the data is processed from the input layer to the intermediate layer and then to the output layer, and the layers are fully connected. However, the nodes in each layer are not connected. Although this ordinary neural network has solved many difficult problems, it is still powerless for many problems. For example, to predict the next word of a sentence, the previous words need to be used because the words in a sentence are not independent. The RNN is called a recurrent neural network because the current output of a sequence is related to the previous output. The specific form is that the network memorizes the previous information and applies it to the calculation of the current output, that is, the nodes in the intermediate layer are connected, and the input of the intermediate layer includes not only the output of the input layer but also the output of the intermediate layer at the previous time. In theory, an RNN can process sequence data of any length. The training of an RNN is the same as the training of a traditional CNN or DNN.
[0112] (5) Adder neural network (ANN)
[0113] An additive neural network is a kind of neural network that contains almost no multiplication. Unlike a convolutional neural network, the additive neural network uses L1 distance to measure the correlation between features and filters in the neural network. Since only addition and subtraction are contained in L1 distance, a large number of multiplication operations in the neural network can be replaced by addition and subtraction, thereby greatly reducing the computational cost of the neural network.
[0114] In the ANN, a kind of metric function with only addition, i.e. L1 distance, is usually used to replace the convolution calculation in the convolutional neural network. By using L1 distance, the output features can be recalculated as:
[0115]
[0116] Or,
[0117] wherein | (·) | is an absolute value operation, ∑ (·) is a summation operation, Y (m, n, t) is the at least one output sub-feature map, Y (m, n, t) is an element of the mth row, the nth column and the tth page in the output feature map, X (m+i, n+j, k) is an element of the ith row, the jth column and the kth page in the at least one input sub-feature map, F (i, j, k, t) is an element of the ith row, the jth column and the kth page in the feature extraction kernel, t is the number of channels of the feature extraction kernel, d is the number of rows of the feature extraction kernel, C is the number of channels of the input feature map, and d, C, i, j, k, m, n, t are all integers.
[0118] It can be seen that the ANN only needs to use addition, and by changing the metric method of calculating features in convolution to L1 distance, the features in the neural network can be extracted only using addition, and an additive neural network can be constructed.
[0119] (5) Loss function
[0120] In the process of training a deep neural network, because the output of the deep neural network is expected to be as close as possible to the value that is truly intended to be predicted, the weight vector of each layer of the neural network can be updated according to the difference between the predicted value of the current network and the truly intended target value, after the two are compared (of course, before the first update, there is usually an initialization process, that is, the parameters of each layer of the deep neural network are pre-configured), for example, if the predicted value of the network is too high, the weight vector is adjusted to make it predict lower, and the adjustment is continuously made until the deep neural network can predict the truly intended target value or a value very close to the truly intended target value. Therefore, it is necessary to define "how to compare the difference between the predicted value and the target value", which is the loss function or the objective function, which is an important equation for measuring the difference between the predicted value and the target value. Taking the loss function as an example, the higher the output value (loss) of the loss function, the greater the difference, and then the training of the deep neural network becomes a process of trying to minimize the loss. In the embodiments of the present application, the difference between the objective function and the loss function is that the objective function includes a constraint function in addition to the loss function, which is used to constrain the update of the neural network, so that the updated neural network is closer to the expected neural network.
[0121] (6) Back propagation algorithm
[0122] The neural network can use the back propagation (BP) algorithm to correct the size of the parameters in the initial neural network model in the training process, so that the reconstruction error loss of the neural network model becomes smaller and smaller. Specifically, the forward propagation of the input signal until the output produces an error loss, and the initial neural network model parameters are updated by back propagating the error loss information, so that the error loss converges. The back propagation algorithm is a back propagation movement dominated by error loss, aiming to obtain the optimal parameters of the neural network model, such as the weight matrix.
[0123] Referring to FIG. 2, Figure 2 The embodiments of the present application provide a system architecture 200. The system architecture includes a database 230 and a client device 240. A data acquisition device 260 is used to acquire data and store it in the database 230, and a training module 202 generates a target model / rule 201 based on the data maintained in the database 230. How the training module 202 obtains the target model / rule 201 based on the data will be described in more detail below, and the target model / rule 201 is the neural network constructed in the embodiments of the present application. For details, please refer to the related description in the following Figure 6-20
[0124] The computing module can include a training module 202, and the target model / rule obtained by the training module 202 can be applied in different systems or devices. In the following Figure 2 The execution device 210 is configured to have a transceiver 212, which can be a wireless transceiver, an optical transceiver, or a wired interface (such as an I / O interface), etc., to interact with external devices. A "user" can input data to the transceiver 212 through a client device 240, for example, in the following embodiments of the present application, the client device 240 can send a target task to the execution device 210, request the execution device to build a neural network, and send a database for training to the execution device 210.
[0125] The execution device 210 can call data, code, etc. in the data storage system 250, or store data, instructions, etc. in the data storage system 250.
[0126] The computing module 211 processes the input data using the target model / rule 201. Specifically, the computing module 211 is configured to: obtain a biased data set and an unbiased data set, the biased data set including biased samples, and the unbiased data set including unbiased samples, the data amount of the biased data set being greater than that of the unbiased data set; select a first distillation manner from a plurality of preset distillation manners according to at least one of the data included in the biased data set or the data included in the unbiased data set, the plurality of distillation manners being different in the guidance manner of a teacher model to a student model when performing knowledge distillation, and a model trained using the unbiased data set guiding a model trained using the biased data set; and train a first neural network based on the biased data set and the unbiased data set according to the first distillation manner, to obtain an updated first neural network.
[0127] Finally, the transceiver 212 returns the built neural network to the client device 240 for deployment of the neural network in the client device 240 or other devices.
[0128] More deeply, the training module 202 can obtain corresponding target models / rules 201 based on different data for different tasks, to provide better results for users.
[0129] In the following Figure 2In the scenario shown, the data input to the execution device 210 can be determined based on the user's input data. For example, the user can operate on the interface provided by the transceiver 212. Alternatively, the client device 240 can automatically input data to the transceiver 212 and obtain results. If the client device 240 needs user authorization to automatically input data, the user can set appropriate permissions on the client device 240. The user can view the results output by the execution device 210 on the client device 240; the specific presentation format can be display, sound, animation, etc. The client device 240 can also act as a data acquisition terminal, storing the acquired data associated with the target task into the database 230.
[0130] It should be noted that the appendix Figure 2 This is merely an exemplary schematic diagram of a system architecture provided in this application embodiment, and the positional relationships between the devices, components, modules, etc., shown in the diagram do not constitute any limitation. For example, in the appendix... Figure 2 In this context, the data storage system 250 is an external memory relative to the execution device 210. In other scenarios, the data storage system 250 can also be placed within the execution device 210.
[0131] The training or update process mentioned in this application can be executed by the training module 202. It is understood that the training process of a neural network is learning how to transform the control space, more specifically, learning the weight matrix. The purpose of training a neural network is to make its output as close as possible to the expected value. Therefore, this can be achieved by comparing the current network's predicted value with the expected value, and then updating the weight vector of each layer of the neural network based on the difference between the two (of course, the weight vector can usually be initialized before the first update, i.e., pre-configured parameters for each layer in the deep neural network). For example, if the network's predicted value is too high, the values of the weights in the weight matrix are adjusted to lower the predicted value. This adjustment continues until the neural network's output value is close to or equal to the expected value. Specifically, the difference between the neural network's predicted value and the expected value can be measured using a loss function or an objective function. Taking the loss function as an example, a higher output value (loss) indicates a greater difference, and the training of the neural network can be understood as a process of minimizing the loss as much as possible. The process of updating the weights of the starting network and training the serial network in the following embodiments of this application can be referred to in this process, and will not be repeated hereafter.
[0132] like Figure 2As shown, the target model / rule 201 is trained according to the training module 202. In this embodiment, the target model / rule 201 can be the first neural network in this application. Specifically, the first neural network, second neural network, teacher model, or student model provided in this embodiment can be a deep convolutional neural network (DCNN), a recurrent neural network (RNNS), etc. The neural networks mentioned in this application can include various types, such as deep neural networks (DNN), convolutional neural networks (CNN), recurrent neural networks (RNN), residual networks, or other neural networks.
[0133] See appendix Figure 5 This application also provides a system architecture 500. The execution device 210 is implemented by one or more servers, optionally in conjunction with other computing devices, such as data storage, routers, load balancers, etc. The execution device 210 can be deployed on a single physical site or distributed across multiple physical sites. The execution device 210 can use data from the data storage system 250 or call program code from the data storage system 250 to implement the following aspects of this application. Figure 6 The steps of the corresponding training set processing method.
[0134] Users can interact with execution device 210 by operating their respective user devices (e.g., local device 501 and local device 502). Each local device can represent any computing device, such as a personal computer, computer workstation, smartphone, tablet, smart camera, smart car or other type of cellular phone, media consumption device, wearable device, set-top box, game console, etc.
[0135] The local device of each user can interact with the execution device 210 through a communication network of any communication mechanism / communication standard, which can be a wide area network, a local area network, a point-to-point connection, etc., or any combination thereof. Specifically, the communication network can include a wireless network, a wired network, or a combination of a wireless network and a wired network, etc. The wireless network includes, but is not limited to, any one or more of a combination of a 5th-Generation (5G) system, a long term evolution (LTE) system, a global system for mobile communication (GSM) or a code division multiple access (CDMA) network, a wideband code division multiple access (WCDMA) network, wireless fidelity (WiFi), Bluetooth, Zigbee, radio frequency identification (RFID), long range (Lora) wireless communication, near field communication (NFC), etc. The wired network can include an optical fiber communication network or a network composed of coaxial cables, etc.
[0136] In another implementation, one aspect or multiple aspects of the execution device 210 can be implemented by each local device, for example, the local device 501 can provide local data or feedback calculation results for the execution device 210.
[0137] The data processing method provided by the embodiments of the present application can be executed on a server, and can also be executed on a terminal device. The terminal device can be a mobile phone, a tablet personal computer (TPC), a media player, a smart television, a laptop computer (LC), a personal digital assistant (PDA), a personal computer (PC), a camera, a camcorder, a smart watch, a wearable device (WD), or an autonomous vehicle, etc., and the embodiments of the present application do not limit this.
[0138] Generally, knowledge distillation can transfer the knowledge of one network to another network, which can be homogeneous or heterogeneous. The method is to first train a teacher network, or called teacher model, and then use the output of the teacher network to train a student network, or called student model. When performing knowledge distillation, a pre-trained complex network can be used to train another simple network, so that the simple network can have the same or similar data processing capability as the complex network.
[0139] Knowledge distillation can quickly and conveniently implement some small networks. For example, a complex network model can be trained on a cloud server or enterprise server using a large amount of data, and then knowledge distillation is performed to obtain a small model that implements the same function, and the small model is compressed and migrated to a small device (such as a mobile phone, a smart bracelet, etc.). For another example, by collecting a large amount of user data on a smart bracelet, a complex and time-consuming network training is performed on a cloud server to obtain a user behavior recognition model, and then the model is compressed and migrated to the smart bracelet, which is a small carrier, so that the model can be quickly trained while protecting user privacy and improving user experience.
[0140] However, when the teacher model is used to guide the student model, the output accuracy of the student model is usually limited by the output accuracy of the teacher model, which limits the improvement of the output accuracy of the student model. In addition, when performing knowledge distillation, a biased data set is usually used, so that the output of the student model trained by the biased data set is biased, that is, the output result is inaccurate.
[0141] Therefore, the present application provides a neural network distillation method for selecting a suitable guidance method for a data set used for training, completing knowledge distillation of a neural network, and using a model trained by an unbiased data set to guide a model trained by a biased data set, reducing the bias degree of the output of the student model, and improving the output accuracy of the student model.
[0142] The neural network distillation method provided by the present application can be applied to a recommendation system, user portrait, image recognition, or other debiasing scenarios, etc. The recommendation system can be used to recommend applications (Apps), music, images, videos, or goods, etc. to users. The user portrait is used to reflect the characteristics or preferences of users, etc.
[0143] The neural network distillation method provided by the present application will be described in detail below. Referring to Figure 6 , the flowchart of the neural network distillation method provided by the present application.
[0144] 601, a sample set is obtained, and the sample set includes a biased data set and an unbiased data set.
[0145] The sample set includes at least a biased data set and an unbiased data set. The biased data set includes samples with bias (hereinafter referred to as biased samples), and the unbiased data set includes samples without bias (hereinafter referred to as unbiased samples). Generally, the data quantity of the biased data set is greater than that of the unbiased data set.
[0146] For ease of understanding, the sample with bias can be understood as a sample deviating from the actual use sample of the user. For example, as a feedback loop system, the recommendation system usually faces various bias problems such as position bias, popularity bias and pre-model bias. The existence of these biases makes the user feedback data collected by the recommendation system unable to reflect the real preferences of the user.
[0147] The bias of the sample may also be different in different scenarios, such as position bias, selection bias or popularity bias. For example, in the scenario of recommending items to users, the position bias can be understood as: when describing the user, the item in a better position is preferentially selected for interaction, and this preference has nothing to do with whether the item meets the actual needs of the user. The selection bias can be understood as: the "target group" cannot be accurately represented by the "research group", so that the measurement of the risk or benefit of the "research group" cannot accurately represent the "target group", resulting in that the conclusion cannot be effectively generalized.
[0148] For example, in the scenario of recommending APPs to users, Figure 7 The click rate of the same APP at each recommendation position under the random distribution strategy can be seen. As the recommendation position is further back, the click rate of the APP is lower, which shows the influence of position bias on the click rate. Position bias leads to higher click rate of the APP with earlier recommendation position and lower click rate of the APP with later recommendation position. If such click data is used to train the model, the Matthew effect of the trained model will be aggravated, resulting in polarization of the output result of the model. For example, if the user searches for an APP in the recommendation system, and the APPs meeting the user's demand include APP1 and APP2, and APP2 meets the user's search demand more. However, because the click rate of APP1 is higher, the recommendation position of APP1 is more optimal, resulting in that the user clicks APP1 and does not click APP2. Subsequently, when recommending APPs to the user, the historical data of the user clicking APP1 (i.e., biased sample) is combined for recommendation, while the actual demand of the user should be related to APP2 (i.e., unbiased sample), which may lead to inaccurate recommendation to the user.
[0149] The unbiased data can be collected in a manner of random flow. Taking a recommendation system as an example. The specific process of collecting the unbiased data set can include: randomly sampling from all candidate sets, then randomly displaying the samples obtained by random sampling, then collecting feedback data for the randomly displayed samples, and obtaining unbiased samples from the feedback data. It can be understood that all samples in the candidate set have an equal opportunity to be displayed to the user for selection, and therefore it can be regarded as a good unbiased proxy.
[0150] 602. Determine a first distillation manner according to data characteristics of the sample set.
[0151] Among them, the first distillation manner can be determined according to the data characteristics included in the sample set. Specifically, after obtaining the biased data set and the unbiased data set, a matching distillation manner is selected from a plurality of preset distillation manners based on the biased data set and / or the unbiased data set, to obtain the first distillation manner.
[0152] Generally, the first distillation manner is selected from a plurality of preset distillation manners, and the plurality of distillation manners includes at least two distillation manners in which the guidance manner of the teacher model to the student model is different. Generally, the unbiased data set is used to train the teacher model, and the biased data set is used to train the student model, that is, the model trained using the unbiased data set is used to guide the model obtained using the biased data set.
[0153] Optionally, the plurality of preset distillation manners can include but are not limited to one or more of the following: sample distillation, label distillation, feature distillation, or model structure distillation, etc.
[0154] Among them, sample distillation refers to using samples in the biased data set and the unbiased data set for distillation. For example, using samples in the unbiased data set to guide the knowledge distillation of the student model.
[0155] Label distillation refers to using a predicted label based on samples in the unbiased data set as a guide to distill the student model, wherein the predicted label is output by a teacher model trained based on the unbiased data set.
[0156] Feature distillation refers to training a teacher model based on features extracted from the unbiased data set, and performing knowledge distillation through the teacher model and the biased data set.
[0157] Model structure distillation, that is, using the unbiased data set to train a teacher model, and using the teacher model and the biased data set to perform knowledge distillation on the student model to obtain an updated student model.
[0158] Specifically, more detailed descriptions of the foregoing plurality of distillation manners can be referred to the descriptions of the following Figure 8 , which will not be described here again.
[0159] In some possible implementation manners, the matched distillation manner can be selected as the first distillation manner based on a sample quantity of the unbiased data set and a sample quantity of the biased data set, a ratio between positive samples and negative samples in the unbiased data set, a ratio between positive samples and negative samples in the biased data set, or a feature dimension quantity of data included in the unbiased data set and the biased data set.
[0160] Exemplarily, the manner of selecting the distillation manner can include but is not limited to:
[0161] Condition 1: a first ratio between the sample of the unbiased data set and the sample quantity of the biased data set is calculated, and when the first ratio is less than a first threshold value, the sample distillation is selected as the first distillation manner.
[0162] Condition 2: when the first ratio is not less than the first threshold value, the label distillation is selected as the first distillation manner.
[0163] Condition 3: a second ratio between a quantity of positive samples and a quantity of negative samples included in the unbiased data set is calculated, and when the second ratio is greater than a second threshold value, the model structure distillation is selected as the first distillation manner; or, a third ratio between a quantity of positive samples and a quantity of negative samples included in the biased data set is calculated, and when the third ratio is greater than a third threshold value, the model structure distillation is selected as the first distillation manner.
[0164] Condition 4: a feature dimension quantity of the unbiased data set and the biased data set included in the biased data set is calculated, and when the feature dimension quantity is greater than a preset dimension, the feature distillation is selected as the first distillation manner.
[0165] In which, a priority of each distillation manner can be preset, and when the above multiple conditions are met at the same time, a suitable distillation manner can be selected according to the priority. For example, the priority of the feature distillation > the priority of the model structure distillation > the priority of the sample distillation = the priority of the label distillation, and when the unbiased data set and the unbiased data set meet the condition 3 and the condition 4 at the same time, the feature distillation is selected as the first distillation manner.
[0166] Of course, the priority of each distillation manner can be different in different scenarios, which is only exemplarily described herein and is not limited in this regard.
[0167] It should be further noted that the teacher model and the student model referred to in the present application can be models with different structures, or can be models for the same structure, models obtained by using different data sets, which can be adjusted according to actual application scenarios, and the present application does not limit this.
[0168] 603、based on the biased data set and the unbiased data set, training the first neural network in a first distillation manner to obtain an updated first neural network.
[0169] After the first distillation manner is selected, the first neural network can be knowledge distilled in the guidance manner included in the first distillation manner to obtain the updated first neural network.
[0170] For ease of understanding, an example of a scenario is given. The unbiased data set collected by the Uniform data is not affected by the previous model, and meets the sample properties of the expected model, that is, all candidate sets are equally displayed to the user for selection. Therefore, the unbiased data set can be regarded as a good unbiased proxy. However, the sample size of the unbiased data set is small, and it cannot be directly used to train the online model. The model trained by the unbiased data set is more unbiased, but has a large variance, and the model trained by the biased data set has bias, but has a relatively small variance. Therefore, in the embodiments of the present application, the unbiased data set and the biased data set are effectively combined for training, so that the unbiased data set guides the training of the biased data set, so that the bias degree of the output result of the finally obtained first neural network is lower, and the accuracy of the output result of the first neural network is improved.
[0171] Specifically, the following takes several distillation manners as examples to explain step 603 in detail.
[0172] I. When the first distillation manner is sample distillation.
[0173] Among them, there are many ways to distill samples in the data set. The samples in the biased data set and the unbiased data set include input features and actual labels. The input features of the samples in the unbiased data set can be used as the input of the teacher model to train the teacher model. The input features of the samples in the biased data set are used as the input of the student model, that is, the first neural network, so as to complete the knowledge distillation of the first neural network and obtain the updated first neural network.
[0174] In a possible implementation, the specific process of knowledge distillation can include: alternately using the biased data set and the unbiased data set to train the first neural network to obtain the updated first neural network, wherein in one alternation process, the batch training times of using the biased data set to train the first neural network and the batch training times of using the unbiased data set to train the first neural network are in a preset ratio, and when training the first neural network, the input features of the samples are used as the input of the first neural network.
[0175] Therefore, in the embodiments of the present application, the first neural network can be trained by alternately using the biased data set and the unbiased data set, and when the training is performed by using the unbiased data set, the bias generated when the training is performed by using the biased data set can be corrected, so that the bias degree of the output result of the finally obtained first neural network is lower, and the output result is more accurate.
[0176] In a possible implementation, when the preset ratio is 1, the difference between the first regular term and the second regular term is added in the loss function of the first neural network, the first regular term is the parameter obtained by training the first neural network by using the sample included in the unbiased data set, and the second regular term is the parameter obtained by training the first neural network by using the sample included in the biased data set.
[0177] In a possible implementation, the specific process of knowledge distillation can include: setting a confidence for all or part of the samples in the biased data set, the confidence being used to represent the bias degree of the sample; training the first neural network based on the biased data set, the confidence of the sample in the biased data set, and the unbiased data set, to obtain an updated first neural network, and when the first neural network is trained, the sample includes the input feature as the input of the first neural network.
[0178] II. When the first distillation mode is label distillation.
[0179] In the label distillation, the second neural network can be trained by using the unbiased data set, and then the prediction label of the sample in the biased data set is output by the trained second neural network, and then the prediction label is used as a constraint to train the first neural network to obtain an updated first neural network.
[0180] In a possible implementation, the aforementioned sample set further includes an unobserved data set, the unobserved data set including a plurality of unobserved samples, and the specific process of knowledge distillation can include: training the first neural network by using the biased data set to obtain a trained first neural network, and training the second neural network by using the unbiased data set to obtain an updated second neural network; collecting a plurality of samples from the full data set to obtain an auxiliary data set; and using the auxiliary data set, using the prediction label of the sample in the auxiliary data set as a constraint, updating the trained first neural network to obtain an updated first neural network. Generally, the sample in the auxiliary data set has at least two prediction labels, and the at least two prediction labels are respectively output by the updated first neural network and the second neural network.
[0181] Therefore, in the embodiments of the present application, the bias influence of the biased data set on the training of the first neural network can be reduced by introducing the unobserved data set and using the samples included in the unobserved data set, and the bias degree of the output result of the updated first neural network is reduced.
[0182] In a possible implementation, the specific process of performing knowledge distillation can include: training the second neural network through an unbiased data set to obtain an updated second neural network; outputting, by the updated second neural network, a predicted label of a sample in a biased data set; merging the predicted label of the sample and an actual label of the sample to obtain a merged label of the sample; and training the first neural network using the merged label of the sample to obtain an updated first neural network.
[0183] Therefore, in the implementation of the present application, the first neural network can be updated using the merged label of the sample in the biased data set output by the second neural network, and it can be understood that the teacher model guides the update of the first neural network using the predicted label, thereby reducing the bias degree of the output result of the updated first neural network and improving the accuracy of the output result of the updated first neural network.
[0184] III. When the first distillation manner is feature distillation.
[0185] In the implementation of the present application, the stable features can be extracted from the unbiased data set, and then the second neural network is trained based on the stable features to obtain an updated second neural network. Then the first neural network is trained using the biased data set, and the updated second neural network is used as a teacher model and the first neural network is used as a student model to perform knowledge distillation to obtain an updated first neural network.
[0186] In a possible implementation, the specific process of performing knowledge distillation can include: outputting, by a preset algorithm, input features of part of samples in the unbiased data set, the input features of the part of samples can be understood as stable features in the unbiased data set, and the preset algorithm can be a DGBR algorithm; training the second neural network according to the input features of the part of samples to obtain an updated second neural network; using the updated second neural network as a teacher model and the first neural network as a student model to perform knowledge distillation on the first neural network using the biased data set to obtain an updated first neural network.
[0187] Therefore, in the implementation of the present application, the stable features in the unbiased data set can be used to train the second neural network to obtain an updated second neural network, i.e., a teacher model, and therefore the output of the teacher model is more stable and has higher accuracy. On this basis, the knowledge distillation is performed using the teacher model, and the output of the student model obtained is also more stable and has higher accuracy.
[0188] IV. When the first distillation manner is model structure distillation.
[0189] The second neural network can be trained using the unbiased data set to obtain an updated second neural network. Then, the updated neural network is used as a teacher model, the first neural network is used as a student model, the biased data set and the output result of the intermediate layer of the teacher model are used to perform knowledge distillation on the first neural network to obtain an updated neural network.
[0190] Therefore, in the embodiment, the knowledge distillation process of the first neural network can be guided using the unbiased samples included in the biased data set, so that the updated neural network can output unbiased results, correct the input samples, and improve the output accuracy of the first neural network.
[0191] Therefore, in the embodiment, the knowledge distillation process of the first neural network can be guided using the unbiased samples included in the biased data set, so that the updated neural network can output unbiased results, correct the input samples, and improve the output accuracy of the first neural network. In addition, in the neural network distillation method provided by the embodiment, a distillation method matched with the unbiased data set and the biased data set can be selected, different distillation methods can be used for different scenes, and the generalization ability of the knowledge distillation of the neural network is improved. Different knowledge distillation methods are selected under different conditions, and the conditions such as the size of the data set, the ratio of positive examples and negative examples, and the proportion of different data are adapted to maximize the benefit of knowledge distillation.
[0192] In a possible implementation, the types of samples in the unbiased data set and the types of samples in the biased data set are different. For example, the sample type included in the unbiased data set is music, and the sample type included in the biased data set is video. Therefore, in the embodiment, different fields of data can be used for knowledge distillation to realize training of cross-field neural networks, so that cross-field user recommendation can be realized to improve user experience.
[0193] In a possible implementation, after obtaining the updated first neural network, at least one sample of a target user can be acquired, the at least one sample is taken as an input of the updated first neural network, at least one label of the target user is output, the at least one label is used to construct a user portrait of the target user, the user portrait is used to describe the target user, or to recommend a matched sample to the user. For example, an APP clicked by user A can be acquired, the APP clicked by the user is taken as an input of the updated first neural network, one or more labels of user A are output, the one or more labels can be used to represent a probability of the user clicking the corresponding APP, when the probability exceeds a preset probability, a feature of the corresponding APP can be used as a feature of user A, so as to construct a user portrait of user A, the feature included in the user portrait is used to describe the user, or to recommend a matched APP to the user, and the like.
[0194] In the implementation of the present application, the updated first neural network can be used to generate a user portrait, so as to describe the user through the user portrait, or to recommend a matched sample to the user. Since the updated neural network is a neural network after rectification, the bias of the output result can be reduced, so that the obtained user portrait is more accurate, and the recommendation experience of the user is improved.
[0195] The foregoing introduces the flow of the neural network distillation method provided by the present application, and the neural network distillation method provided by the present application is introduced in more detail in combination with a more specific application scenario.
[0196] First, an biased data set 801 and an unbiased data set 802 are acquired.
[0197] The pre-set distillation mode can include sample distillation 803, label distillation 804, feature distillation 805, and model structure distillation 806.
[0198] In combination with the biased data set 801 and the unbiased data set 802, a matched distillation mode is selected from the sample distillation 803, the label distillation 804, the feature distillation 805, and the model structure distillation 806, and then knowledge distillation 807 is performed to obtain an updated first neural network.
[0199] The data and steps involved in the embodiments of the present application are described in detail below.
[0200] Specifically, the biased data set 801 can include constructed or collected samples. For example, the biased data set 801 can be an APP clicked or downloaded by a user, music clicked or played by a user, a video clicked or played by a user, a picture clicked or saved by a user, and the like. For the sake of understanding, the biased data set is referred to as S c .
[0201] The unbiased data set can be a data set collected in a uniform data manner, that is, a plurality of samples are randomly sampled from the candidate set, and then a plurality of samples are randomly sampled from the plurality of samples. For example, taking the APP recommendation for a user as an example, a plurality of APPs can be randomly sampled from the candidate set, and the pictures of the plurality of APPs are randomly arranged and displayed in the recommendation interface, and then the APPs clicked or downloaded by the user are collected to obtain unbiased samples to form an unbiased data set. For example, taking the picture recommendation for a user as an example, a plurality of pictures can be randomly sampled from the candidate set, and the thumbnails of the plurality of pictures are randomly arranged and displayed in the recommendation interface, and then the pictures clicked or downloaded by the user are collected to obtain an unbiased data set. For ease of understanding, the biased data set is referred to as S t .
[0202] Optionally, S c and S t may be data in different fields, for example, S c may be music clicked or played by the user, S t may be pictures or videos clicked by the user, and the like. Therefore, subsequent knowledge distillation across fields is implemented, so that the first neural network can output a prediction result in a field different from the input data. For example, in a cross-field recommendation system, the user's preference for one type of item can be used to predict the user's preference for another type of item, to alleviate the cold start problem of new application scenarios and improve user experience.
[0203] After S c and S t are obtained, a suitable distillation method is selected from a plurality of distillation methods based on the S c and S t .
[0204] For example, the ratio of the sample size of S t to S c is calculated. When the proportion of the sample size of S t is small, the variance of the model trained using S t will be large, and label distillation is not suitable, and sample distillation is more suitable, that is, sample distillation 803 is selected as the distillation method. When the proportion of the sample size of S t is large, label distillation 804 is selected as the distillation method.
[0205] For another example, the ratio of positive samples to negative samples in S t is calculated. When the ratio is large, the sample distribution is uneven, and the sample distillation or label distillation effect is poor, and at this time, model structure distillation can be selected as the distillation method. Alternatively, the ratio of the number of positive samples to the number of negative samples in S cThe ratio of positive to negative samples is important. When this ratio is large, it is better than uneven sample distribution. When the sample distillation or label distillation effect deteriorates, model structure distillation can be selected as the distillation method.
[0206] For example, typically, as the number of feature dimensions of the samples included in the dataset increases, the final trained model also becomes more complex, and the model's output performance improves. Therefore, when S t and S c When the number of feature dimensions of the included samples is large, feature distillation can be selected to improve the final model output.
[0207] After selecting a suitable distillation method, the first neural network can be distilled using that method to obtain an updated first neural network.
[0208] The following is a detailed description of the specific process of distillation using various distillation methods.
[0209] I. Sample distillation
[0210] Sample distillation can be performed in several ways, and several possible implementation methods are described below as examples.
[0211] 1. Causal embedding strategy
[0212] Among them, S can be used c and S t Train the same model alternately, and use S t The training results are constrained by using S c The training conducted.
[0213] Specifically, first, the structure of the first neural network is selected; this first neural network can be a CNN, an ANN, etc. Then, S is used alternately. c and S t The first neural network is trained. For ease of understanding, an example of a single alternation process will be used, employing S... t The trained model is represented as M t S will be used c The trained model is represented as M c M t This can be understood as a teacher model, M c This can be understood as a student model.
[0214] During training, an objective function can be used to train the first neural network. This objective function includes not only a loss function but also a constraint term. This constraint term constrains the updates of the first neural network, ensuring that M...c and M t parameters are close or consistent. Then, the weight parameters and the structure parameters are derived based on the value of the objective function and gradient update, etc., to obtain updated parameters, such as weight parameters or structure parameters, so as to obtain the updated first neural network.
[0215] For example, the objective function can be expressed as:
[0216]
[0217] wherein |S c | and |S t | respectively refer to the sample amount of S c and S t , is the output of S c substituted into the first neural network, is the output of S t substituted into the first neural network, and respectively refer to the value of the loss function after S c and S t are substituted into the first neural network, which can be binary, cross-entropy or mean error loss, etc. and respectively refer to the parameters of S c and S t model, and respectively refer to the regular term of S c and S t model parameters, λ c and λ t respectively refer to the weight parameter of M c and M t model regular term, λ ‖t-c‖ refers to the weight parameter of the square difference term of the parameter. In the objective function, in addition to including the loss function for S c and S t , the regular term for S c and S t , and the square difference term of the parameter can also be included, so as to form a constraint when updating the parameters of the first neural network subsequently, so that the parameters of M c and M t are closer or consistent.
[0218] Therefore, in the embodiments of the present application, S c and S t can be used to alternately train the first neural network, so that the model trained by using S t is used to train S cThe model being trained guides and corrects the student model, and reduces the bias of the output result of the student model.
[0219] 2. Delayed combination strategy
[0220] The distillation manner of this strategy is similar to the aforementioned causal representation strategy, but the difference is that the aforementioned causal representation measurement can be trained alternately in a 1:1 batch training number ratio, while in this strategy, it can be trained alternately in an s:1 batch training number ratio, where s is an integer greater than 1. For example, s can take an integer in the range of 1-20. The batch training number can be understood as the number of iterations of the neural network in each training process. Generally, the training process of the neural network is divided into multiple epochs, and each epoch contains multiple batches, which is the batch training. For example, if the data set used for training includes 6000 pictures, the number of pictures used for training in each epoch can be 6000, and a batch process uses 600 pictures, a total of 100 batches, that is, the batch training number is 100.
[0221] Correspondingly, the objective function of the first neural network can be set as:
[0222]
[0223] Where S t step represents using S t The batch training number of the first neural network is S c step represents using S c The batch training number of the first neural network, which can be s:1.
[0224] 3. Weighted combination strategy
[0225] Where S c and S t Add a confidence variable a to all or part of the samples ij , the value of which is in the range of [0, 1], and a ij is used to indicate the bias degree of the sample.
[0226] For example, the objective function used for updating the first neural network can be represented as:
[0227] Generally, the confidence variable of the sample in S t can be set to 1. S cThe confidence of the samples is set by two different mechanisms: in the global mechanism, the confidence is set to a predefined value within [0, 1]; in the local mechanism, the samples are associated with an independent confidence, and the confidence is learned during the model training process. The confidence variable is used to constrain the use of S c When training the first neural network, S c is used to train the first neural network. The confidence of the samples in S c and S t is used to train the first neural network. It can be understood that the confidence variable can be used to reflect the bias degree of the samples in S c , so that the training using S c is constrained by the confidence variable in the subsequent training process, and the bias degree of the output result of the updated first neural network is reduced.
[0228] II. Label distillation
[0229] Among them, label distillation refers to using the predicted label based on the samples in the unbiased data set as a guide to distill the student model, and the predicted label is output by the teacher model, which is trained based on the unbiased data set.
[0230] Specifically, label distillation can also use a variety of strategies, and several possible strategies are exemplarily described.
[0231] 1. Bridge strategy
[0232] In this strategy, S c and S t are used to train M c and M t , respectively.
[0233] An unobserved data set is introduced, which includes a plurality of unobserved samples. For example, taking recommending APPs to users as an example, the icons of the APPs recommended to users can be displayed in the recommendation interface, and the APPs clicked or downloaded by users can be understood as the biased samples described above, and the APPs in the recommendation interface that are not clicked by users are unobserved samples.
[0234] The combination of S c , S t and the unobserved data set is referred to as the full data set, and then a plurality of samples are randomly sampled from the full data set to obtain the auxiliary data set S a . Usually, due to data sparsity, most of the data in S a are unobserved samples.
[0235] When updating the first neural network, S can be used. a To train and thus constrain M c and M t In S a The predicted results for the samples in the dataset are the same or similar. The objective function used may include:
[0236]
[0237] |S a | refers to the unobserved sample S a The sample size of the dataset S represents a The samples in S c The trained model and S t The error function for predicting labels on the trained model. For S a Substitute the output of the first neural network, For S a Substitute the output of the second neural network. Therefore, in this strategy, unobserved datasets are introduced for bias correction, reducing M... c Model and M t The difference between the models lies in the introduction of S into the objective function. a The samples in M c Model and M t The error function of the predicted label on the model is used to constrain the training of the first neural network, thereby reducing the bias of the output of the first neural network.
[0238] 2. Refine Strategy
[0239] S t Using pre-trained M t Then use M t For S c Make a prediction and obtain S c Predicted labels for the middle sample; then combine the predicted labels with S c The real labels are weighted and merged; then M is trained using the new labels. c Note that due to predicted labels and S c The actual labels may have different distributions, so the predicted labels need to be normalized to reduce the difference between the predicted labels and the actual labels.
[0240] Specifically, the objective function used to train the first neural network can be expressed as:
[0241]
[0242] Where α represents the weighting coefficient for the predicted label, denotes the normalized processing of the predicted label ij denotes the actual label of the sample in S t denotes the predicted label of the sample in S t output by M c
[0243] III. Feature distillation
[0244] wherein a stable feature can be screened from S t , and then the stable feature is used for training to obtain M t , i.e., a teacher model, and then an M c is trained using S c , and M t is used for knowledge distillation of M c to obtain a distilled M c .
[0245] For ease of understanding, the stable feature can be understood as follows: different data sets are used to train a neural network to obtain different neural networks, and the output results of the different neural networks are relatively small, and then the same features in the different data sets can be understood as representative stable features. For example, a deep global balancing regression (DGBR) algorithm can be used to screen representative stable features from S t .
[0246] The specific process of using the feature distillation method to perform knowledge distillation on the first neural network can be, for example, a sample with a stable feature is screened from S t using a DGBR algorithm, and then a second neural network is trained based on the sample with the stable feature, and the trained second neural network is used as a teacher model, the first neural network is used as a student model, and S c The first neural network is trained, and knowledge distillation is performed on the first neural network to obtain an updated first neural network. For example, a correspondence relationship between a part of neural network layers in the student model and the teacher model is determined. It should be noted that the correspondence relationship refers to that the relative positions of the neural network layers in the student model and the teacher model are the same or similar. For example, if the student model and the teacher model are different types of networks, and the number of neural network layers included in the student model and the teacher model is the same, in this case, the first neural network layer in the student model is the Nth layer counted from the input layer, and the second neural network layer in the teacher model is the Nth layer counted from the input layer. At this time, the first neural network layer and the second neural network layer are neural network layers having a correspondence relationship. The neural network layers can include intermediate layers and output layers. When performing knowledge distillation, the student model and the teacher model process the to-be-processed data, and the outputs of the neural network layers having a correspondence relationship are used to construct a loss function. The student model is subjected to knowledge distillation through the loss function until a preset condition is met. At this time, the outputs of the neural network layers having a correspondence relationship of the student model and the teacher model after knowledge distillation are similar or the same when processing the same to-be-processed data. In this way, the student model after knowledge distillation can have the same or similar data processing capability as the teacher model. Taking the first neural network layer and the second neural network layer as an example, the outputs of the first neural network layer and the second neural network layer of the student model and the teacher model after knowledge distillation are similar when processing the same to-be-processed data. Since the number of neural network layers having a correspondence relationship can be multiple, a part or all of the neural network layers of the student model and the teacher model after knowledge distillation have the same or similar data processing capability, and thus the student model and the teacher model after knowledge distillation have the same or similar data processing capability.
[0247] Therefore, in the present distillation manner, the teacher model can be trained using stable features, so that the student model is distilled using the teacher model trained based on the stable features, and the subsequent student model can also output unbiased or low-bias results under the guidance of the teacher model.
[0248] IV. Model structure distillation
[0249] In the present distillation manner, S t is trained to obtain M t . Then, the output results of the intermediate layers of M t are used to guide the training of M c .
[0250] For example, in order to align M t and M cfeature embedding of M t is trained in S t , and the feature embedding is used as the initialization value of the variable of M c . The feature embedding is trained in S c , and the variable of M c is randomly initialized, and then the weighted operation is performed on the initialization value and the randomly initialized value, and the result of the weighted operation is used to train M c , to obtain the trained M c .
[0251] For example, the Hint layers of M c and M t that need to be aligned can be paired (one or more, and the network layer indexes of M c and M t may not need to be consistent), and then a pairing term is added to the objective function of M c , which can be represented as α*y t +(1-α)*y c , α∈(0.5,1), y t represents the output result of the Hint layer of M t , y c represents the output result of the Hint layer of M c , and α represents the proportion of y t .
[0252] For example, a temperature variable and a softmax operation can be introduced to obtain the soft label predicted by M t , that is, the label output by the network layer before the softmax layer of M t , and then in the process of training M c , the label output by the network layer before the softmax layer of M c is constrained to be the same or close to the label output by the network layer before the softmax layer of M t . For example, a corresponding pairing term can be added to the objective function of M c , which can be represented as ω*y t +(1-ω)*y c , ω∈(0.5,1), y t represents the output result of the network layer before the softmax layer of M t , y c represents the output result of the network layer before the softmax layer of M c , and ω represents the proportion of y t .
[0253] Therefore, in the distillation manner, the intermediate layer of the teacher model can be used to guide the training of the intermediate layer of the student model. Since the teacher model is trained using an unbiased data set, the teacher model will constrain the output of the student model during the guidance of the student model, reduce the bias of the output of the student model, and improve the accuracy of the output of the student model.
[0254] After the updated first neural network is obtained by the above-mentioned one of the knowledge distillation manners, the first neural network can be used for subsequent prediction. For example, it can be applied to a recommendation scenario to recommend music, video, image, etc. for a user.
[0255] The foregoing describes the process of the neural network distillation method provided by the present application in detail. The application scenarios of the neural network distillation method provided by the present application are exemplarily described below in combination with the foregoing process.
[0256] For example, a “lifelong learning project” for a user can be established. Based on the historical data of the user in the video, music, news, etc. domain, various models and algorithms are used to imitate the human brain mechanism, build a cognitive brain, and build a user lifelong learning system framework.
[0257] The lifelong learning project is exemplarily divided into four stages, i.e. learning using the historical data of the user (first stage), monitoring the real-time data of the user (second stage), predicting the future data of the user (third stage), and making decisions for the user (fourth stage). The neural network distillation method provided by the present application can be applied to the first stage, the third stage, or the fourth stage.
[0258] For example, the data of the user (including end-side short messages, photos, email events, etc.) can be obtained according to the music APP, video APP, browser APP, etc. multi-domain platform. On the one hand, the obtained data is used to build a user portrait, and on the other hand, learning and memory modules based on user information filtering, correlation analysis, cross-domain recommendation, causal reasoning, etc. are realized to build a user personal knowledge graph.
[0259] Exemplarily, as Figure 9As shown, when a user enters the recommendation system's interface, a recommendation request is triggered. The recommendation system inputs this request and its related information into the prediction model, then predicts the user's click-through rate for items within the system. Next, based on the predicted click-through rate or a function based on that rate, the items are sorted in descending order. The recommendation system then displays these items in different positions as recommendations to the user. Users browse different locations and perform user actions, such as browsing or clicking to download. Simultaneously, the user's actual behavior is stored in logs as training data. Through offline training, the parameters of the prediction model are continuously updated, improving the model's prediction performance. This application corresponds to the offline training of the recommendation system and also changes the prediction logic of the prediction model. Specifically, for example, when a user opens a mobile browser app, the browser's recommendation module is triggered. Based on the user's historical download records, click records, application characteristics, and environmental features such as time and location, the browser predicts the probability of the user downloading various candidate news articles / articles. Based on the calculation results, the browser displays them in order of probability, achieving the effect of increasing the application download probability. Specifically, news items more likely to be downloaded are placed at the top, while news items less likely to be downloaded are placed at the bottom. User behavior is also stored in logs and the parameters of the prediction model are trained and updated offline.
[0260] More specifically, the neural network distillation method provided in this application can be introduced into lifelong learning. Taking a recommendation system applied to a terminal as an example, such as... Figure 10 The diagram illustrates a framework for a recommendation system provided in this application. The terminal has various apps installed, such as third-party apps, video apps, music apps, browser apps, or app store apps, or system apps for sending text messages, emails, photos, calendars, or other devices. When a user uses an app installed on the terminal, user behavior data, such as text messages, photos, email events, videos, and browsing history, can be obtained by collecting data generated during user activity. Of course, user privacy can be protected by obtaining data collection permissions before collecting app data.
[0261] The unbiased data set and the biased data set can be collected by the APP described above. For example, when collecting the unbiased data set, taking the recommended APP in the application market as an example, a part of APPs can be randomly sampled from the APP candidate set to recommend to the user, and the icons of the sampled APPs are randomly displayed in the recommendation interface, and then the information of the APPs clicked by the user is obtained. For another example, taking the music APP as an example, a part of music can be randomly sampled from the music candidate set, and the information of the sampled music, such as the title, the singer and the like, is randomly displayed in the recommendation interface, and then the information of the music clicked by the user is obtained. For example, when collecting the biased data set, the user can be recommended according to the pre-set recommendation rule, such as the APP, music or video with higher label association degree of the user, and the music, APP or video clicked or downloaded by the user is collected to obtain the biased data set.
[0262] Optionally, the unobserved data set can also be collected. For example, if 100 APPs are selected for recommendation, and only the icons of 10 APPs are displayed in the recommendation interface, the remaining 90 APPs are unobserved samples.
[0263] After the unbiased data set and the biased data set are collected, the unbiased data set and the biased data set can be used for knowledge distillation, that is, the unbiased data set and the biased data set are input into the knowledge distillation counterfactual recommendation (KDCRec) module based on knowledge distillation shown in Figure 10 , to perform knowledge distillation, to obtain the trained first neural network, that is, the memory model shown in Figure 10 . The process of knowledge distillation can refer to the foregoing Figure 8 , which will not be described here. Optionally, the unobserved data set can also be used for knowledge distillation, which can refer to the foregoing Figure 8 introduction of label distillation 804, which will not be described here. Therefore, in the process of knowledge distillation, the bias problem (including location bias, selection bias and popularity bias) of the user historical data can be corrected by the neural network distillation method provided by the present application, to obtain the real data distribution of the user.
[0264] After obtaining the memory model, the one or more predicted labels corresponding to the user can be output by the memory model, and the one or more labels are used to construct, for example, the label can be used to represent the probability of the user clicking the APP, and when the probability is greater than a pre-set probability value, the feature of the sample corresponding to the label is added to the user image as the feature of the user. The labels included in the user portrait are used to describe the user, such as the preferred APP type and music type of the user.
[0265] Optionally, the feature knowledge data and knowledge inference data of the user can also be output, that is, the user features are mined through correlation analysis, cross-domain learning, causal inference and other technologies, and knowledge-based reasoning and presentation are realized with the aid of an external general knowledge graph, and the feature expansion based on general knowledge is input into the enhanced user portrait module, and the user portrait is enhanced in a visual and dynamic manner.
[0266] Then, the business server can determine music, APP or video information recommended for the user based on the enhanced user portrait, complete accurate recommendation for the user, and improve user experience.
[0267] It can be understood that the application provides a counterfactual learning method based on generalized knowledge distillation, which is used to realize unbiased cross-domain recommendation, construct an unbiased user portrait system and an unbiased personal knowledge graph. Experiments on the application include cross-domain recommendation, interest mining based on causal reasoning and construction of a user portrait system. The offline experimental results are as follows: in the user portrait, the algorithm based on gender prediction improves the baseline accuracy by more than 3%, the multi-classification task of age improves the baseline accuracy by nearly 8%, and the introduction of counterfactual causal learning reduces the accuracy variance of each age group by 50%. User interest mining based on counterfactual causal reasoning replaces the algorithm based on association rule learning, effectively reduces the effective action set of the user, and provides interpretability for the user's favorite tags.
[0268] For example, taking an application market as an example, a plurality of lists can be displayed in the recommendation interface of the application market, the click probability of the user on the candidate set of goods is predicted according to the user, the candidate set of goods and the context features, and the candidate goods are arranged in descending order according to the probability, and the most likely downloaded application is arranged in the most front position. After the user sees the recommendation result of the application market, according to the personal interest, the operation of browsing, clicking or downloading is selected, and these user behaviors are stored in the log.
[0269] The accumulated user behavior log is used as training data to train the click rate prediction model. When the click rate prediction model is trained offline, user behavior logs are needed. The collected user data has position bias and selection bias. In order to eliminate the influence of these biases on the click rate prediction model, uniform data is introduced, combined with the 101 decision mechanism module proposed in the application, from the foregoing Figure 8The appropriate distillation method is selected from 803-806 in the foregoing method, combined with user log data, i.e., biased data, to jointly train a recommendation model, i.e., a first neural network. The counterfactual technology based on label distillation has an 8.7% improvement in the area under the ROC curve (AUC) compared to the baseline, the counterfactual causal learning technology based on sample distillation has a 6% improvement compared to the baseline, and the counterfactual causal learning technology based on model structure distillation has a 5% improvement compared to the baseline.
[0270] The foregoing has described in detail the flow and application scenarios of the neural network distillation method provided in the present application. The first neural network obtained by the foregoing method can be applied to a recommendation scenario. The recommendation method provided in the present application is described in detail below in combination with the foregoing method.
[0271] Figure 11 A schematic diagram of a recommendation method 1100 provided in an embodiment of the present application is shown. Figure 11 The method shown can be executed by a recommendation device, which can be a cloud service device or a terminal device, for example, a computer, a server, or another device with sufficient computing power to execute the recommendation method, or a system composed of a cloud service device and a terminal device. Illustratively, the method 1100 can be executed by Figure 2 or Figure 5 the execution device 210 in the foregoing method or Figure 5 the local device in the foregoing method.
[0272] For example, the method 1100 can be executed by the execution device 210 as shown in Figure 3 The target user and the candidate recommendation object in the method 1100 can be data in the database 230 as shown in Figure 3
[0273] The method 1100 includes steps S1110 and S1120. The steps S1110-S1120 are described in detail below.
[0274] S1110, obtaining information of a target user and information of a candidate recommendation object.
[0275] For example, when a user enters a recommendation system, a recommendation request is triggered. The recommendation system can take the user triggering the recommendation request as a target user and take the recommendation object that can be displayed to the user in the recommendation system as a candidate recommendation object.
[0276] For example, the target user's information may include the user's identifier, such as the target user ID. The target user's information may also include some personalized attribute information of the user, such as the target user's gender, age, occupation, income, hobbies, or education.
[0277] For example, the information of a candidate recommendation object may include its identifier, such as its ID. The information may also include some attribute information, such as its name or type.
[0278] S1120, Input the target user's information and the information of the candidate recommended objects into the recommendation model to predict the probability that the target user will perform an action on the candidate recommended objects.
[0279] Among them, the recommendation model is the one mentioned above. Figure 6 The updated first neural network obtained in the process is referred to as the recommendation model below for ease of understanding. The training method of the recommendation model can be referred to in the relevant descriptions in steps 601-603 above, and will not be repeated here.
[0280] For example, candidate recommendation objects in a candidate recommendation set can be ranked by predicting the probability that the target user will perform an action on the candidate recommendation object, thereby obtaining the recommendation result. For instance, the candidate recommendation object with the highest probability can be selected and displayed to the user. For example, the candidate recommendation object could be a candidate recommendation application.
[0281] like Figure 12 As shown, Figure 12 The image shows the "Recommended" page in an app store. This page can display multiple lists, such as featured apps and featured games. Taking featured games as an example, the app store's recommendation system predicts the probability that a user will download (install) a candidate recommended app based on user information and information about the candidate recommended apps. It then ranks the candidate recommended apps in descending order based on this probability, placing the app most likely to be downloaded at the top.
[0282] For example, the recommended results in the featured apps section could be: App 5 in the first recommended position in the featured games section, App 6 in the second recommended position, App 7 in the third recommended position, and App 8 in the fourth recommended position. After seeing the recommended results in the app store, users can perform actions based on their interests, and these actions will be stored in the user behavior log.
[0283] Figure 12The application market shown can obtain training data for training the recommendation model through user behavior logs.
[0284] It should be understood that the above examples are intended to help those skilled in the art to understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the specific values or specific scenarios exemplified. Those skilled in the art can obviously make various equivalent modifications or changes according to the above examples given, and such modifications or changes also fall within the scope of the embodiments of the present application.
[0285] The recommendation model is obtained by training the first neural network using a biased data set and an unbiased data set in the sample set according to a first distillation manner, the biased data set includes biased samples, the unbiased data set includes unbiased samples, the first distillation manner is determined according to data characteristics of the sample set, the samples in the biased data set include information of a first user, information of a first recommendation object, and actual labels, the actual labels of the samples in the unbiased data set are used to indicate whether the first user has an operation action on the first recommendation object, the samples in the unbiased data set include information of a second user, information of a second recommendation object, and actual labels, and the actual labels of the samples in the unbiased data set are used to indicate whether the second user has an operation action on the second recommendation object.
[0286] In a possible implementation, the unbiased data set is obtained in a case where candidate recommendation objects in the candidate recommendation object set have the same probability of being displayed, and the second recommendation object is a candidate recommendation object in the candidate recommendation object set.
[0287] In a possible implementation, the unbiased data set is obtained in a case where candidate recommendation objects in the candidate recommendation object set have the same probability of being displayed, and the second recommendation object is a candidate recommendation object in the candidate recommendation object set.
[0288] In a possible implementation, the samples in the unbiased data set belong to source domain data, and the samples in the biased data set belong to target domain data.
[0289] It can be understood Figure 6 The corresponding method is the training phase of the recommendation model (such as Figure 3 the phase executed by the training module 202), and the specific training is performed by using the updated first neural network provided in the method of FIG. 6, that is, the recommendation model; and Figure 11 The corresponding method can be understood as the application phase of the recommendation model (such as Figure 3 the phase executed by the execution device 210), and can be embodied as using the updated first neural network provided in the method of FIG. 6, that is, the recommendation model. Figure 6The corresponding method trains a recommendation model, and obtains an output result, i.e., a probability of operation of the target user on the candidate recommendation object, according to information of the target user and information of the candidate recommendation object.
[0290] The training method of the recommendation model described below can be regarded as a specific implementation manner of the method Figure 6 The recommendation method described below can be regarded as a specific implementation manner of the method Figure 11 To avoid unnecessary repetition, the repeated description is appropriately omitted below when introducing the three examples of the embodiments of the present application.
[0291] Example 1
[0292] As shown in Figure 13 For each recommendation request, the recommendation system usually needs to perform multiple processes such as recall, fine arrangement or manual rules on all items in the full quantity library based on the user portrait to generate the final recommendation result, and then show it to the user. The number of items recommended to the user is much smaller than the total number of items, and various bias problems are introduced in the process, such as position bias and selection bias.
[0293] The user portrait refers to a label set of personalized preferences of the user. For example, the user portrait can be generated from the interaction history of the user.
[0294] Selection bias refers to the bias of the collected data due to the different probabilities of the items being displayed. The ideal training data is obtained in the case that the items are displayed to the user according to the same display probability. In reality, due to the limitation of the number of display positions, all items cannot be displayed. The recommendation system usually recommends the user according to the predicted selection rate of the user on the item, and the user can only interact with the displayed items, and the items that do not have the opportunity to be displayed cannot be selected, i.e., cannot participate in the interaction, which leads to the fact that the items do not have the same opportunity to be displayed. In the entire recommendation process, such as recall, fine arrangement and other processes, there will be a truncation operation, i.e., selecting part of the candidate recommendation objects for display.
[0295] Position bias refers to the bias in the collected data due to the different positions of the item display. The recommendation system usually displays the recommendation results in order from top to bottom or from left to right. According to people's browsing habits, the items located in the front are more likely to be seen, and the selection rate of the user is higher. For example, in a list of an application market, the same application (application, APP) can be displayed in the first place or in the last place. Through a random placement strategy, it can be verified that the download rate of the APP displayed in the first place is much higher than that of the APP displayed in the last place. As shown in Figure 13 , by performing the fine arrangement process, the difference in the display position of the item is caused, thereby introducing the position bias.
[0296] Due to the existence of the bias problem, the probability of the item with more display opportunities being selected by the user is higher, the higher the probability of the user's selection is, the more likely the item is to be recommended to the user in the subsequent recommendation, thereby obtaining more display opportunities, being easily clicked by other users, aggravating the influence of the bias problem, causing the Matthew effect, and leading to the aggravation of the long tail problem. The long tail problem leads to the fact that most of the personalized needs of the public cannot be met, which affects the user experience. In addition, many items in the recommendation system cannot produce actual commercial value due to the lack of exposure opportunities, which wastes storage resources and computing resources, causing resource waste.
[0297] Example 2
[0298] The lifelong learning project refers to a project based on the historical data of the user in multiple fields such as video, music, news, etc., through various models and algorithms, imitating the human brain mechanism, constructing a cognitive brain, and achieving the goal of lifelong learning.
[0299] Figure 14 A schematic diagram of a lifelong learning framework is shown in FIG. 1. In the framework, multiple recommendation scenarios such as a video APP, a reading APP, and a browser APP are included. The traditional recommendation learning scheme is to learn the rules hidden in the historical behavior of the user in each domain in each recommendation scenario or domain, and then make recommendations according to the learned rules. The whole learning and implementation process does not consider the knowledge transfer and sharing between domains at all.
[0300] However, in the initial stage of the new recommendation scenario, the interaction history of the user is scarce. If the recommendation model learned based on only the interaction history in the domain cannot discover the rules hidden in the historical behavior of the user, the prediction result will be inaccurate, that is, there is a cold start problem in the new recommendation scenario.
[0301] Cross-domain recommendation is a recommendation method that learns the preferences of the user in the source domain and applies it to the target domain. Through cross-domain recommendation, the rules learned in the source domain can be used to guide the recommendation results in the target domain, realize the knowledge transfer and sharing between domains, and solve the cold start problem.
[0302] For example, by predicting the user's preference for music and video according to the user's reading preference in the reading App recommendation scenario, the cold start problem of the user in the music App recommendation scenario is solved.
[0303] As shown in Figure 15 In the recommendation scenario of the reading APP, books are recommended to user A. Based on the interaction history data of user A, the interest preference of user A in the recommendation scenario of the reading APP can be learned, and the neighbor users with the same interest as user A can be determined based on the interest preference of user A in the recommendation scenario of the reading APP. In the recommendation scenario of the music APP, music is recommended to the user. Based on the interaction history data of the neighbor users in the recommendation scenario of the music APP, the interest preference of the neighbor users in the recommendation scenario of the music APP is learned, and then the learned interest preference is used to guide the recommendation result provided to user A in the recommendation scenario of the music APP. The recommendation scenario of the reading APP is the source domain, and the recommendation scenario of the music APP is the target domain. However, the data distribution of the source domain and the target domain is often inconsistent, so the data distribution of the source domain is biased relative to the data distribution of the target domain. Directly using the above association rule and other methods to realize cross-domain recommendation will cause bias to be introduced in the learning process. The model will consider the interest preference of the user in the source domain more to make recommendations, that is, the trained model is biased, which leads to the model learned on the data of the source domain cannot be effectively generalized in the target domain, and the model has the risk of distortion.
[0304] Example 3:
[0305] The following describes an implementation of step S1110 by taking the recommendation scenario of the reading APP as the source domain and the recommendation scenario of the video APP as the target domain as an example.
[0306] The recommendation scenario of the reading APP refers to the recommendation scenario of recommending books to users, and the recommendation scenario of the video APP refers to the recommendation scenario of recommending videos to users.
[0307] As shown in FIG. 16, the biased samples are obtained according to the interaction history of the user in the recommendation scenario of the video APP (target domain).
[0308] Table 1 shows the data obtained based on the interaction history (for example, user behavior log) of the user in the recommendation scenario of the video APP.
[0309] Table 1
[0310] Tag User ID Video ID Tag Producer Actor Score 1 13718bbd 5316a17f Thriller Producer 1 Zhang San 6.8 0 0b153874 93bad2c0 Artistic Producer 2 Li Si 7.1 … … … … … … …
[0311] Each row in Table 1 represents a single sample. Taking this training sample as an example, the biased sample includes information about the first user and the first recommended object. The first user's information includes the user's ID, and the first recommended object is a video. The information about the first recommended object includes the video's ID, tags, producer, actors, and rating. In other words, the biased sample includes a total of 6 types of features.
[0312] It should be understood that Table 1 is for illustrative purposes only, and the information of users and the information corresponding to recommendations may include more or fewer items than those in Table 1, or more or fewer types of feature information.
[0313] Furthermore, the processed data is stored in libSVM format. For example, the data in Table 1 can be stored in the following format: 1 25173:1 38553:1 50053:1 50216:1 59109:1 98079:1 0 19468:1 19850:1 79800:1 81901:1 85533:1 13010:1
[0316] …
[0317] Based on the above data, n biased samples can be obtained, forming a biased dataset.
[0318] like Figure 16 As shown, the unbiased samples are obtained based on the user's interaction history in the recommendation scenario (source domain) of the reading app. It should be noted that... Figure 16 The data in the source domain is for illustrative purposes only. The data in the source domain may also include data from other recommendation scenarios, or data from multiple recommendation scenarios. For example, the data in the source domain may include user history data from the recommendation scenarios of reading apps and user history data from the recommendation scenarios of music apps.
[0319] It should be understood that Figure 16 The above is for illustrative purposes only; unbiased samples may not be used as data in the validation set.
[0320] Table 2 shows the data obtained based on the user's interaction history (e.g., user behavior logs) in the recommendation scenario of the reading app.
[0321] Table 2
[0322] Tag User ID Book ID Tag Publisher Author Score 1 25c83c98 68fd1e64 Suspense Publisher 1 Zhang San 6.8 0 efea433b 0b153874 Art Publisher 2 Li Si 7.1 … … … … … … …
[0323] One row in Table 2 is a training sample. The sample is an unbiased sample, which includes the information of the second user and the information of the second recommended object. The information of the second user includes the ID of the second user, the second recommended object is a book, and the information of the second recommended object includes the ID of the second recommended object, the label of the second recommended object, the publisher of the second recommended object, the author of the second recommended object, and the score of the second recommended object. That is, the unbiased sample includes 6 types of features.
[0324] It should be understood that Table 2 is only illustrative, and the information of the user and the information of the recommended object can also include more or less information than Table 2, or more or less types of feature information.
[0325] Further, the processed data, for example, the data in Table 2, can be stored in the following form: 1 77891:1 81901:1 82101:1 83267:1 83896:1 91899:1 0 55060:1 59115:1 60857:1 75847:1 97576:1 42803:1
[0328] …
[0329] The recommendation model can be applied to a target domain, for example, Figure 16 a recommendation scenario of a video APP.
[0330] Compared with the recommendation scenario of the video APP, the user interaction data in the recommendation scenario of the reading APP is more abundant, and the data distribution can more accurately reflect the user's preference. According to intuitive reasoning and the mutual nature of the user's interest in the reading scenario and the video scenario, the recommendation model can better grasp the user's personalized preference in the reading scenario through the scheme of the embodiments of the present application, and then guide the recommendation result in the video scenario, thereby improving the accuracy of the recommendation result.
[0331] By migrating and sharing knowledge (for example, user interest preferences) between different domains, the user interaction history records in the source domain (for example, the recommendation scenario of the reading APP) and the target domain (for example, the recommendation scenario of the video APP) are all included in the learning. The model trained in this way has good evaluation effect in the source domain, and at this time the model well captures the user's interest preferences in the source domain. In a similar recommendation scenario, the user's interest preferences are also similar, so the recommendation model can also well fit the user's interest preferences in the target domain, recommend the recommended results that meet the user's interests to the user, and realize cross-domain recommendation and alleviate the cold start problem.
[0332] The recommendation model can predict the probability of the user having an operation action on the recommended object in the target domain, that is, predict the probability of the user selecting the recommended object. Deploying the target recommendation model in the target domain (for example, in the recommendation scene of the video APP), the recommendation system can determine the recommendation result to be displayed to the user based on the output of the target recommendation model.
[0333] As described above, the traditional recommendation learning scheme is to learn the rules hidden in the user's historical behavior in each domain, and then make recommendations according to the learned rules. The whole learning and implementation process does not consider the knowledge transfer and sharing between domains.
[0334] At present, many electronic devices such as mobile phones and tablet computers have multiple application programs, and each application program can be regarded as an application scene. When the application program makes recommendations for the user, it usually only learns the user's preferences based on the user's interaction data in the application program, and then makes recommendations for the user, without considering the user's interaction data in other application programs.
[0335] However, in the application program just downloaded by the user, the user's interaction data is scarce, and if the recommendation model learned based on the interaction history in the domain cannot discover the rules hidden in the user's historical behavior, the prediction result will be inaccurate, which will affect the user experience, that is, there is a cold start problem in the new recommendation scene.
[0336] The embodiments of the present application provide a recommendation method and an electronic device, which can learn the preferences of users in other domains to make recommendations for users, thereby improving the accuracy of the prediction result and improving the user experience.
[0337] It should be understood that in the embodiments of the present application, "user behavior data", "user interaction data", "interaction data", "behavior data" and the like can be considered to express the same meaning, and can all be understood as data related to the user's operation behavior when the recommended object is displayed to the user.
[0338] For ease of understanding, the present application will take a mobile phone as an electronic device, and first introduce some human-computer interaction embodiments of the present application. Figure 17 is a set of graphical user interface (GUI) schematic diagrams provided by the embodiments of the present application.
[0339] The user can perform a click operation on the settings application program in the mobile phone, and in response to the click operation, the mobile phone performs the main interface 301 of the settings application program. The main interface of the settings application program can display, for example, Figure 17the content shown in FIG. 1(a). In the main interface 301, bulk management controls, cross-domain recommendation management controls of various applications, and sidebar alphabetical index controls, etc. can be included. The main interface 301 can also display whether the cross-domain recommendation function of various applications (e.g. music APP, reading APP, browser APP, news APP, video APP, or shopping APP, etc.) is turned on or turned off. In some embodiments, the cross-domain recommendation management controls of various applications displayed in the main interface 301 can be displayed in the order of application names from "A" to "Z", where each application corresponds to a respective cross-domain recommendation management control. It should be understood that the main interface 301 can also include more or less or similar display content, which is not limited in the present application.
[0340] When the user clicks on the cross-domain recommendation management control of an application, the phone can display the cross-domain recommendation management interface corresponding to the application. For example, the user performs the click operation on the cross-domain recommendation management control of the browser APP in FIG. 1(a), and in response to the click operation, the phone enters the browser APP cross-domain recommendation management interface 302, which can display the content shown in FIG. 1(b). Figure 17 Figure 17 In the cross-domain recommendation management interface 302, the cross-domain recommendation control can be included. It should be understood that the cross-domain recommendation management interface 302 can also include more or less similar display content, and the cross-domain recommendation management interface 302 can also include different display content according to different applications, which is not limited in the embodiments of the present application.
[0341] Optionally, the default state of the cross-domain recommendation management control can be the off state.
[0342] For example, as shown in FIG. 1(c), the cross-domain recommendation management control of the browser APP is in the off state, and the cross-domain recommendation management control of the music APP is in the on state. Figure 17 As shown in (b) of FIG. 1, when the cross-domain recommendation control is in the enabled state, the cross-domain recommendation function of the browser APP is enabled, and accordingly, the browser APP can obtain user interaction data from multiple APPs and learn to recommend relevant videos for the user. Further, when the cross-domain recommendation control is in the enabled state, the cross-domain recommendation management interface 302 can further present a learning list of the browser APP, and the learning list includes multiple options. An option on the cross-domain recommendation management interface 302 can be understood as the name of an application and a corresponding switch control. Therefore, it can also be said that the cross-domain recommendation management interface 302 includes the cross-domain recommendation control and multiple options, and each option in the multiple options is associated with an application, and the option associated with the application is used to control the enabling and disabling of the permission of the browser APP to obtain user behavior data from the application. It can also be understood that the option associated with the application is used to control the browser APP to perform the cross-domain recommendation function based on the user behavior data in the application. For ease of understanding, the meaning of the option is still illustrated by the switch control in the following embodiments.
[0343] As mentioned above, the learning list includes multiple options, that is, the cross-domain recommendation management interface 302 presents the names of multiple applications and corresponding switch controls. As shown in (b) of FIG. 1, the cross-domain recommendation management interface 302 presents the names of the music APP, the reading APP, the browser APP, the news APP, the video APP, and the shopping APP, and corresponding switch controls. Figure 17 As shown in (b) of FIG. 1, when the switch control corresponding to an application is in the enabled state, the video APP can obtain user behavior data from the APP and learn to recommend for the user. The cross-domain recommendation interface 302 can further display that the application that has enabled the cross-domain recommendation function obtains user data in each application (for example, the music APP, the reading APP, the browser APP, the news APP, the video APP, or the shopping APP, etc.). As shown in (b) of FIG. 1, the music APP, the reading APP, the browser APP, the news APP, the video APP, and the shopping APP are in the enabled state, and the chat APP is in the disabled state. Figure 17 As shown in (b) of FIG. 1, when the cross-domain recommendation control is in the enabled state, the first interface presents multiple switch controls, and the multiple switch controls correspond to the music APP, the reading APP, the shopping APP, the video APP, the news APP, and the chat APP, etc. Taking the control corresponding to the music APP as an example, when the control corresponding to the music APP is in the enabled state, that is, the music APP is in the “allowed” state, the browser APP can obtain user behavior data from the music APP and learn to recommend for the user.
[0344] If the user performs a disabling operation on the control corresponding to the music APP, in response to the disabling operation, the phone presents a second interface as shown in (c) of FIG. 1. Figure 17As shown in (c), the browser app no longer obtains user behavior data from the music app; that is, it is not allowed to obtain user behavior data from the music app. If the user performs a "close" operation on the "Allow cross-domain recommendations" control, in response to this operation, the browser app will disable the cross-domain recommendation function, meaning it will not allow the browser app to obtain user interaction data from other apps. For example, if the user performs a... Figure 17 As shown in Figure (b), clicking the "Allow Cross-Domain Recommendations" control triggers a click on the phone, which in turn disables the browser app's cross-domain recommendation function. The cross-domain recommendation management interface can display something like... Figure 17 As shown in Figure (d), the browser app's cross-domain recommendation function is disabled across all applications in this learning list. This improves management efficiency and enhances user experience.
[0345] The content recommended by an application to a user is called the recommendation object, which can be displayed within the application. When a user enters the application, a recommendation request is triggered, and the recommendation model recommends relevant content to the user based on that request.
[0346] For example, the information feed recommended by the browser app to the user can be displayed on the main interface of the browser app.
[0347] For example, when a user clicks on a browser app, the phone displays the following in response to the click: Figure 18 The main interface 303 of the browser app shown in (a) can display a recommendation list of one or more recommended contents, which are the recommended objects in the browser app. It should be understood that the main interface 303 of the browser app may also include other more or fewer display contents, and this application does not limit this.
[0348] Users can perform actions on the recommended list displayed on the browser app's main interface (303 error message) to view, delete (or ignore) recommended content, or view related information. For example, clicking on a recommended item will open the recommended content on the phone. Similarly, swiping quickly to the left (or right) on a recommended item will remove it from the recommended list. Long-pressing a recommended item will display its related information on the phone. Figure 18 As shown in Figure (a), the user performs the following... Figure 18In response to the long press operation shown in (a), the phone can display a prompt box as shown in the figure. The prompt information is displayed in the selection box, which is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs. As shown in (b), the phone can display a prompt box as shown in the figure. The prompt information is displayed in the selection box, which is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs. Figure 18 In response to the long press operation shown in (a), the phone can display a prompt box as shown in the figure. The prompt information is displayed in the selection box, which is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs. As shown in (b), the phone can display a prompt box as shown in the figure. The prompt information is displayed in the selection box, which is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs.
[0349] It should be understood that in some other embodiments, the user can open the video or delete the recommended content in other ways, and the related information of the recommended content can also be called out in other ways such as left and right slow sliding, which is not limited in the embodiments of the present application.
[0350] For example, when the user performs a click operation on the browser APP, in response to the click operation, the phone can also display a prompt box as shown in (a) of FIG. 10B. The prompt information is displayed in the selection box, which is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs. Figure 18 As shown in (b) of FIG. 10B, the phone can display a main interface 304 of the browser APP, which can display a recommended list of one or more recommended contents and prompt information corresponding to the one or more recommended contents in the main interface 304. The one or more recommended contents are the recommended objects in the browser APP. It should be understood that the main interface 304 can also include more or less display contents, which are not limited in the embodiments of the present application. The prompt information is used to prompt the user that the recommended content is recommended based on the user interaction data in other application programs.
[0351] The user can perform certain operations on the video presented by the recommended list of the main interface 304 to view the recommended content, delete (or ignore) the recommended content, etc. For example, the user clicks on a certain recommended content, and in response to the click operation, the phone can open the recommended content. For another example, the user slides left (or right) a certain recommended content, and in response to the operation, the phone can delete the recommended content from the recommended list. It should be understood that in some other embodiments, the user can open the recommended content or delete the recommended content in other ways, and the related information of the recommended content can also be deleted in other ways such as left and right slow sliding, which is not limited in the embodiments of the present application.
[0352] It should be understood that the prompt information is mainly provided for the user to provide reference information, so that the user knows that the current recommended object is obtained based on the cross-domain recommendation function, and the content of the prompt information can also have other forms, which are not limited in the embodiments of the present application.
[0353] It should be noted that in the embodiments of the present application, the user deletes the recommended content in the main interface, which can be understood as that the user only deletes a certain recommended content in the recommended list of the main interface, that is, the user is not interested in the recommended content. This behavior can be recorded in the user behavior log as training data for the recommendation model. For example, as a biased sample in the foregoing method.
[0354] When a phone has a large number of apps, for some apps that require cross-domain recommendations, the cross-domain recommendation feature can be enabled. For example, the cross-domain recommendation feature can be enabled or disabled in the following two ways.
[0355] One type is enabling or disabling a cross-domain recommendation feature for a specific application at a single point. For example, ... Figure 13 As shown, in the cross-domain recommendation management interface of the application, enabling or disabling the cross-domain recommendation control allows you to turn the application's cross-domain recommendation function on or off with a single click.
[0356] Another approach is to batch disable or enable cross-domain recommendation features for all applications. For example, ... Figure 19 Figure (a) shows the relationship with Figure 17 The same interface as diagram (a). The user executes... Figure 19 Clicking the batch management control shown in Figure (a) activates the batch management interface 305, which includes a search application control, a cross-domain recommendation master switch control, cross-domain recommendation switch controls for individual applications, or a sidebar alphabetical sorting index control. Users can enable or disable the cross-domain learning function for all applications by turning the cross-domain recommendation master switch control (the switch after "All" in the figure) on and off. The batch management interface 305 also includes cross-domain recommendation switch controls for individual applications, allowing users to enable or disable the cross-domain recommendation function for a single application. In some embodiments, the cross-domain recommendation switch controls for each application displayed in the batch management interface 305 can be arranged alphabetically by the first letter of the application name from "A" to "Z," with each application's cross-domain recommendation function controlled by its own switch control.
[0357] It should be understood that in the embodiments of this application, "disable cross-domain recommendation," "disable application's cross-domain recommendation," "disable cross-domain recommendation function," and "disable application's cross-domain recommendation function" can be considered to express the same meaning, all of which can be understood as disabling the application's cross-domain recommendation function, and the application no longer performs cross-domain recommendations. Similarly, "enable cross-domain recommendation," "enable application's cross-domain recommendation," "enable cross-domain recommendation function," and "enable application's cross-domain recommendation function" can be considered to express the same meaning, all of which can be understood as enabling the application's cross-domain recommendation function, and the application can perform cross-domain recommendations.
[0358] Based on the above embodiments and related drawings, this application provides a recommended method that can be implemented in electronic devices (such as mobile phones, tablets, etc.). Figure 20is a schematic flowchart of the recommendation method provided by the embodiments of the present application, as shown in Figure 20 The method 1200 can include the following steps:
[0359] S1210, displaying a first interface.
[0360] The first interface can include a learning list of at least one application program, and the learning list of a first application program in the learning list of the at least one application program includes at least one option, each of which is associated with an application program.
[0361] Exemplarily, as shown in (b) of FIG. 2 in the specification, Figure 17 The first interface can be a cross-domain recommendation management interface 302 of the browser APP. The cross-domain recommendation management interface 302 is used to control the opening and closing of the cross-domain recommendation function of the browser APP.
[0362] Exemplarily, as shown in (b) of FIG. 2 in the specification, Figure 17 The learning list of the first application program can be a learning list of the browser APP.
[0363] Exemplarily, as shown in (b) of FIG. 2 in the specification, Figure 17 The at least one option can be the same as the application name, such as a "shopping" option, a "map" option, a "health" option, a "video" option, etc. Each of the at least one option is associated with an application program, and the option associated with the application is used to control the opening and closing of the function of learning the user's behavior in the application program. In other words, the option associated with the application is used to control whether to allow the first application program to obtain the data of the application program for cross-domain recommendation.
[0364] S1220, sensing a first operation of the user on the first interface.
[0365] The first operation can be a click operation, a double-click operation, a long-press operation, or a sliding operation, etc.
[0366] S1230, in response to the first operation, opening or closing the cross-domain recommendation function of the first application program in the application programs associated with the part or all options in the learning list of the first application program.
[0367] That is, the first application program is allowed to obtain the user behavior data in the application programs associated with the part or all options, learn the user's preferences in the application program, and make recommendations for the user in the first application program.
[0368] After the first operation, the user can see from the interface that the cross-domain recommendation function of the first application program is in an open state or a closed state.
[0369] In one embodiment, a first operation is applied to a first option, and in response to a user's first operation on the first option, the cross-domain recommendation function of the first application in the application associated with the first option is turned on or off; wherein, the first option is located in the learning list of the first application.
[0370] For example, such as Figure 17 As shown in Figure (c), the first option can be the "Music" option on the first interface. It should be understood that the first option can be any application-related option in the learning list of the first application on the first interface, such as the "Music" option, the "Shopping" option, the "Browser" option, etc.
[0371] For example, such as Figure 17 As shown in Figure (c), the first operation can be an on / off operation of the switch control corresponding to the first option. For example, when the switch control corresponding to the first option is in the on state, the first operation can be used to close the switch control corresponding to the first option, thereby disabling the function of the first application in cross-domain recommendation within the application associated with the first option. Conversely, when the switch control corresponding to the first option is in the off state, the first operation can be used to open the switch control corresponding to the first option, thereby enabling the function of the first application in cross-domain recommendation within the application associated with the first option. In this way, the user can individually control the on / off state of the cross-domain recommendation function of the first application in each of the other applications.
[0372] In one embodiment, the first operation is applied to a switch control corresponding to the learning list of the first application. In response to the user's first operation on the switch control, the cross-domain recommendation function of the first application in the applications associated with all options in the learning list of the first application is turned on or off.
[0373] For example, such as Figure 17 As shown in Figure (b), the first operation can be a closing operation on the cross-domain recommendation control. Optionally, if the cross-domain recommendation control is closed before the first operation, the first operation can be a closing operation on the cross-domain recommendation control. In this way, the user can have overall control over the cross-domain recommendation function of the first application, improving management efficiency and enhancing the user experience.
[0374] In one embodiment, method 1200 further includes: displaying a second interface for presenting one or more recommended objects and prompts for the one or more recommended objects, the prompts for the one or more recommended objects indicating that the one or more recommended objects are determined based on user behavior data in the at least one application.
[0375] For example, such asFigure 18 As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP.
[0376] As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP. Figure 18 As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP.
[0377] As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP. Figure 18 As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP.
[0378] In one embodiment, the one or more recommended objects are determined by inputting the information of the user and the information of the candidate recommended object into the recommendation model to predict the probability of the user having an operation action on the candidate recommended object.
[0379] For example, the user behavior data in the video APP is taken as the data of the source domain, and the user behavior in the browser APP is taken as the data of the target domain. The method 1100 is executed to obtain the recommendation model. The recommendation model can be used to predict the probability of the user having an operation action on the candidate recommended object. The recommended content is determined based on the probability value, and the content shown in (a) of FIG. 13 is displayed. Figure 14
[0380] In one embodiment, the recommendation model is obtained by training the first neural network using a biased data set and an unbiased data set in a sample set according to a first distillation manner. The biased data set includes biased samples, and the unbiased data set includes unbiased samples. The first distillation manner is determined according to the data characteristics of the sample set. The samples in the biased data set include the information of the first user, the information of the first recommended object, and the actual label. The actual label of the sample in the unbiased data set is used to indicate whether the first user has an operation action on the first recommended object. The samples in the unbiased data set include the information of the second user, the information of the second recommended object, and the actual label. The actual label of the sample in the unbiased data set is used to indicate whether the second user has an operation action on the second recommended object.
[0381] For example, when the user allows the first application program to start the cross-domain recommendation function, the first application program can obtain the user behavior data from the application programs associated with the first selection, and take the user behavior data in the application programs associated with the first selection as the data of the source domain. It should be understood that the data of the source domain can also include user behavior data in other applications. For example, when the user allows the first application program to perform cross-domain learning in all application programs associated with the options in the learning list of the first application program, the first application program can obtain user behavior data from all application programs associated with the options, and take the obtained user behavior data as the data of the source domain.
[0382] As shown in (a) of FIG. 13, the second interface can be a main interface 303 of the browser APP.Figure 6 The trained first neural network is updated. For detailed description, please refer to the foregoing Figure 6 The steps of the method are shown, and details are not repeated here.
[0383] In an embodiment, before displaying the first interface, the method further includes: displaying a third interface, the third interface including at least one application corresponding switch control; detecting a third operation of a user on a switch control of a first application in the at least one application corresponding switch control on the third interface; and in response to the third operation, displaying the first interface.
[0384] Exemplarily, as shown in (a) of FIG. 1, Figure 17 , the third interface can be a setting application main interface 301.
[0385] Exemplarily, as shown in (a) of FIG. 1, Figure 17 , the switch control of the first application can be a cross-domain recommendation management control of a browser APP.
[0386] Exemplarily, as shown in (a) of FIG. 1, Figure 17 , the third operation can be a click operation on the switch control corresponding to the first application, and in response to the click operation, an interface as shown in (b) of FIG. 1 is displayed. Figure 17
[0387] According to the scheme in the embodiments of the present application, by migrating and sharing knowledge (for example, user interest preferences) between different domains, the user interaction history records of the source domain and the target domain are both included in learning, so that the recommendation model can better learn the user's preferences, so that the recommendation model can also well fit the user's interest preferences in the target domain, recommend the recommendation results conforming to the user's interests to the user, realize cross-domain recommendation, and alleviate the cold start problem.
[0388] The foregoing has introduced in detail the flow of the neural network distillation method and the recommendation method provided by the present application. Next, the device provided by the present application is described in combination with the flow of the foregoing method.
[0389] Referring to Figure 21 , a structural schematic diagram of a neural network distillation device provided by the present application is shown.
[0390] The neural network distillation device can include:
[0391] The acquisition module 2101 is configured to sample sets, the sample sets including an biased data set and an unbiased data set, the biased data set including biased samples, and the unbiased data set including unbiased samples. Generally, the sample quantity of the biased data set is greater than that of the unbiased data set.
[0392] The decision module 2102 is configured to determine a first distillation manner according to a data feature of the sample set, wherein different distillation manners are different in a guidance manner of a teacher model to a student model during knowledge distillation, the teacher model is trained by using an unbiased data set, and the student model is trained by using a biased data set.
[0393] The training module 2103 is configured to train the first neural network according to the first distillation manner based on the biased data set and the unbiased data set, to obtain an updated first neural network.
[0394] In a possible implementation, the samples in the sample set include input features and actual labels, and the first distillation manner is to perform distillation based on the input features of the samples in the biased data set and the unbiased data set.
[0395] In a possible implementation, the training module 2103 is specifically configured to train the first neural network by alternately using the biased data set and the unbiased data set, to obtain the updated first neural network, wherein in one alternation process, a batch training number of training the first neural network by using the biased data set and a batch training number of training the first neural network by using the unbiased data set are in a preset ratio, and the samples include input features as inputs of the first neural network.
[0396] In a possible implementation, when the preset ratio is 1, a difference between a first regular term and a second regular term is added in a loss function of the first neural network, the first regular term is a parameter obtained by training the first neural network by using the samples included in the unbiased data set, and the second regular term is a parameter obtained by training the first neural network by using the samples included in the biased data set.
[0397] In a possible implementation, the training module 2103 is specifically configured to set a confidence for the samples in the biased data set, the confidence is used to indicate a bias degree of the samples, and the first neural network is trained based on the biased data set, the confidence of the samples in the biased data set, and the unbiased data set, to obtain the updated first neural network, and the samples include input features as inputs of the first neural network during training of the first neural network.
[0398] In a possible implementation, the samples included in the biased data set and the unbiased data set include input features and actual labels, and the first distillation manner is to perform distillation based on predicted labels of the samples included in the unbiased data set, the predicted labels are output by an updated second neural network for the samples in the unbiased data set, and the updated second neural network is obtained by training the second neural network by using the unbiased data set.
[0399] In a possible implementation, the sample set further includes an unobserved data set, the unobserved data set including a plurality of unobserved samples; the training module 2103 is specifically configured to: train the first neural network by using the biased data set to obtain a trained first neural network, and train the second neural network by using the unbiased data set to obtain an updated second neural network; collect a plurality of samples from the sample set to obtain an auxiliary data set; and update the trained first neural network by using the auxiliary data set and taking the predicted labels of the samples in the data set as constraints to obtain an updated first neural network, the predicted labels of the samples in the data set being output by the updated second neural network.
[0400] In a possible implementation, the training module 2103 is specifically configured to: train the second neural network by using the unbiased data set to obtain an updated second neural network; output the predicted labels of the samples in the biased data set by using the updated second neural network; combine the predicted labels of the samples and the actual labels of the samples by weighting to obtain combined labels of the samples; and train the first neural network by using the combined labels of the samples to obtain an updated first neural network.
[0401] In a possible implementation, the decision module 2102 is specifically configured to: calculate a first ratio between the sample quantity of the unbiased data set and the sample quantity of the biased data set, select a first distillation manner matched with the first ratio from a plurality of distillation manners, and take the data features of the sample set to include the first ratio.
[0402] In a possible implementation, the first distillation manner includes: training a teacher model based on the features extracted from the unbiased data set, and performing knowledge distillation on a student model by using the teacher model and the biased data set.
[0403] In a possible implementation, the training module 2103 is specifically configured to: output the features of the unbiased data set by using a preset algorithm; train the second neural network according to the features of the unbiased data set to obtain an updated second neural network; take the second neural network as a teacher model and the first neural network as a student model, and perform knowledge distillation on the first neural network by using the biased data set to obtain an updated first neural network.
[0404] In a possible implementation, the training module 2103 is specifically configured to: obtain the feature dimension quantity included in the unbiased data set and the biased data set; select a first distillation manner matched with the feature dimension quantity from a plurality of distillation manners, and take the data features of the sample set to include the feature dimension quantity.
[0405] In a possible implementation, the training module 2103 is specifically configured to: update the second neural network by using the unbiased data set to obtain an updated second neural network; and use the updated second neural network as a teacher model and the first neural network as a student model to perform knowledge distillation on the first neural network by using the biased data set to obtain an updated first neural network.
[0406] In a possible implementation, according to at least one of data included in the biased data set or data included in the unbiased data set, the decision module 2102 is specifically configured to: calculate a second ratio of a number of positive samples and a number of negative samples included in the unbiased data set, and select a first distillation manner matched with the second ratio from a plurality of distillation manners, the data feature of the sample set including the second ratio; or calculate a third ratio of a number of positive samples and a number of negative samples included in the biased data set, and select a first distillation manner matched with the third ratio from a plurality of distillation manners, the data feature of the sample set including the third ratio.
[0407] In a possible implementation, the type of the sample included in the biased data set is different from the type of the sample included in the unbiased data set.
[0408] In a possible implementation, after obtaining the updated first neural network, the apparatus further includes:
[0409] The output module 2104 is configured to: obtain at least one sample of a target user; input the at least one sample into the updated first neural network to output at least one label of the target user, the at least one label forming a user portrait of the target user, and the user portrait being used to determine a sample matched with the target user.
[0410] Referring to Figure 22 The present application provides a structure diagram of a recommendation device, as follows.
[0411] The obtaining unit 2201 is configured to obtain information of a target user and information of a candidate recommendation object;
[0412] The processing unit 2202 is configured to input the information of the target user and the information of the candidate recommendation object into a recommendation model to predict a probability of an operation action of the target user on the candidate recommendation object;
[0413] The recommendation model is obtained by training the first neural network according to a first distillation manner using a biased data set and an unbiased data set in the sample set, the biased data set includes biased samples, the unbiased data set includes unbiased samples, the first distillation manner is determined according to data characteristics of the sample set, the samples in the biased data set include information of a first user, information of a first recommendation object, and actual labels, the actual labels of the samples in the unbiased data set are used to indicate whether the first user has an operation action on the first recommendation object, the samples in the unbiased data set include information of a second user, information of a second recommendation object, and actual labels, and the actual labels of the samples in the unbiased data set are used to indicate whether the second user has an operation action on the second recommendation object.
[0414] In a possible implementation, the unbiased data set is obtained in a case where candidate recommendation objects in the candidate recommendation object set have the same probability of being displayed, and the second recommendation object is a candidate recommendation object in the candidate recommendation object set.
[0415] In a possible implementation, the unbiased data set is obtained in a case where candidate recommendation objects in the candidate recommendation object set have the same probability of being displayed, and the second recommendation object is a candidate recommendation object in the candidate recommendation object set.
[0416] In a possible implementation, the samples in the unbiased data set belong to source domain data, and the samples in the biased data set belong to target domain data.
[0417] Please refer to Figure 23 The application provides a structural diagram of an electronic device, as follows.
[0418] The display unit 2301 is configured to display a first interface, the first interface includes at least one learning list of an application, a learning list of a first application in the at least one learning list of the application includes at least one option, and an option in the at least one option is associated with an application;
[0419] The processing unit 2302 is configured to perceive a first operation of a user on the first interface.
[0420] The display unit is further configured to, in response to the first operation, open or close a cross-domain recommendation function of the first application in an application associated with a part or all of the options in the learning list of the first application.
[0421] In a possible implementation, the one or more recommended objects are determined by inputting the information of the user and the information of the candidate recommended objects into a recommendation model to predict a probability of the user having an operation action on the candidate recommended objects.
[0422] In a possible implementation, the recommendation model is obtained by training the first neural network using a biased data set and an unbiased data set in the sample set according to a first distillation manner, the biased data set includes biased samples, the unbiased data set includes unbiased samples, the first distillation manner is determined according to data characteristics of the sample set, the samples in the biased data set include information of a first user and information of a first recommended object and an actual label, the actual label of the sample in the unbiased data set is used to indicate whether the first user has an operation action on the first recommended object, the samples in the unbiased data set include information of a second user and information of a second recommended object and an actual label, and the actual label of the sample in the unbiased data set is used to indicate whether the second user has an operation action on the second recommended object.
[0423] Referring to Figure 24 , another structural diagram of a neural network distillation apparatus provided by the present application is shown as follows.
[0424] The neural network distillation apparatus can include a processor 2401 and a memory 2402. The processor 2401 and the memory 2402 are interconnected by a line. The memory 2402 stores program instructions and data.
[0425] The memory 2402 stores program instructions and data corresponding to the steps in the foregoing Figure 6 .
[0426] The processor 2401 is configured to execute the method steps performed by the neural network distillation apparatus shown in any of the embodiments in the foregoing Figure 6 .
[0427] Optionally, the neural network distillation apparatus can further include a transceiver 2403 for receiving or sending data.
[0428] The computer readable storage medium provided in the embodiments of the present application stores a program, and when the program is run on a computer, the computer executes the steps in the method described in the embodiments shown in the foregoing Figure 6 .
[0429] Optionally, the neural network distillation apparatus shown in the foregoing Figure 24 is a chip.
[0430] Referring to Figure 25 , another structural diagram of a recommendation apparatus provided by the present application is shown as follows.
[0431] The recommendation apparatus can include a processor 2501 and a memory 2502. The processor 2501 and the memory 2502 are interconnected by a line. The memory 2502 stores program instructions and data.
[0432] The memory 2502 stores program instructions and data corresponding to the steps in the foregoing Figure 11 .
[0433] The processor 2501 is configured to execute the method steps performed by the recommendation apparatus shown in any of the foregoing Figure 11 embodiments.
[0434] Optionally, the recommendation apparatus can further include a transceiver 2503 for receiving or sending data.
[0435] The embodiment of the present application further provides a computer readable storage medium, which stores a program. When the program runs on a computer, the computer is caused to execute the steps in the method described in the foregoing Figure 11 embodiments.
[0436] Optionally, the recommendation apparatus shown in the foregoing Figure 25 is a chip.
[0437] Please refer to Figure 26 , the present application provides another structural schematic diagram of an electronic device, as follows.
[0438] The electronic device can include a processor 2601 and a memory 2602. The processor 2601 and the memory 2602 are interconnected by a line. The memory 2602 stores program instructions and data.
[0439] The memory 2602 stores program instructions and data corresponding to the steps in the foregoing Figure 20 .
[0440] The processor 2601 is configured to execute the method steps performed by the electronic device shown in the foregoing Figure 20 .
[0441] Optionally, the electronic device can further include a transceiver 2603 for receiving or sending data.
[0442] The embodiment of the present application further provides a computer readable storage medium, which stores a program. When the program runs on a computer, the computer is caused to execute the steps in the method described in the foregoing Figure 20 embodiments.
[0443] Optionally, the electronic device shown in the foregoing Figure 26 is a chip.
[0444] The embodiments of the present application also provide a neural network distillation apparatus, which can also be referred to as a digital processing chip or a chip. The chip includes a processing unit and a communication interface. The processing unit obtains program instructions through the communication interface. The program instructions are executed by the processing unit. The processing unit is configured to execute the method steps of the foregoing Figure 6-20 embodiments.
[0445] The embodiments of the present application also provide a digital processing chip. The digital processing chip integrates a circuit for implementing the functions of the processor 2401, the processor 2501, the processor 2601, or the processor 2301, the processor 2501, the processor 2601, and one or more interfaces. When the digital processing chip integrates a memory, the digital processing chip can complete the method steps of any one or more of the foregoing embodiments. When the digital processing chip does not integrate a memory, the digital processing chip can be connected with an external memory through a communication interface. The digital processing chip implements the actions performed by the neural network distillation apparatus, the recommendation apparatus, or the electronic device according to the program code stored in the external memory.
[0446] The embodiments of the present application also provide a computer program product. When the computer program product is executed on a computer, the computer is caused to execute the method steps described in the foregoing Figure 6-20 embodiments.
[0447] The neural network distillation apparatus provided by the embodiments of the present application can be a chip. The chip includes a processing unit and a communication unit. The processing unit can be a processor. The communication unit can be an input / output interface, a pin, or a circuit. The processing unit can execute computer execution instructions stored in a storage unit, so that the chip in the server executes the training set processing method described in the foregoing Figure 6-10 embodiments. Optionally, the storage unit is a storage unit in the chip, such as a register or a cache. The storage unit can also be a storage unit outside the chip in the wireless access device, such as a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM), and the like.
[0448] Specifically, the aforementioned processing unit or processor can be a central processing unit (CPU), a neural-network processing unit (NPU), a graphics processing unit (GPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), or a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0449] Exemplarily, refer to Figure 27 , Figure 27 A structural schematic diagram of a chip provided by an embodiment of the present application is shown in FIG. 3. The chip can be a neural-network processing unit (NPU) 270, which is mounted on a host CPU as a coprocessor and assigned tasks by the host CPU. The core part of the NPU is an operation circuit 2703, which extracts matrix data in a memory and performs multiplication operation under the control of a controller 2704.
[0450] In some implementations, the operation circuit 2703 internally includes a plurality of processing engines (PEs). In some implementations, the operation circuit 2703 is a two-dimensional systolic array. The operation circuit 2703 can also be a one-dimensional systolic array or other electronic circuit capable of performing mathematical operations such as multiplication and addition. In some implementations, the operation circuit 2703 is a general-purpose matrix processor.
[0451] For example, assume that there are an input matrix A, a weight matrix B, and an output matrix C. The operation circuit takes corresponding data of the matrix B from a weight memory 2702 and caches the data on each PE of the operation circuit. The operation circuit takes matrix A data from an input memory 2701 and performs matrix operation with the matrix B, and the partial result or final result of the matrix is saved in an accumulator 2708.
[0452] The unified memory 2706 is used to store input data and output data. The weight data is transferred to the weight memory 2702 through the direct memory access controller (DMAC) 2705. The input data is also transferred to the unified memory 2706 through the DMAC.
[0453] The bus interface unit (BIU) 2710 is used for the interaction between the AXI bus and the DMAC and the instruction fetch buffer (IFB) 2709.
[0454] The bus interface unit (BIU) 2710 is used for the instruction fetch buffer 2709 to fetch instructions from the external memory, and is also used for the direct memory access controller 2705 to fetch the original data of the input matrix A or the weight matrix B from the external memory.
[0455] The DMAC is mainly used to transfer the input data in the external memory DDR to the unified memory 2706, or to transfer the weight data to the weight memory 2702, or to transfer the input data to the input memory 2701.
[0456] The vector calculation unit 2707 includes a plurality of operation processing units, which further process the output of the operation circuit as needed, such as vector multiplication, vector addition, exponential operation, logarithmic operation, size comparison, etc. It is mainly used for non-convolutional / full connection layer network calculation in neural networks, such as batch normalization, pixel-level summation, upsampling of feature planes, etc.
[0457] In some implementations, the vector calculation unit 2707 can store the processed output vector to the unified memory 2706. For example, the vector calculation unit 2707 can apply a linear function and / or a nonlinear function to the output of the operation circuit 2703, such as linear interpolation on the feature planes extracted by the convolutional layer, and further, for example, a vector of accumulated values to generate activation values. In some implementations, the vector calculation unit 2707 generates normalized values, pixel-level summation values, or both. In some implementations, the processed output vector can be used as an activation input to the operation circuit 2703, for example, for use in a subsequent layer in the neural network.
[0458] The instruction fetch buffer 2709 connected to the controller 2704 is used to store instructions used by the controller 2704;
[0459] The unified memory 2706, the input memory 2701, the weight memory 2702, and the instruction memory 2709 are on-chip memories. The external memory is private to the NPU hardware architecture.
[0460] The operations of the layers in the recurrent neural network can be performed by the operation circuit 2703 or the vector calculation unit 2707.
[0461] The processor mentioned in any of the above can be a general central processing unit, a microprocessor, an ASIC, or one or more integrated circuits for controlling the program execution of the method mentioned above. Figure 6-20
[0462] It should be noted that the apparatus embodiments described above are merely illustrative, and the units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Some or all of the modules can be selected to achieve the purpose of the embodiment according to actual needs. In addition, the connection relationship between the modules in the apparatus embodiment provided in the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.
[0463] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and necessary general hardware, and of course can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits, or special circuits. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., including a plurality of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0464] In the above embodiments, all or part can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part can be implemented in the form of a computer program product.
[0465] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that a computer can store or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk (SSD)) and the like.
[0466] The terms "first", "second", "third", "fourth" and the like in the specification and claims of the present application and the above-described drawings, if any, are used to distinguish similar objects, and do not necessarily have to describe a particular order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0467] Finally, it should be noted that the above is only a specific embodiment of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A neural network distillation method, characterized in that, include: Obtain a sample set, which includes a biased dataset and an unbiased dataset. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The sample set includes user behavior data obtained based on user interaction history. The user behavior data includes data related to the user's operation behavior when the recommended object is displayed to the user. The first distillation method is determined based on the data characteristics of the sample set, wherein, in the first distillation method, the teacher model is trained using the unbiased dataset, and the student model is trained using the biased dataset; Based on the biased dataset and the unbiased dataset, the first neural network is trained according to the first distillation method to obtain the updated first neural network; At least one sample of the target user is used as the input of the updated first neural network, and at least one label of the target user is output. The at least one label constitutes a user profile of the target user, and the user profile is used to make recommendations for the target user.
2. The method according to claim 1, characterized in that, The samples in the sample set include input features and actual labels, and the first distillation method is to distill using the input features of the samples in the sample set.
3. The method according to claim 2, characterized in that, The step of training the first neural network according to the first distillation method based on the biased dataset and the unbiased dataset to obtain the updated first neural network includes: The first neural network is trained by alternating between the biased dataset and the unbiased dataset to obtain the updated first neural network. In one alternation process, the number of batch training times using the biased dataset to train the first neural network and the number of batch training times using the unbiased dataset to train the first neural network are in a preset ratio, and the input features of the samples in the sample set are used as the input of the first neural network.
4. The method according to claim 2, characterized in that, The step of training the first neural network according to the first distillation method based on the biased dataset and the unbiased dataset to obtain the updated first neural network includes: A confidence level is set for the samples in the biased dataset, the confidence level being used to represent the degree of bias of the samples; The first neural network is trained based on the biased dataset, the confidence scores of the samples in the biased dataset, and the unbiased dataset to obtain the updated first neural network. When training the first neural network, the samples include input features as input to the first neural network.
5. The method according to claim 1, characterized in that, The first distillation method is to distill based on the predicted labels of the samples included in the unbiased dataset. The predicted labels are output by the updated second neural network for the samples in the unbiased dataset. The updated second neural network is obtained by training the second neural network using the unbiased dataset.
6. The method according to claim 5, characterized in that, The sample set also includes an unobserved dataset, which contains multiple unobserved samples; The step of training the first neural network according to the first distillation method based on the biased dataset and the unbiased dataset to obtain the updated first neural network includes: The first neural network is trained using the biased dataset to obtain the trained first neural network, and the second neural network is trained using the unbiased dataset to obtain the updated second neural network. Multiple samples are collected from the sample set to obtain an auxiliary dataset; Using the auxiliary dataset, and with the predicted labels of the samples in the auxiliary dataset as constraints, the trained first neural network is updated to obtain the updated first neural network. The predicted labels of the samples in the dataset include the labels output by the updated second neural network.
7. The method according to claim 5, characterized in that, The step of training the first neural network according to the first distillation method based on the biased dataset and the unbiased dataset to obtain the updated first neural network includes: The updated second neural network is obtained by training the second neural network using the unbiased dataset. The updated second neural network outputs the predicted labels of the samples in the biased dataset; The predicted labels and actual labels of the samples are weighted and merged to obtain the merged labels of the samples; The first neural network is trained using the merged labels of the samples to obtain the updated first neural network.
8. The method according to any one of claims 2-7, characterized in that, The data characteristics of the sample set include a first ratio, which is the ratio between the sample size of the unbiased dataset and the sample size of the biased dataset. Determining the first distillation method based on the data characteristics of the sample set includes: Select the first distillation method that matches the first ratio from a variety of distillation methods.
9. The method according to claim 1, characterized in that, The first distillation method includes: training the teacher model based on features extracted from the unbiased dataset to obtain the trained teacher model, and performing knowledge distillation on the student model using the trained teacher model and the biased dataset.
10. The method according to claim 9, characterized in that, The step of training the first neural network according to the first distillation method based on the biased dataset and the unbiased dataset to obtain the updated first neural network includes: Input features of some samples are selected from the unbiased dataset using the Deep Global Balanced Regression (DGBR) algorithm. The second neural network is trained based on the input features of the partial samples to obtain the updated second neural network; The updated second neural network is used as the teacher model, and the first neural network is used as the student model. The first neural network is then subjected to knowledge distillation using the biased dataset to obtain the updated first neural network.
11. The method according to claim 9 or 10, characterized in that, The data features of the sample set include the number of feature dimensions of the sample set, and determining the first distillation method based on the data features of the sample set includes: Select the first distillation method from a variety of distillation methods that matches the number of the feature dimensions.
12. The method according to any one of claims 1-7, characterized in that, The first distillation method is selected from a plurality of preset distillation methods, including at least two distillation methods in which the teacher model provides different guidance to the student model.
13. A recommendation method, characterized in that, include: Obtain information about the target user and the candidate recommendation objects; The information of the target user and the information of the candidate recommendation objects are input into the recommendation model, and the probability of the target user having an action on the candidate recommendation objects is predicted based on the user profile. The recommendation model is trained on a first neural network using a biased and an unbiased dataset from the sample set according to a first distillation method. At least one sample of the target user serves as input to the recommendation model, and at least one label of the target user is output. These at least one label constitute the user profile of the target user. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The first distillation method is determined based on the data characteristics of the sample set. In the first distillation method, the unbiased dataset is used to train a teacher model, and the biased dataset is used to train a student model. The samples in the biased dataset include information about a first user, information about a first recommended object, and actual labels. The actual labels of the samples in the unbiased dataset indicate whether the first user has performed an action on the first recommended object. The samples in the unbiased dataset also include information about a second user and information about a second recommended object, as well as actual labels. The actual labels of the samples in the unbiased dataset indicate whether the second user has performed an action on the second recommended object.
14. The method according to claim 13, characterized in that, The unbiased dataset is obtained when the probability of displaying the candidate recommendation objects in the candidate recommendation object set is the same, and the second recommendation object is one of the candidate recommendation objects in the candidate recommendation object set.
15. The method according to claim 14, characterized in that, The unbiased dataset is obtained when the probability of displaying each candidate recommendation object in the candidate recommendation object set is the same, including: The samples in the unbiased dataset are obtained when candidate recommendation objects in the candidate recommendation object set are randomly presented to the second user. Alternatively, the samples in the unbiased dataset are obtained when the second user searches for the second recommended object.
16. A recommendation method, characterized in that, include: Display a first interface, the first interface including a learning list of at least one application, the learning list of the first application in the learning list of at least one application including at least one option, the option of the at least one option being associated with an application; Sensing the user's first action on the first interface; In response to the first operation, the cross-domain recommendation function of the first application in the applications associated with some or all of the options in the learning list of the first application is turned on or off; The one or more recommended objects are determined by inputting the user's information and the information of the candidate recommended objects into the recommendation model, and predicting the probability that the user will perform an action on the candidate recommended objects based on the user profile. The recommendation model is trained on a first neural network using a biased and an unbiased dataset from the sample set according to a first distillation method. At least one sample from the target user is used as input to the recommendation model, and at least one label from the target user is output. These at least one label constitute the user profile of the target user, which describes the target user. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The first distillation method is determined based on the data characteristics of the sample set. In the first distillation method, the teacher model is trained using the unbiased dataset, and the student model is trained using the biased dataset. The samples in the biased dataset include information about the first user, information about the first recommended object, and actual labels. The actual labels of the samples in the unbiased dataset indicate whether the first user has performed an action on the first recommended object. The samples in the unbiased dataset also include information about the second user and the second recommended object, as well as actual labels. The actual labels of the samples in the unbiased dataset indicate whether the second user has performed an action on the second recommended object.
17. A neural network distillation apparatus, characterized in that, include: The acquisition module is used to acquire a sample set, which includes a biased dataset and an unbiased dataset. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The sample set includes user behavior data obtained based on user interaction history. The user behavior data includes data related to the user's operation behavior when the recommended object is displayed to the user. The decision module is used to determine a first distillation method based on the data characteristics of the sample set, wherein, in the first distillation method, the teacher model is trained using the unbiased dataset, and the student model is trained using the biased dataset; The training module is used to train the first neural network based on the biased dataset and the unbiased dataset according to the first distillation method to obtain the updated first neural network. The output module is used to take at least one sample of the target user as input to the updated first neural network and output at least one label of the target user, wherein the at least one label constitutes a user profile of the target user, and the user profile is used to make recommendations for the target user.
18. The apparatus according to claim 17, characterized in that, The samples in the sample set include input features and actual labels, and the first distillation method is to perform distillation using the input features of the samples in the sample set.
19. The apparatus according to claim 18, characterized in that, The training module is specifically used to alternately train the first neural network using the biased dataset and the unbiased dataset to obtain the updated first neural network. In one alternation process, the number of batch training times using the biased dataset to train the first neural network and the number of batch training times using the unbiased dataset to train the first neural network are in a preset ratio, and the input features of the samples in the sample set are used as the input of the first neural network.
20. The apparatus according to claim 18, characterized in that, The training module is specifically used to set confidence levels for samples in the biased dataset, whereby the confidence level represents the degree of bias of the samples; and to train a first neural network based on the biased dataset, the confidence levels of the samples in the biased dataset, and the unbiased dataset to obtain the updated first neural network, wherein the samples include input features as input to the first neural network during the training of the first neural network.
21. The apparatus according to claim 17, characterized in that, The first distillation method is to distill based on the predicted labels of the samples included in the unbiased dataset. The predicted labels are output by the updated second neural network for the samples in the unbiased dataset. The updated second neural network is obtained by training the second neural network using the unbiased dataset.
22. The apparatus according to claim 21, characterized in that, The sample set also includes an unobserved dataset, which contains multiple unobserved samples; The training module is specifically used for: The first neural network is trained using the biased dataset to obtain the trained first neural network, and the second neural network is trained using the unbiased dataset to obtain the updated second neural network. Multiple samples are collected from the sample set to obtain an auxiliary dataset; Using the auxiliary dataset, and with the predicted labels of the samples in the auxiliary dataset as constraints, the trained first neural network is updated to obtain the updated first neural network. The predicted labels of the samples in the auxiliary dataset include the labels output by the updated second neural network.
23. The apparatus according to claim 21, characterized in that, The training module is specifically used for: The updated second neural network is obtained by training the second neural network using the unbiased dataset. The updated second neural network outputs the predicted labels of the samples in the biased dataset; The predicted labels and actual labels of the samples are weighted and merged to obtain the merged labels of the samples; The first neural network is trained using the merged labels of the samples to obtain the updated first neural network.
24. The apparatus according to any one of claims 18-23, characterized in that, The data characteristics of the sample set include a first ratio, which is the ratio between the sample size of the unbiased dataset and the sample size of the biased dataset. The decision module is specifically used to select the first distillation method that matches the first ratio from a variety of distillation methods.
25. The apparatus according to claim 17, characterized in that, The first distillation method includes: training the teacher model based on features extracted from the unbiased dataset to obtain the trained teacher model, and performing knowledge distillation on the student model using the trained teacher model and the biased dataset.
26. The apparatus according to claim 25, characterized in that, The training module is specifically used for: Input features of some samples are selected from the unbiased dataset using the Deep Global Balanced Regression (DGBR) algorithm. The second neural network is trained based on the input features of the partial samples to obtain the updated second neural network; Using the second neural network as the teacher model and the first neural network as the student model, the first neural network is subjected to knowledge distillation using the biased dataset to obtain the updated first neural network.
27. The apparatus according to claim 25 or 26, characterized in that, The data features of the sample set include the number of feature dimensions of the sample set; the training module is specifically used for: Select the first distillation method from a variety of distillation methods that matches the number of the feature dimensions.
28. The apparatus according to any one of claims 17-23, characterized in that, The first distillation method is selected from a plurality of preset distillation methods, including at least two distillation methods in which the teacher model provides different guidance to the student model.
29. A recommendation device, characterized in that, include: The acquisition unit is used to acquire information about the target user and the candidate recommendation objects. The processing unit is used to input the information of the target user and the information of the candidate recommendation object into the recommendation model, and predict the probability that the target user will have an operation on the candidate recommendation object based on the user profile; The recommendation model is trained on a first neural network using a biased and an unbiased dataset from the sample set according to a first distillation method. At least one sample of the target user serves as input to the recommendation model, and at least one label of the target user is output. These at least one label constitute the user profile of the target user. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The first distillation method is determined based on the data characteristics of the sample set. In the first distillation method, the unbiased dataset is used to train a teacher model, and the biased dataset is used to train a student model. The samples in the biased dataset include information about a first user, information about a first recommended object, and actual labels. The actual labels of the samples in the unbiased dataset indicate whether the first user has performed an action on the first recommended object. The samples in the unbiased dataset also include information about a second user and information about a second recommended object, as well as actual labels. The actual labels of the samples in the unbiased dataset indicate whether the second user has performed an action on the second recommended object.
30. The apparatus as claimed in claim 29, characterized in that, The unbiased dataset is obtained when the probability of displaying the candidate recommendation objects in the candidate recommendation object set is the same, and the second recommendation object is one of the candidate recommendation objects in the candidate recommendation object set.
31. The apparatus according to claim 30, characterized in that, The unbiased dataset is obtained when the probability of displaying each candidate recommendation object in the candidate recommendation object set is the same, including: The samples in the unbiased dataset are obtained when candidate recommendation objects in the candidate recommendation object set are randomly presented to the second user. Alternatively, the samples in the unbiased dataset are obtained when the second user searches for the second recommended object.
32. An electronic device, characterized in that, include: The display unit is used to display a first interface, the first interface including a learning list of at least one application, the learning list of the first application in the learning list of at least one application including at least one option, and the option in the at least one option is associated with an application; A processing unit, the processing unit being used to sense the user's first operation on the first interface; The display unit is also configured to, in response to the first operation, turn on or off the cross-domain recommendation function of the first application in the applications associated with some or all of the options in the learning list of the first application; The one or more recommended objects are determined by inputting the user's information and the information of the candidate recommended objects into the recommendation model, and predicting the probability that the user will perform an action on the candidate recommended objects based on the user profile. The recommendation model is trained on a first neural network using a biased and an unbiased dataset from the sample set according to a first distillation method. At least one sample from the target user is used as input to the recommendation model, and at least one label from the target user is output. These at least one label constitute the user profile of the target user. The biased dataset includes biased samples, and the unbiased dataset includes unbiased samples. The first distillation method is determined based on the data characteristics of the sample set. In the first distillation method, the unbiased dataset is used to train a teacher model, and the biased dataset is used to train a student model. The samples in the biased dataset include information about a first user, information about a first recommended object, and actual labels. The actual labels of the samples in the unbiased dataset indicate whether the first user has performed an action on the first recommended object. The samples in the unbiased dataset include information about a second user and information about a second recommended object, as well as actual labels. The actual labels of the samples in the unbiased dataset indicate whether the second user has performed an action on the second recommended object.
33. A neural network distillation apparatus, characterized in that, The method includes a processor coupled to a memory storing a program, wherein the program instructions stored in the memory are executed by the processor to implement the method of any one of claims 1 to 12.
34. A recommended device, characterized in that, It includes at least one processor and a memory, the at least one processor being coupled to the memory for reading and executing instructions in the memory to perform the recommended method as described in any one of claims 13-15.
35. An electronic device, characterized in that, include: processor; Memory; The memory stores one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform the method of claim 16.
36. A computer-readable storage medium, characterized in that, The program, when executed by the processing unit, performs the method as described in any one of claims 1 to 12, 13-15, or 16.
Citation Information
Patent Citations
Display control method, electronic equipment and computer readable storage medium
CN110879679A