A fair recommendation method and device based on contrastive learning

By combining collaborative information and item-side information, and using contrastive learning to establish a sensitive attribute encoder, the problem of decreased prediction performance when sensitive attributes are sparse in existing technologies is solved, and the fair recommendation effect is improved in scenarios with missing labels.

CN120123593BActive Publication Date: 2026-03-17HUAZHONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing fair recommendation algorithms struggle to effectively train encoders when sensitive attributes are extremely sparse, leading to decreased prediction performance. Furthermore, existing technologies, which are constrained by limitations, fail to effectively address the sensitive attribute modeling problem in scenarios with missing labels.

Method used

By combining collaborative information and item-side information to predict unknown sensitive attributes, a sensitive attribute encoder is established through contrastive learning, the encoder is trained using contrastive loss, and then integrated into an adversarial learning or mutual information framework to construct a fair recommendation model.

Benefits of technology

In the case of missing labels, it improves the prediction performance of sensitive attributes and the fairness of recommendation, reduces the dependence on the number of labels, and improves the accuracy and fairness of the prediction model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123593B_ABST
    Figure CN120123593B_ABST
Patent Text Reader

Abstract

The application discloses a fair recommendation method and device based on contrast learning, wherein the method comprises the following steps: step S1, predicting the unknown sensitive attribute of a user by using collaborative information to obtain a first sensitive attribute prediction value; step S2, predicting the unknown sensitive attribute of a user by using item-side information to obtain a second sensitive attribute prediction value; step S3, fusing the first sensitive attribute prediction value and the second sensitive attribute prediction value to obtain a final sensitive attribute prediction value of the user; and step S4, establishing a sensitive attribute encoder of contrast learning, training the encoder by using a contrast loss, and performing fair recommendation based on the trained encoder. The application can model the sensitive attribute in a scene where the sensitive label is limited, and then perform fair recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of recommendation system technology, and in particular to a fair recommendation method and apparatus based on contrastive learning. Background Technology

[0002] With the rapid development of the internet, people's lives are overwhelmed by massive amounts of information. Recommendation systems are widely used on various platforms because they can filter information based on user preferences and model user interests. However, while learning user interests, these recommendation algorithms often learn sensitive attribute information about users, leading to biased recommendations. To address this issue, researchers have proposed various fair recommendation algorithms that aim to model sensitive attributes of users and achieve fair recommendations by maintaining the independence between sensitive attributes and user interests. For example, some methods remove sensitive information from user embeddings through adversarial training, while others use mutual information constraints to reduce sensitive information in user embeddings, thereby achieving fairness.

[0003] These fair recommendation algorithms require sensitive attribute labels from users during model training. However, due to privacy regulations and other reasons, many users are unwilling to provide such sensitive information. Therefore, only a limited number of user attribute labels are available, making it difficult for fair recommendation algorithms to achieve satisfactory results. To address the problem of limited labels, several fair recommendation algorithms for limited sensitive attribute information have been proposed. The core idea of ​​these methods is to use known user sensitive attributes to predict unknown sensitive attributes, and then use the complete attributes for subsequent fair recommendation tasks.

[0004] While these methods have achieved good results in terms of fairness, they still face some challenges when the sensitivity attributes are extremely sparse. On the one hand, training the prediction model becomes difficult when the number of known labels is limited, leading to a performance degradation. On the other hand, existing prediction models rely on collaborative information to predict unknown labels, which assumes that users who click on the same item have similar sensitivity attributes. Therefore, the decline in prediction performance is more significant when user historical data is sparse. Existing fairness methods based on adversarial learning can work effectively only if the encoder is easy to train to ensure the effectiveness of adversarial training. However, when the sensitivity attributes are extremely sparse, training the encoder becomes challenging. This stems from the use of cross-entropy loss in the encoder: on the one hand, the extreme scarcity of labels results in a limited number of available labels; on the other hand, cross-entropy loss completely introduces noise from the labels into the discriminator, making it difficult for the model to find the correct optimization direction. Summary of the Invention

