Fair recommendation method and device based on comparative learning

By combining synergistic information and item-side information to predict user sensitive attributes and using contrast loss training encoder, the problem of fair recommendation in the case of missing or sparse labels is solved, and more accurate modeling of sensitive attributes and fair recommendations are achieved.

CN120123593AActive Publication Date: 2025-06-10HUAZHONG UNIV OF SCI & TECH
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510298592.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-06-10
Estimated Expiration
2045-03-13

AI Technical Summary

Technical Problem

In the absence of labels or extremely sparse, existing fair recommendation algorithms are difficult to effectively model users' sensitive attributes, resulting in a degradation of recommendation performance.

Method used

A fair recommendation method based on contrast learning is adopted, and a sensitive attribute encoder is trained using contrast loss to achieve fair recommendation.

Benefits of technology

This method can alleviate the dependence on the number of tags when tags are missing or sparse, and improve the accuracy and fairness of the prediction of sensitive attributes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123593A_ABST
    Figure CN120123593A_ABST
Patent Text Reader

Abstract

The invention discloses a fair recommendation method and device based on comparative learning, and the method comprises the following steps: S1, predicting an unknown sensitive attribute of a user through collaborative information, and obtaining a first sensitive attribute prediction value; s2, predicting an unknown sensitive attribute of the user by using the article side information to obtain a second sensitive attribute prediction value; s3, fusing the first sensitive attribute predicted value and the second sensitive attribute predicted value to obtain a final user sensitive attribute predicted value; and S4, establishing a sensitive attribute encoder of comparative learning, training the encoder by adopting comparative loss, and performing fair recommendation based on the trained encoder. According to the method, sensitive attribute modeling can be carried out in a scene with limited sensitive tags, and then fair recommendation is carried out.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of recommendation systems, and in particular, to a fairness recommendation method and device based on contrastive learning. Background Art

[0002] With the rapid development of the Internet, people's lives are inundated with a vast amount of information. Recommendation systems have been widely applied on various platforms because they can screen out information that users prefer and model user interests. However, while learning user interests, these recommendation algorithms often learn sensitive attribute information of users, resulting in biased recommendations. To address this issue, researchers have proposed various fairness recommendation algorithms aimed at modeling users' sensitive attributes and achieving fairness 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 to achieve fairness.

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

[0004] Although these methods have achieved good results in terms of fairness, they still face some challenges when sensitive attributes are extremely sparse. On the one hand, when the number of known labels is limited, the training of the prediction model becomes difficult, resulting in 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 sensitive attributes. Therefore, when user historical data is sparse, the decline in prediction performance is more significant. The premise for existing fairness methods based on adversarial learning to work effectively is that the encoder is easy to train to ensure the effectiveness of adversarial training. However, when sensitive attributes are extremely sparse, the training of the encoder becomes challenging. This is due to the encoder using cross-entropy loss: on the one hand, the extreme scarcity of labels leads to a limited number of available labels; on the other hand, the cross-entropy loss introduces all the noise in 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 fairness recommendation method and device based on contrastive learning to effectively solve the technical problem of difficult sensitive attribute modeling in the scenario of label absence.

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

[0007] Preferably, in step S1, collaborative information is used to predict unknown sensitive attributes of a user, obtaining a first sensitive attribute prediction value;

[0008] In step S2, item-side information is used to predict unknown sensitive attributes of a user, obtaining a second sensitive attribute prediction value;

[0009] In step S3, the first sensitive attribute prediction value and the second sensitive attribute prediction value are fused to obtain a final prediction value of the user's sensitive attributes;

[0010] In step S4, a contrastive learning-based sensitive attribute encoder is established, and the encoder is trained using contrastive loss, and fair recommendation is performed based on the trained encoder.

[0011] Preferably, step S1 specifically includes:

[0012] In step S11, graph convolution operations are performed on a user-item bipartite graph to obtain user embedding vectors and item embedding vectors;

