A method and apparatus for training a recommendation model

By performing global analysis and mining on the training recommendation sample set, classifying sample types and setting weights using loss function values, the overfitting and generalization problems of the recommendation model in low-frequency scenarios are solved, thereby improving the training efficiency and recommendation accuracy of the model.

CN116383638BActive Publication Date: 2025-11-14BEIJING LONGZHI DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211699937.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2025-11-14
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

Existing recommendation models suffer from overfitting and reduced online generalization ability in low-frequency scenarios due to sparse sample data, with few positive samples and many negative samples.

Method used

By acquiring a training recommendation sample set, classifying the samples using loss function values, determining the sample type, and setting different loss function weight values ​​according to different sample types, the recommendation model is trained.

Benefits of technology

It improves the training efficiency and effectiveness of the recommendation model, and enhances the recommendation accuracy of the model in real-world business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383638B_ABST
    Figure CN116383638B_ABST
Patent Text Reader

Abstract

This disclosure relates to the field of artificial intelligence technology, and provides a method, apparatus, computer device, and computer-readable storage medium for training a recommendation model. The method can set different loss function weight values ​​according to different sample types. During the training of the recommendation model, it can reduce the loss function weight values ​​of training recommendation samples of sample types that do not affect the model's training effect, and increase the loss function weight values ​​of training recommendation samples of sample types that have a greater impact on the model's training effect. This fully utilizes the potential of training recommendation samples of sample types that have a greater impact on the model's training effect, and reduces the impact of training recommendation samples of sample types that have no or poor impact on the model's training effect. Therefore, it improves the training efficiency and effectiveness of the recommendation model, thereby enhancing the performance of the recommendation model and further improving the recommendation effect in practical business scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to a method and apparatus for training a recommendation model. Background Technology

[0002] In online e-commerce, recommending suitable products or services to users based on their personalized characteristics has always been a crucial issue. In relatively low-frequency scenarios, such as online advertising, online rentals, and online home purchases, the sample data is sparse, with fewer positive samples and a much larger number of negative samples. Most of these negative samples are easily distinguishable and have relatively little impact on network training. A large number of easily distinguishable negative samples offer no benefit to model training and can lead to overfitting, reducing online generalization ability. Summary of the Invention

[0003] In view of this, the present disclosure provides a method, apparatus, computer device, and computer-readable storage medium for training a recommendation model, in order to solve the problem that in the training process of existing recommendation models, a large number of easily distinguishable negative samples do not provide any training benefit for the model and will lead to overfitting and reduced online generalization ability.

[0004] A first aspect of this disclosure provides a method for training a recommendation model, the method comprising:

[0005] Obtain a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results;

[0006] The preset recommendation model is trained N times using the training recommendation sample set to obtain the loss function value of each group of training recommendation samples in each round of training.

[0007] Based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set, the sample type of each group of training recommendation samples is determined;

[0008] The recommendation model is trained using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, to obtain the trained recommendation model.

[0009] A second aspect of this disclosure provides a training apparatus for a recommendation model, the apparatus comprising:

[0010] The set acquisition unit is used to acquire the training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information and real recommendation conversion results;

[0011] The numerical determination unit is used to train the preset recommendation model for N rounds using the training recommendation sample set, and to obtain the loss function value of each group of training recommendation samples in each round of training.

[0012] The type determination unit is used to determine the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set.

[0013] The model training unit is used to train the recommendation model using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, so as to obtain the trained recommendation model.

[0014] A third aspect of this disclosure provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0015] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0016] The beneficial effects of this disclosure embodiment compared to the prior art are as follows: This disclosure embodiment can first obtain a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each group of training recommendation samples includes user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results. Then, the preset recommendation model is trained N times using the training recommendation sample set to obtain the loss function value of each group of training recommendation samples in each round of training. Next, based on the loss function value of each group of training recommendation samples in each round of training, the sample type of each group of training recommendation samples is determined. Finally, the recommendation model is trained using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the preset loss function weight value corresponding to the sample type to obtain the trained recommendation model. As can be seen, in this embodiment, the user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results in each group of training recommendation samples are first used to determine the loss function value of each group of training recommendation samples in each round of training. Then, based on the loss function value of each group of training recommendation samples in each round of training, the group of training recommendation samples is classified to determine the sample type. In this way, a thorough global analysis and mining of the training recommendation samples is performed. By classifying the loss function values ​​of the training recommendation samples in the first stage of training (i.e., N rounds of training), different sample types (such as simple samples, ordinary samples, and difficult samples) are identified. Since the degree of influence of different sample types on the training effect of the recommendation model (such as the influence on the generalization ability of the recommendation model) is different, different loss function weight values ​​can be set according to different sample types so as to utilize the training recommendation sample set and the training recommendation samples. By centralizing the sample types of each training recommendation sample and the corresponding loss function weights for each preset sample type, the loss function weights of training recommendation samples of sample types that do not affect the model's training effect can be reduced during the training process, while the loss function weights of training recommendation samples of sample types that have a greater impact on the model's training effect can be increased. This fully leverages the potential of training recommendation samples of sample types that have a greater impact on the model's training effect, while reducing the impact of training recommendation samples of sample types that have no or a poor impact on the model's training effect. Therefore, this embodiment can effectively improve the distribution of training weights (i.e., loss function weights) of training recommendation samples of different sample types, thereby making the training process of the recommendation model more thorough, improving the training efficiency and effectiveness of the recommendation model, and ultimately improving the performance of the recommendation model, further enhancing the recommendation effect of the recommendation model in actual business scenarios (such as improving the recommendation accuracy of the recommendation model). Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this disclosure;

