Training method and device of recommendation model

CN116028708BActive Publication Date: 2026-10-27ALIPAY (HANGZHOU) INFORMATION TECH CO LTD +1
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211249909.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2026-10-27
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

[0003]然而,目前的推荐算法往往忽略了公平性的要求

Benefits of technology

[0023]采用本说明书实施例提供的方法和装置,通过构造矫正样本补入原始数据集,实现对原始数据集中数据不公平性的去除,再使用得到的公平数据集训练推荐模型,实现从数据层面彻底解决推荐领域的不公平性问题,使得推荐模型的预测结果具有公平性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116028708B_ABST
    Figure CN116028708B_ABST
Patent Text Reader

Abstract

Embodiments of the present specification provide a method and device for training a recommendation model. The method comprises: first, obtaining a real sample set, wherein any first real sample comprises user features of a first user, object features of a first business object, and a first behavior label indicating whether the first user performs a predetermined behavior on the first business object; M users involved in the real sample set are divided into two groups of users corresponding to two attribute values of a preset sensitive attribute; then, based on the first real sample, a corresponding fictitious sample is constructed, a second user involved in the fictitious sample belongs to the two groups of users to which the first user belongs, a fictitious business object involved in the fictitious sample has a similarity to the first business object satisfying a preset threshold, and a fictitious behavior label of the fictitious sample has a same label value as the first behavior label; and then, based on the first real sample and the fictitious sample, the recommendation model is trained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of internet and information technology, the amount of information online has exploded, and the vast amount of goods, audio and video resources has brought users the problem of information overload. To solve this problem, personalized recommendation system technology has attracted the attention of researchers. By mining information such as users' historical records and product characteristics, personalized recommendation system technology models users' potential preferences and recommends a set of products that users are interested in.

[0003] However, current recommendation algorithms often neglect the requirement of fairness. For example, job recommendation systems may recommend drastically different jobs to male and female users with similar qualifications.

[0004] Therefore, a solution is needed to address the unfairness problem in the recommendation field. Summary of the Invention

[0005] This specification describes a training method for a recommendation model that can completely solve the problem of unfairness in the recommendation field from the data level.

[0006] According to the first aspect, a method for training a recommendation model is provided, comprising: acquiring a real sample set, wherein any first real sample includes user features of a first user and object features of a first business object, and a first behavior label indicating whether the first user performs a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute. Based on the first real sample, a corresponding fictional sample is constructed, wherein a second user involved in the fictional sample belongs to one of the two user groups as the first user, the similarity between the fictional business object involved in the fictional sample and the first business object satisfies a preset threshold, and the fictional behavior label of the fictional sample has the same label value as the first behavior label. Based on the first real sample and the fictional sample, the recommendation model is trained.

[0007] In one embodiment, the preset sensitive attribute is gender, and the two attribute values ​​are male and female.

[0008] In one embodiment, the business object is an advertisement and the reservation behavior is a click behavior; or, the business object is a product and the reservation behavior is a purchase.

[0009] In one embodiment, constructing a corresponding fictional sample based on the first real sample includes: selecting a user from the user group that does not include the first user from the two user groups as the second user; determining a fictional business object whose similarity to the first business object meets the preset threshold; determining a fictional behavior label with the same label value as the first behavior label; and determining the fictional sample based on the second user, the fictional business object, and the fictional behavior label.

[0010] In one embodiment, the real sample set involves N business objects, and the N business objects correspond to N learnable noise vectors; wherein, constructing a corresponding fictional sample based on the first real sample includes: superimposing a first noise vector corresponding to the first business object onto a first object embedding vector obtained by processing the object features using the recommendation model, to obtain a fictional object embedding vector corresponding to the fictional business object; and constructing the fictional sample based on the fictional object embedding vector.

[0011] In one specific embodiment, the norm of the first noise vector is less than a preset threshold.

[0012] In one specific embodiment, the object feature is an object identifier.

[0013] In one specific embodiment, the method further includes: training the first noise vector based on the fictional sample.

[0014] In a more specific embodiment, training the first noise vector based on the fictional sample includes: obtaining a second real sample from the real sample set based on the fictional sample, wherein the user involved in the second real sample is the second user, and the label value of the second behavior label is different from the label value of the fictional behavior label; processing the fictional sample and the second real sample respectively using the recommendation model to obtain two behavior prediction results; and training the first noise vector with the goal of increasing the gap between the two behavior prediction results.

[0015] Furthermore, in one example, the recommendation model is used to process the fictional sample and the second real sample respectively to obtain two behavior prediction results, including: processing the user features of the second user using the recommendation model to obtain a second user embedding vector; obtaining a behavior prediction result for the fictional sample based on the dot product of the second user embedding vector and the fictional object embedding vector; processing the object features of the second business object in the second real sample using the recommendation model to obtain a second object embedding vector; and obtaining a behavior prediction result for the second real sample based on the dot product of the second user embedding vector and the second object embedding vector.

[0016] In one embodiment, training the recommendation model based on the first real sample and the fictional sample includes: obtaining a second real sample from the real sample set that is the same user as the fictional sample but has different behavioral labels, forming a first sample pair with the fictional sample; obtaining a third real sample from the real sample set that is the same user as the first real sample but has different behavioral labels, forming a second sample pair with the first real sample; processing the first sample pair and the second sample pair using the recommendation model to obtain two pairs of behavioral prediction results; and training the recommendation model with the goal of increasing the intra-pair gap of the two pairs of behavioral prediction results.