[0005] In view of this, it is necessary to provide a fair recommendation method and apparatus based on contrastive learning to effectively solve the technical problem of difficulty in modeling sensitive attributes in scenarios with missing labels.

[0006] This invention provides a fair recommendation method based on contrastive learning, comprising the following steps:

[0007] Preferably, in step S1, the user's unknown sensitive attributes are predicted using collaborative information to obtain the predicted value of the first sensitive attribute;

[0008] Step S2: Use the item-side information to predict the user's unknown sensitive attributes and obtain the predicted value of the second sensitive attribute;

[0009] Step S3: Fuse the predicted values ​​of the first and second sensitive attributes to obtain the final predicted values ​​of the user's sensitive attributes;

[0010] Step S4: Establish a sensitive attribute encoder for contrastive learning, train the encoder using contrastive loss, and make fair recommendations based on the trained encoder.

[0011] Preferably, step S1 specifically includes:

[0012] Step S11: Perform graph convolution on the user-item bipartite graph to obtain the user embedding vector and the item embedding vector;

[0013] Step S12: Set up a classifier, train the classifier using the sensitive information of the known labels, and use the trained classifier to predict the predicted value of the first sensitive attribute from the user embedding vector.

[0014] Preferably, step S2 specifically includes:

[0015] Step S21: Convert the item-side information into an embedding vector using a word embedding model;

[0016] Step S22: Aggregate the embedding vectors of all words in the item content information to obtain the item description vector;

[0017] Step S23: Aggregate the item description vectors of all items that the user has interacted with to obtain the user description vector;

[0018] Step S24: Predict the user's unknown sensitive attributes based on the user description vector to obtain the predicted value of the second sensitive attribute.

[0019] Preferably, step S3 specifically comprises:

[0020] The predicted values ​​of the first and second sensitive attributes are fused to obtain the final predicted value of the user's sensitive attributes:

[0021]

[0022] Among them, su The final predicted value for user-sensitive attributes. To predict the value of the first sensitive attribute using collaborative information, This represents the predicted value of the second sensitive attribute using item-side information. α is a hyperparameter used to balance... and The weights between them.

[0023] Preferably, in step S4, establishing a contrastive learning-based sensitive attribute encoder and training the encoder using contrastive loss specifically involves:

[0024] A sensitive attribute encoder based on contrastive learning is established. This encoder learns the embeddings of the user's sensitive attributes and is trained using a contrastive loss, which is:

[0025]

[0026] in, To compare the losses, M is the number of all users, exp() represents the exp function, and θ() represents calculating the vector dot product. Embed sensitive attributes for user u. It is the embedding of positive samples of anchor user u, obtained through data augmentation. It is the embedding of negative samples of anchor user u, and τ is a hyperparameter.

[0027] Preferably, the negative samples of the anchor users are obtained using a negative sampling algorithm:

[0028]

[0029] Among them, u neg For negative samples of anchor user u, argmax() represents the maximum operation. For user u i The sensitive attribute, batch represents a batch of users sampled during training, s u For the final predicted value of user-sensitive attributes, This represents the average value of the sensitivity attributes for all users.

[0030] Preferably, in step S4, fair recommendation is performed based on the trained encoder, specifically as follows:

[0031] The encoder is integrated into an adversarial learning framework or a mutual information framework to construct a fair recommendation model, and the fair recommendation model is used to perform fair recommendations.

[0032] Preferably, the sensitive attribute encoder is integrated into an adversarial learning framework to construct a fair recommendation model, specifically as follows:

[0033] A filter is set up to remove sensitive information. The input of the filter is a pre-trained user and item embedding, and the output is the filtered user and item embedding.

[0034] The encoder is used as a discriminator, and the filter is used to filter users. The embedded vector of the filtered users is then input into the discriminator.

[0035] The discriminator is trained using contrastive loss, the filter is trained by combining contrastive loss and BRP ranking loss, and the filter and discriminator are subjected to iterative adversarial training.

[0036] The user representation and item representation after removing sensitive information are used to predict the user's predicted rating for the item, and a recommendation list is generated based on the predicted rating.