[0019] Figure 2 This is a flowchart of the training method for the recommendation model provided in this embodiment of the disclosure;

[0020] Figure 3 This is a block diagram of the training apparatus for the recommendation model provided in the embodiments of this disclosure;

[0021] Figure 4 This is a schematic diagram of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0022] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.

[0023] The following will describe in detail, with reference to the accompanying drawings, a method and apparatus for training a recommendation model according to an embodiment of the present disclosure.

[0024] In existing technologies, traditional recommendation model training methods suffer from limitations in certain low-frequency scenarios, such as online advertising, online rentals, and online home purchases. Due to sparse sample data, positive samples are few, while the number of negative samples far exceeds the number of positive samples. Most of these negative samples are easily distinguishable and contribute little to network training. A large number of easily distinguishable negative samples offer no training benefit to the model and can lead to overfitting and reduced online generalization ability. In other words, current training methods fail to effectively mine and utilize training samples of different types, significantly impacting the generalization ability of recommendation models, leading to performance degradation, and consequently affecting the accuracy of the predicted recommendations.

[0025] To address the aforementioned problems, this invention provides a training method for a recommendation model. In this method, the user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results of each training recommendation sample are first used to determine the loss function value of each training recommendation sample in each round of training. Then, based on the loss function value of each training recommendation sample in each round of training, the training recommendation samples are classified to determine the sample type. This allows for a thorough global analysis and mining of the training recommendation samples. By classifying the loss function values ​​of the training recommendation samples during the first stage of training (i.e., N rounds of training), different sample types (e.g., simple samples, ordinary samples, and difficult samples) are identified. Since different sample types have different degrees of influence on the training effect of the recommendation model (e.g., affecting the generalization ability of the recommendation model), different loss function weight values ​​can be set according to different sample types to utilize the training recommendation... The sample set, the sample types of each group of training recommendation samples in the training recommendation sample set, and the preset loss function weight values ​​corresponding to the sample types are used to train the recommendation model. During the training process, the loss function weight values ​​of training recommendation samples of sample types that do not affect the model training effect can be reduced, while the loss function weight values ​​of training recommendation samples of sample types that have a greater impact on the model training effect can be increased. This fully utilizes the potential of training recommendation samples of sample types that have a greater impact on the model training effect, and reduces the impact of training recommendation samples of sample types that have no or poor impact on the model training effect. Therefore, this embodiment can effectively improve the distribution of training weights (i.e., loss function weight values) of training recommendation samples of different sample types, thereby making the training process of the recommendation model more thorough, improving the training efficiency and effect of the recommendation model, and thus improving the performance of the recommendation model, further enhancing the recommendation effect of the recommendation model in actual business scenarios (such as improving the recommendation accuracy of the recommendation model).

[0026] For example, embodiments of the present invention can be applied to, for example... Figure 1 The application scenario shown can include terminal device 1 and server 2.

[0027] Terminal device 1 can be hardware or software. When terminal device 1 is hardware, it can be various electronic devices with a display screen that support communication with server 2, including but not limited to smartphones, tablets, laptops, and desktop computers; when terminal device 1 is software, it can be installed in the aforementioned electronic devices. Terminal device 1 can be implemented as multiple software programs or software modules, or as a single software program or software module, and this disclosure does not limit this. Furthermore, various applications can be installed on terminal device 1, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0028] Server 2 can be a server that provides various services, such as a backend server that receives requests sent by terminal devices with which it has established communication connections. This backend server can receive and analyze the requests sent by the terminal devices and generate processing results. Server 2 can be a single server, a server cluster consisting of several servers, or a cloud computing service center; this disclosure does not limit this.

[0029] It should be noted that server 2 can be either hardware or software. When server 2 is hardware, it can be various electronic devices that provide various services to terminal device 1. When server 2 is software, it can be multiple software programs or software modules that provide various services to terminal device 1, or it can be a single software program or software module that provides various services to terminal device 1. This disclosure does not impose any limitations on this aspect.

