Model training and recommendation method, device, electronic device and storage medium
By aggregating the gradient of user activity in the recommendation system and adjusting the recommended model parameters, the recommendation reliability problem caused by the long-tail distribution of user activity is solved, and the understanding and prediction ability of the recommendation model is improved.
Patent Information
- Application Number
- CN202210492953.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-05-07
AI Technical Summary
In the recommendation system, user activity forms a long-tail distribution, resulting in limited behavior of tail users, the recommendation model does not fully understand user preferences, and poor recommendation reliability.
By obtaining the user group data corresponding to the activity of each user, it is determined that the user group data is based on the training gradient of the recommended model, gradient aggregation is performed based on the activity of the user, and the recommended model parameters are adjusted to eliminate the impact of user activity on the recommended model.
The influence of user activity as a confounding factor on the parameters of the recommended model is eliminated, so that the recommended model can learn the characteristics of different user activity, and improve the recommendation reliability of the recommended model.
Smart Images

Figure CN114840757B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a model training and recommendation method, device, electronic device and storage medium. Background Art
[0002] The recommendation system is a product of the rapid development of the Internet. With the explosive growth of the user scale and the increasing variety of items provided by suppliers, the recommendation system can help users find information of interest from a large amount of information when the user's needs are unclear. The recommendation system combines user information, item information, and the user's past behavior on items, and uses machine learning technology to build a user interest model to provide users with accurate personalized recommendations.
[0003] In recommendation systems, user activity tends to form a long-tail distribution, and the behavior of tail users is very limited, resulting in the recommendation model's insufficient understanding of user preferences and poor reliability of recommendations. Summary of the invention
[0004] In view of this, embodiments of the present application provide a model training and recommendation method, device, electronic device and storage medium to at least partially solve the above problems.
[0005] According to a first aspect of an embodiment of the present application, a model training method is provided, including: obtaining user group data corresponding to each user activity; determining a training gradient of each user group data based on a recommendation model; performing gradient aggregation on the training gradient based on the activity of each user; and adjusting parameters of the recommendation model based on the aggregated training gradient.
[0006] In another implementation of the present application, the gradient aggregation of the training gradient based on the activity of each user includes: determining the conditional probability of each user activity relative to the corresponding user group data; and gradient aggregation of the training gradient of each user group data based on the conditional probability of each user activity.
[0007] In another implementation of the present application, the recommendation model includes a main network, which includes an embedding layer, a feature extraction layer and a classification layer. The input of the embedding layer serves as the input of the main network, the output of the embedding layer is connected to the input of the feature extraction layer, the output of the feature extraction layer is connected to the input of the classification layer, and the output of the classification layer serves as the output of the main network.
[0008] In another implementation of the present application, the recommendation model further includes a first branch network, which is connected between the embedding layer and the feature extraction layer.
[0009] In another implementation of the present application, the first branch network includes a first downsampling layer and a first upsampling layer, the first downsampling layer is used to downsample the input data of the embedding layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the feature extraction layer.
[0010] In another implementation of the present application, the recommendation model further includes a second branch network, which is connected between the feature extraction layer and the classification layer.
[0011] In another implementation of the present application, the second branch network includes a second downsampling layer and a second upsampling layer, the second downsampling layer is used to downsample the input data of the feature extraction layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the classification layer.
[0012] In another implementation of the present application, the method further includes: determining a training gradient of each user group data based on a recommendation model; and adjusting parameters of the first branch network and the second branch network respectively based on the training gradient of each user group data.
[0013] According to a second aspect of an embodiment of the present application, a recommendation method is provided, comprising: obtaining user data; inputting the user data into a recommendation model to obtain a recommendation object, wherein the recommendation model is the recommendation model according to the first aspect.
[0014] According to a third aspect of an embodiment of the present application, a model training device is provided, comprising: an acquisition module, which acquires user group data corresponding to each user activity; a determination module, which determines the training gradient of each user group data based on a recommendation model; an aggregation module, which performs gradient aggregation on the training gradient based on the activity of each user; and an adjustment module, which performs parameter adjustment on the recommendation model based on the training gradient after aggregation.
[0015] According to a fourth aspect of an embodiment of the present application, a recommendation device is provided, comprising: an acquisition module for acquiring user data; a recommendation module for inputting the user data into a recommendation model to obtain a recommendation object, wherein the recommendation model is the recommendation model according to the first aspect.
[0016] According to the fifth aspect of the embodiments of the present application, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method described in the first aspect.
[0017] According to a sixth aspect of an embodiment of the present application, a computer storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the method described in the first aspect is implemented.
[0018] In the scheme of the embodiment of the present application, the training gradients are aggregated based on the activity of each user, so that the influence of user activity as a confounding factor on the recommendation model parameters is eliminated, and the recommendation model learns the characteristics of different user activities, for example, the characteristics of the head users and the tail users of the long-tail distribution of user activity, thereby improving the recommendation reliability of the recommendation model. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0020] Figure 1 The following is a schematic architecture diagram of a recommendation system for an example.
[0021] Figure 2 The present invention is a flowchart of the steps of a model training method according to an embodiment of the present application.
[0022] Figure 3A for Figure 2 A flowchart of the steps of a model training method of a specific example of an embodiment.
[0023] Figure 3B for Figure 3A A schematic structural diagram of a recommendation model of an embodiment.
[0024] Figure 4 The present invention is a flowchart of a method according to another embodiment of the present invention.
[0025] Figure 5 It is a structural block diagram of a model training device according to another embodiment of the present application.
[0026] Figure 6 is a structural block diagram of a recommendation device according to another embodiment of the present application.
[0027] Figure 7 Schematic diagram of the structure of an electronic device according to another embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and in detail below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the embodiments of the present application should fall within the scope of protection of the embodiments of the present application.
[0029] The specific implementation of the embodiment of the present application is further explained below in conjunction with the accompanying drawings of the embodiment of the present application.
[0030] Figure 1 The following is a schematic architecture diagram of a recommendation system for an example. Figure 1 The recommendation system includes a recommendation server 110, a training server 130 and a user device 120. The user device 120 includes a human-computer interaction interface and an application program. The human-computer interaction interface can obtain various operation instructions input by the user for the application program and display elements of the user interface of the application program, for example, displaying the recommendation result in the user interface. At this time, the recommendation condition corresponding to the recommendation result can be generated based on various operation instructions.
[0031] Further, the recommendation result comes from the recommendation server 110, and the recommendation server 110 can call the recommendation module to perform the recommendation of the application. Specifically, the recommendation module can be deployed with a recommendation model, and the recommendation model is used to make recommendations. Alternatively, the recommendation model can also be deployed in the user device 120, and make recommendations in response to the recommendation instruction from the recommendation module.
[0032] The recommendation server 110 and the user device 120 can be configured as the client and server of the application respectively. When the user device 120 accesses the recommendation server 110 as the server of the application, the user behavior data of the user device 120, such as the access log, will be recorded in the access module of the recommendation server 110.
[0033] Furthermore, before the recommendation model is deployed, model training (training) of the recommendation model is performed in the training server 130. The training server 130 can be configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture, and the training server 130 can be deployed in a cloud server such as a proprietary cloud, a private cloud, or a hybrid cloud. Specifically, the training server 130 obtains user behavior data such as access logs from the recommendation server 110 through a training module, and trains the recommendation model based on at least one of the user behavior data or the material library data.
[0034] Specifically, the recommendation conditions can be associated with the data of the material library and the user behavior data. For example, the material library data can be associated with the user activity corresponding to the user device. The user activity tends to form a long-tail distribution. In other words, the user activity of the head users in the long-tail distribution is higher, and the user activity of the tail users is lower. Although the proportion of head users is greater than that of tail users, the tail users also occupy a non-negligible proportion. When the recommendation model does not have a sufficient understanding of user preferences, the reliability of the recommendation is poor. For this reason, the embodiment of the present application provides a model training scheme and a recommendation scheme, which can improve the reliability of the recommendation.
[0035] Figure 2 The flowchart is a step-by-step model training method according to an embodiment of the present application. The solution of this embodiment can be applied to any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc. For example, in the model training stage, a computing device (for example, a data center) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can be used to train the encoder-decoder model based on training samples. Computing devices such as data centers can be deployed in cloud servers such as proprietary clouds, private clouds, or hybrid clouds. Accordingly, in the inference stage, a computing device configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can also be used to perform inference operations. For example, the model training method of this embodiment can adopt Figure 1 The training server 130 in is executed.
[0036] Specifically, the model training method of this embodiment includes:
[0037] S210: Obtain user group data corresponding to the activity level of each user.
[0038] It should be understood that user activity may refer to the frequency, number of times or frequency of a user accessing an application on a mobile device within a unit period or a predetermined period. Unit periods include but are not limited to years, months, days, hours, etc. For example, Daily Active User (DAU). An application accessing a mobile device may be any page or a specific page of an application accessed. In addition, different user activities correspond to different user groups. In one example, the distribution of mobile applications corresponding to the activities of each user may be presented as a long-tail distribution, and the activities of each user may form a user activity sequence. The user ranges of user groups corresponding to adjacent user activities may be an arithmetic progression or a geometric progression.
[0039] It should also be understood that the proportion of users with higher user activity of an application may be greater than the proportion of users with lower user activity, for example, the proportion of users corresponding to the top 20% of user activity is approximately 80%. For example, the following Table 1 shows the proportion of users of each user activity of an exemplary application:
[0040] Table 1
[0041] DAU / 10 million User ratio DAU>10 50% 10>DAU>5 20% 5>DAU>1 10% 1>DAU>0.5 10% 0.5>DAU>0.1 10%
[0042] It should also be understood that the user group in the text is a grouping in the sense of user activity. In other words, the activity of a specific user and the corresponding user group can be in a one-to-one correspondence. The user group data includes recommendation condition data and corresponding recommendation result data, and the recommendation condition data includes at least one of a user identifier, an operation object identifier, and an operation state. The recommendation result data includes a recommendation object that matches the recommendation condition data. In an example, the user identifier can be a login account of an application, and the operation object can be a display object in a page control of the application, such as a product advertisement. The operation state can be a browsing operation, a click operation, a touch operation, etc. of a page control.
[0043] S220: Determine the training gradient of each user group data based on the recommendation model.
[0044] It should be understood that a loss function of the recommendation model can be determined, and the recommendation model can be trained based on the loss function. When training the recommendation model, multiple iterations can be performed, and parameters in the recommendation model can be adjusted for each iteration. In each iteration, the current loss function can be calculated based on the input and output of the recommendation model corresponding to the current iteration, and then the training gradient is calculated based on the current loss function.
[0045] S230: Based on the activity of each user, perform gradient aggregation on the training gradient.
[0046] It should be understood that when each user group data is used as the input and output of the recommendation model, the training gradient can be a function of the user group or the user activity corresponding to the user group. Based on the principle of causal inference, eliminating the influence of the user group factor or the user activity factor on the training gradient is equivalent to eliminating the confounding factors between the recommendation condition data and the recommendation result data in the user group data, that is, eliminating the non-causal correlation between the recommendation condition data and the recommendation result data, and obtaining the causal relationship between the recommendation condition data and the recommendation result data. Such a causal relationship reliably reflects and avoids the insufficient generalization performance of the recommendation model caused by the large proportion of users with high user activity in the above-mentioned long-tail user distribution.
[0047] S240: Adjust parameters of the recommendation model based on the aggregated training gradient.
[0048] It should be understood that the user group data corresponding to the activity of each user of the application can be obtained, and the recommendation model after parameter adjustment is used to recommend the application. Specifically, the parameter adjustment can be performed for each iteration, and then the training gradient of the next iteration is calculated based on the parameters adjusted in the current iteration.
[0049] In the scheme of the embodiment of the present application, the training gradients are aggregated based on the activity of each user, so that the influence of user activity as a confounding factor on the recommendation model parameters is eliminated, and the recommendation model learns the characteristics of different user activities, for example, the characteristics of the head users and the tail users of the long-tail distribution of user activity, thereby improving the recommendation reliability of the recommendation model.
[0050] In other examples, based on the activity of each user, the training gradients are gradient aggregated, including: determining the conditional probability of each user activity relative to the corresponding user group data; based on the conditional probability of each user activity, the training gradients of each user group data are gradient aggregated, the conditional probability can accurately reflect the correlation between the user activity and the user group data, so that the user activity can be reliably excluded as a confounding factor.
[0051] Specifically, the gradient polymerization process can be performed using the following formula (1):
[0052]
[0053] In formula (1), u is the user ID, i is the operation object ID, and y u,i It is the association between the user ID and the recommended object, for example, the operation of the user with the user ID on the operation object. The underlined part indicates the conditional probability of the user activity relative to the corresponding user group data.
[0054] In addition, g represents the gradient of the model; z represents the user activity as a confounding variable, for example, different z corresponds to a user group. P(.) represents the gradient estimator after backpropagation of the model.
[0055] Figure 3A for Figure 2 A flowchart of the steps of a model training method of a specific example of an embodiment. Figure 3A The exemplary embodiment is only Figure 2 The following are examples of model training methods, but should not be understood as Figure 2 The embodiments constitute limitations. In other exemplary embodiments, compared to Figure 3A The implementation method may also include different steps, or include more or fewer steps. Specifically, Figure 3A The model training method includes the following steps:
[0056] In step S301, user data of multiple user groups are obtained. It should be understood that this step is a specific implementation of step S210. More specifically, the access log of the recommendation server can be obtained, and the data of each user group can be extracted from the access log based on multiple preset user activities, and the multiple user activities and their corresponding user numbers follow a long-tail distribution.
[0057] In step S302, multiple first training gradients of the user data of multiple user groups based on the main network are determined. It should be understood that this step is a specific implementation of step S220, wherein the "first training gradient" is an example of a "training gradient". Specifically, the user data of multiple user groups are respectively input into the main network, and multiple first training gradients of the multiple user groups are determined based on the loss function. Specifically, Figure 3B As shown, the main network includes an embedding layer 310, a feature extraction layer 320 and a classification layer 330. The input of the embedding layer 310 is used as the input of the main network, the output of the embedding layer 310 is connected to the input of the feature extraction layer 320, the output of the feature extraction layer 320 is connected to the input of the classification layer 330, and the output of the classification layer 330 is used as the output of the main network. The embedding layer is used to vectorize the input recommendation conditions and generate a vector sequence of recommendation conditions. The feature extraction layer is used to extract features from the vector sequence, and then, through the connection between the feature extraction layer and the classification layer, the association between the features in the recommendation conditions and the recommended objects is constructed, and the classification layer is used to output the recommended objects.
[0058] In step S303, based on multiple user activities, multiple first training gradients are aggregated to eliminate the influence of multiple user activities. That is, this step is an example of step S230. In this step, the influence of multiple user activities is eliminated. This is because, based on the principle of causal inference, eliminating the influence of user group factors or user activity factors on training gradients is equivalent to eliminating the confounding factors between recommendation condition data and recommendation result data in user group data.
[0059] In step S304, the parameters of the main network are adjusted based on the training gradient after aggregation. That is, this step is an example of step S240. In this example, the recommendation model includes the main network. It should be understood that in other examples, the recommendation model may also include a branch network.
[0060] The following steps S305-S307 are for operations after the parameters of the primary network are adjusted, specifically:
[0061] In step S305, the branch network is connected to the main network. Specifically, at least one of the first branch network and the second branch network can be connected to the main network, the first branch network is used to connect between the embedding layer and the feature extraction layer of the main network, and the second branch network is used to connect between the feature extraction layer and the classification layer. In this case, the recommendation model includes the main network and the branch network. As shown in Figure 3, the branch network may include branch network 1 (315) (an example of the first branch network) and branch network 2 (325) (an example of the second branch network), and the branch network may also be referred to as a plug-in network. For branch network 1, the output of the embedding layer 310 is connected to the input of branch network 1, and the output of branch network 1 is connected to the feature extraction layer 320. For branch network 325, the input of the feature extraction layer 320 is connected to the input of branch network 325, and the output of branch network 325 is connected to the input of classification layer 330.
[0062] In step S306, multiple second training gradients of multiple user group data based on both the main network and the branch network are determined. Specifically, the user data of multiple user groups can be input into the connected branch network and the main network respectively, and then, based on the loss function, multiple second training gradients of multiple user groups are obtained.
[0063] It should be understood that the above steps S305 and S306 are an example of the step of “determining the training gradient of each user group data based on the recommendation model”, wherein the “second training gradient” is another example of the “training gradient”.
[0064] In step S307, the branch network and the main network are trained based on the multiple second training gradients. This step is an example of "adjusting the parameters of the first branch network and the second branch network respectively based on the training gradients of each user group data". Specifically, when implementing this step, the parameters of the main network can be fixed, and only the parameters of the branch network can be adjusted, or the parameters of the branch network and the main network can be adjusted at the same time. When adjusting the parameters of the branch network, the parameters of at least one of the first branch network and the second branch network can be adjusted, that is, the parameters of the branch network connected to the main network are adjusted.
[0065] Alternatively, the branch network can be connected to the main network before step S304, and then in step S304, the main network and the branch network are trained based on the training data to obtain a recommendation model. In other words, the connection between the embedding layer 310 and the feature extraction layer 320, and the connection between the embedding layer 310 and the feature extraction layer 320 through the branch network 1, form a first residual structure, and the first residual structure can fine-tune the vector output by the embedding layer 310. The connection between the feature extraction layer 320 and the classification layer 330, and the connection between the feature extraction layer 320 and the classification layer 330 through the branch network 2, form a second residual structure, and the second residual structure can fine-tune the vector output by the feature extraction layer 320. At the same time, the existence of the main network limits the learning of the plug-in network to prevent the bias of the branch network 1 and the branch network 2 from being too large.
[0066] The training principle of the branch network will be described in further detail below.
[0067] The model training method can determine the training gradient of each user group data based on the recommendation model, and then adjust the parameters of the first branch network and the second branch network respectively based on the training gradient of each user group data.
[0068] In one example, after training the main network, the training gradients of each user group need to be obtained during each training iteration of the main network, and then gradient aggregation is performed. Based on the results of the gradient aggregation, the parameters of the main network are updated. During each training iteration of the branch network, the training gradients of a user group need to be obtained, and then the parameters of the branch network are directly updated without gradient aggregation. It should be understood that the branch network can be trained separately based on multiple user groups, and each user group in some user groups can be trained separately. In this case, the training of the branch network can serve as a fine-tuning of the main network.
[0069] In another example, the training of the branch network and the training of the main network can be performed alternately. When performing the training of the branch network, there is no need to perform gradient aggregation, and the training gradient of one user group is directly used to adjust the parameters of the main network. When training the main network, the training gradients of multiple user groups are aggregated, and then the aggregated gradients are used to adjust the parameters of the branch network.
[0070] In addition, the training of the branch network and the training of the main network can use the same loss function or different loss functions. In one example, a first loss function is used for the first branch network, a second loss function is used for the second branch network, and a third loss function is used for the main network. The third loss function can be the sum of the first loss function and the second loss function.
[0071] In addition, the structure of the first branch network may be the same as or different from that of the second branch network. Specifically, the first branch network may include a first downsampling layer and a first upsampling layer, the first downsampling layer is used to downsample the input data of the embedding layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and the upsampling result is output to the feature extraction layer. The first branch network inputs an input sequence of the same length as the embedding layer input to the feature extraction layer through upsampling and downsampling, and at the same time, the input sequence from the first branch network is different from the input sequence from the embedding layer. Furthermore, since gradient aggregation is not performed and confounding factors are not eliminated when training the first branch network, when the proportion of users with high user activity is greater than the proportion of users with low user activity, the first branch network compensates for the weight of high user activity.
[0072] Correspondingly, the second branch network includes a second downsampling layer and a second upsampling layer, the second downsampling layer is used to downsample the input data of the feature extraction layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the classification layer. The second branch network inputs an input sequence of the same length as the input of the feature extraction layer to the classification layer through upsampling and downsampling, and at the same time, makes the input sequence from the second branch network different from the input sequence from the feature extraction layer. Furthermore, since gradient aggregation is not performed and confounding factors are not eliminated when training the second branch network, when the proportion of users with high user activity is greater than the proportion of users with low user activity, the second branch network compensates for the weight of high user activity.
[0073] In addition, when downsampling is performed on the first branch network, 1 / 2 downsampling can be performed, that is, the first branch network processes the input vector of the first dimension from the embedding layer to obtain a feature vector of half the dimension of the first dimension, and then upsamples the feature vector of half the dimension of the first dimension to obtain an output vector of the first dimension and output it to the feature extraction layer.
[0074] Correspondingly, when downsampling is performed on the second branch network, 1 / 2 downsampling can be performed, that is, the second branch network processes the input vector of the second dimension from the feature extraction layer to obtain a feature vector of half the dimension of the second dimension, and then upsamples the feature vector of half the dimension of the second dimension to obtain an output vector of the second dimension and outputs it to the classification layer.
[0075] It should be understood that the first dimension and the second dimension mentioned above may be the same or different. The 1 / 2 down-sampling mentioned above is only exemplary, and other down-sampling ratios may be performed.
[0076] Alternatively, the first branch network can upsample the vector from the embedding layer and then perform downsampling, and input the downsampled result to the feature extraction layer. Correspondingly, the second branch network can upsample the vector from the feature extraction layer and then perform downsampling, and input the downsampled result to the classification layer.
[0077] The recommendation model obtained by training the above model training method can be used to perform recommendations, for example, Figure 4 The flowchart is a step-by-step guide of a recommendation method according to another embodiment of the present application. The solution of this embodiment can be applied to any appropriate electronic device with data processing capabilities, including but not limited to: servers, mobile terminals (such as mobile phones, PADs, etc.) and PCs, etc. For example, in the model training stage, a computing device (for example, a data center) configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can be used to train the encoder-decoder model based on training samples. Computing devices such as data centers can be deployed in cloud servers such as proprietary clouds, private clouds, or hybrid clouds. Accordingly, in the inference stage, a computing device configured with a CPU (an example of a processing unit) + GPU (an example of an acceleration unit) architecture can also be used to perform inference operations. For example, the recommendation method of this embodiment can be adopted Figure 1 The recommendation server 110 or the user device 120 executes.
[0078] Specifically, the recommended method of this embodiment includes:
[0079] S410: Obtain user data.
[0080] S420: Input the user data into the recommendation model to obtain the recommended object. Figure 2 Any one of the recommendation models is obtained by training with the model training scheme.
[0081] In the scheme of the embodiment of the present application, the training gradients are aggregated based on the activity of each user, so that the influence of user activity as a confounding factor on the recommendation model parameters is eliminated, and the recommendation model learns the characteristics of different user activities, for example, the characteristics of the head users and the tail users of the long-tail distribution of user activity, thereby improving the recommendation reliability of the recommendation model.
[0082] Specifically, the user data may include at least recommendation condition data, and the recommendation condition data may include at least one of a user identifier, an operation object identifier, and an operation state, and is used to characterize user characteristics, operation object characteristics, and operation state characteristics. The recommendation result data includes a recommendation object that matches the recommendation condition data. In an example, the user identifier may be a login account of an application, and the operation object may be a display object in a page control of the application, such as a product advertisement. The operation state may be a browsing operation, a click operation, a touch operation, etc. of a page control.
[0083] The following will be combined Figure 5 Describe in detail each example corresponding to the model training device. Figure 5 It is a structural block diagram of a model training device according to another embodiment of the present application.
[0084] The graphical model training device of this embodiment is Figure 2 The model training method corresponds to:
[0085] The acquisition module 510 acquires the user group data corresponding to each user activity.
[0086] The determination module 520 determines the training gradient of each user group data based on the recommendation model.
[0087] The aggregation module 530 performs gradient aggregation on the training gradients based on the activity of each user.
[0088] The adjustment module 540 adjusts the parameters of the recommendation model based on the aggregated training gradients.
[0089] In the scheme of the embodiment of the present application, the training gradients are aggregated based on the activity of each user, so that the influence of user activity as a confounding factor on the recommendation model parameters is eliminated, and the recommendation model learns the characteristics of different user activities, for example, the characteristics of the head users and the tail users of the long-tail distribution of user activity, thereby improving the recommendation reliability of the recommendation model.
[0090] In other examples, the aggregation module is specifically used to determine the conditional probability of each user activity relative to the corresponding user group data, and then, based on the conditional probability of each user activity, perform gradient aggregation on the training gradients of each user group data.
[0091] In some other examples, the recommendation model includes a main network, which includes an embedding layer, a feature extraction layer and a classification layer, the input of the embedding layer serves as the input of the main network, the output of the embedding layer is connected to the input of the feature extraction layer, the output of the feature extraction layer is connected to the input of the classification layer, and the output of the classification layer serves as the output of the main network.
[0092] In some other examples, the recommendation model also includes a first branch network connected between the embedding layer and the feature extraction layer.
[0093] In some other examples, the first branch network includes a first downsampling layer and a first upsampling layer, the first downsampling layer is used to downsample the input data of the embedding layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the feature extraction layer.
[0094] In some other examples, the recommendation model further includes a second branch network connected between the feature extraction layer and the classification layer.
[0095] In some other examples, the second branch network includes a second downsampling layer and a second upsampling layer, the second downsampling layer is used to downsample the input data of the feature extraction layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the classification layer.
[0096] In some other examples, the determination module is further used to determine the training gradient of each user group data based on the recommendation model, and accordingly, the adjustment module is further used to adjust the parameters of the first branch network and the second branch network respectively based on the training gradient of the each user group data.
[0097] The device of this embodiment is used to implement the corresponding methods in the aforementioned multiple method embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. In addition, the functional implementation of each module in the device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will not be repeated here.
[0098] Figure 6 is a structural block diagram of a recommendation device according to another embodiment of the present application. The recommendation device of this embodiment corresponds to Figure 4 Recommended method.
[0099] The recommended device of this embodiment includes:
[0100] The acquisition module 610 acquires user data.
[0101] The recommendation module 620 inputs the user data into a recommendation model to obtain a recommendation object.
[0102] In the scheme of the embodiment of the present application, the training gradients are aggregated based on the activity of each user, so that the influence of user activity as a confounding factor on the recommendation model parameters is eliminated, and the recommendation model learns the characteristics of different user activities, for example, the characteristics of the head users and the tail users of the long-tail distribution of user activity, thereby improving the recommendation reliability of the recommendation model.
[0103] Reference Figure 7 , shows a schematic diagram of the structure of an electronic device according to another embodiment of the present application. The specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0104] like Figure 7 As shown, the electronic device may include: a processor (processor) 702 , a communication interface (Communications Interface) 704 , a memory (memory) 706 storing a program 710 , and a communication bus 708 .
[0105] The processor, the communication interface, and the memory communicate with each other via a communication bus.
[0106] Communication interface, used to communicate with other electronic devices or servers.
[0107] The processor is used to execute the program, and specifically can execute the relevant steps in the above method embodiment.
[0108] Specifically, the program may include program codes including computer operation instructions.
[0109] The processor may be a processor CPU, or an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0110] The memory is used to store programs. The memory may include a high-speed RAM memory, and may also include a non-volatile memory, such as at least one disk memory.
[0111] The program can be specifically used to enable the processor to perform the following operations: obtain user group data corresponding to each user activity; determine the training gradient of each user group data based on the recommendation model; based on the activity of each user, perform gradient aggregation on the training gradient; based on the aggregated training gradient, perform parameter adjustment on the recommendation model.
[0112] Alternatively, the program may be specifically used to enable the processor to perform the following operations: obtain user data, input the user data into a recommendation model, and obtain a recommended object.
[0113] In addition, the specific implementation of each step in the program can refer to the corresponding description of the corresponding steps and units in the above method embodiment, which will not be repeated here. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the above method embodiment, which will not be repeated here.
[0114] It should be pointed out that, according to the needs of implementation, the various components / steps described in the embodiments of the present application can be split into more components / steps, or two or more components / steps or partial operations of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of the present application.
[0115] The above-mentioned method according to the embodiment of the present application can be implemented in hardware, firmware, or implemented as software or computer code that can be stored in a recording medium (such as a CD ROM, RAM, floppy disk, hard disk or magneto-optical disk), or implemented as a computer code originally stored in a remote recording medium or a non-temporary machine-readable medium downloaded through a network and to be stored in a local recording medium, so that the method described herein can be stored in such software processing on a recording medium using a general-purpose computer, a special-purpose processor or programmable or special-purpose hardware (such as an ASIC or FPGA). It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component (e.g., RAM, ROM, flash memory, etc.) that can store or receive software or computer code, and when the software or computer code is accessed and executed by a computer, a processor or hardware, the method described herein is implemented. In addition, when a general-purpose computer accesses the code for implementing the method shown here, the execution of the code converts the general-purpose computer into a special-purpose computer for executing the method shown here.
[0116] Those of ordinary skill in the art will appreciate that the units and method steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of the present application.
[0117] The above implementation methods are only used to illustrate the embodiments of the present application, and are not limitations on the embodiments of the present application. Ordinary technicians in the relevant technical field can make various changes and modifications without departing from the spirit and scope of the embodiments of the present application. Therefore, all equivalent technical solutions also belong to the scope of the embodiments of the present application. The scope of patent protection of the embodiments of the present application should be limited by the claims.
Claims
1. A model training method, comprising: Get the user group data corresponding to each user's activity level; Determine a training gradient of each user group data based on a recommendation model, wherein the recommendation model includes a main network and a first branch network, the first branch network is connected between an embedding layer and a feature extraction layer of the main network, the first branch network is used to downsample a vector from the embedding layer, upsample the obtained downsampled result, and input the obtained upsampled result into the feature extraction layer; Based on the activity of each user, performing gradient aggregation on the training gradient; Based on the aggregated training gradients, parameters of the recommendation model are adjusted.
2. The method according to claim 1, wherein: The step of performing gradient aggregation on the training gradient based on the activity of each user includes: Determine the conditional probability of each user's activity relative to the corresponding user group data; Based on the conditional probability of each user's activity, the training gradients of each user group's data are aggregated.
3. The method according to claim 1, wherein: The main network includes the embedding layer, the feature extraction layer and the classification layer, the input of the embedding layer serves as the input of the main network, the output of the embedding layer is connected to the input of the feature extraction layer, the output of the feature extraction layer is connected to the input of the classification layer, and the output of the classification layer serves as the output of the main network.
4. The method according to claim 1, wherein: The first branch network includes a first downsampling layer and a first upsampling layer, the first downsampling layer is used to downsample the input data of the embedding layer, the first upsampling layer is used to upsample the output of the first downsampling layer, and output the upsampling result to the feature extraction layer.
5. The method according to claim 3, wherein: The recommendation model also includes a second branch network connected between the feature extraction layer and the classification layer.
6. The method according to claim 5, wherein: The second branch network includes a second downsampling layer and a second upsampling layer, the second downsampling layer is used to downsample the input data of the feature extraction layer, the second upsampling layer is used to upsample the output of the second downsampling layer, and output the upsampling result to the classification layer.
7. The method according to claim 6, wherein: The method further comprises: Determine the training gradient of each user group data based on the recommendation model; Based on the training gradients of the data of each user group, parameters of the first branch network and the second branch network are adjusted respectively.
8. A recommendation method comprising: Get user data; The user data is input into a recommendation model to obtain a recommendation object, wherein the recommendation model is trained according to any one of claims 1-7.
9. A model training device, comprising: The acquisition module obtains the user group data corresponding to each user's activity level; A determination module, determining a training gradient of each user group data based on a recommendation model, wherein the recommendation model includes a main network and a first branch network, the first branch network is connected between an embedding layer and a feature extraction layer of the main network, the first branch network is used to downsample a vector from the embedding layer, upsample the downsampled result, and input the upsampled result into the feature extraction layer; An aggregation module, performing gradient aggregation on the training gradient based on the activity of each user; The adjustment module adjusts the parameters of the recommendation model based on the aggregated training gradient.
10. A recommendation device, comprising: Get module to get user data; The recommendation module inputs the user data into a recommendation model to obtain a recommendation object, wherein the recommendation model is trained according to the method according to any one of claims 1 to 7.
11. An electronic device, comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform an operation corresponding to the method according to any one of claims 1 to 8.
12. A computer storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Classification model training method, classification method and device, equipment and medium
CN109684478A
Training method and device of service prediction system
CN113902473A