Knowledge graph recommendation method based on generative denoising and multistage contrast learning
Through the methods of generative denoising and multi-level contrastive learning, the problems of insufficient entity representation accuracy and noise interference in knowledge graph recommendation are solved, the accuracy and personalized service capabilities of the recommendation system are improved, and fine-grained user preference modeling and noise robustness are achieved.
Patent Information
- Application Number
- CN202510948473.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-10
- Publication Date
- 2025-10-24
AI Technical Summary
Existing knowledge graph recommendation methods have problems such as insufficient entity representation accuracy, difficulty in eliminating noise interference, and insufficient granularity in user interest modeling, which limits the recommendation effect.
A generative denoising and multi-level contrastive learning method is adopted. Entities and relations are mapped to subspaces through multi-view gating units. Relation-aware attention scores and LightGCN are combined for information aggregation. Gumbel noise is used to remove noise. A graph contrastive learning framework is constructed for self-supervised learning. User and item embeddings are optimized. A multi-task joint optimization loss function is used to improve recommendation performance.
It effectively improves the accuracy and personalized service capabilities of the recommendation system, enhances the model's ability to mine effective knowledge signals, eliminates noise interference, realizes fine-grained user preference modeling, and improves the robustness and personalized modeling capabilities of the recommendation system.
Smart Images