[0030] Terminal device 1 and server 2 can communicate via a network. The network can be a wired network using coaxial cable, twisted pair, or fiber optic connection, or a wireless network that enables interconnection of various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), or Infrared. This disclosure does not limit the scope of the embodiments.

[0031] Specifically, the user can input a training recommendation sample set through terminal device 1; terminal device 1 sends the training recommendation sample set to server 2. Server 2 stores the recommendation model to be trained; server 2 can first use the training recommendation sample set to train the preset recommendation model for N rounds, obtaining the loss function value of each group of training recommendation samples in each round of training; then, server 2 can determine the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training; next, server 2 can use the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type to train the recommendation model, obtaining the trained recommendation model. In this embodiment, the loss function value of each training recommendation sample in each round of training is determined by first utilizing user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results from each training recommendation sample set. Then, based on the loss function value of each training recommendation sample in each round of training, the training recommendation samples are classified to determine the sample type. This allows for a thorough global analysis and mining of the training recommendation samples. By classifying the loss function values ​​of the training recommendation samples during the first stage of training (i.e., N rounds of training), different sample types (e.g., simple samples, ordinary samples, and difficult samples) are identified. Since different sample types have varying degrees of impact on the training effect of the recommendation model (e.g., affecting the generalization ability of the recommendation model), different loss function weight values ​​can be set according to different sample types to utilize the training recommendation sample set and the training recommendation sample... This set of examples defines the sample types and corresponding loss function weights for each training recommendation sample. During the training of the recommendation model, this approach reduces the loss function weights of training recommendation samples of sample types that do not affect the model's training performance, while increasing the loss function weights of training recommendation samples of sample types that significantly impact the model's training performance. This fully leverages the potential of training recommendation samples of sample types that have a significant impact on the model's training performance, while reducing the impact of training recommendation samples of sample types that have no or poor impact on the model's training. Therefore, this embodiment can effectively improve the distribution of training weights (i.e., loss function weights) for training recommendation samples of different sample types, thereby making the training process of the recommendation model more thorough, improving the training efficiency and effectiveness of the recommendation model, and ultimately enhancing the performance of the recommendation model in real-world business scenarios (such as improving the recommendation accuracy).

[0032] It should be noted that the specific types, quantities, and combinations of terminal device 1, server 2, and network can be adjusted according to the actual needs of the application scenario, and this disclosure embodiment does not impose any restrictions on this.

[0033] It should be noted that the above application scenarios are shown only for the purpose of understanding this disclosure, and the implementation of this disclosure is not limited in any way. On the contrary, the implementation of this disclosure can be applied to any applicable scenario.

[0034] Figure 2 This is a flowchart of a training method for a recommendation model provided in an embodiment of this disclosure. Figure 2 One method for training a recommendation model can be derived from... Figure 1 The terminal device or server executes the command. For example... Figure 2 As shown, the training method for this recommendation model includes:

[0035] S201: Obtain the training recommendation sample set.

[0036] In this embodiment, the training recommendation sample set may include several training recommendation samples. Each training recommendation sample set includes user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results.

[0037] User attribute information can be understood as information that reflects the attributes of the user (i.e., the account) itself, such as the user's gender, age, and the account's location (e.g., province, city). Product attribute information can be understood as information that reflects the attributes of the recommended product itself, such as the product's price, daily sales volume, and product type.

[0038] Interactive behavior information can be understood as historical product interaction behaviors. It can also be understood as information that reflects the actions performed by the user on the product. For example, interactive behavior information may include the number of times the user clicked on the product, whether it was favorited and / or purchased by the user. It should be noted that in online e-commerce scenarios, users often browse multiple products or services on the same e-commerce website or mobile application. Their behavior may include staying on a product page, clicking on the product to view details, etc. These actions can be collectively referred to as interactive behavior.

[0039] Recommendation conversion results can be understood as whether a user adds a product to their favorites or purchases it after interacting with it. Actual recommendation conversion results, on the other hand, can be understood as the actual recommendation conversion results corresponding to the training recommendation sample.

[0040] S202: Use the training recommendation sample set to train the preset recommendation model for N rounds, and obtain the loss function value of each group of training recommendation samples in the training recommendation sample set in each round of training.