[0017] In one embodiment, the method involves multiple rounds of iterative training of a recommendation model, wherein each round of iterative training includes: constructing multiple fictitious samples based on multiple real samples randomly selected from the real sample set; the number of objects involving different business objects in the multiple real samples is less than a predetermined number threshold; and performing iterative training of the recommendation model for the current round based on the multiple fictitious samples.

[0018] In one embodiment, training the recommendation model based on the first real sample and the fictional sample includes: performing embedding processing using the recommendation model to obtain a first user embedding vector of the first user, a first object embedding vector of the first business object, and a second user embedding vector of the second user; obtaining a first behavior prediction result based on the dot product of the first user embedding vector and the first object embedding vector; obtaining a second behavior prediction result based on the dot product of the second user embedding vector and the fictional object embedding vector of the fictional business object; and training the recommendation model based on the first behavior prediction result and the first behavior label, as well as the second behavior prediction result and the fictional behavior label.

[0019] In one specific embodiment, the real sample set involves N business objects, and the recommendation model is implemented as a graph neural network model. Before training the recommendation model based on the first real samples and the fictional samples, the method further includes: obtaining a user-object bipartite graph constructed based on the real sample set. The user-object bipartite graph includes M user nodes corresponding to the M users, N object nodes corresponding to the N business objects, and connection edges established by user nodes performing predetermined actions on object nodes. The embedding process using the recommendation model includes: performing graph embedding processing on the user-object bipartite graph using the graph neural network.

[0020] According to the second aspect, a training apparatus for a recommendation model is provided, comprising: a real sample acquisition unit configured to acquire a real sample set, wherein any first real sample includes user features of a first user and object features of a first business object, and a first behavior label indicating whether the first user performs a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute. A fictional sample construction unit configured to construct corresponding fictional samples based on the first real samples, wherein the second user involved in the fictional sample belongs to the two groups of users, the similarity between the fictional business object involved in the fictional sample and the first business object satisfies a preset threshold, and the fictional behavior label of the fictional sample has the same label value as the first behavior label. A model training unit configured to train the recommendation model based on the first real samples and the fictional samples.

[0021] According to a third aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed in a computer, causes the computer to perform the method of the first aspect.

[0022] According to a fourth aspect, a computing device is provided, including a memory and a processor, wherein the memory stores executable code, and the processor, when executing the executable code, implements the method of the first aspect.

[0023] By using the methods and apparatus provided in the embodiments of this specification, corrective samples are constructed and added to the original dataset to remove data unfairness in the original dataset. The resulting fair dataset is then used to train the recommendation model, thereby completely solving the unfairness problem in the recommendation field from the data level and making the prediction results of the recommendation model fair. Attached Figure Description

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

[0025] Figure 1 The diagram illustrates an implementation architecture diagram of a training scheme for a recommendation model according to one embodiment.

[0026] Figure 2 A schematic diagram illustrating the training method of a recommendation model according to one embodiment is shown.

[0027] Figure 3 A schematic diagram of a training device for a recommendation model according to one embodiment is shown. Detailed Implementation

[0028] The solution provided in this specification will now be described with reference to the accompanying drawings.

[0029] As mentioned earlier, recommender systems play a vital role in our daily lives, making the issue of recommendation fairness a pressing concern. The unfairness in recommendations stems primarily from two aspects: first, the interaction data between different user groups (e.g., male and female groups) in the training data is unfair; second, the recommendation model amplifies the unfairness of the training data when learning user preferences. Currently, measures proposed to address recommendation unfairness mainly focus on analyzing the model itself, neglecting the fact that the unfairness of the model originates from the inherent data unfairness within the historical interaction data.

[0030] Based on the above analysis, the inventors propose a solution that supplements the original interaction data by generating corrective data, thereby completely eliminating unfairness in recommendations from a data perspective while also ensuring the accuracy of the recommendations.

[0031] Figure 1 This diagram illustrates an implementation architecture diagram of a training scheme for a recommendation model according to one embodiment, such as... Figure 1 As shown, first, a real sample set is constructed based on historical real behavior data. Then, a fictitious sample set containing fictitious behavior data is constructed based on the real sample set. Finally, a recommendation model is trained using both the real and fictitious sample sets. In this way, the real sample set is corrected using the fictitious sample set, and the recommendation model is trained using the corrected interaction data, thus eliminating data unfairness at its source and ensuring that the user preferences learned by the recommendation model are fair. The implementation steps of the above scheme are described below with more examples. Figure 2 The diagram illustrates a training method flowchart for a recommendation model according to one embodiment. The execution entity of the method can be any device, platform, server, or device cluster with computing and processing capabilities. Figure 2 As shown, the method includes the following steps:

[0032] Step S210: Obtain a real sample set, wherein any first real sample includes user features of a first user and object features of a first business object, as well as a first behavior label indicating whether the first user has performed a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute; Step S220: Construct corresponding fictional samples based on the first real samples, wherein the second user involved in the fictional samples belongs to the two groups of users, the similarity between the fictional business object involved in the fictional samples and the first business object meets a preset threshold, and the fictional behavior label of the fictional samples has the same label value as the first behavior label; Step S230: Train the recommendation model based on the first real samples and the fictional samples.