[0037] Preferably, the loss for training the filter is:

[0038]

[0039] in, The loss for training the filter, This represents the BPR ranking loss. This represents the contrast loss, where η is a hyperparameter used to balance the weights of the two losses.

[0040] The present invention also provides a fair recommendation device based on contrastive learning, including a memory and a processor, wherein the memory stores a computer program, and the computer program, when executed by the processor, implements the fair recommendation method based on contrastive learning.

[0041] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention combines item-side information and collaborative information to predict unknown sensitive attributes, alleviating the dependence on the number of tags and further improving the prediction effect. Based on completing the sensitive attributes, contrastive learning is used to learn the user's sensitive attribute representation and attribute embedding, resulting in a more accurate model of sensitive attributes. Simultaneously, this invention is combined with existing fair recommendation frameworks, integrating the contrastive learning-based sensitive attribute encoder into the existing framework to form a complete fairness model, achieving fair recommendation even in cases of missing tags, thus improving both recommendation performance and fairness. Attached Figure Description

[0042] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:

[0043] Figure 1A flowchart illustrating an embodiment of a fair recommendation method based on contrastive learning provided by the present invention;

[0044] Figure 2 yes Figure 1 The illustrated embodiment is a block diagram of a fair recommendation method based on contrastive learning. Detailed Implementation

[0045] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0046] Example 1

[0047] Please see Figure 1 The fair recommendation method based on contrastive learning in this embodiment specifically includes the following steps:

[0048] Step S1: Use collaborative information to predict the user's unknown sensitive attributes and obtain the predicted value of the first sensitive attribute;

[0049] Step S2: Use the item-side information to predict the user's unknown sensitive attributes and obtain the predicted value of the second sensitive attribute;

[0050] Step S3: Fuse the predicted values ​​of the first and second sensitive attributes to obtain the final predicted values ​​of the user's sensitive attributes;

[0051] Step S4: Establish a sensitive attribute encoder for contrastive learning, train the encoder using contrastive loss, and make fair recommendations based on the trained encoder.

[0052] To mitigate the performance degradation caused by using single-source information (i.e., collaborative information), this embodiment proposes combining item-side information, such as item category and title, to assist in sensitive attribute prediction. This is because item-side information contains semantic cues related to user sensitive attributes. For example, if a user primarily watches science fiction or horror movies, it is reasonable to infer that the user is likely male. Therefore, utilizing item-side information to assist in sensitive attribute prediction is necessary because it provides more comprehensive knowledge, helping the model predict sensitive attributes even with limited labels. Unlike existing technologies that incorporate item-side information to enhance the primary task (i.e., recommendation), this embodiment introduces item-side information not to strengthen the primary task, but to mine attribute-related information from item-side information to improve the predictive model's capabilities, thereby better meeting fairness requirements. Given the excellent performance of contrastive learning in tasks such as feature extraction and clustering, contrastive loss can naturally be applied to the training of the discriminator, offering the following advantages: Firstly, as an unsupervised loss function, contrastive loss is unaffected by the number of labels. Secondly, contrastive loss can adaptively adjust for noise by sampling and comparing positive and negative samples, preventing noise from being introduced into the discriminator.

[0053] Step S1 specifically includes:

[0054] Step S11: Perform graph convolution on the user-item bipartite graph to obtain the user embedding vector and the item embedding vector;

[0055] Step S12: Set up a classifier, train the classifier using the sensitive information of the known labels, and use the trained classifier to predict the predicted value of the first sensitive attribute from the user embedding vector.

[0056] In this embodiment, step S1 specifically includes:

[0057] Perform graph convolution on the user-item bipartite graph:

[0058]

[0059] in, This represents the embedding vector of user u after the k-th convolution. This represents the embedding vector of item v after the k-th convolution. This represents the set of items that user u has interacted with. Let k represent the set of users who have interacted with item v, where k takes values ​​from 0 to K, and K is the total number of convolutions.

[0060] Set a classifier from the embedding vector In the prediction of sensitive information, known labels are used to train the classifier:

[0061]

[0062] in, Represents a classifier. Indicates the prediction result;

[0063] For user u with unknown sensitive attributes, the prediction result is used as its predicted sensitive attribute, and denoted as...

[0064] Among them, U T This represents a set of users with unknown sensitive attributes.

[0065] Step S2 specifically includes:

[0066] Step S21: Convert the item-side information into an embedding vector using a word embedding model;

[0067] Step S22: Aggregate the embedding vectors of all words in the item content information to obtain the item description vector;

[0068] Step S23: Aggregate the item description vectors of all items that the user has interacted with to obtain the user description vector;

[0069] Step S24: Predict the user's unknown sensitive attributes based on the user description vector to obtain the predicted value of the second sensitive attribute.

[0070] In this embodiment, step S2 specifically includes:

[0071] Item-side information is converted into embedding vectors using a word embedding model:

[0072]

[0073] in, This represents the word vector corresponding to the i-th word in the item-side information of item v. word2vec() is a word embedding model. B represents the i-th word in the item-side information of item v. v This represents the set of all words in the item-side information of item v;

[0074] Aggregate all word embedding vectors in the item-side information to obtain the item description vector:

[0075]

[0076] Among them, c v Let v be the item description vector;

[0077] Aggregate the item description vectors of all items that user u has interacted with to obtain the user description vector:

[0078]

[0079] Among them, c u Let be the user description vector for user u, and AGG() represent the aggregation operation. In this embodiment, average pooling is used for aggregation. This represents the set of items that user u has interacted with;

[0080] Predict unknown sensitive attributes of a user based on their description vector:

[0081]

[0082] in, This represents the predicted value of the second sensitive attribute of user u, where σ() is the sigmoid activation function. Represents the user description vector c u The transpose of ω is the attribute embedding, used to learn a specific attribute, and is a learnable parameter.

[0083] Users with known sensitive attributes are used for training. For users with unknown sensitive attributes, the prediction result is used as the predicted value of their second sensitive attribute, and denoted as:

[0084]

[0085] in, U represents the predicted value of the second sensitive attribute for users with unknown sensitive attributes. T This represents a set of users with unknown sensitive attributes.

[0086] In this embodiment, step S3 specifically includes:

[0087] The predicted values ​​of the first and second sensitive attributes are fused to obtain the final predicted value of the user's sensitive attributes:

[0088]

[0089] Among them, s u The final predicted value for user-sensitive attributes. To predict the value of the first sensitive attribute using collaborative information, This represents the predicted value of the second sensitive attribute using item-side information. α is a hyperparameter used to balance... and The weights between them.

[0090] In step S4, a contrastive learning-based sensitive attribute encoder is established, and the encoder is trained using contrastive loss. Specifically:

[0091] A sensitive attribute encoder based on contrastive learning is established, which is used to learn the user's sensitive attribute embeddings:

[0092]

[0093] in, Embed sensitive attributes for user u. The initial feature representation for user u is replaced by a pre-trained user embedding, and SenEncode() is the encoder to be trained.

[0094] The contrastive loss for training the encoder is:

[0095]

[0096] in, To compare the losses, M is the number of all users, exp() represents the exp function, and θ() represents calculating the vector dot product. Embed sensitive attributes for user u. It is the embedding of positive samples of anchor user u, obtained through data augmentation. It is the embedding of negative samples of anchor user u, and τ is a hyperparameter.

[0097] The negative samples of the anchor users are obtained using a negative sampling algorithm:

[0098]

[0099] Among them, u neg For negative samples of anchor user u, argmax() represents the maximum operation. For user u i The sensitive attribute, batch represents a batch of users sampled during training, s u For the final predicted value of user-sensitive attributes, This represents the average value of the sensitivity attributes for all users.

[0100] In step S4, fair recommendations are made based on the trained encoder, specifically as follows:

[0101] The sensitive attribute encoder is integrated into an adversarial learning framework or a mutual information framework to construct a fair recommendation model, and the fair recommendation model is used to perform fair recommendations.