[0041] After obtaining the training sample set, each set of training recommendation samples in the training sample set can be used to train the preset recommendation model for N rounds, obtaining the loss function value of each set of training recommendation samples in each round of training. It can be understood that since a set of training recommendation samples is used to train the preset recommendation model for N rounds, N loss function values ​​corresponding to that set of training recommendation samples can be obtained. If the training recommendation sample set includes Z sets of training recommendation samples, then Z*N loss function values ​​can be obtained. It should be noted that N can be a positive integer greater than 1, and N rounds can be a preset number of rounds based on actual needs, or it can be the number of training rounds that causes the recommendation model to experience slight overfitting (i.e., the loss function value of the training recommendation sample set decreases, but the loss function value of the validation set begins to increase). For example, assuming that the recommendation model is trained using the training recommendation sample set, and the recommendation model experiences slight overfitting after the 100th round of training, then N can be set to 100. It should be noted that, in one implementation, the recommendation model may include a multi-layer fully connected neural network, such as a DIN (Deep Interest Network), DeepFM (Deep Factorization Machine), or DeepCrossNet (Deep Cross Network).

[0042] Specifically, for each round of training of each set of training recommendation samples in the training recommendation sample set, the user attribute information, product attribute information, and interaction behavior information in the training recommendation samples are input into a preset recommendation model to obtain the predicted recommendation conversion results corresponding to the user attribute information, the product attribute information, and the interaction behavior information. That is, products with user interaction behavior within a certain time period are input into the recommendation model, and the recommendation model performs a binary classification prediction on these products to predict whether the user will convert on these products. Then, based on the actual recommendation conversion results and the predicted recommendation conversion results in the training recommendation samples, the loss function value for this round of training can be determined. For example, in one implementation, the loss function of the recommendation model is a binary cross-entropy or a multi-class cross-entropy. The loss function of the recommendation model can be used to calculate the loss function values ​​of the actual recommendation conversion results and the predicted recommendation conversion results, and this loss function value can be used as the loss function value for this round of training of the set of training recommendation samples.

[0043] S203: Determine the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set.

[0044] Since different types of training recommendation samples have varying degrees of impact on the training effect of the recommendation model (e.g., affecting the generalization ability of the recommendation model), it is necessary to classify the training recommendation samples in the training sample set so that the preset model can be trained differently for different types of training recommendation samples. In this embodiment, the loss function value is used as an indicator to adaptively and efficiently classify the training recommendation samples, avoiding tedious data analysis and business knowledge intervention. It is efficient, widely adaptable, and can be well adapted to other scenarios.

[0045] Specifically, in this embodiment, for each group of training recommendation samples in the training recommendation sample set, the sample type of that group of training recommendation samples can be determined based on the loss function values ​​of that group of training recommendation samples in each round of training. In other words, in this embodiment, after performing a global and thorough analysis and mining of the group of training recommendation samples, the loss function values ​​of that group of training recommendation samples in each round of training can be obtained, and the sample type of that group of training recommendation samples can be determined by classifying them based on these loss function values.

[0046] It should be noted that the types of training recommendation samples can be divided into the first type of sample (such as ordinary samples), the second type of sample (such as simple samples), and the third type of sample (such as difficult samples).

[0047] S204: Using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the preset loss function weight value corresponding to the sample type, the recommendation model is trained to obtain the trained recommendation model.

[0048] In this embodiment, different loss function weight values ​​can be pre-set for training recommendation samples of different sample types during the training process. This allows the potential of the training recommendation samples to be fully utilized, enabling the recommendation model to be trained more thoroughly, improving model performance, and further enhancing the recommendation effect of the online model in real-world business scenarios. Furthermore, it effectively identifies a large number of useless simple samples, thereby reducing the training weights of some simple samples that do not affect the effect. That is, during the training of the recommendation model, the loss function weight values ​​of training recommendation samples of sample types that do not affect the model training effect can be reduced, while the loss function weight values ​​of training recommendation samples of sample types that have a significant impact on the model training effect can be increased. This fully utilizes the potential of training recommendation samples of sample types that have a significant impact on the model training effect, while reducing the impact of training recommendation samples of sample types that have no or poor impact on the model training effect. This effectively improves the distribution of training weights between simple and difficult samples, further enhancing the efficiency and effectiveness of model training.

[0049] In this embodiment, since the third sample type (e.g., difficult samples) has a significant impact on the model training effect, the loss function weight value of the training recommendation samples of the third sample type can be increased. That is, the loss function weight value corresponding to the training recommendation samples of the third sample type is greater than the loss function weight value corresponding to the training recommendation samples of the first sample type. For example, the loss function weight value of the training recommendation samples of the third sample type is between 2 and 5 times that of the training recommendation samples of the first sample type. Since the second sample type (e.g., simple samples) has a relatively small impact on the model training effect, for example, it does not provide any gain for the recommendation model training and can lead to overfitting and reduced online generalization ability, the loss function weight value of the training recommendation samples of the second sample type can be decreased. That is, the loss function weight value corresponding to the training recommendation samples of the second sample type is less than the loss function weight value corresponding to the training recommendation samples of the first sample type. For example, the loss function weight value of the training recommendation samples of the first sample type is between 2 and 5 times that of the training recommendation samples of the second sample type.