[0033] The steps above are explained in detail below:

[0034] First, in step S210, a real sample set is obtained. It can be understood that real samples are constructed based on historically occurring interaction data, involving two parties: users and business objects (or simply objects). For simplicity and clarity, any real sample in the real sample set is referred to as the first real sample, and the user and business object involved in the first real sample are respectively referred to as the first user and the first business object.

[0035] The sample features in the first real sample include the user features of the first user and the object features of the first business object. The sample label is the first interaction label (or first behavior label) between the first user and the first business object, which indicates whether the first user has performed a predetermined behavior on the first business object.

[0036] In one embodiment, user characteristics may include static user characteristics and behavioral user characteristics. In a specific embodiment, static user characteristics may include age, gender, occupation, place of residence, and hobbies. In a specific embodiment, behavioral user characteristics may include a number of business objects to which the first user has performed predetermined actions, as well as the time, address (such as geographical location and network address), and terminal device information of the predetermined actions performed on each of these business objects.

[0037] In one embodiment, the pre-ordering behavior is adapted to the business object. In one specific embodiment, the business object is an advertisement or content information, and the pre-ordering behavior is a click behavior; for example, advertisement characteristics may include advertisement format (such as image, video, or text), spokesperson, advertisement content, and distribution channel, while content information characteristics may include content category (such as technology, humanities, entertainment, etc.) and push platform, etc. In another specific embodiment, the business object is a product, and the pre-ordering behavior is a purchase; for example, product characteristics may include place of origin, cost, sales volume, category, and sales platform, etc. In yet another specific embodiment, the business object is user benefits, and the pre-ordering behavior is redemption; for example, user benefits are coupons, whose characteristics may include usage conditions and discount levels, etc.; or, for example, user benefits are red envelopes, whose characteristics may include redemption platform and red envelope amount, etc.

[0038] In another embodiment, the user features and object features may include only identification information; that is, the user feature is the user identifier and the object feature is the object identifier.

[0039] In one embodiment, the first line label indicates whether a predetermined action has been performed or not. For example, if the label value of the first line label is 1, it indicates that a predetermined action has been performed; if the label value of the first line label is 0, it indicates that a predetermined action has not been performed, and vice versa.

[0040] The above describes the composition of the first real sample.

[0041] On the other hand, research on fairness in machine learning is based on user groups. Therefore, the multiple (denoted as M) users involved in the above real samples can be divided into groups. Specifically, the division is based on the user's sensitive attributes that cause unfairness. These sensitive attributes can be pre-set according to the actual recommendation scenario, for example, set as user gender. Furthermore, based on the two attribute values ​​of the sensitive attribute, such as male and female, the M users are divided into two groups of users (or two user subsets, two user groups), which can be denoted as G0 and G1. It can be understood that users within the same group have the same sensitive attribute value.

[0042] The above describes the obtained real sample set and the user groups G0 and G1 obtained by dividing the M users involved.

[0043] Then, in step S220, a corresponding fictional sample is constructed based on the first real sample.

[0044] It should be noted that user behavior towards business objects falls into two categories: performing a predetermined action (or positive behavior) and not performing a predetermined action (or negative behavior). Recommendation research focuses on users' implicit feedback. The idea of ​​fairness based on user groups mainly assumes that different user groups have similar behavioral patterns. Therefore, in order to correct the original unfair data (i.e., the aforementioned real sample set) into fair data, corresponding fictitious samples (or corrected samples) are generated for each user group, and then the original data is corrected using the corrected samples.

[0045] Based on the two types of user behavior and the concept of fairness mentioned above, the inventors proposed two hypotheses to guide the generation of corrective samples. The first hypothesis focuses on the positive behaviors of the two groups of users (G0 and G1).

[0046] Assumption 1. For any user u0 in user group G0, the set of objects to which a predetermined action is performed. Let i0 be any object in the group. To ensure data fairness, there will be a user u1 in user group G1 who is similar to the object. Perform the predetermined action. Similarly, for any user u1 in user group G1, if they perform a predetermined action on the business object... If a predetermined action is performed, then there exists a user u0 in user group G0, who is similar to the target object. To perform a predetermined action. This assumption can be expressed as follows:

[0047]

[0048]

[0049] In equations (1) and (2) above, The symbol indicates that the two objects on either side are similar to each other; r represents the actual interactive label. The two labels represent fictitious interactions. The subscripts of both labels indicate the interacting party, and a label value of 1 indicates that a pre-planned action has been performed, while a value of 0 indicates that no pre-planned action has been performed.

[0050] It should be noted that the most common scenario for positive behavior is that users in one user group perform a predetermined action on a certain object, while no user in another user group performs the same predetermined action on the same object. To address this, corrective samples are generated using Hypothesis 1 to alter user behavior patterns, causing users in another user group to perform the predetermined action on a similar object. Therefore, the user behavior in the corrective data exhibits the opposite behavior pattern compared to the original unfair data. It can be understood that formulas (1) and (2) are independent of each other.

[0051] The above introduces hypothesis 1 regarding positive behavior. Hypothesis 2 focuses on the negative behavior of two groups of users (G0 and G1).

[0052] Assumption 2. If user u0∈G0 has no business object If a predetermined action is performed, then there exists a user u1∈G1 who does not have an object that is similar to object j0. Perform the predetermined action. Similarly, if user u1∈G1 has not performed any action on the business object... If a predetermined action is performed, then there exists a user u0∈G0 who does not have an object that is similar to object j1. Perform the predetermined action. This assumption can be expressed as follows:

[0053]

[0054]

[0055] In equations (3) and (4) above, and These are fictitious interactive labels used to construct corrective samples. Similar to Hypothesis 1, Hypothesis 2 focuses on negative behaviors, and the corrective samples constructed based on it present a behavioral pattern opposite to the negative behaviors in the original unfair data. It can be understood that formulas (3) and (4) are independent of each other.

[0056] Based on the above, in this step, corrective data is generated using Hypotheses 1 and 2 to correct the original data, resulting in a fair dataset and ensuring that users in different user groups have similar behavioral patterns. Analysis of Hypotheses 1 and 2 reveals that the challenge lies in constructing approximate objects (or fictitious business objects) that closely resemble the business objects in the real samples. Two typical implementation methods for constructing approximate objects are described below.

[0057] In implementation method A, a similarity equation and a similarity threshold are defined. Then, for each of the N business objects involved in the real sample set, an approximate business object is found that satisfies the similarity threshold, i.e., the similarity between the two is greater than the similarity threshold. For this implementation method, the object features in the real sample need to be relatively rich, so that the determined approximate object has a sufficiently high usability.

[0058] Specifically, for the first real sample, a fictitious feature value is generated based on the object characteristics of the first business object therein, and the similarity between the object feature value and the fictitious feature value is calculated according to the similarity equation. If the similarity threshold is met, the fictitious feature value is used as the feature value of the fictitious business object; otherwise, the fictitious feature value is adjusted until the similarity threshold is met.

[0059] The above implementation method is applicable when the collected historical data contains rich object features. However, in practical applications, more often only the object identifier of the business object is known; that is, the object features of the real sample only include the object identifier. In this case, it is difficult to directly calculate the similarity between objects based solely on discrete object identifiers, making it difficult to construct approximate objects using the above implementation method A. This prompts us to search for approximate objects in a continuous space.

[0060] Specifically, noting that the recommendation model can map any user u and any object v to a continuous embedding space, approximate objects can be defined and found based on this continuous embedding space. Therefore, another implementation method B is proposed. For ease of understanding, the process of embedding user u and object v using the recommendation model will be introduced first.

[0061] Specifically, the recommendation model is used to analyze user features f u and object characteristics f v By performing embedding processing, the user embedding vector e can be obtained. u and object embedding vector e v It should be noted that the descriptions of user characteristics and object characteristics can be found in the foregoing embodiments; additionally, for the case where both user characteristics and object characteristics are identification information, i.e., f u =ID u f v =ID v You can first identify the user ID separately. u and object identifier ID v Perform one-hot encoding, and then use the two resulting encoded vectors as input to the recommendation model.

[0062] There are many ways to implement the above embedding process. In one embodiment, a user-object bipartite graph can be constructed first based on the aforementioned real sample set, and then a recommendation model implemented as a Graph Neural Network (GNN) can be used to perform graph embedding on the user-object bipartite graph to obtain the embedding vectors of user u and object v. It should be understood that the user-object bipartite graph includes M user nodes corresponding to the aforementioned M users, N object nodes corresponding to the aforementioned N business objects, and connection edges established by user nodes performing predetermined actions on object nodes; in addition, the graph embedding process aims to represent graph nodes as a low-dimensional vector space while preserving the topological structure and node information of the relational network. The implementation details of the graph embedding process can be found in existing related technologies and will not be elaborated here.

[0063] In another embodiment, the recommendation model is implemented as a matrix factorization model. This allows for factorization of the rating matrix constructed based on the real sample set, yielding the embedding vectors of user u and object v. It's important to understand that the rows and columns of the rating matrix correspond to the M users and N business objects mentioned above, respectively. The rating matrix is ​​M*N dimensional, where the element in the u-th row and v-th column is the rating value of user u for user v.

[0064] From the above, we can perform embedding processing on user u and object v to obtain the user embedding vector e. u and object embedding vector e v .

[0065] Returning to the earlier proposal of defining and finding approximate objects based on a continuous embedding space, firstly, the approximate objects need to conform to the real data distribution of the aforementioned N business objects; otherwise, recommendation performance will be severely affected. Secondly, inspired by adversarial examples and poisoning attacks, a non-random perturbation is proposed to generate approximate objects located in the continuous embedding space.

[0066] Specifically, for the aforementioned N business objects, N learnable noise vectors are designed. "Learable" means that the vector elements in each noise vector are optimizable parameters that can be adjusted through training, and their initial values ​​can be random. Based on this, in the object embedding vector e of object v... v Add noise vector δ v This allows us to obtain the embedding vector of the approximate object. This can be represented by the following formula:

[0067]

[0068] In one embodiment, δ v The norm is less than or equal to a preset threshold ∈. It should be understood that the order of the norm can be set by the staff; for example, it can be a second-order norm, and correspondingly, ||δ v ||≤∈. The threshold ∈ can be manually set to a small value, because δ v It was a very small, almost invisible noise, naturally. With e v Approximate, and It lies within the original object embedding vector distribution. Additionally, the noise vector δ v Although the quantity is small, it is sufficient to meet actual needs.