[0102] The sensitive attribute encoder is integrated into the adversarial learning framework to construct a fair recommendation model, specifically as follows:

[0103] A filter is set up to remove sensitive information. The input of the filter is a pre-trained user and item embedding, and the output is the filtered user and item embedding. The filter is specifically as follows:

[0104]

[0105] in, For filters, e u Indicates the user who is pre-trained, e v f represents the pre-trained item embeddings. u f represents the filtered users. v This indicates that the filtered items are embedded.

[0106] The sensitive attribute encoder is used as a discriminator, and the filter is used to filter users. The filtered users are then embedded into the sensitive attribute encoder.

[0107]

[0108] Using contrast loss The discriminator is trained using a loss function. Training the filter:

[0109] The filter and the discriminator undergo iterative adversarial training.

[0110] Using user representations and item representations after removing sensitive information to predict user ratings for items.

[0111]

[0112] in, f is the predicted rating for user u on item v. u For user representation after removing sensitive information, f v This is the representation of an item after sensitive information has been removed.

[0113] A recommendation list is generated based on the predicted scores.

[0114] The loss for training the filter is:

[0115]

[0116] in, The loss for training the filter, This represents the BPR ranking loss, used to ensure recommendation performance. This represents the contrast loss, where η is a hyperparameter used to balance the weights of the two losses.

[0117] The encoder provided in this embodiment can also be integrated into the mutual information framework to build a fair recommendation model, specifically as follows: Figure 2 As shown, Figure 2A detailed principle framework diagram of this embodiment is provided. When integrated into the mutual information framework, the encoder first performs pre-training and generates pre-trained sensitive attribute embeddings. Then, these sensitive attribute embeddings, together with the user embeddings, participate in the calculation of the mutual information upper bound. Finally, the recommendation model is jointly trained using the recommendation loss and the mutual information upper bound constraint, which improves fairness while ensuring recommendation performance.

[0118] To verify the effectiveness of this embodiment, a comparative experiment was also conducted. This experiment used a graph convolutional network as the basic recommendation model, with 10% of users having known sensitive attributes. The encoder provided in this embodiment was combined with adversarial frameworks and mutual information frameworks to construct complete fair recommendation frameworks, and experiments were conducted on three datasets, as shown in Table 1. The experimental results are shown in Table 2.

[0119] Table 1. Data sets used in the comparative experiment

[0120]

[0121]

[0122] Table 2. Comparative Experiment Results

[0123]

[0124]

[0125]

[0126] In Table 1, the dataset Movielens-1M is abbreviated as ML1M, the dataset Movielens-100K is abbreviated as ML100K, and the dataset BookCrossing is abbreviated as BookCro.

[0127] In Table 2, NDCG represents Normalized Diminished Cumulative Gain: an indicator used to measure ranking quality. It comprehensively evaluates the ranking effect of recommendation systems or information retrieval systems by considering the position and relevance of relevant items in the ranking results. The higher the value, the better the ranking quality. RECALL represents Recall: an important indicator in information retrieval and recommendation systems. It represents the proportion of items successfully recalled by the system among all relevant items, i.e., the proportion recommended. It is used to measure the system's ability to find all relevant items. DP represents Statistical Equality: it refers to the fact that different protected groups, such as those classified based on the third sensitivity attribute or the first sensitivity attribute, have the same probability of being classified into positive categories, such as obtaining a loan or being hired. It is used to measure whether the distribution of decision results is fair among different groups and avoid systematic bias caused by group attributes. EO represents Equal Opportunity: it measures whether different groups, such as those classified based on the first sensitivity attribute or the third sensitivity attribute, have the same probability of obtaining a positive decision when they are truly qualified. It focuses on the fairness of opportunity among different groups under certain qualification conditions.