[0050] In this implementation, after determining the sample type of each group of training recommendation samples in the training recommendation sample set, the recommendation model can be trained using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the preset loss function weight values ​​corresponding to the sample types, to obtain a trained recommendation model. That is, the recommendation model is trained using the training recommendation samples in the training recommendation sample set. During the process of adjusting the model parameters of the recommendation model based on the loss function values, the loss function values ​​need to be calculated based on the sample type of each group of training recommendation samples in the training recommendation sample set, the preset loss function weight values ​​corresponding to the sample types, and the preset loss function. Training continues until the loss function value of the recommendation model meets a preset condition, or the number of training iterations reaches a preset number, at which point a trained recommendation model can be obtained.

[0051] Next, an example will be given to illustrate how, in S204, the loss function value is calculated based on the sample type of each training recommendation sample in the training recommendation sample set, the weight value of the loss function corresponding to the preset sample type, and the preset loss function. For example, the training recommendation sample set includes four training recommendation samples: the first training recommendation sample (including user attribute information, product attribute information, and interaction behavior information s1), the second training recommendation sample (including user attribute information, product attribute information, and interaction behavior information s2), the third training recommendation sample (user attribute information, product attribute information, and interaction behavior information s3), and the fourth training recommendation sample (including user attribute information, product attribute information, and interaction behavior information s3). Sexual information and interaction behavior information (s4); assuming the first and second training text samples are of the difficult sample type (i.e., the third sample type), and the third and fourth training text samples are of the normal sample type (i.e., the first sample type), and the actual recommendation conversion results corresponding to s1, s2, s3, and s4 are l1, l2, l3, and l4 respectively, and the loss function weight of the third sample type is w times that of the first sample type, where the neural network (i.e., the recommendation model) is f(), and the loss function is loss(), then in this gradient calculation, the loss function value of the recommendation model after the weights are redistributed is Loss. 平均 The calculation formula is: Loss 平均 =w*(loss(l1, f(s1)+loss(l2, f(s2))+loss(l3, f(s3)+loss(l4, f(s4)). Then, proceed with the model training as normal.

[0052] As can be seen, the embodiments of this disclosure can first obtain a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each group of training recommendation samples includes user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results. Then, the preset recommendation model is trained N times using the training recommendation sample set to obtain the loss function value of each group of training recommendation samples in each training round. Next, based on the loss function value of each group of training recommendation samples in each training round, the sample type of each group of training recommendation samples is determined. Finally, the recommendation model is trained using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the preset loss function weight value corresponding to the sample type to obtain the trained recommendation model. As can be seen, in this embodiment, the user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results in each group of training recommendation samples are first used to determine the loss function value of each group of training recommendation samples in each round of training. Then, based on the loss function value of each group of training recommendation samples in each round of training, the group of training recommendation samples is classified to determine the sample type. In this way, a thorough global analysis and mining of the training recommendation samples is performed. By classifying the loss function values ​​of the training recommendation samples in the first stage of training (i.e., N rounds of training), different sample types (such as simple samples, ordinary samples, and difficult samples) are identified. Since the degree of influence of different sample types on the training effect of the recommendation model (such as the influence on the generalization ability of the recommendation model) is different, different loss function weight values ​​can be set according to different sample types so as to utilize the training recommendation sample set and the training recommendation samples. By centralizing the sample types of each training recommendation sample and the corresponding loss function weights for each preset sample type, the loss function weights of training recommendation samples of sample types that do not affect the model's training effect can be reduced during the training process, while the loss function weights of training recommendation samples of sample types that have a greater impact on the model's training effect can be increased. This fully leverages the potential of training recommendation samples of sample types that have a greater impact on the model's training effect, while reducing the impact of training recommendation samples of sample types that have no or a poor impact on the model's training effect. Therefore, this embodiment can effectively improve the distribution of training weights (i.e., loss function weights) of training recommendation samples of different sample types, thereby making the training process of the recommendation model more thorough, improving the training efficiency and effectiveness of the recommendation model, and ultimately improving the performance of the recommendation model, further enhancing the recommendation effect of the recommendation model in actual business scenarios (such as improving the recommendation accuracy of the recommendation model).

[0053] In some embodiments, step S203, "determining the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training," may include the following steps:

[0054] S203a: For each group of training recommendation samples in the training recommendation sample set, determine the degree of loss reduction of the training recommendation sample throughout the training process based on the loss function value of the training recommendation sample in each round of training.

[0055] In one implementation of this embodiment, the recommendation model can be trained M times using the training recommendation sample set, that is, each round of training will use all the training recommendation samples in the training recommendation sample set to train the recommendation model once.

[0056] First, based on the loss function values ​​of the training recommended samples in each training round, determine the average loss function value for the first M rounds of training and the average loss function value for the next X rounds of training, where M and X are both positive integers and both M and X are less than N. This can be understood as first determining the average loss function value of the training recommended samples in the first M rounds of training based on their loss function values, and then determining the average loss function value of the training recommended samples in the next X rounds of training based on their loss function values ​​in each training round. For example, the average loss function value of the training recommended samples in the first 10% of rounds can be calculated based on all the loss function values ​​of the training recommended samples in the first 10% of rounds, and the average loss function value of the training recommended samples in the next 10% of rounds can be calculated based on all the loss function values ​​of the training recommended samples in the next 10% of rounds.

[0057] Then, the overall training loss reduction rate of the training recommended samples can be determined based on the average loss function values ​​of the first M training rounds and the loss function values ​​of the subsequent X training rounds. That is, the overall training loss reduction rate of the training recommended samples can be determined based on the average loss function values ​​of the training recommended samples in the first M training rounds and the average loss function values ​​of the training recommended samples in the subsequent X training rounds. In one implementation, the overall training loss reduction rate of the training recommended samples can be calculated using the following formula: c = (ab) / a; where c is the overall training loss reduction rate of the training recommended samples, a is the average loss function value of the training recommended samples in the first M training rounds, and b is the average loss function value of the training recommended samples in the subsequent X training rounds.

[0058] S203b: Determine the sample type of each group of training recommendation samples based on the degree of loss reduction throughout the training process of each training recommendation sample in the training recommendation sample set.

[0059] After determining the overall training loss reduction rate of each training recommended sample in the training recommended sample set, the overall training loss reduction rate of each training recommended sample in the training recommended sample set can be sorted from high to low to obtain a sorting result. Then, the sample type of the training recommended samples in the top n positions (e.g., in the top 30%) in the sorting result can be determined as the first sample type (e.g., normal samples); the sample type of the training recommended samples in the bottom n positions (e.g., in the bottom 30%) in the sorting result can be determined as the second sample type (e.g., easy samples); and the sample type of the training recommended samples in the sorting result that are not in the top n or bottom n positions (e.g., after the top 30% and before the bottom 30%) can be determined as the third sample type (e.g., difficult samples).

[0060] For example, suppose the training recommendation sample set includes 100 training recommendation samples. The samples are sorted from highest to lowest based on their overall training loss reduction. The training recommendation samples ranked 1st to 30th can be classified as ordinary samples, those ranked 31st to 70th as difficult samples, and those ranked 71st to 100th as easy samples.

[0061] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.

[0062] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0063] Figure 3 This is a schematic diagram of the training apparatus for the recommendation model provided in the embodiments of this disclosure. Figure 3 As shown, the training apparatus for this recommendation model includes:

[0064] The set acquisition unit 301 is used to acquire a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information and real recommendation conversion results;

[0065] The numerical determination unit 302 is used to train the preset recommendation model for N rounds using the training recommendation sample set, and to obtain the loss function value of each group of training recommendation samples in each round of training.

[0066] The type determination unit 303 is used to determine the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set.

[0067] The model training unit 304 is used to train the recommendation model using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, so as to obtain the trained recommendation model.

[0068] Optionally, the recommendation model includes a multi-layer fully connected neural network.

[0069] Optionally, the numerical determination unit 302 is used for:

[0070] For each round of training for each set of training recommendation samples in the training recommendation sample set, the user attribute information, product attribute information, and interaction behavior information in the training recommendation samples are input into a preset recommendation model to obtain the predicted recommendation conversion results corresponding to the user attribute information, the product attribute information, and the interaction behavior information; based on the actual recommendation conversion results in the training recommendation samples and the predicted recommendation conversion results, the loss function value for this round of training is determined.

[0071] Optionally, the type determination unit 303 is used for:

[0072] For each set of training recommendation samples in the training recommendation sample set, the degree of loss reduction of the training recommendation sample throughout the training process is determined based on the loss function value of the training recommendation sample in each round of training.

[0073] Based on the degree of loss reduction throughout the training process for each training recommendation sample in the training recommendation sample set, the sample type of each group of training recommendation samples is determined.

[0074] Optionally, the type determination unit 303 is used for:

[0075] Based on the loss function values ​​of the training recommendation samples in each round of training, determine the average loss function value of the first M rounds of training and the loss function value of the next X rounds of training, where M and X are both less than N;

[0076] The degree of loss reduction of the training recommendation sample throughout the entire training process is determined based on the average loss function value of the first M rounds of training and the loss function value of the subsequent X rounds of training.

[0077] Optionally, the type determination unit 303 is used for:

[0078] The training recommendation sample set is sorted from high to low based on the degree of reduction in training loss throughout the training process, and the sorting result is obtained.

[0079] The sample type of the training recommendation sample that ranks in the top n positions in the ranking result is determined as the first sample type;

[0080] The sample type of the training recommendation sample located in the last n positions of the ranking result is determined as the second sample type;

[0081] The training recommendation samples that are not in the first n or last n positions in the ranking results are defined as the third sample type.

[0082] Optionally, the weight value of the loss function corresponding to the training recommendation sample of the third sample type is greater than the weight value of the loss function corresponding to the training recommendation sample of the first sample type; the weight value of the loss function corresponding to the training recommendation sample of the second sample type is less than the weight value of the loss function corresponding to the training recommendation sample of the first sample type.

[0083] Optionally, the loss function of the recommendation model is binary cross-entropy or multi-class cross-entropy.

[0084] The beneficial effects of this embodiment compared with the prior art are as follows: The training device for the recommendation model provided in this embodiment includes: a set acquisition unit, used to acquire a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information, and real recommendation conversion results; a value determination unit, used to perform N rounds of training on a preset recommendation model using the training recommendation sample set, to obtain the loss function value of each set of training recommendation samples in each round of training; a type determination unit, used to determine the sample type of each set of training recommendation samples based on the loss function value of each set of training recommendation samples in each round of training; and a model training unit, used to train the recommendation model using the training recommendation sample set, the sample type of each set of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, to obtain a trained recommendation model. As can be seen, in this embodiment, the user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results in each group of training recommendation samples are first used to determine the loss function value of each group of training recommendation samples in each round of training. Then, based on the loss function value of each group of training recommendation samples in each round of training, the group of training recommendation samples is classified to determine the sample type. In this way, a thorough global analysis and mining of the training recommendation samples is performed. By classifying the loss function values ​​of the training recommendation samples in the first stage of training (i.e., N rounds of training), different sample types (such as simple samples, ordinary samples, and difficult samples) are identified. Since the degree of influence of different sample types on the training effect of the recommendation model (such as the influence on the generalization ability of the recommendation model) is different, different loss function weight values ​​can be set according to different sample types so as to utilize the training recommendation sample set and the training recommendation samples. By centralizing the sample types of each training recommendation sample and the corresponding loss function weights for each preset sample type, the loss function weights of training recommendation samples of sample types that do not affect the model's training effect can be reduced during the training process, while the loss function weights of training recommendation samples of sample types that have a greater impact on the model's training effect can be increased. This fully leverages the potential of training recommendation samples of sample types that have a greater impact on the model's training effect, while reducing the impact of training recommendation samples of sample types that have no or a poor impact on the model's training effect. Therefore, this embodiment can effectively improve the distribution of training weights (i.e., loss function weights) of training recommendation samples of different sample types, thereby making the training process of the recommendation model more thorough, improving the training efficiency and effectiveness of the recommendation model, and ultimately improving the performance of the recommendation model, further enhancing the recommendation effect of the recommendation model in actual business scenarios (such as improving the recommendation accuracy of the recommendation model).

[0085] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0086] Figure 4 This is a schematic diagram of the computer device 4 provided in an embodiment of this disclosure. Figure 4 As shown, the computer device 4 in this embodiment includes a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, it implements the steps in the various method embodiments described above. Alternatively, when the processor 401 executes the computer program 403, it implements the functions of each module / module in the various device embodiments described above.

[0087] Exemplarily, computer program 403 may be divided into one or more modules, which are stored in memory 402 and executed by processor 401 to perform the present disclosure. The one or more modules may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of computer program 403 in computer device 4.

[0088] Computer device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other similar computer device. Computer device 4 may include, but is not limited to, processor 401 and memory 402. Those skilled in the art will understand that... Figure 4 This is merely an example of computer device 4 and does not constitute a limitation on computer device 4. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.

[0089] Processor 401 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0090] The memory 402 can be an internal storage module of the computer device 4, such as a hard disk or RAM of the computer device 4. The memory 402 can also be an external storage device of the computer device 4, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device 4. Furthermore, the memory 402 can include both internal and external storage modules of the computer device 4. The memory 402 is used to store computer programs and other programs and data required by the computer device. The memory 402 can also be used to temporarily store data that has been output or will be output.