[0069] By adopting implementation method B, a fictional business object that closely resembles the business object in the real sample can be generated. Specifically, the object embedding vector e of object v is obtained. v Corresponding fictitious object embedding vector

[0070] Based on the above, a fictitious business object corresponding to the first business object in the first real sample can be constructed through implementation method A or implementation method B, etc. Further, based on the first user in the first real sample, a user not in the same group as the first user is selected from the aforementioned M users as the second user. For example, if the first user is in group G0, a user is randomly selected from group G1 as the second user; if the first user is in group G1, a user is randomly selected from group G0 as the second user. Furthermore, a fictitious behavior label with the same label value as the first behavior label in the first real sample is determined. Thus, based on the fictitious business object, the second user, and the fictitious behavior label, a fictitious sample corresponding to the first real sample is formed. It is understood that the fictitious sample may include fictitious feature values ​​of the fictitious business object (e.g., when the fictitious business object is constructed using implementation method A) or fictitious object embedding vectors (e.g., when the fictitious business object is constructed using implementation method B). Additionally, the fictitious sample may include user features of the second user or only user identifiers.

[0071] From the above, we can obtain a fictitious sample corresponding to the first real sample. This fictitious sample involves a second user who belongs to one of two user groups (G) that are different from the first user. o And G1), the similarity between the fictional business object involved in this fictional sample and the first business object meets the preset similarity threshold, and the fictional behavior label of this fictional sample has the same label value as the first behavior label.

[0072] Next, in step S230, a recommendation model is trained based on the first real sample and the fictional sample. Specifically, the training loss is first determined based on the first real sample and the fictional sample, and then the model parameters of the recommendation model are updated using the training loss.

[0073] To determine the training loss mentioned above, either the pointwise method or the pairwise method can be used. Simply put, in the pointwise method, the training loss is calculated using a single sample as the smallest unit of calculation, while in the pairwise method, the smallest unit of calculation is a sample pair consisting of two samples.

[0074] In one implementation, a single-point method is used to calculate the training loss. Specifically, the recommendation model is first used to process the first real sample and the fictional sample to obtain the corresponding first behavior prediction result and fictional behavior prediction result. For ease of description, the first user and the first business object in the first real sample are schematically denoted as u0 and i0, respectively, and correspondingly, the second user and the fictional business object in the fictional sample are schematically denoted as u1 and i0.

[0075] It should be noted that the process by which the recommendation model processes real samples to obtain real behavior prediction results includes: first, embedding the users and business objects in the real samples to obtain two embedding vectors; then, calculating the dot product between these two embedding vectors as the corresponding real behavior prediction result. Furthermore, regarding the embedding method, please refer to the aforementioned embodiments. It can be understood that if the embedding vectors were already obtained through embedding processing when determining the aforementioned fictitious object embedding vectors, they can be directly obtained and reused in this step.

[0076] Based on this, in this step, the first user u0 and the first business object i0 are first embedded using the recommendation model to obtain the first user embedding vector. and the first object embedding vector Next, calculate the dot product of these two embedding vectors, and use it as the first row of the prediction result:

[0077]

[0078] Thus, the prediction result for the first row can be obtained.

[0079] Furthermore, a recommendation model is used to process fictional samples to obtain fictional behavior prediction results. It can be understood that if the fictional sample includes object features of a fictional object, then the method of processing the fictional sample using the recommendation model is the same as that used for real samples. Therefore, the fictional behavior prediction results can be obtained:

[0080]

[0081] If the fictional sample contains the embedding vector of a fictional object, then it's unnecessary to use a recommendation model to determine the object embedding vector of the fictional object; the other processing steps are similar. From this, we can obtain the fictional behavior prediction result:

[0082]

[0083] For equation (8) The calculation can be found in formula (5).

[0084] From the above, we can obtain the prediction result for the first row. And fictional behavior prediction results Combined with the first line of tags and fictional behavior tags Calculate the training loss. This training loss can be calculated using methods such as cross-entropy or mean squared error (MSE). For example, the formula for calculating the training loss is:

[0085]

[0086] In equation (9) above, D fair This indicates a fair dataset that includes both raw and corrected data.

[0087] Thus, the training loss L can be calculated using the single-point method.

[0088] In another implementation, a pairwise method is used to determine the training loss to improve training effectiveness. As mentioned earlier, the pairwise method uses a sample pair consisting of two samples as the smallest unit of computation. More specifically, the two samples constituting a sample pair involve the same user and two behavioral labels with different label values. That is, the same user performs a predetermined behavior towards one of two business objects, but does not perform a predetermined behavior towards the other. In this case, it is desirable to have as large a difference as possible between the predicted behavioral results for the two samples.

[0089] Based on this, in this step, sample pairs can be constructed based on the first real sample and the fictional sample respectively to obtain two sample pairs, and then the pairing loss can be calculated.

[0090] Specifically, a second real sample is first obtained from the real sample set, which is identical to the fictional sample user but has different behavioral tags. This second real sample forms a first sample pair with the fictional sample, denoted as [sample pair name]. Furthermore, a third real sample is obtained from the real sample set, which has the same user as the first real sample but different behavioral labels. This third sample forms a second sample pair with the first real sample, denoted as (u0, i0, j0). The recommendation model is then used to process the first and second sample pairs respectively, yielding two pairs of behavioral prediction results, denoted as... and It should be noted that the determination of the behavior prediction results can be found in the relevant descriptions in the foregoing embodiments, and will not be repeated here.