[0128] The results in Table 2 reveal several key points: First, traditional fair recommendation models, such as graph-based fair recommendation models and mutual information-based fair recommendation models, perform poorly in terms of fairness because they cannot proactively handle missing sensitive attribute information. Notably, the recommendation accuracy of the mutual information-based recommendation framework even surpasses that of the base model. Second, compared to traditional fairness models, fair graph representation learning and fair adversarial networks significantly improve fairness, thanks to the prediction of unknown sensitive attributes. We also found that fair adversarial networks slightly outperform fair graph representation learning in both recommendation accuracy and fairness because they use a provable loss function to optimize the filters, avoiding noise introduced by thresholding operations. Third, the present invention plus adversarial framework surpasses the baseline model in both recommendation accuracy and fairness. This is mainly due to two reasons: the present invention improves prediction performance by utilizing item-side information to predict unknown sensitive attributes; and the present invention avoids noise introduced by thresholding operations through contrastive learning. Finally, the present invention plus mutual information framework significantly improves fairness, validating the effectiveness of the present invention. Compared to traditional mutual information models, its recommendation accuracy is weaker. This is because the present invention accurately models sensitive attributes and strengthens fairness constraints, thus leading to a decrease in recommendation accuracy. In summary, the present invention is an effective plug-and-play module that achieves excellent performance.

[0129] We also conducted ablation experiments on the ML1 M dataset. The ablation experiments used the following comparative algorithms: 1. Removing the item-side information extraction module from the complete method (denoted as module C in the table); 2. Removing the collaborative information extraction module from the complete method (denoted as module D in the table); 3. Removing the negative sampling module from the complete method (denoted as module E in the table); 4. Removing the contrastive learning module from the complete method (denoted as module F in the table), and directly using thresholding to obtain the predicted labels. The experimental results are shown in Table 3.

[0130] Table 3. Ablation Experiment Results of ML1 M Dataset

[0131]

[0132]

[0133] From the results in the table above, the following points can be observed: First, the lack of collaborative or item-side information affects model performance, indicating that both types of information are helpful in learning sensitive attributes. Second, removing the negative sampling module significantly reduces the model's fairness, suggesting that contrastive learning relies on widening the distance between embeddings of users from different categories to achieve clustering. The negative sampling algorithm achieves this by sampling users from different categories. Finally, replacing contrastive learning with a thresholding operation reduces recommendation accuracy and fairness. This decrease is attributed to the noise introduced by the thresholding operation; for example, misclassified users are negatively impacted by fairness optimization. The results under the mutual information framework are similar to those under the adversarial learning framework, and therefore will not be elaborated further.

[0134] Since we wanted to explore the model's performance under conditions of extremely scarce sensitive attribute information, we set the proportion of known labels within the range of [0.01, 0.05, 0.1, 0.2, 0.4] for our experiments. The experimental results are shown in Table 4.

[0135] Table 4. Experimental results under conditions of extreme scarcity of sensitive attribute information

[0136]

[0137] From the experimental results, we can observe the following: First, the model considering limited sensitive information significantly outperforms the traditional model in terms of fairness. Second, the advantages of this invention are even more pronounced when the amount of known sensitive information is extremely small. This is because when the amount of known sensitive information is very limited, relying solely on collaborative information to predict unknown sensitive attributes becomes less effective. In contrast, this invention combines item-side information to predict sensitive attributes, maintaining effective predictive ability even when the amount of known sensitive attributes is extremely small.

[0138] Example 2

[0139] This embodiment provides a fair recommendation device based on contrastive learning, including a memory and a processor. The memory stores a computer program, which, when executed by the processor, implements the fair recommendation method based on contrastive learning described in Embodiment 1.

[0140] The fair recommendation device based on contrastive learning provided in this embodiment is used to implement the fair recommendation method based on contrastive learning. Therefore, the fair recommendation device based on contrastive learning also has the same technical effects as the fair recommendation method based on contrastive learning, and will not be described again here.

[0141] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of the present invention.

Claims