[0091] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described functional modules are used as examples. In practical applications, the functions described above can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiments can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules can be implemented in hardware or as software functional modules. Furthermore, the specific names of the functional modules are only for easy differentiation and are not intended to limit the scope of protection of this disclosure. The specific working process of the modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0092] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0093] Those skilled in the art will recognize that the modules and algorithm steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this disclosure.

[0094] In the embodiments provided in this disclosure, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or modules is only a logical functional division, and in actual implementation, there may be other division methods. Multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or modules may be electrical, mechanical, or other forms.

[0095] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0096] Furthermore, the functional modules in the various embodiments of this disclosure can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0097] If an integrated module / module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0098] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be included within the protection scope of this disclosure.

Claims

1. A method for training a recommendation model, characterized in that, The method includes: Obtain a training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information, and actual recommendation conversion results; The preset recommendation model is trained N times using the training recommendation sample set to obtain the loss function value of each group of training recommendation samples in each round of training. Based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set, the sample type of each group of training recommendation samples is determined; The recommendation model is trained using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, to obtain the trained recommendation model. The step of training the preset recommendation model N times using the training recommendation sample set to obtain the loss function value of each group of training recommendation samples in each round of training includes: For each round of training for each set of training recommendation samples in the training recommendation sample set, the user attribute information, product attribute information, and interaction behavior information in the training recommendation samples are input into a preset recommendation model to obtain the predicted recommendation conversion results corresponding to the user attribute information, the product attribute information, and the interaction behavior information; and the loss function value for this round of training is determined based on the actual recommendation conversion results in the training recommendation samples and the predicted recommendation conversion results. The step of determining the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training includes: For each set of training recommendation samples in the training recommendation sample set, based on the loss function value of the training recommendation sample in each round of training, determine the average loss function value of the first M rounds of training and the loss function value of the next X rounds of training, where M and X are both less than N; based on the average loss function value of the first M rounds of training and the loss function value of the next X rounds of training, determine the degree of loss reduction of the training recommendation sample throughout the training process. Based on the degree of loss reduction throughout the training process for each training recommendation sample in the training recommendation sample set, the sample type of each group of training recommendation samples is determined.