[0091] Next, the recommendation model is trained with the goal of increasing the intra-pair gap between the two pairs of behavior prediction results. It's important to understand that because users' preferences for different objects are directional, this intra-pair gap is also directional, which is related to the label values. For example, the intra-pair gap can be calculated by subtracting the behavior prediction result with the smaller label value from the behavior prediction result with the larger label value. If the tag value The internal gap can then be calculated as follows:

[0092] For example, the training loss can be calculated using the following formula:

[0093]

[0094] In equation (10) above, σ() represents the sigmoid function.

[0095] Therefore, the pairwise method can be used to calculate the training loss, which can then be used to train the recommendation model.

[0096] Based on the above, the training loss can be calculated using a single-point method or a pairwise method, and then the parameters in the recommendation model can be updated using the backpropagation method, thereby achieving the training of the recommendation model.

[0097] It's understandable that the recommendation model needs to undergo multiple rounds of iterative training until the model parameters converge to obtain the final trained recommendation model. In each round of training iteration, multiple real samples can be selected from the real sample set to construct corresponding fictional samples, which are then used to train the recommendation model for that round of iteration.

[0098] According to another embodiment, to enhance data fairness, it is preferable to use all four formulas representing Hypothesis 1 and Hypothesis 2 simultaneously, namely (1) to (4), when generating fictitious samples in batches, to generate four types of fictitious samples. In this case, the calculation formula for the training loss can be written as:

[0099]

[0100] Furthermore, considering that using the full set of corrected samples for training would drastically alter the distribution of the original data and reduce recommendation accuracy, a proposed approach is to use a number of fictitious samples, roughly equivalent to the number of real samples, in each training iteration to ensure accuracy. Specifically, a random masking operation is designed to partially select the corrected samples. This masking operation can be denoted as:

[0101]

[0102] In equation (12) above, Max mask This represents the upper limit on the number of objects involved in the fictitious samples used in one round of training iterations. For example, the calculation of the training loss can be written as:

[0103]

[0104]

[0105] Thus, because only a portion of the corrected samples are used for training, the impact of the corrected samples on the recommendation accuracy can be controlled.

[0106] According to another embodiment, if the fictitious sample is constructed using the fictitious embedding object embedding vector generated by the above-described implementation method B. In one embodiment, in step S230, in addition to training the recommendation model, the noise vector δ can also be processed. v Conduct training.

[0107] In another embodiment, the noise vector δ may not need to be trained in step S230. v Instead, it uses an alternating training approach, fixing the parameters of the recommendation model in other training rounds and training the noise vector δ separately. v Similarly, it is preferable to train the noise vector δ using the above four types of fictitious samples simultaneously. In this case, the loss calculation formula for the noise vector can be denoted as:

[0108]

[0109] In equation (14) above, D anti This represents a fictional sample set.

[0110] Thus, through multiple rounds of iterative training, a well-trained recommendation model and N noise vectors can be obtained. It can be understood that the N noise vectors are mainly used to assist in training the recommendation model. After training, they can be discarded or kept for use in retraining. In the actual recommendation prediction stage, only the well-trained recommendation model needs to be used.

[0111] In summary, by employing the recommendation model training method disclosed in the embodiments of this specification, the unfairness of the original dataset is removed by constructing corrective samples to supplement the original dataset. Then, the recommendation model is trained using the obtained fair dataset, thereby completely solving the unfairness problem in the recommendation field from the data level and making the prediction results of the recommendation model fair.

[0112] Corresponding to the training method described above, this specification also discloses a training device. Figure 3 A schematic diagram of a training device structure for a recommendation model according to one embodiment is shown, as follows. Figure 3 As shown, the device 300 includes:

[0113] The real sample acquisition unit 310 is configured to acquire a real sample set, wherein any first real sample includes user features of a first user and object features of a first business object, as well as a first behavior label indicating whether the first user has performed a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute. The fictional sample construction unit 320 is configured to construct corresponding fictional samples based on the first real samples, wherein the second user involved in the fictional sample belongs to one of the two user groups as the first user, the similarity between the fictional business object involved in the fictional sample and the first business object meets a preset threshold, and the fictional behavior label of the fictional sample has the same label value as the first behavior label. The model training unit 330 is configured to train the recommendation model based on the first real samples and the fictional samples.

[0114] In one embodiment, the preset sensitive attribute is gender, and the two attribute values ​​are male and female.

[0115] In one embodiment, the business object is an advertisement and the reservation behavior is a click behavior; or, the business object is a product and the reservation behavior is a purchase.

[0116] In one embodiment, the fictional sample construction unit 320 is specifically configured to: select a user from the user group that does not include the first user from the two user groups as the second user; determine a fictional business object whose similarity to the first business object meets the preset threshold; determine a fictional behavior label with the same label value as the first behavior label; and determine the fictional sample based on the second user, the fictional business object, and the fictional behavior label.

[0117] In one embodiment, the real sample set involves N business objects, and the N business objects correspond to N learnable noise vectors; the fictional sample construction unit 320 is specifically configured to: superimpose the first noise vector corresponding to the first business object onto the first object embedding vector obtained by processing the object features using the recommendation model, to obtain the fictional object embedding vector corresponding to the fictional business object; and construct the fictional sample based on the fictional object embedding vector.

