A knowledge graph enhancement recommendation method and system based on a conditional diffusion model
Patent Information
- Application Number
- CN202611381715.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本发明旨在解决现有基于知识图谱的推荐方法中,由于知识图谱不完整以及生成知识图谱质量不可靠而导致推荐准确性受限的技术问题,提供一种基于条件扩散模型的知识图谱增强推荐方法及系统
[0026] 1. This invention generates knowledge graph triples through a conditional diffusion model. It can learn the distribution of item-related triples in the original knowledge graph within the triple embedding space composed of the current entity embedding and relation embedding. The generated triples can be used to supplement the missing information that may exist in the original knowledge graph. Moreover, by generating triples based on items and relations, the generation process is constrained by target conditions, which increases the likelihood that the generated triples are semantically related to the recommendation task.
Smart Images

Figure CN122925757A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of recommendation system technology, specifically relating to a knowledge graph-enhanced recommendation method and system based on a conditional diffusion model, applicable to scenarios where knowledge graphs are used to assist in item recommendation. Background Technology
[0002] Recommender systems are widely used in e-commerce, social media, and streaming platforms. Their core task is to predict target items that users may be interested in based on their historical behavior data. Collaborative filtering, as one of the most classic techniques in recommender systems, estimates user preferences by analyzing historical interaction data between users and items. However, when user-item interaction data is sparse, collaborative filtering methods often fail to accurately capture user preferences, severely limiting recommendation performance.
[0003] Knowledge graphs store entities and their semantic relationships in the form of triples (head entity, relation, tail entity), providing rich background information and associations for items, and have attracted widespread attention in recommender systems. By incorporating entity and relation information from knowledge graphs into recommendation models, the problem of data sparsity can be alleviated to some extent, and the interpretability of recommendation results can be improved.
[0004] Existing knowledge graph-based recommendation methods typically treat the observed knowledge graph as a fixed source of information, using techniques such as graph neural networks to propagate and aggregate information on the knowledge graph to enhance item representations. However, knowledge graphs in real-world scenarios are often incomplete, sparse, or contain noisy information irrelevant to the recommendation task. Previous research has attempted to enhance or edit knowledge graphs, but the generated knowledge graphs still suffer from quality deficiencies: some methods lack effective evaluation mechanisms for generated triples, potentially introducing a large number of noisy triples irrelevant to the recommendation task and reducing recommendation accuracy; other methods employ denoising techniques to process the generated knowledge graph, but these denoising methods usually only rely on simple rules or single-dimensional indicators for screening, making it difficult to comprehensively measure the multi-dimensional quality features of the generated triples. Therefore, how to effectively generate high-quality supplementary knowledge graphs in recommendation systems and reliably evaluate the confidence of the generated knowledge graph triples to improve the accuracy of recommendation systems is a pressing technical problem in this field. Summary of the Invention
[0005] This invention aims to address the technical problem that existing knowledge graph-based recommendation methods suffer from limited recommendation accuracy due to incomplete knowledge graphs and unreliable quality of generated knowledge graphs. It provides a knowledge graph-enhanced recommendation method and system based on a conditional diffusion model.
[0006] According to a first aspect of the present invention, a knowledge graph-enhanced recommendation method based on a conditional diffusion model is provided, comprising the following steps:
[0007] S1: Obtain historical interaction data between users and items, as well as raw knowledge graph data; wherein, the raw knowledge graph represents the semantic relationship between items and entities in the form of triples (head entity, relation, tail entity);
[0008] S2: Construct initial embedding representations for user embedding, entity embedding, and relation embedding; the embedding of each item node contains three consecutive channels, corresponding to the collaborative filtering channel, the original knowledge graph channel, and the generated knowledge graph channel, respectively. The embedding of each channel is obtained through random initialization.
[0009] S3: Perform graph convolution operation based on the original knowledge graph, embedding entities along the edges of the original knowledge graph for information propagation and aggregation, to obtain the item embedding perceived by the original knowledge graph; in information propagation, the sum of tail entity embedding and relation embedding is used as the message to be transmitted, and the item embedding is obtained through multi-layer graph convolution, residual accumulation and normalization.
[0010] S4: Based on the conditional diffusion model, using item embeddings and relation embeddings as conditions, a knowledge graph triplet is generated through diffusion training and diffusion generation processes. This triplet is then expanded using non-item entity triplets from the original knowledge graph to obtain the generated knowledge graph. Specifically, firstly, triplets associated with items are extracted from the original knowledge graph as training data to construct triplet embedding vectors. Gaussian forward diffusion is performed on the triplet embeddings to obtain noisy triplet embeddings. A conditional vector is constructed by summing the head entity embedding and relation embedding. The noisy triplet embedding, time-step embedding, and conditional vector are input into a conditional denoising network to predict noise. The conditional diffusion model is trained using a positive-negative sample contrast loss. In the generation stage, starting from random Gaussian noise, backdiffusion generation is performed using item embeddings and relation embeddings as conditions. Nearest neighbor search is performed on the generated tail entity embedding segments to obtain candidate tail entities. These are then combined with the items and relations as conditions to obtain generated triplets. These generated triplets are then expanded based on non-item entity triplets from the original knowledge graph to obtain the generated knowledge graph.
[0011] S5: A confidence score is calculated for each triple in the generated knowledge graph to obtain a confidence score for each triple. The confidence score includes an attention score calculated based on a multi-head triple attention mechanism and a authenticity score calculated based on the TransE translation hypothesis. Then, the attention score and the authenticity score are fused into a confidence score using adaptive fusion gating.
[0012] S6: Based on the generated knowledge graph and its corresponding confidence score, perform a confidence graph convolution operation, use the confidence score as the message passing weight, and obtain the item embedding perceived by the generated knowledge graph through weighted neighbor aggregation;
[0013] S7: The item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph are concatenated to form the concatenated item embeddings; based on the user-item interaction graph, the concatenated item embeddings are aggregated through collaborative filtering; the user embeddings and item embeddings are updated through the interaction relationship between users and items; and high-order collaborative relationships are captured through multi-layer stacking to obtain the final user embeddings and the final item embeddings.
[0014] S8: Based on the end-user embedding and the end-item embedding, calculate the recommendation score through the inner product, sort the candidate items according to the recommendation score, and select a predetermined number of items as the recommendation result output.
[0015] According to a second aspect of the present invention, a knowledge graph-enhanced recommendation system based on a conditional diffusion model is provided, comprising:
[0016] The data acquisition module is used to acquire historical interaction data between users and items, as well as raw knowledge graph data;
[0017] The embedding initialization module is used to construct the initial embedding representations for user embeddings, entity embeddings, and relation embeddings;
[0018] The original knowledge graph convolution module is used to perform graph convolution operations based on the original knowledge graph to obtain the item embedding perceived by the original knowledge graph.
[0019] The conditional diffusion generation module is used to generate knowledge graph triples based on the conditional diffusion model, using item embedding and relation embedding as conditions;
[0020] The confidence scoring module is used to score the confidence of each triple in the generated knowledge graph, including a multi-head triple attention submodule, an authenticity scoring submodule, and an adaptive fusion gating submodule.
[0021] A knowledge graph convolution module is used to perform a confidence graph convolution operation based on the generated knowledge graph and its corresponding confidence score to obtain the item embedding perceived by the generated knowledge graph.
[0022] The embedding and splicing module is used to splice the item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph.
[0023] The collaborative filtering aggregation module is used to perform collaborative filtering aggregation on the stitched embeddings based on the user-item interaction graph to obtain the final user embedding and the final item embedding.
[0024] The recommendation output module is used to calculate the recommendation score based on the end-user embedding and the final item embedding, and output the item recommendation result.
[0025] The beneficial effects of this invention are as follows:
[0026] 1. This invention generates knowledge graph triples through a conditional diffusion model. It can learn the distribution of item-related triples in the original knowledge graph within the triple embedding space composed of the current entity embedding and relation embedding. The generated triples can be used to supplement the missing information that may exist in the original knowledge graph. Moreover, by generating triples based on items and relations, the generation process is constrained by target conditions, which increases the likelihood that the generated triples are semantically related to the recommendation task.
[0027] 2. This invention performs confidence scoring on the triples generated in the knowledge graph, combining relevance assessment based on a multi-head attention mechanism and structural rationality assessment based on the TransE translation hypothesis, namely attention score and authenticity score. By adaptively fusing gating and dynamically balancing the two weights, it achieves a refined evaluation of the quality of generated triples, which can suppress the contribution of low-quality generated triples in message propagation and retain the enhancement information that is beneficial to the recommendation task.
[0028] 3. This invention adopts a three-channel architecture, which concatenates the item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph before performing collaborative filtering aggregation. This allows the recommendation model to utilize user behavior information and diverse knowledge graph information simultaneously. Furthermore, each channel is modeled separately and jointly fused and optimized, effectively improving the richness of item representation and recommendation accuracy. Attached Figure Description
[0029] Figure 1 This is the main flowchart of the method of the present invention;
[0030] Figure 2 This is a diagram illustrating the overall architecture of the model in an embodiment of the present invention.
[0031] Figure 3 This is a flowchart illustrating the training and generation process of the conditional triple diffusion model in this embodiment of the invention.
[0032] Figure 4 This is a flowchart illustrating the process of generating confidence scores for knowledge graph triples in an embodiment of the present invention. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this invention clearer and easier to understand, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the invention.
[0034] According to a first aspect of the present invention, this embodiment provides a knowledge graph-enhanced recommendation method based on a conditional diffusion model. For example... Figure 1 As shown, the method provided in this embodiment includes the following steps S1 to S8. It should be noted that the sequence numbers of S1 to S8 in this method are not limited to a strict order of execution. Without violating the logic of this method, some steps can be adjusted in execution order or executed in parallel.
[0035] Step S1: Data Acquisition
[0036] Obtain a historical interaction dataset between users and items, containing users, items, and observed interaction data. Let the user set be... The collection of items is The set of user-item interactions in the training data is denoted as . Simultaneously, the original knowledge graph is obtained, represented in the form of triples (head entity, relation, tail entity), denoted as... ,in For entities, Let the entity set be a relation type in a knowledge graph. The set of relation types is An entity set contains a set of items, that is... The goal of the recommendation task is to provide recommendations to each user. Learn a scoring function This results in positive sample items ranking higher than non-interactive items in the test set.
[0037] Step S2: Embedded Initialization
[0038] Initialize embedding vectors for each user, entity, and relation, all using Xavier uniform initialization. Let the embedding dimensions of entities and relations be 1. The unified embedding vector for each item node consists of three consecutive channels: a collaborative filtering channel, a raw knowledge graph channel, and a generated knowledge graph channel, with dimensions... That is, the dimension of each channel is The user embedding dimension is also set to The uniform embedding vector for each item node can be initialized as follows:
[0039]
[0040] Step S3: Convolution of the original knowledge graph
[0041] Graph convolution is performed based on the original knowledge graph. For each edge in the original knowledge graph... The message is passed from the tail entity to the head entity. The edges of the original knowledge graph are weighted with 1 for message passing, without using additional confidence scores for weighting. The embedding update process of the head entity h in the l-th layer graph convolution is as follows:
[0042]
[0043] Among them, the messages of the original knowledge graph Defined as:
[0044]
[0045] After stacking L layers of graph convolution and accumulating residuals, the object embeddings perceived by the original knowledge graph are obtained.
[0046] Step S4: Generate a knowledge graph using the conditional diffusion model.
[0047] like Figure 3 As shown, this step is divided into two sub-processes: the training phase and the generation phase. The training phase includes sub-steps S4.1 to S4.5, and the generation phase includes sub-step S4.6.
[0048] S4.1: Triple Embedding Construction. Triples associated with items are extracted from the original knowledge graph as training data. For each triple... The head entity embedding, relation embedding, and tail entity embedding are concatenated to form a triplet embedding:
[0049]
[0050] S4.2: Gaussian forward diffusion. Following the Gaussian diffusion process, Gaussian noise is progressively added to the original triplet. A given diffusion time step... The forward diffusion distribution is as follows:
[0051]
[0052] The sampling form of forward diffusion can be expressed as:
[0053]
[0054] in It is the cumulative product of the cumulative coefficients of the forward process. It is standard Gaussian noise. The accumulation factor is defined as:
[0055]
[0056] in These are noise scheduling parameters that control the amount of noise added at each step.
[0057] S4.3: Conditional Vector Construction. The sum of the head entity embedding and the relation embedding is used as input, and a linear transformation is performed to obtain the conditional vector. Conditional encoding compresses the head entity and relation information into a compact conditional representation, which guides the denoising network in conditional reconstruction.
[0058]
[0059] in For learnable weight matrix, This is the bias vector. Furthermore, a time-step embedding is constructed using sine and cosine position encoding to provide the denoiser with information about the current diffusion step:
[0060]
[0061] S4.4: Conditional Denoising Noise Prediction. The noisy triple embedding, time-step embedding, and conditional vector are concatenated and input into the conditional denoising network. The conditional denoising network consists of stacked conditional triple denoising blocks. Each block includes layer normalization, a multilayer perceptron based on the SiLU activation function, pointwise transformation, Dropout, and residual connections, and is adjusted by scaling parameters jointly generated by the time-step embedding and the conditional vector. The denoising network outputs predicted noise:
[0062]
[0063] Based on the predicted noise, the original triplet embedding can be reconstructed:
[0064]
[0065] S4.5: Contrastive Loss Training. The training loss for the diffusion model uses a positive-negative sample contrast approach. The following L1 reconstruction distance is used as the measure of positive samples:
[0066]
[0067] Negative samples are constructed by randomly replacing the tail entity of the triple with other non-item entities, and the following L1 reconstruction distance is used as the negative sample metric:
[0068]
[0069] The training loss function for the conditional diffusion model is:
[0070]
[0071] in For the interval hyperparameter, This is the sigmoid function. This loss function encourages the model to produce lower reconstruction errors for positive samples, while producing dissimilar reconstruction results for negative sample triples, enabling the model to distinguish between true and false triples.
[0072] S4.6: Backdiffusion generates candidate triples. Starting from standard Gaussian noise, a stepwise backdiffusion process is performed, conditioned on the target item embedding and relation embedding. At each step, the backdiffusion mean is calculated based on the current noise scheduling coefficient and the predicted noise. :
[0073]
[0074] The complete update form of the backdiffusion step is:
[0075]
[0076] The variance of the back-diffusion noise term is: The variance is the posterior variance at step t.
[0077] Except for the last step, after each back-diffusion step, the conditional constraint update is repeatedly performed on the generated embedding a predetermined number of times; this update simultaneously constrains the head entity and relation fragments, and adjusts the tail entity fragment in conjunction with the mean of the constraint gradients of the two:
[0078]
[0079]
[0080]
[0081] in The constraint step size is defined in the formula. In the formula, the index within the superscript parentheses represents the constraint iteration number; the first and second halves of the constraint gradient correspond to the head entity fragment and the relation fragment, respectively. In this embodiment, the constraint update is repeated 10 times. After completing all back-diffusion steps, the reconstructed triplet embedding is obtained. Tail entity embedding fragments are extracted from these, and candidate tail entities are selected from the non-item entity set using nearest neighbor search.
[0082]
[0083] For each item-relation pair, multiple candidate tail entities are retained and filtered using a global distance percentile threshold to control the quantity and quality of generated triples. The filtered candidate triples are further locally expanded using edges in the original knowledge graph where both the first and last edges are non-item entities, forming the final set of generated knowledge graph triples.
[0084] Step S5: Generate confidence scores for knowledge graph triples
[0085] like Figure 4 As shown, this step assigns a confidence score to each triple in the generated knowledge graph. Through a multi-dimensional confidence evaluation mechanism, it comprehensively considers the attention score and authenticity score of the generated triple. Specifically, it includes the following sub-steps:
[0086] S5.1: Relation-Aware Projection. The same entity should have different semantic representations under different relations. Relation-aware projection is performed on the head entity embedding and the tail entity embedding respectively:
[0087]
[0088]
[0089] Here, ⊙ represents element-wise multiplication. and Learnable projection vectors specific to the relation. and This is the corresponding bias vector.
[0090] S5.2: Multi-head Triple Attention. Using relation embeddings as queries, the projected head and tail entity embeddings are treated as key-value pair sequences containing two elements. Attention features of the interactions within the triples are calculated using a multi-head attention mechanism. Let the number of attention heads be... The dimensions of each head are:
[0091]
[0092] The formula for calculating scaled dot product attention is:
[0093]
[0094] The calculation for each attention head is as follows:
[0095]
[0096] Multi-head attention combines the outputs of each head and then performs a linear transformation to obtain the final output.
[0097]
[0098] The output of multi-head attention and relation embedding are subjected to residual connection and layer normalization to obtain attention feature embedding, denoted as . :
[0099]
[0100] S5.3: Attention Score Calculation. The projected head entity embedding, relation embedding, tail entity embedding, and attention feature embedding are concatenated and input into a multilayer perceptron. The attention score is obtained after passing through a sigmoid activation function.
[0101]
[0102] in, To score attention, It is a multilayer perceptron. The attention score reflects the semantic relevance of the triple in the recommendation task and is automatically learned by the model during the training process.
[0103] S5.4: Calculation of Authenticity Score. Based on the classic TransE translation assumption in the field of knowledge graph embedding, that is, for any correct triple, the embedding vector of the head entity plus the embedding vector of the relation should be approximately equal to the embedding vector of the tail entity. The L2 distance between the projected head entity embedding plus the relation embedding and the tail entity embedding is calculated and converted into an authenticity score using an exponential function.
[0104]
[0105] in, The learnable scale parameter is initialized to 1 and its scale is constrained by a regularization term. The smaller the distance, the more the triple conforms to the TransE translation assumption, and the higher the authenticity score.
[0106] S5.5: Adaptive Fusion Gating. Attention scores, authenticity scores, and relational embeddings are concatenated and input into an adaptive fusion gating network. The gating network transforms the concatenated vector using a multilayer perceptron and then normalizes it using softmax to obtain two gating weights:
[0107]
[0108] in, It satisfies the convex combination constraint, and the two weights are adaptively balanced according to the specific characteristics of the triple:
[0109]
[0110] S5.6: Confidence Score Synthesis. The attention score and authenticity score are weighted and summed with their corresponding gating weights to obtain the final confidence score for the triple:
[0111]
[0112] The confidence score The algorithm combines attention score and authenticity score, and uses adaptive fusion gating to dynamically adjust the contribution ratio of the two scores to the final confidence score based on relationship type and data distribution. Triples with higher confidence scores indicate that they are more relevant to the recommendation task and have a more reasonable structure, and should contribute more weight in subsequent message passing.
[0113] Step S6: Generate knowledge graph graph convolution
[0114] Weighted graph convolution is performed based on the generated knowledge graph and its confidence score. For each edge in the generated knowledge graph, the confidence score obtained in step S5 is used in message passing. Weighting the weights:
[0115]
[0116] Weighted graph convolution uses the same method as the original knowledge graph convolution described above, averaging by the number of neighbors and summing the residuals. The difference lies in the message... For confidence score Weighted messages are aggregated on the generated knowledge graph channel. Triples with high confidence scores contribute more weight to message aggregation, while the contribution of low-confidence triples is effectively suppressed. Item embeddings perceived by the generated knowledge graph are obtained through stacking multiple layers of weighted graph convolutions and residual accumulation.
[0117] Step S7: Three-channel embedding and splicing with collaborative filtering aggregation
[0118] The item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph are concatenated along their dimensions to form the concatenated item embeddings:
[0119]
[0120] This splicing operation is completed before collaborative filtering aggregation to ensure that information from the three channels can be used in a unified manner.
[0121] Based on the user-item interaction graph, collaborative filtering aggregation is performed on the item embeddings concatenated in step S7. Let the elements in the sparse interaction matrix be... In this embodiment, the observed interactive edge has a value of 1, and the unobserved edge has a value of 0. In layer aggregation, user embedding and item embedding are updated as follows:
[0122]
[0123]
[0124] After aggregation and residual accumulation at a predetermined number of layers, the final user embedding and final item embedding are obtained. It should be noted that updates on the user side are only performed through the interaction graph, and the influence of the knowledge graph on the user is indirectly achieved through item representation: the generated knowledge graph triples first affect the item embedding, and then are passed to the user embedding through collaborative filtering aggregation.
[0125] Step S8: Calculate the recommended score and output the results
[0126] Based on the final user embedding and final item embedding obtained in step S7, the user's recommendation score for the item is calculated using the inner product:
[0127]
[0128] All candidate items are sorted according to their recommendation scores, and the items with the highest scores are selected. Output one item as the recommendation result.
[0129] The training objective of the method of this invention is to minimize the following combined loss function:
[0130]
[0131] in, The labeled smooth cross-entropy recommendation loss is used to optimize recommendation performance.
[0132]
[0133]
[0134]
[0135] The regularization loss for the confidence scoring module includes L2 regularization of the relation-aware projection weights and regularization of the truth scale parameter. Let the number of relation types be... The head-side projection vectors and tail-side projection vectors of each relation are stacked into matrices. and ,but:
[0136]
[0137] To mitigate the diversity loss of relation projection weights, we penalize the cosine similarity between the head-side projection vectors corresponding to different relations, thereby promoting the learning of differentiated projection representations of relations and enhancing the discriminative power between different relations.
[0138]
[0139] in, , and The coefficients within the regularization loss are... and These represent the coefficients of regularization loss and diversity loss in the total loss, respectively. The recommendation model is trained using the Adam optimizer and employs an early stopping strategy to prevent overfitting; the conditional diffusion model is trained using an independent Adam optimizer and a positive-negative sample contrast loss. Upon reaching a predetermined generation frequency, entity embeddings and relation embeddings are extracted and fixed from the current recommendation model to train the conditional diffusion model, and then a new knowledge graph is generated. The training of this diffusion model and the recommendation model uses independent optimization steps, while the generated knowledge graph participates in subsequent recommendation model training via confidence graph convolution.
[0140] According to a second aspect of the present invention, this embodiment provides a knowledge graph-enhanced recommendation system based on a conditional diffusion model. Corresponding to the foregoing method embodiments, this system includes the following modules:
[0141] Data Acquisition Module: Used to acquire historical interaction data between users and items, as well as raw knowledge graph data. The raw knowledge graph represents the semantic relationships between items and entities in the form of triples (head entity, relation, tail entity).
[0142] Embedding Initialization Module: Used to construct the initial embedding representations for user embeddings, entity embeddings, and relation embeddings. The embedding vector of each item node contains three consecutive channels, corresponding to the collaborative filtering channel, the original knowledge graph channel, and the generated knowledge graph channel, respectively. The embedding of each channel is obtained through random initialization.
[0143] The original knowledge graph convolution module performs graph convolution operations based on the original knowledge graph, embedding entities along the edges of the original knowledge graph for information transmission and aggregation, resulting in item embeddings perceived by the original knowledge graph. This module uses unit weights for message passing and obtains item embeddings through multi-layer stacking and residual connections.
[0144] Conditional Diffusion Generation Module: This module generates knowledge graph triples based on the conditional diffusion model, using item embeddings and relation embeddings as conditions. It consists of two stages: conditional diffusion model training and conditional diffusion model generation, realizing a complete process from training the original triples to generating the generated triples.
[0145] Confidence scoring module: used to score the confidence of each triple in the generated knowledge graph. This module further includes: a multi-head triple attention submodule for calculating the attention score of the triple; a authenticity assessment submodule for calculating the authenticity score based on the TransE translation hypothesis; and an adaptive fusion gating submodule for dynamically fusing the attention score and the authenticity score into a confidence score.
[0146] The knowledge graph generation convolution module is used to perform weighted graph convolution operations based on the generated knowledge graph and its confidence score, using the confidence score as the message passing weight, and obtaining the item embedding perceived by the generated knowledge graph through weighted neighbor aggregation.
[0147] Embedding and splicing module: used to splice the item embeddings of the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph according to dimensions to form the spliced item embeddings.
[0148] Collaborative Filtering Aggregation Module: Based on the user-item interaction graph, it performs multi-level collaborative filtering aggregation on the stitched item embeddings, updates the user embeddings and item embeddings through the interaction relationships between users and items, and obtains the final user embeddings and final item embeddings.
[0149] Recommendation output module: It is used to calculate the recommendation score based on the end user embedding and the end item embedding through the inner product, sort the candidate items in descending order according to the recommendation score, and output the preset number of items with the highest scores as the recommendation results.
[0150] The functions of each module described above are consistent with the corresponding steps in the aforementioned method embodiments, and will not be repeated here. It should be noted that the above system embodiments and method embodiments share the same inventive concept, and key technical details in the system embodiments can be found in the relevant descriptions in the method embodiments.
[0151] The above description is merely a preferred embodiment of the present invention and does not limit the scope of the patent. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A knowledge graph-enhanced recommendation method based on a conditional diffusion model, characterized in that, Includes the following steps: S1: Obtain historical interaction data between users and items, as well as raw knowledge graph data; wherein, the raw knowledge graph represents the semantic relationship between items and entities in the form of triples (head entity, relation, tail entity); S2: Construct initial embedding representations for user embeddings, entity embeddings, and relation embeddings; S3: Perform graph convolution operation based on the original knowledge graph, embed entities along the edges of the original knowledge graph for message passing and aggregation, and obtain the item embedding perceived by the original knowledge graph. S4: Based on the conditional diffusion model, with item embedding and relation embedding as conditions, through diffusion training and diffusion generation processes, the generated knowledge graph triples are obtained, and the generated knowledge graph is obtained by expanding the non-item entity triples in the original knowledge graph. S5: Calculate the confidence score for each triple (h, r, t) in the generated knowledge graph to obtain the confidence score for each triple; the confidence score includes: calculating the attention score based on the multi-head triple attention mechanism, calculating the authenticity score based on the TransE translation hypothesis, and fusing the attention score and the authenticity score into a confidence score through adaptive fusion gating. S6: Perform a confidence graph convolution operation based on the generated knowledge graph and its corresponding confidence score to obtain the item embedding perceived by the generated knowledge graph; S7: The item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph are concatenated to form the concatenated item embeddings; based on the user-item interaction graph, the concatenated item embeddings are aggregated through collaborative filtering, and the user embeddings and item embeddings are updated through the interaction relationship between users and items to obtain the final user embeddings and the final item embeddings. S8: Based on the end-user embedding and the end-item embedding, calculate the recommendation score and output the item recommendation result according to the recommendation score.
2. The method according to claim 1, characterized in that, In step S2, the user embedding, entity embedding, and relation embedding are all initialized using Xavier uniform initialization; wherein, the embedding vector of each item node contains three continuous channels, corresponding to the collaborative filtering channel, the original knowledge graph channel, and the generated knowledge graph channel, respectively.
3. The method according to claim 1, characterized in that, In step S3, the graph convolution operation based on the original knowledge graph includes: for each edge (h, r, t) in the original knowledge graph, the message is passed from the tail entity to the head entity, and the message content is the sum of the tail entity embedding and the relation embedding; the item embedding perceived by the original knowledge graph is obtained by multi-layer stacking through residual connection and normalization.
4. The method according to claim 1, characterized in that, In step S4, the training and generation process of the conditional diffusion model includes: S4.1: Extract triples associated with items from the original knowledge graph as training samples, and concatenate the head entity embedding, relation embedding and tail entity embedding of each triple (h,r,t) according to the dimensions to form the triple embedding. S4.2: Noise is gradually added to the triplet embedding according to the Gaussian diffusion process to obtain the noisy triplet embedding; S4.3: Construct the condition vector, which is obtained by linear transformation of the sum of the head entity embedding and the relation embedding; S4.4: Using noisy triple embeddings, time steps, and conditional vectors as inputs, a conditional denoising network is used to predict noise components. S4.5: Train the conditional diffusion model using a positive-negative sample contrast loss; S4.6: In the generation stage, starting from random Gaussian noise, and using item embedding and relation embedding as conditions, the triplet embedding is gradually reconstructed through a back diffusion process to regenerate the triplet embedding. The tail entity embedding segment of the generated triplet embedding is searched for nearest neighbor to obtain candidate tail entities. Then, the generated triplet is obtained by combining the items and relations as conditions. The generated triplet is expanded based on the non-item entity triplets in the original knowledge graph to obtain the generated knowledge graph.
5. The method according to claim 1, characterized in that, In step S5, the confidence score for each triple (h, r, t) in the generated knowledge graph includes the following sub-steps: S5.1: Transform the head entity embedding and tail entity embedding through relation-aware projection so that the same entity has different embedding representations under different relations; S5.2: Using relation embedding as the query vector, and projected head entity embedding and tail entity embedding as key-value pairs, attention features are calculated through a multi-head attention mechanism, and residual connections and layer normalization are employed. S5.3: The projected head entity embedding, relation embedding, tail entity embedding and attention features are concatenated and input into a multilayer perceptron, and the attention score is obtained by passing through the sigmoid activation function; S5.4: Based on the TransE translation assumption, calculate the distance between the sum of the head entity embedding and the relation embedding and the tail entity embedding, and obtain the authenticity score through an exponential function; S5.5: The attention score, authenticity score and relation embedding are concatenated and input into the adaptive fusion gating network. The attention gating weights and authenticity gating weights are obtained by softmax normalization. S5.6: The gating weights and corresponding scores are weighted and summed to obtain the confidence score of the triple.
6. The method according to claim 1, characterized in that, In step S6, the confidence graph convolution operation aggregates neighbor information by using the confidence score as the message weight: in each layer, the weighted messages of all neighbor triples are averaged according to the number of neighbors, and the residuals are added to the head entity embedding.
7. The method according to claim 1, characterized in that, In step S7, the splicing operation splices the item embeddings of the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph by dimension to form the spliced item embeddings; the collaborative filtering aggregation is based on the adjacency matrix of the user-item interaction graph, the update of the user embedding is achieved by aggregating the embeddings of the items that the user has interacted with, the update of the item embedding is achieved by aggregating the embeddings of the users that the user has interacted with, and high-order collaborative relationships are captured through multi-layer stacking.
8. The method according to claim 1, characterized in that, In step S8, the recommendation score is calculated by the inner product of the user embedding and the item embedding. The candidate items are sorted in descending order based on the recommendation score, and the top K items with the highest scores are selected as the recommendation results output. The training objective of the method is to minimize the total loss function, which includes the labeled smooth cross-entropy recommendation loss, the regularization loss of the confidence scoring module parameters, and the diversity loss of the relation-aware projection weights.
9. A knowledge graph-enhanced recommendation system based on a conditional diffusion model, characterized in that, include: The data acquisition module is used to acquire historical interaction data between users and items, as well as raw knowledge graph data; The embedding initialization module is used to construct the initial embedding representations for user embeddings, entity embeddings, and relation embeddings; The original knowledge graph convolution module is used to perform graph convolution operations based on the original knowledge graph to obtain the item embedding perceived by the original knowledge graph. The conditional diffusion generation module is used to generate knowledge graph triples based on the conditional diffusion model, using item embedding and relation embedding as conditions; The confidence scoring module is used to score the confidence of each triple in the generated knowledge graph, including a multi-head triple attention submodule, an authenticity scoring submodule, and an adaptive fusion gating submodule. A knowledge graph convolution module is used to perform a confidence graph convolution operation based on the generated knowledge graph and its corresponding confidence score to obtain the item embedding perceived by the generated knowledge graph. The embedding and splicing module is used to splice the item embeddings from the collaborative filtering channel, the item embeddings perceived by the original knowledge graph, and the item embeddings perceived by the generated knowledge graph. The collaborative filtering aggregation module is used to perform collaborative filtering aggregation on the stitched embeddings and user embeddings based on the user-item interaction graph to obtain the final user embeddings and the final item embeddings. The recommendation output module is used to calculate the recommendation score based on the end-user embedding and the final item embedding, and output the item recommendation result.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.