2. The method according to claim 1, characterized in that, The recommendation model includes a multi-layer fully connected neural network.

3. The method according to claim 1, characterized in that, The step of determining the sample type of each group of training recommendation samples based on the overall training loss descent rate of each training recommendation sample in the training recommendation sample set includes: The training recommendation sample set is sorted from high to low based on the degree of reduction in training loss throughout the training process, and the sorting result is obtained. The sample type of the training recommendation sample that ranks in the top n positions in the ranking result is determined as the first sample type; The sample type of the training recommendation sample located in the last n positions of the ranking result is determined as the second sample type; The training recommendation samples that are not in the first n or last n positions in the ranking results are defined as the third sample type.

4. The method according to claim 3, characterized in that, The weight value of the loss function corresponding to the training recommendation sample with the third sample type is greater than the weight value of the loss function corresponding to the training recommendation sample with the first sample type. The weight value of the loss function corresponding to the training recommendation sample of sample type 2 is less than the weight value of the loss function corresponding to the training recommendation sample of sample type 1.

5. The method according to claim 1, characterized in that, The loss function of the recommendation model is either binary cross-entropy or multi-class cross-entropy.

6. A training device for a recommendation model, characterized in that, The device includes: The set acquisition unit is used to acquire the training recommendation sample set; wherein, the training recommendation sample set includes several training recommendation samples, and each set of training recommendation samples includes user attribute information, product attribute information, interaction behavior information and real recommendation conversion results; The numerical determination unit is used to train the preset recommendation model for N rounds using the training recommendation sample set, and to obtain the loss function value of each group of training recommendation samples in each round of training. The type determination unit is used to determine the sample type of each group of training recommendation samples based on the loss function value of each group of training recommendation samples in each round of training in the training recommendation sample set. The model training unit is used to train the recommendation model using the training recommendation sample set, the sample type of each group of training recommendation samples in the training recommendation sample set, and the loss function weight value corresponding to the preset sample type, so as to obtain the trained recommendation model. The numerical determination unit is specifically used for: for each round of training of each group of training recommendation samples in the training recommendation sample set, inputting the user attribute information, product attribute information and interaction behavior information in the training recommendation samples into a preset recommendation model to obtain the predicted recommendation conversion result corresponding to the user attribute information, the product attribute information and the interaction behavior information; and determining the loss function value of this round of training based on the actual recommendation conversion result in the training recommendation samples and the predicted recommendation conversion result. The type determination unit is specifically used for: for each group of training recommendation samples in the training recommendation sample set, determining the average loss function value of the first M rounds of training and the loss function value of the next X rounds of training based on the loss function value of the training recommendation sample in each round of training, where M and X are both less than N; determining the overall training loss reduction degree of the training recommendation sample based on the average loss function value of the first M rounds of training and the loss function value of the next X rounds of training; and determining the sample type of each group of training recommendation samples based on the overall training loss reduction degree of each training recommendation sample in the training recommendation sample set.

7. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Right and interest model training method, recommendation method, electronic terminal and computer medium

    CN114912030A

  • Model training method and apparatus for information recommendation, electronic device and medium

    US20220277204A1