[0013] In step S12, a classifier is set, and the classifier is trained using sensitive information with known labels, and the first sensitive attribute prediction value is predicted from the user embedding vectors using the trained classifier.

[0014] Preferably, step S2 specifically includes:

[0015] In step S21, a word embedding model is used to convert the item-side information into embedding vectors;

[0016] In step S22, the embedding vectors of all words in the item content information are aggregated to obtain an item description vector;

[0017] In step S23, the item description vectors of all items interacted with by the user are aggregated to obtain a user description vector;

[0018] In step S24, the unknown sensitive attributes of the user are predicted based on the user description vector, obtaining the second sensitive attribute prediction value.

[0019] Preferably, step S3 is specifically:

[0020] The first sensitive attribute prediction value and the second sensitive attribute prediction value are fused to obtain a final prediction value of the user's sensitive attributes:

[0021]

[0022] where su is the final predicted value of the user's sensitive attribute, is the predicted value of the first sensitive attribute predicted using collaborative information, represents the predicted value of the second sensitive attribute predicted using item-side information, and α is a hyperparameter used to balance and the weights between them.

[0023] Preferably, in step S4, a sensitive attribute encoder for contrastive learning is established, and the encoder is trained using contrastive loss. Specifically:

[0024] A sensitive attribute encoder based on contrastive learning is established. The encoder is used to learn the sensitive attribute embedding of the user, and the encoder is trained using contrastive loss. The contrastive loss is:

[0025]

[0026] where is the contrastive loss, M is the number of all users, exp() represents the exp function, θ() represents calculating the inner product of vectors, is the sensitive attribute embedding of user u, is the embedding of the positive sample of the anchor user u, obtained by data augmentation, is the embedding of the negative sample of the anchor user u, and τ is a hyperparameter.

[0027] Preferably, the negative sample of the anchor user is obtained using the negative sampling algorithm:

[0028]

[0029] where u neg is the negative sample of the anchor user u, argmax() represents the maximum operation, is for user u i 's sensitive attribute, batch represents a batch of users sampled during training, s u is the final predicted value of the user's sensitive attribute, represents the average value of the sensitive attributes of all users.

[0030] Preferably, in step S4, fair recommendation is performed based on the trained encoder. Specifically:

[0031] Integrate the encoder into an adversarial learning framework or a mutual information framework to construct a fairness recommendation model, and use the fairness recommendation model for fair recommendation.

[0032] Preferably, integrate the sensitive attribute encoder into an adversarial learning framework to construct a fairness recommendation model. Specifically:

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

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

[0035] The discriminator is trained using the contrastive loss, and the filter is trained by combining the contrastive loss and the BRP ranking loss. Iterative adversarial training is performed on the filter and the discriminator;

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

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

[0038]

[0039] where is the loss for training the filter, represents the BPR ranking loss, represents the contrastive loss, and η 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. A computer program is stored on the memory, and when the computer program is executed by the processor, the fair recommendation method based on contrastive learning is implemented.

[0041] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention combines item-side information and collaborative information to predict unknown sensitive attributes, alleviates the dependence on the number of labels, and further improves the prediction effect. On the basis of complementing sensitive attributes, contrastive learning is used to learn the sensitive attribute representation of users, learn the attribute embeddings of users, and more accurately model sensitive attributes. At the same time, the present invention is combined with the existing fairness recommendation framework, and the sensitive attribute encoder based on contrastive learning is integrated into the existing framework to form a complete fairness model, realizing fairness recommendation in the case of label loss, and improving both the recommendation effect and the fairness effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention, and do not constitute an improper limitation of the present invention. In the drawings:

[0043] Figure 1Flowchart of an embodiment of a fairness recommendation method based on contrastive learning provided by the present invention;

[0044] Figure 2 is Figure 1 Principle block diagram of an embodiment of the fairness recommendation method based on contrastive learning in the illustrated embodiment. Specific implementation manner