1. A fair recommendation method based on contrastive learning, characterized in that, The method comprises the following steps: Step S1, predicting a sensitive attribute unknown to a user by using collaborative information to obtain a first sensitive attribute prediction value; Step S2, predicting the sensitive attribute unknown to the user by using item-side information to obtain a second sensitive attribute prediction value; Step S3, fusing the first sensitive attribute prediction value and the second sensitive attribute prediction value to obtain a final sensitive attribute prediction value of the user; Step S4, establishing a sensitive attribute encoder for contrast learning, training the encoder by using a contrast loss, and performing fair recommendation based on the trained encoder; In the step S4, the sensitive attribute encoder for contrast learning is established, and the encoder is trained by using a contrast loss, and specifically: The sensitive attribute encoder for contrast learning is established, and the encoder is used to learn the sensitive attribute embedding of the user, and the encoder is trained by using a contrast loss, and the contrast loss is: in, To compare the losses, It is the total number of users. This represents the exp function. This indicates the calculation of the vector dot product. For users Embedding of sensitive attributes Anchor users The embeddings of positive samples are obtained through data augmentation. Anchor users Embedding of negative samples, For hyperparameters; The negative samples of the anchor user are obtained by using a negative sampling algorithm: where, is the anchor user negative sample, denotes the max operation, is the sensitive attribute of the user is the sensitive attribute of the user denotes a batch of users sampled at training time, is the final user sensitive attribute prediction, denotes the average sensitive attribute of all users.

2. The contrast learning based fair recommendation method according to claim 1, characterized in that, The step S1 specifically comprises: Step S11, performing graph convolution operation on a user-item bipartite graph to obtain a user embedding vector and an item embedding vector; Step S12, setting a classifier, training the classifier by using the known sensitive information of the label, and predicting the first sensitive attribute prediction value from the user embedding vector by using the trained classifier.

3. The contrast learning based fair recommendation method according to claim 1, characterized in that, The step S2 specifically comprises: Step S21, converting the item-side information into an embedding vector by using a word embedding model; Step S22, aggregating the embedding vectors of all words in the item content information to obtain an item description vector; Step S23, aggregating the item description vectors of all items interacted by the user to obtain a user description vector; Step S24, predicting the sensitive attribute unknown to the user according to the user description vector to obtain the second sensitive attribute prediction value.

4. The contrast learning based fair recommendation method of claim 1, wherein, The step S3 specifically comprises: The first sensitive attribute prediction value and the second sensitive attribute prediction value are fused to obtain a final sensitive attribute prediction value of the user: wherein, is the final prediction of the user sensitive attribute, is the first sensitive attribute prediction value predicted using the collaborative information, is the second sensitive attribute prediction value predicted using the item side information, is a hyper parameter used to balance the weight between and .

5. The contrast learning based fair recommendation method according to claim 1, characterized in that, In the step S4, the fair recommendation is performed based on the trained encoder, and specifically: The encoder is integrated into an adversarial learning framework or a mutual information framework to construct a fairness recommendation model, and the fairness recommendation model is used for fair recommendation.

6. The contrast learning based fair recommendation method according to claim 5, characterized in that, The sensitive attribute encoder is integrated into an adversarial learning framework to construct a fairness recommendation model, and specifically: A filter is set to remove sensitive information, the input of the filter is a pre-trained user and item embedding, and the output is a filtered user and item embedding; The encoder is used as a discriminator, the filter is used to filter the user, and the embedding vector of the filtered user is input into the discriminator; The discriminator is trained by using a contrast loss, and the filter is trained by combining a contrast loss and a BRP ranking loss, and the filter and the discriminator are iteratively adversarially trained; The user representation and the item representation after the sensitive information is removed are used to predict a predicted score of the user on the item, and a recommendation list is generated based on the predicted score.

7. The contrast learning based fair recommendation method according to claim 6, characterized in that, The loss for training the filter is: where, is the loss for training the filter, denotes the BPR ranking loss, denotes the contrastive loss, is a hyper-parameter for balancing the weights of the two losses.

8. A fair recommendation device based on contrastive learning, characterized in that, The computer program is stored in the memory and is executed by the processor to implement the fair recommendation method based on contrast learning according to any one of claims 1-7.

Citation Information

Patent Citations

  • Sensitive attribute automatic identification method based on comparative learning

    CN115758229A

  • Depolarization method of graph neural network based on comparative learning

    CN115906922A