[0118] In one specific embodiment, the norm of the first noise vector is less than a preset threshold.

[0119] In one specific embodiment, the object feature is an object identifier.

[0120] In one specific embodiment, the apparatus further includes a noise training unit 340 configured to train the first noise vector based on the fictitious sample.

[0121] In a more specific embodiment, the noise training unit 340 specifically includes: a sample acquisition subunit configured to acquire a second real sample from the real sample set based on the fictional sample, wherein the user involved in the second real sample is the second user, and the label value of its second behavior label is different from the label value of the fictional behavior label; a behavior prediction subunit configured to process the fictional sample and the second real sample respectively using the recommendation model to obtain two behavior prediction results; and a noise training subunit configured to train the first noise vector with the goal of increasing the gap between the two behavior prediction results.

[0122] Furthermore, the behavior prediction subunit is specifically configured as follows: using the recommendation model to process the user features of the second user to obtain a second user embedding vector; based on the dot product of the second user embedding vector and the fictitious object embedding vector, to obtain a behavior prediction result for the fictitious sample; using the recommendation model to process the object features of the second business object in the second real sample to obtain a second object embedding vector; based on the dot product of the second user embedding vector and the second object embedding vector, to obtain a behavior prediction result for the second real sample.

[0123] In one embodiment, the model training unit 330 is specifically configured to: obtain a second real sample from the real sample set that is the same as the fictional sample user but has a different behavior label, and form a first sample pair with the fictional sample; obtain a third real sample from the real sample set that is the same as the first real sample user but has a different behavior label, and form a second sample pair with the first real sample; process the first sample pair and the second sample pair using the recommendation model to obtain two pairs of behavior prediction results; and train the recommendation model with the goal of increasing the intra-pair gap of the two pairs of behavior prediction results.

[0124] In one embodiment, the training of the recommendation model includes multiple rounds, and the device 300 further includes a sample selection unit 350, configured to construct multiple corresponding fictitious samples based on multiple real samples randomly selected from the real sample set in any round of iterative training, for using to perform iterative training of the recommendation model in the current round; the number of different business objects involved in the multiple real samples is less than a predetermined number threshold.

[0125] In one embodiment, the model training unit 330 is specifically configured to: perform embedding processing using the recommendation model to obtain a first user embedding vector of the first user, a first object embedding vector of the first business object, and a second user embedding vector of the second user; obtain a first behavior prediction result based on the dot product of the first user embedding vector and the first object embedding vector; obtain a second behavior prediction result based on the dot product of the second user embedding vector and the fictional object embedding vector of the fictional business object; and train the recommendation model based on the first behavior prediction result and the first behavior label, as well as the second behavior prediction result and the fictional behavior label.

[0126] In a specific embodiment, the real sample set involves N business objects, and the recommendation model is implemented as a graph neural network model; the device 300 further includes: a relationship network graph acquisition unit, configured to acquire a user-object bipartite graph constructed based on the real sample set, the user-object bipartite graph including M user nodes corresponding to the M users, N object nodes corresponding to the N business objects, and connection edges established by user nodes performing predetermined actions on object nodes; the model training unit 330 uses the recommendation model for embedding processing, specifically including: using the graph neural network to perform graph embedding processing on the user-object bipartite graph.

[0127] In summary, by using the recommendation model training apparatus disclosed in the embodiments of this specification, the unfairness of the original dataset is removed by constructing corrective samples to supplement the original dataset, and then the recommendation model is trained using the obtained fair dataset. This completely solves the unfairness problem in the recommendation field from the data level, making the prediction results of the recommendation model fair.

[0128] According to another embodiment, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed in a computer, causes the computer to perform a combination Figure 2 The method described.

[0129] According to another embodiment, a computing device is also provided, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements a combination... Figure 2 The methods described herein. Those skilled in the art will recognize that, in one or more of the examples above, the functions described in this invention can be implemented using hardware, software, firmware, or any combination thereof. When implemented in software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium.

[0130] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made on the basis of the technical solution of the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for training a recommendation model, comprising: Obtain a real sample set, wherein any first real sample includes user characteristics of a first user and object characteristics of a first business object, as well as a first behavior label indicating whether the first user performs a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute; the user characteristics include user behavior characteristics; Based on the first real sample, a corresponding fictional sample is constructed. The second user involved in the fictional sample belongs to the two groups of users, and the similarity between the fictional business object involved in the fictional sample and the first business object is greater than a preset threshold. The fictional behavior label of the fictional sample has the same label value as the first behavior label. The recommendation model is trained based on the first real sample and the fictional sample; The real sample set involves N business objects, and the N business objects correspond to N learnable noise vectors. The construction of the corresponding fictional sample based on the first real sample includes: superimposing the first noise vector corresponding to the first business object onto the first object embedding vector obtained by processing the object features using the recommendation model, to obtain the fictional object embedding vector corresponding to the fictional business object; and constructing the fictional sample based on the fictional object embedding vector. Wherein, the business object is an advertisement or content information, and the reservation behavior is a click behavior; or, the business object is a product, and the reservation behavior is a purchase.

2. The method according to claim 1, wherein, The preset sensitive attribute is gender, and the two attribute values ​​are male and female.