[0045] The preferred embodiments of the present invention will be specifically described below with reference to the accompanying drawings. The accompanying drawings form a part of this application and are used together with the embodiments of the present invention to explain the principles of the present invention, and are not used to limit the scope of the present invention.

[0046] Embodiment 1

[0047] Please refer to Figure 1 , a fairness recommendation method based on contrastive learning in this embodiment specifically includes the following steps:

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

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

[0050] Step S3: Fuse the first sensitive attribute prediction value and the second sensitive attribute prediction value to obtain the final prediction value of the user's sensitive attributes;

[0051] Step S4: Establish a contrastive learning sensitive attribute encoder, train the encoder using contrastive loss, and perform fairness recommendation based on the trained encoder.

[0052] To alleviate the problem of degraded prediction performance caused by using single-source information, i.e., collaborative information, this embodiment proposes to combine item-side information, such as item category and title, to assist in sensitive attribute prediction. This is because item-side information contains semantic clues related to users' sensitive attributes. For example, if a user mainly watches science fiction or horror movies, it is reasonable to infer that the user may be male. Therefore, it is necessary to use item-side information to assist in predicting sensitive attributes because it can provide more comprehensive knowledge to help the model predict sensitive attributes when the labels are limited. Different from the prior art where item-side information is incorporated to enhance the main task, i.e., the recommendation task, the purpose of introducing item-side information in this embodiment is not to strengthen the main task, but to mine attribute-related information from item-side information to improve the ability of the prediction model, thereby better meeting the fairness requirements. Given that contrastive learning performs well in tasks such as feature extraction and clustering, the contrastive loss can naturally be applied to the training of the discriminator, which has the following advantages: on the one hand, as an unsupervised loss function, the contrastive loss is not affected by the number of labels. On the other hand, the contrastive loss can adaptively adjust the influence of 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 operations on the user-item bipartite graph to obtain user embedding vectors and item embedding vectors;

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

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

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

[0058]

[0059] where represents the embedding vector of user u after the k-th convolution, represents the embedding vector of item v after the k-th convolution, represents the set of items interacted with by user u, represents the set of users who have interacted with item v, and k takes values in the range of 0 to K, where K is the total number of convolutions;

[0060] Set a classifier to predict sensitive information from the embedding vectors and the known labels are used to train the classifier:

[0061]

[0062] Among them, represents a classifier, represents the prediction result;

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

[0064] where U T represents the set of users with unknown sensitive attributes.

[0065] The specific steps of step S2 include:

[0066] Step S21: Use the word embedding model to convert the item-side information into an embedding vector;

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

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

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

[0070] In this embodiment, the specific steps of step S2 are as follows:

[0071] Use the word embedding model to convert the item-side information into an embedding vector:

[0072]

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

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

[0075]

[0076] Among them, c v is the item description vector of item v;

[0077] Aggregate the item description vectors of all items interacted by user u to obtain a user description vector:

[0078]

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

[0080] Predict the unknown sensitive attributes of the user according to the user's description vector:

[0081]

[0082] Among them, represents the predicted value of the second sensitive attribute of user u, and σ() is the sigmoid activation function. represents the transposed vector of the user description vector c u . ω is the attribute embedding, which is used to specifically learn a certain 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 is denoted as:

[0084]

[0085] Among them, represents the predicted value of the second sensitive attribute of the user with unknown sensitive attributes, and U T represents the set of users with unknown sensitive attributes.

[0086] In this embodiment, the specific content of step S3 is as follows:

[0087] Fuse the predicted value of the first sensitive attribute and the predicted value of the second sensitive attribute to obtain the final predicted value of the user's sensitive attribute:

[0088]

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

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

[0091] Build a contrastive learning-based sensitive attribute encoder, which is used to learn the sensitive attribute embedding of users:

[0092]