Figure CN120832952A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of recommendation system and knowledge graph combination, and particularly relates to a knowledge graph recommendation method based on generative denoising and multi-level contrastive learning. BACKGROUND
[0002] With the explosive growth of Internet information, users have difficulty in quickly discovering interested information in the face of massive content. Therefore, the recommendation system has become an important tool for information filtering. However, the traditional recommendation methods (such as collaborative filtering and matrix decomposition) have obvious performance decline in the data sparse or cold start scene, which seriously restricts the improvement of the recommendation effect. In order to alleviate the above problems, the knowledge graph is widely used to enhance the recommendation system due to its rich structured semantics. In the knowledge graph recommendation, the user, the item and the attribute thereof are represented in the form of triplets, and the graph structure is constructed, which is helpful to capture high-order semantics and context association and improve the recommendation accuracy. However, in actual application, the knowledge graph usually has problems such as insufficient entity representation accuracy, difficult-to-eliminate noise interference and insufficient fine-grained user interest modeling.
[0003] In view of the above challenges, self-supervised learning (especially contrastive learning and generative modeling) has gradually emerged in the application of recommendation system. On the one hand, contrastive learning is helpful to model diverse preferences and representation robustness; on the other hand, generative modeling (such as mask reconstruction) can effectively eliminate low-confidence noise. How to integrate the advantages of the two to improve the accuracy and semantic expression ability of the recommendation is an important direction of current research. SUMMARY
[0004] In order to solve the problems of insufficient entity representation accuracy, difficult-to-eliminate noise interference and insufficient fine-grained user interest modeling in the existing knowledge graph recommendation method, the application provides a knowledge graph recommendation method based on generative denoising and multi-level contrastive learning, which effectively improves the accuracy, robustness and personalized service ability of the recommendation system.
[0005] The technical scheme adopted by the knowledge graph recommendation method based on generative denoising and multi-level contrastive learning of the application is as follows:
[0006] The knowledge graph recommendation method based on generative denoising and multi-level contrastive learning comprises the following steps:
[0007] S1, a public data set is selected, user and item interaction behaviors are extracted to construct an interaction collaborative graph, and an external knowledge base is introduced to supplement item semantic information combined with user interaction information to generate an item-end knowledge graph;
[0008] S2, respectively from the synergy diagram and the knowledge graph, utilize the multi-view gate unit to map entities and relations in the knowledge graph to a subspace, obtain decoupled entity and relation embedding; map users and items in the user-item interaction synergy diagram to another subspace, obtain decoupled user embedding and item embedding;
[0009] S3, the graph aggregation module utilizes the relation-aware attention score to perform information aggregation on each subspace in the knowledge graph to capture the importance of different types of relations, and simultaneously adopts LightGCN to perform information aggregation on each subspace in the synergy diagram to enhance learning of user and item embedding representation;
[0010] S4, based on the original knowledge graph, calculate the local attention score of the triple and add noise, select high-confidence triples for mask processing, update entity embedding by using the remaining low-confidence triples, and calculate reconstruction loss by the masked triples to optimize the model, enhance key knowledge capture and noise robustness;
[0011] S5, extract user multi-preference representation from each subspace, construct a contrastive learning task, and combine an attention mechanism to generate a final user representation;
[0012] S6, map the item embedding under the knowledge graph and collaborative filtering view to a unified space;
[0013] S7, fuse the knowledge graph and collaborative filtering information through decoupled subspace to generate user and item comprehensive embedding, and adopt BPR loss and multi-task joint optimization to improve the personalized modeling capability and performance of the recommendation system.
[0014] The further improvement of the technical scheme of the application is that the step S2 is specifically,
[0015] The user-item collaborative interaction graph and the knowledge graph are respectively modeled as two heterogeneous graph structures, and the entity, relation, user and item embedding are initialized, and the multi-view gate unit is used to map them to multiple decoupled subspaces, and the initial decoupled entity embedding e v,k , decoupled relation embedding e r,k , decoupled item embedding e i,k and decoupled user embedding e u,k ,
[0016] e v,k =e v ⊙σ(W·e v +b) (2-1)
[0017] e r,k =e r ⊙σ(W r ·e r +b r) (2-2)
[0018] e i,k = e u ⊙σ(W i · e i +b) (2-3)
[0019] e u,k = e u ⊙σ(W u · e u +b u ) (2-4)
[0020] where e v , e r , e u are the original embedding representations obtained by the IDs of entities, relations and users, respectively; W and b are the learnable parameter matrix and bias value, respectively; ⊙ represents Hadamard product, that is, multiplying the corresponding position elements of two vectors; g(·) represents the Sigmoid activation function, which is used for the gating mechanism of information flow.
[0021] The further improvement of the technical scheme of the application is that the step S3 comprises the following steps,
[0022] S3.1, first, calculate the relation-aware attention score β(h, r, t) for each triple (h, r, t), the attention score is realized by a multi-head attention mechanism, and the specific calculation method is,
[0023]
[0024] where e h , e r , e t represent the embedding vectors of the head entity, the relation and the tail entity, respectively, W Q and W K are learnable parameter matrices, and ⊙ represents Hadamard product, which is used to scale the dot product to stabilize the training; then, the attention score is normalized by using a softmax function to obtain the normalized attention weight α(h, r, t) of the triple under the same head entity, and the expression is,
[0025]
[0026] Then, based on the attention weight, the model performs weighted aggregation on the information of the neighbor node N h , and updates the embedding representation of the head entity h in the (l+1)th layer in the kth subspace The specific formula is as follows,
[0027]
[0028] For each user u, the model uses neighborhood aggregator to obtain its embedding representation in the (l+1)-th layer of the k-th subspace
[0029]
[0030] S3.2, further introduce LightGCN in the collaborative view to optimize the information propagation mechanism between users and items, the embedding of user u and item i in the (l+1)-th layer of the k-th subspace is updated by the following way,
[0031]
[0032] S3.3, introduce graph aggregator AGG(·) to integrate the embedding representation of different layers, in the knowledge view, the embedding of the aggregation head entity in each layer gets the final entity representation e v,k and user representation e u,k ; in the collaborative view, use the same mechanism to aggregate the user and item embedding output by LightGCN in each layer, respectively get the final x u,k and x i,k , which is in the form as follows,
[0033]
[0034]
[0035] The further improvement of the technical scheme of the present application is that the step S4 comprises the following steps,
[0036] S4.1, according to the original knowledge graph, for each triple (h, r, t), calculate its local attention score using the following formula, which reflects the importance of the triple in all edges of the same head entity,
[0037]
[0038] At the same time, in order to improve the robustness of sampling, Gumbel noise is added to the learned global confidence score as follows,
[0039]
[0040] S4.2, according to the global confidence score added with Gumbel noise, select the top n triples with the highest score for masking, then, based on the remaining low confidence triples, construct an enhanced knowledge view, and update the embedding representation of the entities in this view through formulas 3-4, then, use the masked triples as self-supervised signals to calculate the reconstruction loss which is in the form of,
[0041]
[0042] where g(·) is a sigmoid function, and represents Hadamard product.
[0043] The further improvement of the technical scheme of the application is that the step S5 comprises the following steps,
[0044] S5.1, first construct a graph contrast learning framework in the knowledge graph, and regard the embedding of the same node in the same subspace as a positive sample, and regard the embedding of the node in different subspaces as a negative sample, so as to enhance the independence and discriminability of the decoupled representation, specifically, in the knowledge graph, the model uses the following formula to optimize the entity embedding,
[0045]
[0046] where e v,k represents the aggregated embedding of the entity in the kth subspace of the mask knowledge graph, s(·) is a cosine similarity function, and τ1 is a temperature parameter for controlling the smoothness of the similarity distribution, in the collaborative view, the model further optimizes the embedding representation of the user and the item through contrast learning, and the detailed formula is as follows,
[0047]
[0048] where x i,k and x u,k respectively represent the aggregated embedding of the item and the user in the kth subspace of the collaborative view G CF , s(·) represents the cosine similarity, and τ1 is a temperature parameter.
[0049] S5.2, finally, the overall multi-preference contrast learning loss is composed of three parts, as shown in the following formula,
[0050]
[0051] The total loss function unifies the optimization of entity embedding in the knowledge view and the optimization of user and item embedding in the collaborative view, so as to realize the joint modeling of multi-angle preferences.
[0052] The further improvement of the technical scheme of the application is that the step S6 comprises the following steps,
[0053] S6.1, remove the noise edges of the knowledge graph and the collaborative graph, and discard the smallest n triplets in the knowledge graph according to the global confidence score , as shown in the following formula,
[0054] The enhanced knowledge view is obtained,
[0055]
[0056] In the collaborative view, the global credibility score in the knowledge graph is utilized The weight is assigned to the interaction edge, the noise edge is determined, and the average credibility score of each item is calculated
[0057]
[0058] The sampling strategy of the multinomial distribution is used to sample and delete edges, and the enhanced collaborative view is obtained
[0059]
[0060] S6.2, in order to align the item embedding under two views, a multilayer perceptron with a hidden layer is used to map them to the same embedding space, and the item representation in the knowledge view is The mapping process is,
[0061]
[0062] For the item representation in the collaborative view The mapping process is,
[0063]
[0064] Wherein, is a learnable parameter, and σ(·) represents an ELU activation function,
[0065] The InfoNCE loss function is introduced to realize the alignment of the item representation under different views, and the contrastive learning loss is defined as follows,
[0066]
[0067] Wherein, K represents the number of subspaces, τ2 is a temperature parameter, which is used to control the similarity scaling degree, and s(·) represents the cosine similarity.
[0068] The further improvement of the technical scheme of the application is that the step S7 comprises the following steps,
[0069] S7.1, in the attention fusion strategy, first, the fusion representation z of the user and the item is calculated based on the decoupled subspace u,k And z i,k ,
[0070]
[0071] where "||" represents the integrated embedding representation z of item i and user u in the k-th subspace by vector concatenation operation i,k and z u,k , and are the embedding vectors of items and users after knowledge graph enhancement, while x i,k and x u,k are the embedding vectors obtained based on the collaborative filtering method, and the prediction score in each subspace is further obtained by the inner product of them
[0072]
[0073] The dynamic fusion weight θ of each subspace is calculated using a multi-layer perception k ,
[0074]
[0075] The prediction scores of all subspace are weighted and summed according to the corresponding fusion weight to obtain the final total prediction score
[0076]
[0077] S7.2, the model parameters are optimized by Bayesian loss,
[0078]
[0079] where, and are the prediction scores of user u to items i and j respectively; in which represents the observed interaction, represents the unobserved interaction;
[0080] S7.3, multi-task joint contrast learning loss optimization is adopted, and the losses of recommendation task, knowledge reconstruction task and graph contrast learning task are comprehensively considered,
[0081]
[0082] where, is the Bayesian personalized ranking loss of the recommendation task; and represent the knowledge reconstruction task, the graph contrast learning task and other possible task losses respectively; λ1, λ2, λ3 are hyperparameters for balancing different task losses.
[0083] With the technical scheme, the technical progress achieved by the application includes:
[0084] The application combines the generative and contrastive self-supervised learning paradigms, effectively overcomes the problem of sparse supervision signals, and enhances the mining ability of the model to effective knowledge signals. First, in view of the high heterogeneity of the knowledge graph, a heterogeneous graph Transformer is innovatively introduced to replace the relationship perception path encoder in the traditional method. Second, in terms of noise suppression, the application uses a trusted knowledge mask and a reconstruction mechanism to effectively filter noise knowledge irrelevant to recommendations. Finally, in terms of fine-grained preference modeling, the decoupling mechanism and multi-preference contrastive learning are used to effectively capture the multi-angle preferences of users and enhance the explainability of user behavior. BRIEF DESCRIPTION OF DRAWINGS
[0085] Figure 1 is a flowchart of a knowledge graph recommendation method based on generative denoising and multi-level contrastive learning according to the application;
[0086] Figure 2 is a model framework diagram of a knowledge graph recommendation method based on generative denoising and multi-level contrastive learning according to the application. DETAILED DESCRIPTION
[0087] To make the purpose, technical scheme and advantages of the application clearer, further detailed description will be made below in combination with specific embodiments and with reference to the drawings. In the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the application.
[0088] The application provides a knowledge graph recommendation method based on generative denoising and multi-level contrastive learning, comprising the following steps:
[0089] S1, select a public data set (such as Last-FM, Movielens-1M, etc.), extract user and item interaction behaviors to construct an interaction collaborative graph, and introduce an external knowledge base to supplement item semantic information combined with user interaction information to generate an item-end knowledge graph.
[0090] S2, respectively from the collaborative graph and the knowledge graph, use a multi-view gating unit to map entities and relationships in the knowledge graph to a subspace to obtain decoupled entity and relationship embeddings; map users and items in the user-item interaction collaborative graph to another subspace to obtain decoupled user and item embeddings.
[0091] The above step S2 is specifically:
[0092] The user-item collaborative interaction graph and the knowledge graph are respectively modeled as two heterogeneous graph structures, and entity, relation, user and item embeddings are initialized respectively, the multi-view gating unit is used to map them to multiple decoupled subspaces, and initial decoupled entity embeddings e v,k , decoupled relation embeddings e r,k , decoupled item embeddings e i,k and decoupled user embeddings e u,k are constructed.
[0093] e v,k = e v ⊙σ(W·e v +b) (2-1)
[0094] e r,k = e r ⊙σ(W r ·e r +b r ) (2-2)
[0095] e i,k = e u ⊙σ(W i ·e i +b) (2-3)
[0096] e u,k = e u ⊙σ(W u ·e u +b u ) (2-4)
[0097] Wherein, e v , e r , e u are the original embedding representations obtained by the ID of entity, relation and user respectively; W and b are the learnable parameter matrix and bias value respectively; ⊙ represents Hadamard product, that is, the corresponding position elements of two vectors are multiplied; g(·) represents the Sigmoid activation function, which is used to control the gating mechanism of information flow.
[0098] S3, the graph aggregation module uses the relation-aware attention score to aggregate information in each subspace of the knowledge graph to capture the importance of different types of relations, and uses LightGCN to aggregate information in each subspace of the collaborative graph to enhance the learning of user and item embedding representations.
[0099] The above step S3 specifically includes the following steps:
[0100] S3.1, first calculate the relation-aware attention score β(h, r, t) for each triple (h, r, t), the attention score is realized through a multi-head attention mechanism, and the specific calculation method is,
[0101]
[0102] where e h , e r , e t denote the embedding vectors of head entity, relation and tail entity respectively, W Q and W K are learnable parameter matrices, and denotes the Hadamard product. to stabilize training; then, the attention scores are normalized using the softmax function to obtain the normalized attention weight a(h, r, t) of the triplets under the same head entity, which is expressed as,
[0103]
[0104] Then, based on the attention weight, the model aggregates the information of the neighbor nodes N h and updates the embedding representation of the head entity h in the (l+1)th layer in the kth subspace as follows,
[0105]
[0106] For each user u, the model uses the neighborhood aggregator to obtain its embedding representation in the (l+1)th layer in the kth subspace as follows,
[0107]
[0108] S3.2, further introduce LightGCN in the collaborative view to optimize the information propagation mechanism between users and items, the embedding of user u and item i in the (l+1)th layer in the kth subspace is updated as follows,
[0109]
[0110] S3.3, introduce the graph aggregator AGG(·) to integrate the embedding representations of different layers. In the knowledge view, the embedding of the head entity in each layer is aggregated to obtain the final entity representation e v,k and user representation e u,k ; in the collaborative view, the same mechanism is used to aggregate the user and item embeddings output by each layer of LightGCN to obtain the final x u,k and x i,k , which is expressed as follows,
[0111]
[0112] S4, calculate the local attention score of the triple based on the original knowledge graph and add noise, select high-confidence triples for mask processing, update entity embeddings using remaining low-confidence triples, and optimize the model by calculating reconstruction loss from masked triples to enhance key knowledge capture and noise robustness.
[0113] The step S4 specifically includes the following steps:
[0114] S4.1, according to the original knowledge graph, for each triple (h, r, t), calculate its local attention score using the following formula, which reflects the importance of the triple in all edges of the same head entity,
[0115]
[0116] Meanwhile, in order to improve the robustness of sampling, Gumbel noise is added to the learned global confidence score as shown below,
[0117]
[0118] S4.2, according to the global confidence score with Gumbel noise, select the top n triples with the highest score for mask processing, then build an enhanced knowledge view based on the remaining low-confidence triples, and update the embedding representation of entities in the view using formulas 3-4, then use the masked triples as self-supervised signals to calculate the reconstruction loss which is,
[0119]
[0120] where g(·) is the Sigmoid function and represents Hadamard product.
[0121] S5, extract user multi-preference representation from each subspace, build a contrastive learning task, and combine attention mechanism to aggregate and generate the final user representation.
[0122] The step S5 specifically includes the following steps:
[0123] S5.1, first build a graph contrastive learning framework in the knowledge graph, consider the embedding of the same node in the same subspace as positive samples, and consider the embedding of the node in different subspaces as negative samples, to enhance the independence and discriminability of decoupled representations. Specifically, in the knowledge view, the model optimizes entity embeddings using the following formula for contrastive learning,
[0124]
[0125] where e v,k represents entity embedding in the masked knowledge view The aggregated embedding of the kth subspace in the collaborative view is s(·), and τ1 is a temperature parameter for controlling the smoothness of the similarity distribution. In the collaborative view, the model further optimizes the embedding representation of users and items through contrastive learning. The detailed formula is as shown below,
[0126]
[0127] where x i,k and x u,k respectively represent the aggregated embedding of the kth subspace in the collaborative view G CF of the item and the user, s(·) represents the cosine similarity, and τ1 is a temperature parameter.
[0128] S5.2, finally, the overall multi-preference contrastive learning loss is composed of three parts, as shown in the following formula,
[0129]
[0130] The total loss function unifies the optimization of entity embedding in the knowledge view and the optimization of user and item embedding in the collaborative view, thereby realizing joint modeling of multi-angle preferences.
[0131] S6, map the item embedding in the knowledge graph and collaborative filtering view to a unified space.
[0132] The above step S6 specifically includes the following steps:
[0133] S6.1, remove the noise edges of the knowledge graph and the collaborative graph, and discard the smallest n triples in the knowledge graph according to the global confidence score as shown in the following formula,
[0134]
[0135] The enhanced knowledge view is obtained as
[0136] In the collaborative view, the global confidence score in the knowledge graph is used to assign weights to the interaction edges to determine which interaction edges are noise edges, and the average confidence score of each item is calculated.
[0137]
[0138] Use a multinomial distribution sampling strategy to sample and discard edges to obtain an enhanced collaborative view
[0139]
[0140] S6.2, To align the item embeddings in two views, a multi-layer perceptron with one hidden layer is used to map them to the same embedding space, for item representation in the knowledge view The mapping process is,
[0141]
[0142] For item representation in the collaborative view The mapping process is,
[0143]
[0144] where, are learnable parameters, and σ(·) denotes the ELU activation function,
[0145] The InfoNCE loss function is introduced to align the item representations in different views. The contrastive learning loss is defined as,
[0146]
[0147] where K denotes the number of subspaces, τ2 is the temperature parameter to control the degree of similarity scaling, and s(·) denotes the cosine similarity.
[0148] S7, By decoupling the subspaces, the knowledge graph and collaborative filtering information are fused to generate comprehensive user and item embeddings. BPR loss and multi-task joint optimization are used to improve the personalized modeling ability and performance of the recommendation system.
[0149] The above step S7 specifically includes the following steps:
[0150] S7.1, In the attention fusion strategy, first, the fused representations z u,k and z i,k of users and items are calculated based on the decoupled subspaces,
[0151]
[0152] where "||" denotes the fusion of the two embedding representations of item i and user u in the kth subspace by vector concatenation to generate comprehensive embedding representations z i,k and z u,k , and are the embedding vectors of items and users obtained after knowledge graph enhancement, while x i,k and x u,k are the embedding vectors obtained based on the collaborative filtering method. The predicted scores in each subspace are further obtained by their inner products
[0153]
[0154] The dynamic fusion weight θ of each subspace is calculated using a multi-layer perception k ,
[0155]
[0156] The prediction scores of all subspace are weighted and summed according to the corresponding fusion weight to obtain the final total prediction score
[0157]
[0158] S7.2, the model parameters are optimized by adopting Bayesian loss,
[0159]
[0160] wherein, and are the prediction scores of user u to items i and j respectively; in indicates the observed interaction, indicates the unobserved interaction.
[0161] S7.3, optimization is performed by adopting multi-task joint contrast learning loss, and the losses of recommendation task, knowledge reconstruction task and graph contrast learning task are comprehensively considered,
[0162]
[0163] wherein, is the Bayesian personalized ranking loss of the recommendation task; and respectively represent the knowledge reconstruction task, the graph contrast learning task and other possible task losses; λ1, λ2, λ3 are hyperparameters for balancing different task losses.
[0164] The application is verified by experiments on three public datasets of Last-FM, Book-Crossing and Movielens-1M, and is significantly superior to the existing baseline model in terms of AUC and F1 score, which proves the effectiveness and innovation of the application as a whole. Compared with the best baseline method, the application achieves an AUC improvement of 2.29% and an F1 improvement of 2.66% on the Last-FM dataset, an improvement of 0.72% and 1.64% on the Book-Crossing dataset, and an improvement of 0.96% and 1.10% on the Movielens-1M dataset, respectively. In addition, in the Top-K recommendation task, the application is also significantly superior to mainstream baseline models such as KGIN, KGAT, KGTN and MCCLKG in terms of recall rate and other indicators.
[0165] In the above embodiments, the application provides a knowledge graph recommendation method based on generative denoising and multi-level contrast learning. The advantage of this method mainly comes from the generative knowledge denoising mechanism introduced by the application, which can effectively alleviate the problem of noise interference in the knowledge graph, accurately filter out low-quality triples through credibility evaluation and reconstruction strategy, and improve the reliability of entity and relationship representation. At the same time, the application innovatively uses a multi-perspective preference modeling method to decouple user interest into multiple subspaces, models user preference from different perspectives in a fine-grained manner, makes up for the shortcomings of existing models in multi-preference modeling, and further improves the personalized expression and prediction performance of the recommendation system.
[0166] The above-described embodiments are merely descriptions of preferred embodiments of the application and do not limit the concept and scope of the application. Various modifications and improvements to the technical solutions of the application made by those of ordinary skill in the art without departing from the design concept of the application shall fall within the protection scope of the application, and the technical content claimed by the application has been fully recorded in the claims.
Claims
1. A knowledge graph recommendation method based on generative denoising and multi-level contrast learning, characterized in that: The method comprises the following steps: S1, selecting a public data set, extracting user and item interaction behavior to construct an interaction collaborative graph, and introducing an external knowledge base to supplement item semantic information to generate an item end knowledge graph combined with user interaction information; S2, starting from the collaborative graph and the knowledge graph respectively, using a multi-view gating unit to map entities and relationships in the knowledge graph to a subspace to obtain decoupled entity and relationship embeddings; mapping users and items in the user-item interaction collaborative graph to another subspace to obtain decoupled user and item embeddings; S3, the graph aggregation module uses relationship-aware attention scores to aggregate information in each subspace of the knowledge graph to capture the importance of different types of relationships, and uses LightGCN to aggregate information in each subspace of the collaborative graph to enhance the learning of user and item embedding representations; S4, calculate the local attention score of the triple based on the original knowledge graph and add noise, select high-confidence triples for mask processing, update entity embeddings using the remaining low-confidence triples, and optimize the model by calculating the reconstruction loss of the masked triples to enhance key knowledge capture and noise robustness; S5, extract user multi-preference representations from each subspace, construct a contrastive learning task, and generate the final user representation by weighted aggregation combined with the attention mechanism; S6, map the item embeddings in the knowledge graph and collaborative filtering view to a unified space; S7, fuse the knowledge graph and collaborative filtering information through decoupled subspaces to generate user and item comprehensive embeddings, and use BPR loss and multi-task joint optimization to improve the personalized modeling capability and performance of the recommendation system.
2. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 1, characterized in that: The step S2 specifically comprises: The user-item collaborative interaction graph and the knowledge graph are respectively modeled as two heterogeneous graph structures, and entity, relation, user and item embeddings are initialized respectively, the multi-view gating unit is used to map them to multiple decoupled subspaces, and initial decoupled entity embeddings e v,k , decoupled relation embeddings e r,k , decoupled item embeddings e i,k and decoupled user embeddings e u,k are constructed. e v,k = e v ⊙σ(W·e v +b) (2-1) e r,k = e r ⊙ σ(W r · e r + b r ) (2-2) e i,k = e u σ(W i · e i + b) (2-3) e u,k = e u ⊙ σ(W u · e u + b u ) (2-4) where e v , e r , e u are the original embedding representations obtained by the entity, the relation, and the user's ID, respectively; W and b are the learnable parameter matrix and bias value, respectively; represents the Hadamard product, i.e., multiplying the corresponding position elements of two vectors; g(·) represents the Sigmoid activation function, which is used to control the gating mechanism of the information flow.
3. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 1, characterized in that: The step S3 comprises the following steps: S3.1, first, calculate the relationship-aware attention score β(h, r, t) for each triple (h, r, t), and the attention score is realized through a multi-head attention mechanism, and the specific calculation method is as follows, where e h , e r , and e t denote the embedding vectors of head entity, relation, and tail entity, respectively, W Q and W K are learnable parameter matrices, and denotes the Hadamard product. is used to scale the dot product to stabilize training; subsequently, the attention scores are normalized using a softmax function to obtain the normalized attention weight a(h, r, t) of the triple under the same head entity, which is expressed as Then, based on the attention weights, the model aggregates the information of the neighbor nodes N h , updating the embedding representation of the head entity h at the l+1-th layer in the k-th subspace The specific formula is as follows, For each user u, the model obtains its embedding representation at the l+1-th level of the k-th subspace using a neighborhood aggregator S3.2, further introduce LightGCN in the collaborative view to optimize the information propagation mechanism between users and items, and the embeddings of user u and item i in the kth subspace at the l+1th layer are updated by the following methods, S3.3, Introduce graph aggregator AGG(·) to integrate the embedding representations of different layers, in the knowledge view, the final entity representation e is obtained by aggregating the embeddings of the entity in each layer v,k and the user representation e u,k ; in the collaborative view, the user and item embeddings output by each layer of LightGCN are aggregated using the same mechanism to obtain the final x u,k and x i,k , which is shown as follows, 4. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 3, characterized in that: The step S4 comprises the following steps: S4.1, according to the original knowledge graph, for each triple (h, r, t), calculate its local attention score using the following formula, which reflects the importance of the triple in all edges of the same head entity, At the same time, in order to improve the robustness of the sampling, Gumbel noise is added to the learned global credibility score as shown below, S4.2, according to the global credibility score added with Gumbel noise, select the top n triplets with the highest scores for masking, then, based on the remaining low-confidence triplets, construct an enhanced knowledge view, and update the embedding representations of entities in this view through formulas 3-4, next, use the masked triplets as self-supervised signals to calculate the reconstruction loss In the form of Where g(·) is a Sigmoid function, and represents Hadamard product.
5. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 1, characterized in that: The step S5 comprises the following steps: S5.1, first, construct a graph contrastive learning framework in the knowledge graph, and regard the embeddings of the same node in the same subspace as positive samples, and regard the embeddings of the node in different subspaces as negative samples, so as to enhance the independence and discriminability of the decoupled representation, specifically, in the knowledge view, the model uses the following formula to optimize the contrastive learning of entity embeddings, where e v,k denotes the aggregated embedding of the entity in the k-th subspace of the mask knowledge view , s(·) is the cosine similarity function, and τ1is the temperature parameter to control the smoothness of the similarity distribution. In the collaborative view, the model further optimizes the embedding representations of users and items through contrastive learning, as shown in the following detailed formulas. where x i,k and x u,k denote the aggregated embeddings of items and users in the k-th subspace of the collaborative view G CF , s(·) denotes the cosine similarity, and τ1 is a temperature parameter. S5.2, finally, the overall multi-preference contrastive learning loss is composed of three parts, as shown in the following formula, The total loss function unifies the entity embedding optimization in the knowledge view and the user and item embedding optimization in the collaborative view, thereby realizing joint modeling of multi-angle preferences.
6. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 1, characterized in that: The step S6 includes the following steps, S6.1, remove noisy edges of the knowledge graph and the collaboration graph, in the knowledge graph according to the global trust score Discard the smallest top-n triples, as shown in the following formula, enhanced knowledge view is obtained, In the collaborative view, utilize the global trust score in the knowledge graph Assign weights to the interaction edges, determine which interaction edges are noise edges, and calculate the average trust score of each item Sampling out edges using a multinomial distribution sampling strategy to obtain an enhanced co-view S6.2, To align the item embeddings across two views, a multilayer perceptron with one hidden layer is used to map them to the same embedding space, for the item representation in the knowledge view The mapping process is that, Item representation in collaborative views The mapping process is that, wherein, are learnable parameters, σ(·) denotes an ELU activation function, An InfoNCE loss function is introduced to realize alignment of item representations in different views, and a contrastive learning loss is defined as follows, wherein K represents the number of subspaces, τ2 is a temperature parameter for controlling the similarity scaling degree, and s(·) represents a cosine similarity.
7. The knowledge graph recommendation method based on generative denoising and multi-level contrast learning according to claim 1, characterized in that: The step S7 includes the following steps, S7.1, In the attention fusion strategy, first, the fusion representation z of users and items are calculated respectively based on the decoupled subspaces u,k and z i,k , where "||” denotes that the two embedding representations of item i and user u in the k-th subspace are fused by vector concatenation operation to generate the comprehensive embedding representation z i,k and z u,k , and are the embedding vectors of items and users after knowledge graph enhancement, respectively, while x i,k and x u,k are the embedding vectors obtained based on the collaborative filtering method, and the prediction score in each subspace is further obtained by the inner product of them The dynamic fusion weight θ of each subspace is calculated using a multi-layer perception k , The prediction scores of all subspaces are weighted and summed according to the corresponding fusion weights to obtain the final total prediction score S7.2, optimizing the model parameters by using the Bayesian loss, wherein, and are the predicted scores of the user u for the items i and j, respectively; in denotes an observed interaction, denotes a non-observed interaction; S7.3, optimizing by using a multi-task joint contrastive learning loss, comprehensively considering the losses of the recommendation task, the knowledge reconstruction task and the graph contrastive learning task, where, is the Bayesian personalized ranking loss of the recommendation task; and represent the knowledge reconstruction task, the graph contrastive learning task and other possible task losses, respectively. λ1, λ2, λ3 are hyperparameters balancing different task losses.
Citation Information
Cited By
Cross-domain recommendation method, system and device based on comparative learning and storage medium
CN121051306A
Contrast learning based cross-domain recommendation method, system, device and storage medium
CN121051306B
Comparative learning recommendation method based on adaptive view optimization
CN121092786A
Knowledge graph comparison learning recommendation method based on attention mechanism
CN121365358A