3. The method according to claim 1, wherein, Constructing corresponding fictional samples based on the first real sample includes: Select a user from the user group that does not include the first user from the two user groups to be the second user; Identify fictitious business objects whose similarity to the first business object meets the preset threshold. Based on the first behavior label, determine the fictional behavior label that has the same label value; The fictional sample is determined based on the second user, the fictional business object, and the fictional behavior tag.

4. The method according to claim 1, wherein, The norm of the first noise vector is less than a preset threshold.

5. The method according to claim 1, wherein, The object characteristic is the object identifier.

6. The method according to claim 1, further comprising: The first noise vector is trained based on the fictional sample.

7. The method according to claim 6, wherein, Based on the fictional sample, the first noise vector is trained, including: Based on the fictional sample, a second real sample is obtained from the real sample set. The user involved in the second real sample is the second user, and the tag value of the second behavior tag is different from the tag value of the fictional behavior tag. The fictional sample and the second real sample are processed using the recommendation model to obtain two behavior prediction results; The first noise vector is trained with the goal of increasing the gap between the two behavior prediction results.

8. The method according to claim 7, wherein, The recommendation model is used to process the fictional sample and the second real sample respectively, resulting in two behavior prediction results, including: The user features of the second user are processed using the recommendation model to obtain the second user's embedding vector; The behavior prediction result for the fictional sample is obtained based on the dot product of the second user embedding vector and the fictional object embedding vector. The recommendation model is used to process the object features of the second business object in the second real sample to obtain the second object embedding vector. The behavior prediction result for the second real sample is obtained based on the dot product of the second user embedding vector and the second object embedding vector.

9. The method according to claim 1, wherein, Based on the first real sample and the fictional sample, the recommendation model is trained, including: A second real sample is obtained from the real sample set that is the same as the fictional sample user but has different behavioral tags, and it forms a first sample pair with the fictional sample. A third real sample is obtained from the real sample set that is the same user as the first real sample but has different behavioral tags, and it forms a second sample pair with the first real sample. The recommendation model is used to process the first sample pair and the second sample pair respectively to obtain two pairs of behavior prediction results; The recommendation model is trained with the goal of increasing the intra-pair gap between the two pairs of behavior prediction results.

10. The method according to claim 1, wherein, The method involves multiple rounds of iterative training of the recommendation model, wherein any round of iterative training includes: Multiple fictitious samples are constructed based on multiple real samples randomly selected from the real sample set; the number of different business objects involved in the multiple real samples is less than a predetermined threshold. The recommendation model is iteratively trained in the current round based on the multiple fictional samples.

11. The method according to claim 1, wherein, Based on the first real sample and the fictional sample, the recommendation model is trained, including: The recommendation model is used for embedding processing to obtain the first user embedding vector of the first user, the first object embedding vector of the first business object, and the second user embedding vector of the second user. The first row of prediction results is obtained based on the dot product of the first user embedding vector and the first object embedding vector; The second behavior prediction result is obtained based on the dot product of the second user embedding vector and the fiction object embedding vector of the fiction business object. The recommendation model is trained based on the first behavior prediction result and the first behavior label, as well as the second behavior prediction result and the fiction behavior label.

12. The method according to claim 11, wherein, The real sample set involves N business objects, and the recommendation model is implemented as a graph neural network model; wherein, before training the recommendation model based on the first real sample and the fictional sample, the method further includes: Obtain a user-object bipartite graph constructed based on the real sample set. The user-object bipartite graph includes M user nodes corresponding to the M users, N object nodes corresponding to the N business objects, and connection edges established by user nodes performing predetermined actions on object nodes. The embedding process using the recommendation model includes: The user-object bipartite graph is embedded using the graph neural network.

13. A training device for a recommendation model, comprising: The real sample acquisition unit is configured to acquire a real sample set, wherein any first real sample includes user features of a first user and object features of a first business object, as well as a first behavior label indicating whether the first user has performed a predetermined behavior on the first business object; the M users involved in the real sample set are divided into two groups of users corresponding to two attribute values ​​of a preset sensitive attribute; the user features include user behavior features; The fictional sample construction unit is configured to construct a corresponding fictional sample based on the first real sample. The second user involved in the fictional sample belongs to the two groups of users, and the similarity between the fictional business object involved in the fictional sample and the first business object is greater than a preset threshold. The fictional behavior label of the fictional sample has the same label value as the first behavior label. The model training unit is configured to train the recommendation model based on the first real sample and the fictional sample; The real sample set involves N business objects, and the N business objects correspond to N learnable noise vectors. The fictional sample construction unit is specifically configured as follows: a first noise vector corresponding to the first business object is superimposed on the first object embedding vector obtained by processing the object features using the recommendation model to obtain a fictional object embedding vector corresponding to the fictional business object; the fictional sample is constructed based on the fictional object embedding vector. Wherein, the business object is an advertisement or content information, and the reservation behavior is a click behavior; or, the business object is a product, and the reservation behavior is a purchase.

14. A computer-readable storage medium having a computer program stored thereon, wherein, When the computer program is executed in the computer, it causes the computer to perform the method according to any one of claims 1-12.

15. A computing device comprising a memory and a processor, wherein, The memory stores executable code, and when the processor executes the executable code, it implements the method of any one of claims 1-12.

Citation Information

Patent Citations

  • Energy consumption prediction method, device and equipment and storage medium

    CN111126700A

  • Behavior prediction model training method and device

    CN111681059A

  • Anti-fact fair recommendation method based on inverse tendency weighting method

    CN114936890A