[0093] Among them, is the sensitive attribute embedding of user u, is the initial feature representation of user u, and the initial feature representation is replaced by the pre-trained user embedding. SenEncode() is the encoder to be trained;

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

[0095]

[0096] Among them, is the contrastive loss, M is the number of all users, exp() represents the exp function, θ() represents the calculation of the vector inner product, is the sensitive attribute embedding of user u, is the embedding of the positive sample of the anchor user u, obtained by data augmentation, is the embedding of the negative sample of the anchor user u, and τ is a hyperparameter.

[0097] The negative sample of the anchor user is obtained by using the negative sampling algorithm:

[0098]

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

[0100] In step S4, fair recommendation is performed based on the trained encoder, specifically:

[0101] Integrate the sensitive attribute encoder into the adversarial learning framework or the mutual information framework to construct a fairness recommendation model, and use the fairness recommendation model for fair recommendation.

[0102] Integrate the sensitive attribute encoder into the adversarial learning framework to construct a fairness recommendation model, specifically:

[0103] Set a filter to remove sensitive information. The input of the filter is the pre-trained user and item embeddings, and the output is the filtered user and item embeddings. The filter is specifically:

[0104]

[0105] Among them, is the filter, e u represents the pre-trained user, e v represents the pre-trained item embedding, f u represents the filtered user, f v represents the filtered item embedding;

[0106] Take the sensitive attribute encoder as a discriminator, use the filter to filter the user, and input the filtered user embedding into the sensitive attribute encoder:

[0107]

[0108] Use the contrastive loss Train the discriminator, use the loss Train the filter:

[0109] Iteratively adversarially train the filter and the discriminator;

[0110] Use the user representation and item representation after removing sensitive information to predict the predicted score of the user for the item

[0111]

[0112] Among them, is the predicted score of user u for item v, f u is the user representation after removing sensitive information, f v is the item representation after removing sensitive information;

[0113] Generate a recommendation list based on the predicted score.

[0114] The loss for training the filter is:

[0115]

[0116] Among them, is the loss for training the filter, represents the BPR ranking loss, which is used to ensure the recommendation effect, represents the contrastive loss, and η 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 construct a fairness recommendation model, specifically as Figure 2 shown, Figure 2The detailed principle framework diagram of this embodiment is given. When integrated into the mutual information framework, the encoder first performs pre-training and generates pre-trained sensitive attribute embeddings. Then, this sensitive attribute embedding participates in the calculation of the upper bound of mutual information together with the user embedding. Finally, the recommendation model is jointly trained using the recommendation loss and the upper bound of mutual information constraint, improving fairness while ensuring the recommendation effect.

[0118] To verify the effect of this embodiment, a comparative experiment was also conducted in this embodiment. This experiment uses a graph convolutional network as the basic recommendation model, in which the proportion of users with known sensitive attributes is 10%. The encoder provided in this embodiment is combined with the adversarial framework and the mutual information framework respectively to form a complete fair recommendation framework, and experiments were carried out on three datasets. The three datasets are shown in Table 1, and the experimental results are shown in Table 2.

[0119] Table 1. Datasets 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 hereinafter, the dataset Movielens-100K is abbreviated as ML100K, and the dataset BookCrossing is abbreviated as BookCro.

[0127] In Table 2, NDCG stands for Normalized Discounted Cumulative Gain, which is an indicator for measuring ranking quality. By considering the positions and degrees of relevance of relevant items in the ranking results, it comprehensively evaluates the ranking effect of a recommendation system or an information retrieval system. The higher its value, the better the ranking quality. RECALL stands for recall rate, which is an important indicator in information retrieval and recommendation systems. It represents the proportion of all relevant items that the system successfully recalls, that is, recommends, and is used to measure the ability of the system to find all relevant items. DP stands for demographic parity, which means that for different protected groups, such as those divided based on the third sensitive attribute, the first sensitive attribute, etc., the probabilities of being classified into positive categories, such as obtaining a loan, being hired, etc., are the same, and it is used to measure whether the distribution of decision results among different groups is fair and to avoid systematic biases caused by group attributes. EO stands for equal opportunity, which measures that for different groups, such as those divided according to the first sensitive attribute, the third sensitive attribute, etc., the probabilities of obtaining a positive decision when they are truly qualified are the same, and it focuses on the opportunity fairness of each group under certain qualification conditions.

