Recommendation method combining large language model and knowledge graph
By iteratively aggregating large language models and BERT text encoding, combined with graph attention network, the information loss and computing resource consumption problems of recommendation systems when combining knowledge graphs and large language models are solved, and the depth of structured and unstructured data is achieved The integration significantly improves the performance and accuracy of the recommendation system.
Patent Information
- Application Number
- CN202411218123.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2025-01-10
AI Technical Summary
When the existing recommendation system combines knowledge graphs and large language models, it faces the problems of structured information loss, large computing resource consumption, slow processing speed and poor system scalability, resulting in unsatisfactory recommendation results.
Using the large language model text processing of iterative aggregation idea, combined with BERT text encoding and graph attention network, the implicit relationships and contextual semantics between nodes and their neighbors are captured by aggregating the text descriptions of nodes and their neighbors, and by aligning and mixing features. Interactive aggregators improve information capture capabilities.
It significantly improves the performance and accuracy of the recommendation system, realizes the deep integration of structured and unstructured data, enhances node characterization capabilities and recommendation effects, and improves user satisfaction.
Smart Images

Figure CN119293312A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of recommendation systems and artificial intelligence technology, and in particular to a recommendation method combining a large language model and a knowledge graph. Background Art
[0002] In recommendation systems, traditional methods such as collaborative filtering mainly predict user preferences by analyzing the interaction history between users and items. Although this method is effective, it is often limited by data sparsity because only a very small number of user-item interactions are known. To overcome this limitation, knowledge graphs are introduced into recommendation systems. Knowledge graphs provide rich semantic context for recommendation systems by integrating additional structured information, such as relationships between entities, thereby enhancing the expression of item and user characteristics. This not only helps to improve the accuracy of recommendations, but also improves the robustness and explanatory power of the system.
[0003] On this basis, graph neural network (GNN) technology, especially graph convolutional network (GCN) and graph attention network (GAT), has provided significant enhancements to the recommendation system. These technologies optimize the capture of complex user-item interaction patterns, and use direct and indirect relationships between nodes to accurately learn and reason about deep connections between entities. Graph convolutional networks improve the representation quality of user and item features through local node aggregation and multi-level information fusion, while graph attention networks dynamically adjust the influence of adjacent nodes through attention mechanisms to further refine the recommendation personality. The method that combines knowledge graphs and graph neural networks not only improves the accuracy of recommendations, but also enhances the system's ability to explain, making recommendations more reliable and transparent.
[0004] However, although structured knowledge that relies solely on knowledge graphs can accurately predict the connections between entities, it is limited in capturing detailed user preferences and understanding complex item attributes. Although structured data encompasses the relationships between entities, it usually lacks sufficient descriptions to fully express the characteristics of the entities, which is insufficient for achieving deeply personalized recommendations. In addition, the natural language descriptions of users and items contain a large amount of unstructured information, such as emotional attitudes, personalized needs, and specific evaluations of items, which are difficult to capture with structured knowledge graphs. Large language models (such as ChatGPT and ChatGLM) have shown significant advantages in processing unstructured text as generative models. These models can deeply understand and generate text through advanced natural language processing technology, extract key semantic information, and enable recommendation systems to better understand complex user intentions and item descriptions. In this way, the recommendation system can more accurately match user needs with item characteristics and enhance the effect of personalized recommendations. This method of combining structured and unstructured data can significantly improve the performance of the recommendation system and further optimize the relevance and personalization of recommendations.
[0005] Although knowledge graphs and large language models have shown significant advantages in recommendation systems, their combination still faces a series of challenges in practical applications. The common practice of traditional methods to convert graph data and text data to adapt to different technologies has brought some technical problems. Specifically, when converting graph data into text form to adapt to large language models, it may lead to partial loss of structured information and increase the complexity of implementation, while also introducing conversion errors. In addition, when extracting triples from text to enrich knowledge graphs, the ambiguity and unstructured nature of natural language often lead to problems with extraction accuracy, and this process usually requires a lot of computing resources, which not only increases costs, but also affects processing speed and system scalability. In view of these challenges, further research and improvement of the combination of these technologies to solve these problems and give full play to their respective advantages is crucial to improving the performance of recommendation systems. Summary of the invention
[0006] The purpose of the present invention is to provide a recommendation method that combines a large language model and a knowledge graph to address the above-mentioned problems that currently exist. By effectively integrating large language models, knowledge graphs and graph neural network technology, the performance and accuracy of the recommendation system are significantly improved.
[0007] The technical solution of the present invention is as follows:
[0008] A recommendation method combining a large language model and a knowledge graph includes the following steps:
[0009] Large language model text processing based on iterative aggregation ideas;
[0010] BERT-based text encoding;
[0011] Aligning entity embeddings with graph attention networks;
[0012] Recommended prediction.
[0013] Furthermore, the large language model text processing based on iterative aggregation idea specifically includes the following steps:
[0014] Aggregate text descriptions of nodes and their neighbor nodes layer by layer based on the graph structure;
[0015] Input the aggregated text description into the large language model through the preset Prompt template;
[0016] Large language models use powerful natural language processing capabilities to integrate all relevant information about a node and its neighbors, capturing implicit relationships and contextual semantics between nodes.
[0017] Furthermore, the large language model text processing based on iterative aggregation idea enhances the text description of the node through the following steps:
[0018] Aggregate the text descriptions of node u and the node i it interacted with, and the new text description D of node u u Generated by a large speech model, the formula is: D′ u =LLM(PROMPT user (D u , {D i , D e :(u,i)∈G 1 , (i, e)∈Z})),
[0019] Among them, PROMPT user is a preset template used to format the text description of node u and its interacted node i, G 1 is the user-item interaction graph, and Z is the item-entity alignment set;
[0020] At the same time, the original description of the item is improved using a large language model i :
[0021] D′ i =LLM(PROMPT item (D i , {D u , D e :(u,i)∈G 1 , (i, e)∈Z})),
[0022] Among them, PROMPT item is a preset template used to integrate the description of item i and the description of users who have interacted with it. u and the description D of the associated entity node e e ;
[0023] Based on the idea of iterative aggregation, a large language model is gradually used to explore the description text of neighbor nodes at each layer of the graph structure.
[0024] Furthermore, the BERT-based text encoding specifically includes the following steps:
[0025] The generated new text description is used as a text encoder through the pre-trained BERT-Base to extract feature vectors;
[0026] Use principal component analysis to reduce the dimension of the feature vector, and then perform linear transformation on the reduced feature vector through a fully connected layer;
[0027] BERT's text encoding unifies the representation of text and graph structure data. The text feature processing of users and items is expressed as follows:
[0028]
[0029] Furthermore, the alignment of entity embedding based on graph attention network specifically includes the following steps:
[0030] Align the embeddings generated by the graph attention network with the embeddings processed by the BERT encoder;
[0031] The TransE method is used to process the embedding of the joint graph. For each triple (h, r, t) in the graph, the expected value e h +e r ≈e t , where e h , e t is the graph node embedding, e r is the embedding of the relation; in this way, the energy scoring function is formulated as follows:
[0032] S(h, r, t) = ||e h +e r -e t || 2 ;
[0033] Model training uses ranking loss to distinguish valid and vandalized triplets, and the loss function is:
[0034]
[0035] in, Includes valid triples (h, r, t) and corresponding broken triples (h, r, t′);
[0036] The information aggregation vector of node h is calculated by weighted aggregation strategy This vector will be the set of adjacency triplets of the node The linear combination of all tail node embeddings in is expressed as:
[0037]
[0038] Among them, e t refers to the embedding vector of the tail node t, and λ(h, r, t) represents a calculated attention weight.
[0039] Furthermore, the process of calculating the attention weight λ(h, r, t) is as follows:
[0040] Calculate the pre-attention score: S(h, r, t) = LeakyReLU(W r x h +W r x t +br ),
[0041] Among them, W r is a transformation matrix associated with relation r, b r is a bias term, and the LeakyReLU function ensures that a certain gradient flow is maintained even in the case of negative input values;
[0042] The Softmax function is used for normalization to determine the final attention weight of each adjacent triplet:
[0043]
[0044] The information aggregation vector at the computing node h After that, the optimized node representation e h and its corresponding neighborhood representation The aggregation strategy of the new node representation will be defined as
[0045] A hybrid feature interaction aggregator is used to improve the information capture capability by combining multiple different feature interaction methods, which is expressed as:
[0046]
[0047] By stacking more propagation layers, nodes can accumulate and utilize more distant neighborhood information between nodes. In each propagation layer l, the representation of a node will be based on its representation in the previous layer and the accumulated information of its neighbors:
[0048]
[0049] Among them, f is the function that integrates the node’s own features with the neighborhood information. is an aggregation function that collects and integrates the information of the l-1 order neighborhood of h, which can be expressed as:
[0050]
[0051] Among them, π (l-1) (h, r, t) is a weighted function that determines the contribution of each neighbor in the l-1 layer, and e t (l-1) is the representation of node t generated in the previous propagation step;
[0052] Finally, for the current layer representation of users and items, their text features are concatenated with the features aggregated by the graph attention network to form the final feature representation of the current layer. The final feature representations of the current layer of users and items are:
[0053]
[0054] in, and Respectively represent the user and item embeddings generated by the graph attention network.
[0055] Furthermore, the recommendation prediction specifically includes the following steps:
[0056] Using the descriptions of users and items across different layers, we further combine the embeddings of each layer to produce the final embeddings of users and items:
[0057]
[0058] in, and are the representations of user u and item i at layer l, respectively. || means concatenating these feature vectors in a specific dimension.
[0059] The degree of interaction or matching between users and items is predicted by calculating the inner product of the representation vectors:
[0060]
[0061] Compared with the prior art, the present invention has the following beneficial effects:
[0062] 1. A recommendation method that combines a large language model and a knowledge graph. It not only uses the interaction data of users and items, but also achieves deep data fusion by combining the structural information of the knowledge graph and the deep text description processed by the large language model. This combination can more comprehensively mine and utilize the potential features of users and items, thereby providing more accurate recommendations.
[0063] 2. A recommendation method that combines a large language model with a knowledge graph, using an iterative aggregation and segmented processing strategy. Iterative aggregation allows the model to gradually process and understand large-scale graph data, and captures the implicit relationship and contextual semantics between nodes by integrating all relevant information about nodes and their neighbors layer by layer, thereby improving the expressiveness and accuracy of text descriptions. The segmented processing strategy effectively overcomes the text token limitations of large language models, and improves information processing efficiency and the generalization ability of the model by processing and integrating a large amount of information in stages;
[0064] 3. A recommendation method that combines a large language model and a knowledge graph. By making full use of the advantages of both large language models and knowledge graphs, data complementarity and effect maximization are achieved. The recommendation system can more effectively integrate and utilize the two data sources, thereby significantly improving the accuracy of recommendations and user satisfaction.
[0065] 4. A recommendation method that combines a large language model and knowledge graphs, and proposes an effective structured and unstructured data fusion scheme, which significantly enhances the representation ability of nodes, and significantly improves the recommendation effect and the comprehensive utilization efficiency of data; in current recommendation systems, the integration of structured data (such as graph data) and unstructured data (such as text descriptions) often does not reach the ideal depth, resulting in the potential value of information not being fully explored. By combining structured data and unstructured data, the system can more comprehensively capture and utilize the characteristics of users and items, and achieve more in-depth personalized recommendations. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 Schematic diagram of a flow chart of a recommendation method that combines a large language model and a knowledge graph.
[0067] Figure 2 Schematic diagram of the overall model architecture of a recommendation method that combines a large language model and a knowledge graph.
[0068] Figure 3 A joint graph of user-item interaction graph and knowledge graph for a recommendation method that combines a large language model and knowledge graph.
[0069] Figure 4 An example diagram of a Prompt template for a recommendation method that combines a large language model and a knowledge graph. DETAILED DESCRIPTION
[0070] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0071] The features and performance of the present invention are further described in detail below in conjunction with the embodiments.
[0072] In the present invention, a series of specific concepts are set to describe the key components of the recommendation system. The user set is set to U = {u 1 ,u 2 ,u 3 …u M}, the item set is set to I = {i 1 ,i 2 ,i 3 …i N}, where M and N represent the total number of users and items respectively. The historical interaction behaviors between users and items are constructed as a user-item interaction graph, denoted as G 1 ={(u, i)|u∈U, i∈I}. If there is an interaction between user u and item i, there is an edge yu between them. i =1; if there is no interaction record, then yu i =0.
[0073] The knowledge graph is set to G 2 = {E, R, T E}, where E, R, T E Represent entity sets, relationship sets, and entity triples, respectively, where T E It is expressed as {(e 1 , r 1 , e 2 )|e 1 , e 2 ∈E,r 1 ∈R}, for example, the triple (Zhang San, purchase, Huawei mobile phone) is used to represent the connection between entities, which describes the purchase relationship between Zhang San and Huawei mobile phone.
[0074] In order to effectively combine the user-item interaction graph with the knowledge graph, the present invention connects the user-item interaction graph with the knowledge graph through the items and seamlessly integrates them into a unified joint graph. Figure 3 As shown in Figure 2, since the item set is a subset of the entity set E, the item-entity alignment set Z = {(i, e)|i∈I, e∈E} is set, where (i, e) indicates that item i can be aligned with entity e in the knowledge graph. The joint graph is set to: G = {(u, Interact, i)|u∈U, (i, e)∈Z, (u, i)∈G 1}, In addition, in the text description, set the description of user u to D u , the description of item i is represented by D i , the description of the entity in the knowledge graph is represented by D e The model uses the descriptive information and the joint graph composed of the user-item interaction graph and the knowledge graph as input, and outputs a prediction function that predicts the probability of a user and an item that they have interacted with before. The formula is:
[0075]
[0076] in is the probability of recommending item i to user u, and Θ is the model parameter.
[0077] See also Figure 1-4 , a recommendation method that combines large language models and knowledge graphs, such as Figure 1 As shown, the following steps are included:
[0078] Large language model text processing based on iterative aggregation ideas; Processing text data of graph nodes through large language models;
[0079] BERT-based text encoding;
[0080] Aligning entity embeddings with graph attention networks;
[0081] Recommended prediction.
[0082] The large language model text processing based on iterative aggregation idea specifically includes the following steps:
[0083] Aggregate text descriptions of nodes and their neighbor nodes layer by layer based on the graph structure;
[0084] The aggregated text description is input into the large language model through the preset Prompt template; the Prompt template example is as follows Figure 4 As shown in Figure 2, by aggregating the text descriptions of nodes and their neighbors layer by layer and feeding them into a large language model, a more comprehensive and rich node text description can be generated.
[0085] Large language models use powerful natural language processing capabilities to integrate all relevant information about nodes and their neighbors, capture implicit relationships and contextual semantics between nodes, and thus improve the expressiveness and accuracy of text descriptions. Based on the idea of iterative aggregation, this method can effectively overcome the text token limitations of large language models, gradually process and integrate large amounts of information, and improve information processing efficiency and the generalization ability of the model.
[0086] The large language model text processing based on iterative aggregation idea enhances the text description of the node through the following steps:
[0087] Aggregate the text descriptions of node u and the node i it interacted with, and the new text description D of node u u Generated by a large speech model, the formula is: D′ u =LLM(PROMPT user (D u , {D i , D e :(u,i)∈G 1 , (i, e)∈Z})),
[0088] Among them, PROMPT user is a preset template used to format the text description of node u and its interacted node i;
[0089] At the same time, the original description of the item is improved using a large language model i :
[0090] D′ i =LLM(PROMPT item (D i , {D u , D e :(u,i)∈G 1 , (i, e)∈Z})),
[0091] Among them, PROMPT item is a preset template used to integrate the description of item i and the description of users who have interacted with it. u and the description D of the associated entity node e e ; In actual application, the design of the prompt template may be adjusted according to the specific task.
[0092] Based on the idea of iterative aggregation, a large language model is gradually used to explore the description text of neighbor nodes at each layer of the graph structure.
[0093] For users and items, iterative aggregation is performed separately to capture higher-order neighbor information, thereby improving the richness and accuracy of node text descriptions.
[0094] First, the node description of the initial layer is set. In the first layer, the text description of the node is generated by the original text of the node and the text description of its direct neighbor nodes through the preset PROMPT template input into the large language model, which is recorded as and Next, a higher level node description is set. At the lth level, the description of each node is generated by inputting the large language model through the description of the previous level and the description of its neighboring nodes through the preset PROMPT template. For example, the lth level description of user node u is It is expressed as:
[0095]
[0096] Similarly, the nth level description of item node i Generated by the following formula:
[0097]
[0098] By iteratively aggregating layer by layer and integrating all relevant information of nodes and their neighbors, it is possible to capture the implicit relationships and contextual semantics between nodes, thereby improving the richness and accuracy of text descriptions.
[0099] The BERT-based text encoding specifically includes the following steps:
[0100] The generated new text description is passed through the pre-trained BERT-Base as a text encoder to extract feature vectors; the BERT-Base model can deeply understand the complex semantic relationships in the text and ensure that the extracted feature vectors have high semantic fidelity.
[0101] The principal component analysis (PCA) is used to reduce the dimension of the feature vector, and the reduced feature vector is then linearly transformed through a fully connected layer (FC) to further adjust and optimize the feature representation.
[0102] BERT's text encoding unifies the representation of text and graph structure data. The text feature processing of users and items is expressed as follows:
[0103]
[0104]
[0105] The alignment of entity embedding based on graph attention network specifically includes the following steps:
[0106] Align the embeddings generated by the graph attention network with the embeddings processed by the BERT encoder;
[0107] The TransE method is used to process the embedding of the joint graph. For each triple (h, r, t) in the graph, the expected value e h +e r ≈e t , where e h , e t is the graph node embedding, e r is the embedding of the relation; in this way, the energy scoring function is formulated as follows:
[0108] S(h, r, t) = ||e h +e r -e t || 2 ;
[0109] Model training uses ranking loss to distinguish valid and vandalized triplets, and the loss function is:
[0110]
[0111] in, Including valid triples (h, r, t) and corresponding corrupted triples (h, r, t′); by applying the TransE model, the joint graph embedding not only provides a deep understanding of graph nodes and relationships, but also provides an effective quantification method for the complex interactions between nodes, providing a solid foundation for subsequent analysis and recommendation tasks.
[0112] In the process of propagation based on the graph attention network, the representation of the node will be updated by aggregating the information of the adjacent nodes. When focusing on how to characterize the relationship between a given node h and its adjacent nodes, the information aggregation vector of node h is calculated through a weighted aggregation strategy. This vector will be the set of adjacency triplets of the node The linear combination of all tail node embeddings in is expressed as:
[0113]
[0114] Among them, e t refers to the embedding vector of the tail node t, and λ(h, r, t) represents a calculated attention weight.
[0115] The process of calculating the attention weight λ(h, r, t) is as follows:
[0116] Calculate the pre-attention score: S(h, r, t) = LeakyReLU(W r x h +W r x t +b r ),
[0117] Among them, W r is a transformation matrix associated with relation r, b r is a bias term, and the LeakyReLU function ensures that a certain gradient flow is maintained even in the case of negative input values;
[0118] The Softmax function is used for normalization to determine the final attention weight of each adjacent triplet:
[0119]
[0120] The information aggregation vector at the computing node h After that, the optimized node representation e h and its corresponding neighborhood representation The aggregation strategy of the new node representation will be defined as
[0121] A hybrid feature interaction aggregator is used to improve the information capture capability by combining multiple different feature interaction methods, which is expressed as:
[0122]
[0123] When exploring the inherent high-order connectivity in the graph, a multi-layer propagation and aggregation method will be adopted. By stacking more propagation layers, nodes are able to accumulate and utilize more distant neighborhood information between nodes. In each propagation layer l, the representation of a node will be based on its representation in the previous layer and the accumulated information of its neighbors:
[0124]
[0125] Among them, f is the function that integrates the node’s own features with the neighborhood information. is an aggregation function that collects and integrates the information of the l-1 order neighborhood of h, which can be expressed as:
[0126]
[0127] Among them, π (l-1) (h, r, t) is a weighted function that determines the contribution of each neighbor in the l-1 layer, and e t (l-1) is the representation of node t generated in the previous propagation step;
[0128] Finally, for the current layer representation of users and items, their text features are concatenated with the features aggregated by the graph attention network to form the final feature representation of the current layer. The final feature representations of the current layer of users and items are:
[0129]
[0130] in, and Respectively represent the user and item embeddings generated by the graph attention network.
[0131] Through this step, the recommendation system can comprehensively utilize the text features and structural features generated by BERT and the graph attention network to provide a powerful feature representation for subsequent recommendation tasks. This method not only enhances the richness and accuracy of node text descriptions, but also improves the ability to process and understand complex graph structure data.
[0132] The recommendation prediction specifically includes the following steps:
[0133] Using the descriptions of users and items across different layers, we further combine the embeddings of each layer to produce the final embeddings of users and items:
[0134]
[0135] in, and are the representations of user u and item i at layer l, respectively. || means concatenating these feature vectors in a specific dimension.
[0136] The degree of interaction or matching between users and items is predicted by calculating the inner product of the representation vectors:
[0137]
[0138] In this way, the recommendation system can comprehensively utilize cross-level node representations to generate final embeddings of users and items, and predict the degree of interaction or matching through the inner product of these embeddings, thereby improving the accuracy and effectiveness of recommendations.
[0139] The above-mentioned embodiments only express the specific implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the protection scope of the present application. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the technical solution concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A recommendation method combining a large language model and a knowledge graph, characterized in that: The following steps are involved: Large language model text processing based on iterative aggregation ideas; BERT-based text encoding; Aligning entity embeddings with graph attention networks; Recommended prediction.
2. A recommendation method combining a large language model and a knowledge graph according to claim 1, characterized in that: The large language model text processing based on iterative aggregation idea specifically includes the following steps: Aggregate text descriptions of nodes and their neighbor nodes layer by layer based on the graph structure; Input the aggregated text description into the large language model through the preset Prompt template; Large language models use natural language processing capabilities to integrate all relevant information about a node and its neighbors, capturing implicit relationships and contextual semantics between nodes.
3. A recommendation method combining a large language model and a knowledge graph according to claim 2, characterized in that: The large language model text processing based on iterative aggregation idea enhances the text description of the node through the following steps: Aggregate the text descriptions of node u and the node i it interacted with, and the new text description D of node u u Generated by a large speech model, the formula is: D′ u =LLM(PROMPT user (D u ,{D i ,D e :(u,i)∈G1,(i,e)∈Z})), Among them, PROMPT user is a preset template used to format the text description of node u and its interacted node i, G1 is the user-item interaction graph, and Z is the item-entity alignment set; At the same time, the original description of the item is improved using a large language model i : D′ i =LLM(PROMPT item (D i ,{D u ,D e :(u,i)∈G1,(i,e)∈Z})), Among them, PROMPT item is a preset template used to integrate the description of item i and the description of users who have interacted with it. u and the description D of the associated entity node e e ; Based on the idea of iterative aggregation, a large language model is gradually used to explore the description text of neighbor nodes at each layer of the graph structure.
4. The recommendation method combining a large language model and a knowledge graph according to claim 1, characterized in that: The BERT-based text encoding specifically includes the following steps: The generated new text description is used as a text encoder through the pre-trained BERT-Base to extract feature vectors; Use principal component analysis to reduce the dimension of the feature vector, and then perform linear transformation on the reduced feature vector through a fully connected layer; BERT's text encoding unifies the representation of text and graph structure data. The text feature processing of users and items is expressed as follows:
5. The recommendation method combining a large language model and a knowledge graph according to claim 1, characterized in that: The alignment of entity embedding based on graph attention network specifically includes the following steps: Align the embeddings generated by the graph attention network with the embeddings processed by the BERT encoder; The TransE method is used to process the embedding of the joint graph. For each triple (h, r, t) in the graph, the expected value e h +e r ≈e t , where e h ,e t is the graph node embedding, e r is the embedding of the relation; in this way, the energy scoring function is formulated as follows: S(h,r,t)=∥e h +e r -e t ∥ 2 ; Model training uses ranking loss to distinguish valid and vandalized triplets, and the loss function is: in, Includes valid triples (h, r, t) and corresponding broken triples (h, r, t′); The information aggregation vector of node h is calculated by weighted aggregation strategy This vector will be the set of adjacency triplets of the node The linear combination of all tail node embeddings in is expressed as: Among them, e t refers to the embedding vector of the tail node t, and λ(h,r,t) represents a calculated attention weight.
6. A recommendation method combining a large language model and a knowledge graph according to claim 5, characterized in that: The process of calculating the attention weight λ(h,r,t) is as follows: Calculate the pre-attention score: S(h,r,t)=LeakyReLU(W r x h +W r x t +b r ), Among them, W r is a transformation matrix associated with relation r, b r is a bias term, and the LeakyReLU function ensures that the gradient keeps flowing even in the case of negative input values; The Softmax function is used for normalization to determine the final attention weight of each adjacent triplet: The information aggregation vector at the computing node h After that, the optimized node representation e h and its corresponding neighborhood representation The aggregation strategy of the new node representation will be defined as A hybrid feature interaction aggregator is used to improve the information capture capability by combining multiple different feature interaction methods, which is expressed as: By stacking more propagation layers, nodes can accumulate and utilize more distant neighborhood information between nodes. In each propagation layer l, the representation of a node will be based on its representation in the previous layer and the accumulated information of its neighbors: Among them, f is the function that integrates the node’s own features with the neighborhood information. is an aggregation function that collects and integrates the information of the l-1 order neighborhood of h, which can be expressed as: Among them, π (l-1) (h, r, t) is a weighted function that determines the contribution of each neighbor in the l-1 layer, and e t (l-1) is the representation of node t generated in the previous propagation step; Finally, for the current layer representation of users and items, their text features are concatenated with the features aggregated by the graph attention network to form the final feature representation of the current layer. The final feature representations of the current layer of users and items are: in, and Respectively represent the user and item embeddings generated by the graph attention network.
7. The recommendation method combining a large language model and a knowledge graph according to claim 1, characterized in that: The recommendation prediction specifically includes the following steps: Using the descriptions of users and items across different layers, we further combine the embeddings of each layer to produce the final embeddings of users and items: in, and are the representations of user u and item i at layer l, respectively. ∥ means concatenating these feature vectors in dimension. The degree of interaction or matching between users and items is predicted by calculating the inner product of the representation vectors:
Citation Information
Patent Citations
Recommendation method and system based on combination of neural network and knowledge graph, terminal and medium
CN113987200A
Knowledge graph mining method based on fusion of graph neural network and large language model
CN117350252A
Cited By
Knowledge graph-based transportation tool matching recommendation method and system
CN119646315A
Knowledge graph enhanced reasoning framework based on graph neural network and large language model
CN120106229A