[0128] The following points can be observed from the results in Table 2: First, traditional fair recommendation models such as the fair recommendation model from the graph perspective and the mutual information fairness recommendation model perform poorly in terms of fairness because these models cannot actively process missing sensitive attribute information. It is worth noting that the recommendation accuracy of the recommendation framework based on mutual information even exceeds that of the basic model. Second, compared with traditional fairness models, fair graph representation learning and fair adversarial networks have significantly improved in terms of fairness, which benefits from the prediction of unknown sensitive attributes. We also found that the fair adversarial network is slightly better than fair graph representation learning in terms of both recommendation accuracy and fairness because the fair adversarial network uses a provable loss function to optimize the filter and avoids the noise introduced by threshold operations. Third, the present invention + adversarial framework outperforms the baseline model in both recommendation accuracy and fairness. There are mainly two reasons for this: the present invention improves the prediction performance by using item-side information to predict unknown sensitive attributes; at the same time, the present invention avoids the noise introduced by threshold operations through contrastive learning. Finally, the present invention + mutual information framework significantly improves fairness, verifying the effectiveness of the present invention. Compared with traditional mutual information models, its recommendation accuracy is weaker because the present invention accurately models sensitive attributes and strengthens fairness constraints, resulting in a decrease in recommendation accuracy. In summary, the present invention is an effective plug-and-play module with excellent performance.

[0129] We also conducted ablation experiments on the ML1 M dataset. The ablation experiments used the following comparison algorithms: 1. Based on the complete method, the item side information extraction module was removed, which is recorded as module C in the table; 2. Based on the complete method, the collaborative information extraction module was removed, which is recorded as module D in the table; 3. Based on the complete method, the negative sampling module was removed, which is recorded as module E in the table; 4. Based on the complete method, the contrastive learning module was removed, which is recorded as module F in the table, and the threshold operation was directly used to obtain the predicted label. 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 above table, the following observations can be made: First, the lack of collaborative information or item-side information affects the performance of the model, indicating that both types of information are helpful in learning sensitive attributes. Second, removing the negative sampling module significantly reduces the fairness of the model, indicating that contrastive learning relies on widening the distance between the embeddings of users of different categories to achieve clustering. The negative sampling algorithm achieves this goal by sampling users from different categories. Finally, replacing contrastive learning with threshold operations reduces recommendation accuracy and fairness. This decline is attributed to the noise introduced by the threshold operation, such that users who are misclassified are adversely affected by fairness optimization. The results under the mutual information framework are similar to those under the adversarial learning framework, so they are not repeated here.

[0134] Since we want to explore the performance of the model under the condition of extremely scarce sensitive attribute information, we set the ratio of known labels in the range of [0.01, 0.05, 0.1, 0.2, 0.4] for the experiment. The experimental results are shown in Table 4.

[0135] Table 4. Experimental results under the condition of extremely scarce sensitive attribute information

[0136]

[0137] From the experimental results, we can observe the following points: First, the model that takes into account limited sensitive information performs significantly better than the traditional model in terms of fairness. Second, when the amount of known sensitive information is extremely small, the advantages of the present invention are more significant. This is because when the amount of known sensitive information is very small, the effect of relying solely on collaborative information to predict unknown sensitive attributes will deteriorate. In contrast, the present invention combines item-side information to predict sensitive attributes, and can maintain effective prediction capabilities even when the number of known sensitive attributes is extremely small.

[0138] Embodiment 2

[0139] This embodiment provides a fair recommendation device based on contrastive learning, including a memory and a processor. A computer program is stored on the memory, and when the computer program is executed by the processor, it 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 technical effects possessed by the fair recommendation method based on contrastive learning are also possessed by the fair recommendation device based on contrastive learning, and will not be elaborated here.

[0141] As mentioned above, the above are only the preferred specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the present invention.

Claims

1. A fair recommendation method based on contrastive learning, characterized in that: The following steps are involved: Step S1: predicting the unknown sensitive attribute of the user by using the collaborative information to obtain a first sensitive attribute prediction value; Step S2: predicting the unknown sensitive attribute of the user using the 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 prediction value of the user's sensitive attribute; Step S4: Establish a sensitive attribute encoder for contrastive learning, train the encoder using contrastive loss, and perform fair recommendation based on the trained encoder.

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

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

4. The fair recommendation method based on contrastive learning according to claim 1, characterized in that: The step S3 is specifically as follows: The first sensitive attribute prediction value and the second sensitive attribute prediction value are merged to obtain the final prediction value of the user's sensitive attribute: Among them, s u is the final predicted value of the user's sensitive attribute, is the predicted value of the first sensitive attribute predicted using collaborative information, represents the predicted value of the second sensitive attribute predicted by item-side information, and α is a hyperparameter used to balance and The weight between .

5. The fair recommendation method based on contrastive learning according to claim 1, characterized in that: In step S4, a sensitive attribute encoder for contrastive learning is established, and contrastive loss is used to train the encoder, specifically: A sensitive attribute encoder based on contrastive learning is established. The encoder is used to learn the sensitive attribute embedding of the user. The encoder is trained using contrastive loss. The contrastive loss is: Among them, L CL is the contrast loss, M is the number of all users, exp() represents the exp function, and θ() represents the calculation of the vector inner product. is the sensitive attribute embedding of user u, is the embedding of the positive sample of anchor user u, obtained by data enhancement, is the embedding of the negative sample of anchor user u, and τ is a hyperparameter.

6. The fair recommendation method based on contrastive learning according to claim 5, characterized in that: The negative samples of the anchor point users are obtained using a negative sampling algorithm: Among them, u neg is the negative sample of anchor user u, argmax() represents the maximum operation, s ui For user u i sensitive attributes, batch represents a batch of users sampled during training, s u is the final predicted value of the user's sensitive attribute, and E(S) represents the average value of the sensitive attributes of all users.

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

8. The fair recommendation method based on contrastive learning according to claim 7, characterized in that: The sensitive attribute encoder is integrated into the adversarial learning framework to construct a fairness recommendation model, specifically: A filter is set to remove sensitive information, wherein the input of the filter is the pre-trained user and item embeddings, and the output is the filtered user and item embeddings; Using the encoder as a discriminator, using the filter to filter the user, and inputting the embedded vector of the filtered user into the discriminator; Use contrast loss to train the discriminator, combine contrast loss and BRP ranking loss to train the filter, and perform iterative adversarial training on the filter and the discriminator; The user representation and the item representation after sensitive information is removed are used to predict the user's predicted rating for the item, and a recommendation list is generated based on the predicted rating.

9. The fair recommendation method based on contrastive learning according to claim 8, characterized in that: The loss for training the filter is: L F =L bpr -ηL CL Among them, L F is the loss of training the filter, L bpr represents the BPR ranking loss, L CL represents the contrast loss, and η is a hyperparameter used to balance the weights of the two losses.

10. A fair recommendation device based on contrastive learning, characterized in that: The invention comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the fair recommendation method based on contrastive learning as claimed in any one of claims 1 to 9 is implemented.

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

  • Software vulnerability assessment method and system based on comparative learning and medium

    CN116204889A

  • Cross-domain cold start article recommendation method based on triple contrast learning

    CN119415770A

  • Method, computer readable medium, recommendation system, electronic device for debiasing data

    US20250013855A1