Federal recommendation method and system based on knowledge graph attention network
By constructing interactive maps, social relationship maps and knowledge maps, using graph attention networks to enhance user and project characteristics, integrating multiple graph information for federal recommendations, the problem of insufficient utilization of social networks and knowledge maps in the existing technology is solved, and the accuracy and effectiveness of the recommendation system are improved.
Patent Information
- Application Number
- CN202510583377.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-07
- Publication Date
- 2025-08-15
AI Technical Summary
The existing federal recommendation framework fails to fully utilize the synergistic benefits of social networks and knowledge graphs, fails to consider implicit information between projects, resulting in poor recommendation results.
By constructing an interaction graph between users and projects, a social relationship graph between users, and a knowledge graph between projects and their entities, the graph attention network is used to enhance the characteristics of users and projects, capture user preferences and project characteristics, and integrate user behavior graphs, social network graphs and knowledge graphs for recommendations.
It improves the accuracy of user preferences and project similarity, solves the cold start problem in the federal recommendation system, and enhances the recommendation effect.
Smart Images

Figure CN120494047A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information processing technology, and in particular to a federated recommendation method and system based on a knowledge graph attention network. Background Art
[0002] With the continuous development of information technology, the amount of data in our daily lives is experiencing explosive growth. In this era of information overload, how to filter out the content that truly interests and is valuable to users from this massive amount of data has become a pressing issue. Therefore, recommendation systems, as a bridge connecting information and users, are becoming increasingly important. They analyze user preferences based on historical interaction data and provide personalized content recommendations, greatly improving the efficiency and experience of information acquisition. With the continuous advancement of technology, recommendation systems are widely used in various fields, such as e-commerce, social media, and news, becoming a key force in driving the upgrade of digital services and improving user satisfaction and loyalty.
[0003] In traditional recommendation systems, users are required to upload their historical interaction data to a server for training, which creates privacy risks. Adversaries can obtain users' private data by attacking the server and subsequently manipulate the recommendation system. With growing awareness of privacy protection and the promulgation of the General Data Protection Regulation (GDPR), various privacy-preserving technologies have garnered widespread attention. Federated learning is a novel privacy-preserving technology that has been applied in many fields since its introduction. Federated learning allows for local model training without requiring users to upload their data to a server, significantly protecting privacy. Numerous studies have combined federated learning with recommendation systems to achieve privacy-preserving recommendations. Graph neural networks, owing to their ability to skillfully model complex relational data, have become a powerful tool in recommendation systems. Despite their potential, existing GNN-based methods often fail to fully exploit the synergistic benefits of integrating social networks and knowledge graphs into the recommendation process, resulting in limited performance. Researchers have proposed a neural influence and interest diffusion network (Ripp-MKR) for social recommendation. This network considers the propagation of preferences and interactions to mine key information from knowledge graphs. Some scholars have also proposed a neural influence and interest diffusion network DiffNet for social recommendation, which models the social influence process to enhance user embedding representation, but does not fully consider the implicit information between items.
[0004] In summary, existing federated recommendation frameworks often fail to fully utilize the synergistic benefits of integrating social networks and knowledge graphs into the recommendation process and do not fully consider the implicit information between items, and therefore cannot achieve good recommendation results. Summary of the Invention
[0005] In view of the shortcomings of existing technologies that often fail to fully utilize the synergistic benefits of integrating social networks and knowledge graphs into the recommendation process and do not fully consider the implicit information between items, and cannot achieve good recommendation effects, the present invention proposes a federated recommendation method and system based on a knowledge graph attention network. By utilizing the graph attention network to enhance the characteristics of users and items, it captures more accurate user preferences and item characteristics, thereby solving the problems existing in the existing technology.
[0006] A federated recommendation method based on a knowledge graph attention network includes the following steps:
[0007] Construct an interaction graph between users and projects, a social relationship graph between users, and a knowledge graph between projects and their entities. Input the interaction graph, social relationship graph, and knowledge graph into a graph neural network, and obtain embeddings of users, projects, and entities by encoding them.
[0008] The social relationship graph is used to aggregate the user's neighbor embeddings, and the attention layer is used to learn the attention weight of each user's neighbor embedding. The interaction graph is used to aggregate the embeddings of users and items, and the attention layer is used to learn the attention weight of the item neighbor embedding. The attention weights of each user's neighbor embedding and the item neighbor embedding are aggregated to obtain the hidden embeddings of the user's neighbors and item neighbors after aggregation. The attention layer is used to calculate the attention weights of the hidden embeddings of the current user, user's neighbors, and item neighbors to obtain the final embedding representation of the user.
[0009] The knowledge graph is used to aggregate the neighbor embeddings of an item, and the attention layer is used to learn the attention weights of all the item's neighbor embeddings. The embeddings of the item and the entity to which it belongs are aggregated to obtain the hidden embedding of the aggregated item. The hidden embedding of the item is vector-concatenated with the relationship vector containing the semantics of the item itself and the semantics of the associated entity to obtain the attention weights of the item embedding and the embeddings of its associated entities in the knowledge graph. The final embedding representation of the item is obtained based on the attention weights of the item embedding and the embeddings of its associated entities.
[0010] Based on the final embedding representation of the user and the final embedding representation of the item, the user's score for the item is predicted, and the item is recommended based on the score.
[0011] Furthermore, the construction of the interaction graph between users and projects, the social relationship graph between users, and the knowledge graph between projects and their entities specifically includes:
[0012] Based on the user-item relationship, build a user-item interaction matrix When user i over-rates item j, When user i has no interaction with item j, According to the user-item interaction matrix, a user-item interaction graph that can reflect the user's preferences and favorites is constructed, which is expressed as in It is a set of edges used to mark interaction relationships; U and V represent the embedding matrices of users and items respectively;
[0013] Build a social matrix based on the social relationships between users As the adjacency matrix between users, when there is a social relationship between user i and user j, then otherwise According to the social matrix Construct a social relationship graph that can reflect the friendly relationship between users, expressed as in Represents the connections established between users in the social graph;
[0014] Based on the relationship between items and entities, a knowledge matrix is constructed to serve as the adjacency matrix between items and entities. When a connection is established between item j and entity f, on the contrary The knowledge graph is constructed according to the knowledge matrix, which is expressed as in Represents the edges between items and entities in the knowledge graph.
[0015] Furthermore, encoding the user, item, and entity through the embedding layer to obtain the embedding of the user, item, and entity includes the following steps:
[0016] Convert interaction graphs, social relationship graphs, and knowledge graphs into embedding vectors of users, items, and entities, respectively. represents the d-dimensional real space;
[0017] By fusing the embedding vector p of user i i Its associated eigenvector x i , get user embedding u i ; By fusing the embedding vector q of item j j Its eigenvector y j , get the item embedding v j ; By fusing the embedding vector o of the entity f to which the project belongs f Its eigenvector z f , get the entity embedding e f .
[0018] Furthermore, the method of aggregating user neighbor embeddings using a social relationship graph and learning the attention weight of each user neighbor embedding using an attention layer specifically includes the following steps:
[0019] For each social pair in the social network that is a friend of user a a ,u b >, its attention weight α ab for:
[0020] α ab =Attention(W1u a ,W1u b )=LeakyReLU(A T [W1u a ||W1u b ]);
[0021] in, is the linear mapping matrix, u b Indicates that a are users with friend relationships; Attention represents the attention layer, which is activated by setting the attention layer as a feedforward neural network and using LeakyRe LU; A represents the attention layer parameters, T represents the transpose of the attention layer parameters, and || represents the vector connection operation;
[0022] According to α ab , get the final attention weight β of the user's neighbors ab for:
[0023]
[0024] Where exp is the exponential function.
[0025] Furthermore, the method of aggregating the embeddings of users and items through the interaction graph and learning the attention weights of the item neighbor embeddings using the attention layer specifically includes the following steps:
[0026] For the user-item interaction relationship in the interaction graph between users and items a , v c >, its attention weight γ ac Expressed as:
[0027] γ ac =Attention(W2u a ,W2v c )=LeakyReLU(B T [W2u a ||W2v c ]);
[0028] in is the mapping matrix, B represents the user-item interaction graph attention layer;
[0029] According to γ ac , we get the attention weight δ of the item neighbor embedding in the interaction graph ac for:
[0030]
[0031] Furthermore, the method aggregates the attention weights of each user's neighbor embedding and the item neighbor embedding to obtain the aggregated hidden embeddings of the user's neighbors and the item neighbors; uses the attention layer to calculate the attention weights of the hidden embeddings of the current user, the user's neighbors, and the item neighbors to obtain the final embedding representation of the user; specifically, the following steps are included:
[0032] Aggregate the attention weights of each user’s neighbors and the attention weights of the item’s neighbors to obtain the aggregated hidden embedding h of the user’s neighbors. b and the hidden embedding h of the item’s neighbors c , respectively expressed as:
[0033]
[0034] in, represents the mapping weight matrix;
[0035] Concatenate the hidden embedding with the relation vector containing social relationship semantics, user-item relationship semantics, and user's own semantics, and use the attention mechanism to calculate its attention weight:
[0036]
[0037] Among them, ε self , ε neighbor , ε interaction Represent the attention weights of the current user, user neighbor hidden embedding, and item neighbor hidden embedding, respectively. is the weight vector of the attention layer;
[0038] According to ε self , ε neighbor , ε interaction , get the final embedding u of user i final Expressed as: u final =ε self u a +ε neighbor h b +ε interaction h c .
[0039] Furthermore, the method of aggregating neighbor embeddings of items using the knowledge graph and learning the attention weights of all neighbor embeddings of the items through the attention layer specifically includes the following steps:
[0040] For each entity e in the knowledge graph that belongs to item df , the entity e f Paired with item d, it is represented as <v d , e f >, its attention weight ζ df Expressed as:
[0041] ζ df =Attention(W3v d ,W3e f )=LeakyReLU(D T [W3v d ||W3e f ]);
[0042] Among them, D represents the attention layer parameter, is a linear mapping matrix;
[0043] According to df , calculate the attention weights of all neighbors of item d:
[0044]
[0045] Furthermore, the method of obtaining the final embedding representation of the project based on the attention weights of the project embedding and the embedding of its associated entities specifically includes the following steps:
[0046] Perform graph aggregation on the item embedding and its associated entity embedding to obtain the aggregated hidden embedding h d :
[0047]
[0048] in, represents the mapping weight matrix;
[0049] Combine hidden embeddings with the semantics of the included item itself ψ d and associated entity semantics ψ e The relationship vectors are connected and the attention weights are calculated using the attention mechanism:
[0050]
[0051] Among them, ε item and ε knowledge Represent the attention weights of the current project and the associated entities in the knowledge graph, is the weight vector of the attention layer; T is the transpose of the attention layer parameters, h e Is the item hidden embedded;
[0052] According to ε item and ε knowledge Get the final project embedding vfinal for:
[0053] v final =ε item v d +ε knowledge h d .
[0054] The present invention also includes a federated recommendation system based on a knowledge graph attention network, comprising:
[0055] The construction module is used to construct the interaction graph between users and projects, the social relationship graph between users, and the knowledge graph between projects and their entities. The interaction graph, social relationship graph, and knowledge graph are input into the graph neural network, and the embedding of users, projects, and entities is obtained by encoding them.
[0056] The user embedding representation module is used to aggregate the user's neighbor embeddings using the social relationship graph and learn the attention weight of each user's neighbor embedding using the attention layer. The user and project embeddings are aggregated through the interaction graph and the attention weight of the project's neighbor embedding is learned using the attention layer. The attention weight of each user's neighbor embedding and the project's neighbor embedding are aggregated to obtain the aggregated hidden embeddings of the user's neighbors and project's neighbors. The attention layer is used to calculate the attention weights of the hidden embeddings of the current user, the user's neighbors, and the project's neighbors to obtain the user's final embedding representation.
[0057] The project embedding representation module is used to aggregate the neighbor embeddings of projects using the knowledge graph and learn the attention weights of all the neighbor embeddings of projects through the attention layer. The module aggregates the embeddings of projects and the entities to which they belong to obtain the hidden embedding of the aggregated projects. The module concatenates the hidden embedding of projects with the relationship vector containing the semantics of the project itself and the semantics of its associated entities to obtain the attention weights of the project embedding and the embeddings of its associated entities in the knowledge graph. The module then obtains the final embedding representation of the project based on the attention weights of the project embedding and the embeddings of its associated entities.
[0058] The prediction module is used to predict the user's score for the item based on the final embedding representation of the user and the final embedding representation of the item, and recommend the item based on the score.
[0059] The present invention provides a federated recommendation method based on a knowledge graph attention network, which has the following beneficial effects:
[0060] This paper proposes a novel federated social recommendation framework, which achieves efficient recommendation by integrating user behavior graph, social network graph and knowledge graph; and proposes a graph attention network for social recommendation system, which embeds and represents the three initial graphs through the embedding layer and fuses features, so that it can accurately reflect complex dynamic features. Its propagation layer enhances the features of users and items through multiple graph attention networks, capturing more accurate user preferences and item features. Due to the introduction of social networks, the cold start problem existing in the federated recommendation system is solved to a certain extent; this method uses the graph attention network to integrate user-item interaction, social relations and knowledge graph in the federated recommendation system, thereby improving the accuracy of capturing user preferences and item similarities, and at the same time improving the recommendation effect by considering the implicit information between items and users, and items and entities. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] Figure 1 This is a diagram showing the overall relationship between users, projects, and entities in an embodiment of the present invention;
[0062] Figure 2 Schematic diagram of a graph attention network framework for a social recommendation system in an embodiment of the present invention;
[0063] Figure 3 This is a structural diagram of the propagation layer in an embodiment of the present invention;
[0064] Figure 4 Schematic diagram of an ablation experiment on the Yelp dataset in an embodiment of the present invention.
[0065] Figure 5 Schematic diagram of the ablation experiment on the Douban dataset in an embodiment of the present invention.
[0066] Figure 6 Schematic diagram of a hyperparameter analysis experiment in an embodiment of the present invention.
[0067] Figure 7 Schematic diagram of a pseudo-item sampling experiment in an embodiment of the present invention. DETAILED DESCRIPTION
[0068] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0069] This paper proposes a method for applying federated knowledge-enhanced graph attention networks for privacy-preserving social recommendation (FGAT4SR), which can achieve personalized recommendations while preserving privacy. Specifically, this solution consists of three main components: an embedding representation, a local graph attention network, and a privacy-preserving strategy. Based on the user interaction graph, recommendations are made using the user social relationship graph and the knowledge graph. After receiving the item embedding gradients and model gradients from the server, the embedding layer first converts users, items, and entities into vectors. Then, the propagation layer uses the graph attention network to enhance user and item features, capturing more accurate user preferences and item characteristics. Furthermore, some fake item samples are added to protect user privacy. Localized differential privacy is then applied to the model and embedding gradients. Finally, the model parameters and item embedding gradients are uploaded to the server, completing one round of iteration. Extensive experiments were conducted on two real-world benchmark datasets. The experimental results demonstrate that FGAT4SR outperforms existing recommendation methods while preserving privacy.
[0070] Social recommendation systems: Social networks and recommendation systems share many similarities, such as their downstream tasks including friend relationship prediction and CTR prediction. Precisely because of these similarities and commonalities, social recommendation has been widely used in various application scenarios. Social recommendation aims to alleviate the cold start problem by leveraging the social links between users. Social recommendation methods can be categorized into matrix factorization (MF)-based methods and GNN-based methods. The MF-based method can be implemented by leveraging ratings and social relationship matrices. SocialMF, a matrix factorization technique for social network recommendation based on trust propagation, introduces a regularizer to constrain the difference between a user's preferences and the average taste of his or her friends. SoRec, a social recommendation method based on probabilistic matrix factorization, jointly decomposes interaction relationships and social matrices, projecting interaction and social context into the same semantic space. With the widespread application of neural networks, social recommendation based on graph neural networks has made significant progress. Graph-based social recommendation represents social networks as graphs and leverages high-order social influence to learn user preferences, enhancing the representation of user preferences. A neural influence and interest diffusion network (DiffNet) for social recommendation is proposed, which models the diffusion process of high-order social influence to enhance user embedding representations. Building on DiffNet, DiffNet++ further improves upon it by utilizing hierarchical attention to combine the diffusion of social influence and the propagation of user-item interests. Furthermore, SocialLGN, a light graph convolutional network for social recommendation, is proposed. This network models user interactions and social behaviors to improve recommendation effectiveness. Although social networks can improve the performance of recommendation systems to a certain extent, these works have not considered integrating all knowledge to maximize the learning capacity of neural networks.
[0071] Knowledge-enhanced recommendation systems: Traditional recommendation methods often fail to achieve personalized recommendations while protecting user privacy. With the widespread adoption of knowledge graphs, many researchers have begun leveraging them to enhance recommendation systems. Most of these methods consider using knowledge graphs to represent and connect items. Specifically, knowledge graphs can serve as auxiliary information to guide recommendation systems, leveraging relational networks to learn user-item and inter-item relationships. Some researchers have proposed a multimodal knowledge graph attention network (MKGAT) to achieve more accurate recommendations. MKGAT constructs a knowledge graph by extracting information about adjacent entities and scoring triplets to establish relationships. Some researchers have proposed a neural influence and interest diffusion network (Ripp-MKR) for social recommendation, combining the advantages of preference propagation and user-item interaction to mine high-level information from knowledge graphs. Some researchers have proposed propagating user preferences (RKG) on the knowledge graph of a recommender system, considering using a knowledge graph based on user preferences to enhance recommendation performance. RKG can be divided into two steps: obtaining a user's preference list and analyzing the relationships between the user's preferred items and non-interacted items. However, existing knowledge graph-based recommendation systems do not take social relationships (i.e., user-user relationships) into account. Cold start is still an unsolved problem.
[0072] Federated Recommender Systems: Researchers have proposed a privacy-preserving recommendation system, SharedMF, which uses secret sharing to address the issue of item feature vector gradients leaking user rating information. Researchers have also proposed a secure federated matrix factorization (FedMF), which uses homomorphic encryption to achieve privacy protection. Further research has revealed that during training, only items with which users have interacted need to upload gradients, allowing attackers to derive user ratings and some private information. Researchers have added perturbations to randomly sampled items and simulated ratings, effectively obfuscating the server but also reducing model accuracy. Researchers have proposed a user-level local differentially private federated recommender system. This system uses a local differentially private module to encrypt the gradient matrix of item latent vectors and, through a proxy network, removes user metadata to obtain a privacy-preserving item update gradient matrix, preventing the threat of third-party reconstruction attacks. However, the application of differential privacy also affects the model's effectiveness. Researchers have proposed Federated Social Recommendation (FedSoG) based on graph neural networks. This is a federated learning framework for social recommender systems. It addresses the challenges of privacy protection and personalized recommendations by decentralized data storage and local client integration of user private data. Some researchers have proposed a federated graph neural network (FedGNN) for privacy-preserving recommendations. Each user locally stores a local user-item graph and proposes a method for expanding the user-item graph. This method can expand the local user-item graph without compromising privacy. Other researchers have proposed FedNewsRec, an improved federated recommendation framework for news recommendations. This framework constructs a recommendation model by combining a user model that models user interests and a news model that learns news representations. The model gradients are calculated locally, encrypted, and uploaded to the server.
[0073] will be as Figure 1 The overall relationship graph of users, items and entities shown is decomposed into three graphs: user behavior graph, social relationship graph and knowledge graph; each graph includes three objects: users, items and entities.
[0074] User Behavior Diagram A: Based on the user-item relationship, a user-item interaction matrix is designed. To reflect user behavior and preferences. Each item in the matrix represents the rating of different users on different products. For example, if user i rated item j, then On the contrary, if user i has no interaction with item j, Therefore, a user-item interaction graph is constructed to reflect the user's preferences and likes. It can be represented as in It is a set of edges used to mark interaction relationships, which can be inferred
[0075] Social relationship graph B: In the social network graph, if there is a social relationship between user i and user j, Set to 1, otherwise, These binary values form the social matrix As the adjacency matrix between users, it reflects the friendship relationship between users. The social relationship graph is thus represented as in Represents the connections established between users in the relationship graph B, which reflects the social network in the user set.
[0076] Knowledge Graph C: For the relationship between items and entities, the knowledge graph is introduced to enhance the embedding representation of items so that it can adapt to more complex environments. If there is a connection between item j and entity f, =1. On the contrary Such a matrix composed of 1 and 0 constitutes the knowledge matrix used as the item-entity adjacency matrix. The knowledge graph can be represented as in Represents the edges between items and entities in the knowledge graph.
[0077] Federated Recommendation System: In the federated recommendation scenario, there is a central server and a large number of users, each of whom has his or her own private client. In this invention, one user represents one client. u Represents the training set of user u, including item-score pairs (i, Y ui ). If user u has interacted with item i, then Y ui = 1. On the contrary, if there is no interaction, Y ui = 0. Due to the sparsity of the recommendation system, each user has many items that have not been interacted with. u The number of negative samples is set to four times that of positive samples. U and V represent the embedding matrices of users and items respectively, u i is the u-th row of U, representing the latent vector of user i, v j is the jth row of V, indicating the latent vector of item j, Θ represents the learnable model parameters, including the weight vector h, weight matrix W, and bias b. For each user i in the federated recommendation system, u i and local dataset D i It will be saved locally and will not be obtained by the attacker. Other information (including learnable parameters Θ and item embedding matrix V are public) can be obtained by the attacker from the server.
[0078] like Figure 2 As shown, the method specifically includes the following steps:
[0079] S1. Based on the three input graphs, the embedding layer converts users, items, and entities into low-dimensional vector representations. Feature fusion enhances the diversity of the embedded representations, enabling them to accurately reflect complex dynamic features and laying the foundation for further feature collection. Specifically, this includes:
[0080] The embedding layer encodes users, items, and entities:
[0081] First, the input data is converted into low-dimensional embedding vectors for users, items, and entities respectively.
[0082] The embedding layer then fuses features from different sources to enhance the model’s expressive power. For user i, user embedding u i The user's embedding vector p i The eigenvector x associated with it i calculate.
[0083] u i =g(W i ·[p i ,x i ]) (1)
[0084] Among them, W i is the transformation matrix of user i, and g(x) represents a nonlinear transformation function.
[0085] Similarly, for a specific item j, the embedding layer embeds the item’s embedding vector q j and the item feature vector y j Calculate the combination to calculate v j .
[0086] v j =g(W j ·[q j ,y j ]) (2)
[0087] Finally, for the entity f to which the item belongs, according to the entity embedding vector o f and entity feature vector z f , entity embedding e f It can be expressed as:
[0088] e f =g(W f ·[o f ,z f ]) (3)
[0089] Based on the user interaction graph, the user social relationship graph and knowledge graph are used for recommendation. The main goal is to extract high-level semantic information from the three graphs to capture the true preferences of each user and the attractiveness of each item. The embedding layer lays the foundation for more advanced feature integration and refinement.
[0090] S2, continuously iteratively optimize the embedding of users, items and entities through the propagation layer, such as Figure 3 As shown in the figure. The relationship graph attention mechanism and relationship graph aggregation method are used to capture the subtle differences in the relationships between users, items, and entities, thereby further improving the recommendation performance. Specifically, it includes:
[0091] The embeddings of users, items, and entities are input into the propagation layer and operated to discover the deep correlations between them, enhancing the model's ability to identify complex relationships in the data to improve the quality of recommendations.
[0092] The user relationship graph attention network GAT is used to perform deep learning of node embedding. The specific process is as follows Figure 3 As shown in Figure 2, GAT is designed using the self-attention mechanism.
[0093] (1) To learn the node embedding u of user a a First, we use the social graph to aggregate the neighbor embeddings of user a. However, since the contribution of neighboring nodes to user a is not completely equal, different neighbors will have different effects on the central node. Therefore, we use the attention layer to learn the weight of each of their neighboring nodes. Specifically, for each social neighbor in the social network that is a friend of user a, a ,u b >, the attention score can be calculated using the following formula (4):
[0094] α ab =Attention(W1u a ,W1u b ) (4)
[0095] Among them, α ab represents the attention weight, is a linear mapping matrix, and Attention represents the attention layer. In this invention, the attention layer is set as a feedforward neural network and activated by LeakyReLU, which is expressed as:
[0096] α ab =LeakyReLU(A T [W1u a ||W1u b ]) (5)
[0097] Among them T , || represent the transpose and vector concatenation operations of the attention layer parameters, respectively. The subsequent normalization of the attention weights is performed as follows:
[0098]
[0099] Among them, β ab Represents the final attention weight, and exp is the exponential function.
[0100] The above formula calculates the attention weights of the user's neighbors, mainly focusing on processing the information of the social relationship graph.
[0101] Next, we use the interaction graph to aggregate the influence of users and items in the same way to analyze the user-item interaction relationship. a , v c > is calculated based on the attention weight, γ ac The calculation is as follows:
[0102] γ ac =Attention(W2u a ,W2v c ) (7)
[0103] γ ac =LeakyReLU(B T [W2u a ||W2v c ]) (8)
[0104] in is the mapping matrix, Represents the weights of the attention layer of the user interaction graph. Then, by applying softmax to item neighbors, the attention weights of the interacting item neighbors can be derived.
[0105]
[0106] where δ ac is the attention weight of the normalized item over all neighboring items. This operation yields the attention weights for user-user neighbors and user-item neighbors. Next, the influence of user and item neighbors is aggregated.
[0107] User relationship graph aggregation: Computing the embedding of the central user (current user) requires aggregating the attention weights of social user neighbors and interaction item neighbors, h b 、h c is the hidden embedding of the aggregated user neighbors and item neighbors, expressed as:
[0108]
[0109] in, Represents the mapping weight matrix. On the other hand, social relationships, user interactions, and central nodes contribute differently to the learning process. Therefore, when aggregating hidden embeddings and central nodes (current users), differentiated considerations are needed to optimize the model's performance. They are the social relationship semantics, the user-item relationship semantics, and the semantics of the central node itself. That is, the hidden embedding and the relationship vector are connected, and the attention mechanism is used to calculate the weight.
[0110]
[0111] Among them, ε self , ε neighbor , ε interaction Represent the attention weights of the central node, hidden user neighbors, and hidden item neighbors respectively. is the weight vector of the attention layer. Finally, the final embedding u of user i can be inferred by calculating final :
[0112] u final =ε self u a +ε neighbor h b +ε interaction h c (15)
[0113] After the above operations, the user embedding of each client is retained, personalized recommendations are achieved, and user embedding can better reflect personal preferences.
[0114] (2) Similarly, knowledge graphs are used to enhance project embeddings, cleverly integrating the contextual attributes between projects and entities, thereby promoting feature fusion.
[0115] To learn the node embedding v for item d d , we consider starting from two aspects. First, we use the knowledge graph to aggregate the neighbor embeddings of project d. However, the contribution and influence of different related entities on project d are different. Therefore, we introduce the attention layer to learn their weights. Specifically, for each entity belonging to project d in the knowledge graph, we pair them with project d and use <v d , e f > is used to represent the attention score, which is expressed as:
[0116] ζ df =Attention(W3v d ,W3e f ) (16)
[0117] ζ df =LeakyReLU(DT [W3v d ||W3e f ]) (17)
[0118] Among them, df , D, || represent the attention weight, attention layer parameter and vector connection operation respectively, is a linear mapping matrix, Attention represents the attention layer. In this paper, the attention layer is defined as a feedforward neural network and uses LeakyReLU activation.
[0119] Next, calculate the attention weight of the central node item d, which can be calculated by the softmax function:
[0120]
[0121] Among them, η df is the attention weight of item d. Next, the relationship graph of items and entities is aggregated, and the hidden embedding h of item-entity d It can be calculated by aggregating the attention weight formula of the associated entities:
[0122]
[0123] in, Represents the mapping weight matrix. Intuitively, the influence of entity neighbors and central nodes on the learning process is different, similar to the calculation method of user embedding, and attention should be paid to their inherent differences. d , ψ e The semantics of the central node itself and the semantics of the associated entities are retained separately. The hidden embedding and the relation vector are then connected, and the attention mechanism is used to calculate the weight.
[0124]
[0125]
[0126] Among them, ε item and ε knowledge Represent the attention weights of the current project and the associated entities in the knowledge graph, is the weight vector of the attention layer, h e is the item hidden embedding. Finally, the final item embedding v can be calculated final :
[0127] v final =ε item v d +ε knowledge h d (twenty two)
[0128] The process described above is similar to using a knowledge graph to enhance the knowledge of items. Based on this, enhanced user embeddings and item embeddings are obtained and used to make predictions.
[0129] S3. Two privacy-preserving strategies are proposed, including local differential privacy and pseudo-item interaction. These privacy-preserving methods will be added to protect user privacy. Specifically, pseudo-item interaction and local differential privacy can defend against privacy attacks, protecting gradients and preventing the leakage of user-rated items, respectively.
[0130] (1) Local differential privacy: Traditional differential privacy is to centralize the original data in a data center, then apply the differential privacy algorithm to the data and publish it to the public. This is called centralized differential privacy. Therefore, centralized differential privacy must ensure that the collected data cannot be stolen. However, in real life, it is very difficult to find a truly trustworthy third-party data collection platform, which greatly limits the application of centralized differential privacy. Therefore, localized differential privacy came into being. Based on the premise of an untrusted third party, it transfers the work of data privacy to each user, allowing users to process and protect their personal data themselves, greatly reducing the possibility of privacy leaks.
[0131] LDP is the most widely used privacy protection method. This paper introduces LDP into FGAT4SR and performs two-way privacy protection on the project gradient g. i and the model gradient g m For gradient clipping, the calculation method of LDP is expressed as:
[0132]
[0133] in, where represents the uploaded gradient, clip(g, τ) represents the constraint of g using τ, and Laplacian(0, σ) is Laplacian noise with mean 0 and strength σ. It is worth noting that the present invention considers that it is unreasonable to use the same noise when processing different noises, and thus also adds an adaptive dynamic noise σ·mean(g).
[0134] (2) Pseudo-project interaction: The proposed FedMF uses homomorphic encryption technology to achieve the purpose of privacy protection, but incurs additional resource consumption.
[0135] In existing work, when no privacy protection measures are in place, only interacted items are required to upload gradients. This allows attackers to steal private information about interacted items based on the gradients uploaded over two rounds. This paper proposes a new privacy protection method called pseudo-item interaction. Specifically, a novel training rule is developed. In each local client, n uninteracted items are sampled and then fed into the embedding and propagation layers. The local model is used to calculate the ratings of these pseudo-items and optimize the model.
[0136] Based on the above operation, the calculated gradient includes information about both the real gradient and the gradient of the pseudo-item, making it impossible for an attacker to correctly distinguish which gradients contain private information. Furthermore, the additional introduction of pseudo-items also addresses the cold start and sparsity issues to a certain extent, achieving the effect of data augmentation.
[0137] S4. Propose a prediction layer, where the final user embedding and item embedding are used to determine the prediction score. Optimize the model by reducing the loss function. Specifically, this includes:
[0138] When user i and item j have not interacted, use To predict the score, which represents the preference of user i for item j. The calculation method is:
[0139]
[0140] Where Υ represents the interaction function.
[0141] In recommender systems based on matrix factorization, Y is fixed. In neural network-based recommender systems, such as NCF and NGCF, Y is learnable. The specific model chosen for a recommender system may vary in different scenarios. It is worth noting that the framework described in this invention can be deployed in various models.
[0142] In this invention, in order to predict the scores of local users for items for recommendation, the recommendation list is calculated by calculating the dot product of user embedding and item embedding. For user i and item v, the predicted score is It can be calculated by the following formula:
[0143]
[0144] Where “·” represents the dot product operation.
[0145] Subsequently, binary cross entropy (BCE) loss is used as the loss function to quantify the gap between the true value and the predicted score. The loss function L BCE Expressed as:
[0146]
[0147] Experiments have shown that:
[0148] Two real-world recommendation system datasets are used, namely Yelp and Douban. In order to evaluate the effectiveness of the method proposed in this invention, a large number of experiments were carried out on these two datasets. Yelp covers areas such as shopping, hotels, and tourism, and is mainly used for point of interest recommendation, user behavior analysis, and multimodal sentiment mining. The dataset covers 10 cities around the world, including Edinburgh and Karlsruhe, and contains 65,514 users, 16,022 merchants, and 10,393.31 billion interaction records. Each record contains user ID, merchant ID, geographic location, merchant classification label, and check-in time. In addition, it also contains richer interaction records and knowledge graph triples (about 1.85 million),
[0149] The detailed information of the dataset is shown in Table 1.
[0150] Table 1 Detailed information of the dataset
[0151]
[0152] Two different types of baseline methods are used for comparison: a centralized traditional recommendation method and a federated recommendation method:
[0153] Traditional recommendation methods include: a personalized ranking algorithm BPR based on Bayesian posterior optimization, which is mainly used to solve the top-K problem of recommendation systems. It uses implicit feedback data to learn user preferences for items and optimizes recommendation results by maximizing the probability that users correctly rank items. A method based on social matrix decomposition, SocialMF, adds a regularization term to constrain the difference between user preferences and the average preferences of friends. An innovative recommendation system model KGAT, which can explicitly utilize high-order correlation information in the knowledge graph and distinguish the importance of different neighbor nodes through the attention mechanism, thereby significantly improving the interpretability and accuracy of the recommendation effect. A deep learning model NGC F based on graph neural networks, which models the relationship between users and items as an interaction graph and captures the complex and high-order connectivity between users and items through graph convolutional networks. This method can more deeply understand the user's potential interests and the correlation between items, thereby providing more accurate recommendations.
[0154] GAT4SR: This framework removes the federated learning framework from FGAT4SR and is a traditional centralized recommendation model. In other words, it simply integrates social networks and knowledge graphs into a graph-based recommendation system.
[0155] Federated recommendation methods include: a secure matrix factorization framework based on federated learning (FedMF). This framework ensures the security of user data during transmission and computation through homomorphic encryption and distributed computing, avoiding the potential privacy leakage risks associated with traditional matrix factorization methods and enhancing the security and privacy protection capabilities of recommendation systems. An effective federated recommendation framework combines federated learning with a graph neural network (FedGNN). On the one hand, it trains a global GNN model from decentralized user data while protecting user data privacy. On the other hand, FedGNN leverages high-order user-item interaction information to improve recommendation performance. An innovative federated social recommendation framework, FedSog, processes user data in a distributed manner, protecting user privacy while leveraging graph neural networks to capture complex social relationships and high-order interaction information between users, thereby providing more personalized and accurate recommendation services. A personalized federated recommendation method, FedRAP, introduces a bilateral personalization strategy that takes into account both user and item information, enhancing privacy protection and personalized recommendations. By gradually increasing the regularization weight, a smooth transition from comprehensive to additive personalization is achieved. Furthermore, FedRAP employs a global item embedding sparsification strategy to reduce communication costs.
[0156] Evaluation Method: Recall@K and normalized discounted cumulative gain@K (NDCG) are used as metrics to measure recommendation performance. K is set to 20. Recall@N and NDCG@N represent relevance and ranking accuracy, respectively, and are calculated using formulas (29) to (31). Higher scores for these two metrics indicate better recommendation performance. In addition, five experiments were conducted and the averaged values were taken to reduce the impact of errors.
[0157]
[0158] Among them, TP represents the number of correct positive sample predictions, and FN represents the number of incorrect positive sample predictions. i Indicates whether the item at position i is liked by the user. If the user likes the i-th item, then rel i = 1. On the contrary, if the user does not like the i-th item, rel i = 0. p represents the total number of products.
[0159] Parameter Settings: The experiment was deployed in PyTorch. The dataset scores were split into a training set (75%) and a test set (25%). The number of epochs was set to 200 to ensure model convergence. User and item embeddings were set to 16. The Adam optimizer was used to optimize the parameters. The learning rate did not significantly affect the experimental results and was set to 0.001. For privacy hyperparameters, the clipping threshold η was set to {0.1, 0.3, 0.5}, and the noise intensity λ in the LDP was set to {0.1, 0.2, 0.3}.
[0160] To demonstrate the superiority of FGAT4SR, the proposed model is compared with the baseline methods and the results are shown in Table 2.
[0161] Table 2 Recommended performance table
[0162]
[0163] Compared to traditional recommender systems, GAT4SR demonstrated superior performance across all datasets, highlighting the effectiveness of our proposed method. By leveraging the rich information contained in social networks and knowledge graphs, GAT4SR achieved improvements of 5.7% and 7.25% in Recall@N and NDCG@N, respectively, demonstrating its exceptional ability to capture high-level information. Among federated recommendation methods, FGAT4SR also outperformed other baseline methods. Due to the high efficiency of graph representation, our proposed method even surpassed the performance of some traditional recommendation methods, such as BPR.
[0164] Compared with matrix decomposition-based methods such as BPR and FedMF, the present invention enhances the representation learning of users and products through attention mechanism and graph learning. This reflects the importance and effectiveness of graph neural networks in recommendation systems. As shown in Table 2, the method proposed in the present invention is better than the existing GNN-based recommendation system. Although FedGNN and FedSog use graph representation learning for enhancement, they still lack an effective method to utilize the potential collaborative information of social networks and knowledge graphs. The method of the present invention integrates user interactions and social relationship knowledge graphs into a unified representation, and improves the recommendation effect by capturing the complex interactions inherent in the data. Therefore, FGAT4SR can achieve better recommendation performance than the benchmark.
[0165] Ablation Experiments: To evaluate the importance of each core component in the proposed method, an ablation study is conducted by creating multiple model variants:
[0166] 1.FGAT4SR w / o SN: The social network graph component was removed.
[0167] 2. FGAT4SR w / o KG: the component of knowledge graph enhancement is removed.
[0168] Ablation experiments are performed to evaluate the various components in the experiment to show how the model benefits from these graphs. Figure 4 and Figure 5 shown.
[0169] like Figure 4 and Figure 5 As shown in Figure 3, FGAT4SR achieves the highest scores for both Recall@N and NDCG@N. Removing social augmentation (FGAT4SR w / o SN) or knowledge graph augmentation (FGAT4SR w / o KG) significantly impairs the effectiveness of the model. This suggests that these components play a crucial role in capturing nuanced user-item interactions and preferences.
[0170] Therefore, it can be concluded that the components are effective and important for the proposed method to improve the recommendation performance.
[0171] Hyperparameter analysis: Although local differential privacy and pseudo-item sampling can protect user privacy, they can also harm model performance. Therefore, it is necessary to select an optimal value to balance the relationship between privacy protection and recommendation performance. This paper mainly analyzes the impact of the hyperparameters of the privacy protection part of FGAT4SR on recommendation performance. The experimental results are shown in Figure 2. Figure 6 shown.
[0172] Local differential privacy can modify uploaded gradients by injecting noise. In local differential privacy, two parameters (the gradient clipping threshold μ and the Laplace noise size λ) also affect the training process, so we also conducted experimental studies. Figure 6 (a) and Figure 6 (b) shows the change curves of recommendation performance on the two datasets affected by hyperparameters. The following conclusions are drawn:
[0173] When the noise size λ is fixed, the recommendation performance of FGAT4SR increases with the increase of the threshold μ. This is mainly because a large threshold will clip less true gradients and be closer to the true gradient;
[0174] When the clipping threshold μ is fixed, the performance of FGAT4SR deteriorates as the noise λ increases. This is because larger noise will inject more noise information into the model, interfering with the model's judgment. Therefore, a smaller noise λ should be used.
[0175] Sampling fake items can protect gradients from being stolen and reduce the risk of privacy leakage. In order to evaluate the impact of the number of fake item interactions on performance, the present invention set different k and conducted experiments on two datasets. Intuitively, the more fake items added, the more computational cost is required, resulting in a decrease in recommendation performance. However, Figure 7 As shown in Figure 2, as the number of pseudo-items increases, the recommendation performance of the present invention shows a trend of first increasing and then decreasing. One reason for this is the sparsity of the dataset. When the number of interactions is low, adding pseudo-items can address the sparsity issue to a certain extent. However, as the number of sampled items increases, the noise generated by the pseudo-items increases, resulting in a decrease in recommendation performance.
[0176] Therefore, in order to build an optimal federated recommendation system, it is necessary to balance the relationship between recommendation quality and privacy protection. This paper proposes a new federated social recommendation framework FGAT4SR, which can achieve personalized recommendations while protecting user privacy. Specifically, by integrating user-item interactions, social relationships and knowledge graphs in the federated recommendation system, the accuracy of capturing user preferences and item similarities is improved, thereby improving the efficiency of recommendations. By integrating them together using a graph attention network, user preferences and product features can be better reflected to achieve personalized recommendations. Secondly, privacy protection is achieved through pseudo-item interactions and local differential privacy. On the other hand, due to the introduction of social networks, the cold start problem in the federated recommendation system can also be solved to a certain extent. A large number of experiments have demonstrated the superiority of the method proposed in this paper on real-world datasets, which can achieve privacy protection.
[0177] Based on the same inventive concept, the present invention also includes a federated recommendation system based on a knowledge graph attention network, comprising:
[0178] The construction module is used to construct the interaction graph between users and projects, the social relationship graph between users, and the knowledge graph between projects and their entities. The interaction graph, social relationship graph, and knowledge graph are input into the graph neural network, and the embedding of users, projects, and entities is obtained by encoding them.
[0179] The user embedding representation module is used to aggregate the user's neighbor embeddings using the social relationship graph and learn the attention weight of each user's neighbor embedding using the attention layer. The user and project embeddings are aggregated through the interaction graph and the attention weight of the project's neighbor embedding is learned using the attention layer. The attention weight of each user's neighbor embedding and the project's neighbor embedding are aggregated to obtain the aggregated hidden embeddings of the user's neighbors and project's neighbors. The attention layer is used to calculate the attention weights of the hidden embeddings of the current user, the user's neighbors, and the project's neighbors to obtain the user's final embedding representation.
[0180] The project embedding representation module is used to aggregate the neighbor embeddings of projects using the knowledge graph and learn the attention weights of all the neighbor embeddings of projects through the attention layer. The module aggregates the embeddings of projects and the entities to which they belong to obtain the hidden embedding of the aggregated projects. The module concatenates the hidden embedding of projects with the relationship vector containing the semantics of the project itself and the semantics of its associated entities to obtain the attention weights of the project embedding and the embeddings of its associated entities in the knowledge graph. The module then obtains the final embedding representation of the project based on the attention weights of the project embedding and the embeddings of its associated entities.
[0181] The prediction module is used to predict the user's score for the item based on the final embedding representation of the user and the final embedding representation of the item, and recommend the item based on the score.
[0182] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
Claims
1. A federated recommendation method based on knowledge graph attention network, characterized in that: The following steps are involved: Construct an interaction graph between users and projects, a social relationship graph between users, and a knowledge graph between projects and their entities. Input the interaction graph, social relationship graph, and knowledge graph into a graph neural network, and obtain embeddings of users, projects, and entities by encoding them. The social graph is used to aggregate the user's neighbor embeddings, and the attention layer is used to learn the attention weights of each user's neighbor embeddings; Aggregate the embeddings of users and items through the interaction graph, and use the attention layer to learn the attention weights of the item neighbor embeddings; aggregate the attention weights of each user's neighbor embedding and the item neighbor embedding to obtain the hidden embeddings of the aggregated user's neighbors and item neighbors; An attention layer is used to calculate the attention weights of the hidden embeddings of the current user, user neighbors, and item neighbors to obtain the final embedding representation of the user; Use the knowledge graph to aggregate the neighbor embeddings of the project, and learn the attention weights of all the neighbor embeddings of the project through the attention layer; Aggregate the embeddings of an item and its entity to obtain the hidden embedding of the aggregated item; Concatenate the hidden embedding of the item with the relation vector containing the semantics of the item itself and the semantics of the associated entity to obtain the attention weight of the item embedding and the embedding of its associated entity in the knowledge graph; based on the attention weight of the item embedding and the embedding of its associated entity, obtain the final embedding representation of the item; Based on the final embedding representation of the user and the final embedding representation of the item, the user's score for the item is predicted, and the item is recommended based on the score.
2. A federated recommendation method based on a knowledge graph attention network according to claim 1, characterized in that: The construction of the interaction graph between users and projects, the social relationship graph between users, and the knowledge graph between projects and their entities specifically includes: Based on the user-item relationship, build a user-item interaction matrix When user i over-rates item j, When user i has no interaction with item j, According to the user-item interaction matrix, a user-item interaction graph that can reflect the user's preferences and favorites is constructed, which is expressed as in It is a set of edges used to mark interaction relationships; U and V represent the embedding matrices of users and items respectively; Build a social matrix based on the social relationships between users As the adjacency matrix between users, when there is a social relationship between user i and user j, then otherwise According to the social matrix Construct a social relationship graph that can reflect the friendly relationship between users, expressed as in Represents the connections established between users in the social graph; Based on the relationship between items and entities, a knowledge matrix is constructed to serve as the adjacency matrix between items and entities. When a connection is established between item j and entity f, on the contrary The knowledge graph is constructed according to the knowledge matrix, which is expressed as in Represents the edges between items and entities in the knowledge graph.
3. A federated recommendation method based on a knowledge graph attention network according to claim 1, characterized in that: The encoding of users, items, and entities through the embedding layer to obtain embeddings of users, items, and entities includes the following steps: Convert interaction graphs, social relationship graphs, and knowledge graphs into embedding vectors of users, items, and entities, respectively. represents the d-dimensional real space; By fusing the embedding vector p of user i i Its associated eigenvector x i , get user embedding u i ; By fusing the embedding vector q of item j j Its eigenvector y j , get the item embedding v j ; By fusing the embedding vector o of the entity f to which the project belongs f Its eigenvector z f , get the entity embedding e f .
4. A federated recommendation method based on a knowledge graph attention network according to claim 3, characterized in that: The method uses a social relationship graph to aggregate the neighbor embeddings of users, and uses an attention layer to learn the attention weights of each neighbor embedding of the user, specifically including the following steps: For each social pair in the social network that is a friend of user a a ,u b >, its attention weight α ab for: α ab =Attention(W1u a ,W1u b )=LeakyReLU(A T [W1u a ||W1u b ]); in, is the linear mapping matrix, u b Indicates that a are users with friend relationships; Attention represents the attention layer, which is activated by setting the attention layer as a feedforward neural network and using LeakyRe LU; A represents the attention layer parameters, T represents the transpose of the attention layer parameters, and || represents the vector connection operation; According to α ab , get the final attention weight β of the user's neighbors ab for: Where exp is the exponential function.
5. A federated recommendation method based on a knowledge graph attention network according to claim 4, characterized in that: The method aggregates the embeddings of users and items through the interaction graph and uses the attention layer to learn the attention weights of the item neighbor embeddings. Specifically, it includes the following steps: For the user-item interaction relationship in the interaction graph between users and items a , v c >, its attention weight γ ac Expressed as: γ ac =Attention(W2u a ,W2v c )=LeakyReLU(B T [W2u a ||W2v c ]); in is the mapping matrix, B represents the user-item interaction graph attention layer; According to γ ac , we get the attention weight δ of the item neighbor embedding in the interaction graph ac for:
6. A federated recommendation method based on a knowledge graph attention network according to claim 5, characterized in that: aggregating the attention weights of each user neighbor embedding and item neighbor embedding to obtain the aggregated hidden embeddings of the user neighbors and item neighbors; The attention layer is used to calculate the attention weights of the hidden embeddings of the current user, the user's neighbors, and the item's neighbors to obtain the final embedding representation of the user. The specific steps include: Aggregate the attention weights of each user’s neighbors and the attention weights of the item’s neighbors to obtain the aggregated hidden embedding h of the user’s neighbors. b and the hidden embedding h of the item’s neighbors c , respectively expressed as: in, represents the mapping weight matrix; Concatenate the hidden embedding with the relation vector containing social relationship semantics, user-item relationship semantics, and user's own semantics, and use the attention mechanism to calculate its attention weight: Among them, ε self , ε neighbor , ε interaction Represent the attention weights of the current user, user neighbor hidden embedding, and item neighbor hidden embedding, respectively. is the weight vector of the attention layer; According to ε self , ε neighbor , ε interaction , get the final embedding u of user i final Expressed as: you final =e self you a +e neighbor h b +e interaction h c 。 7. A federated recommendation method based on a knowledge graph attention network according to claim 3, characterized in that: The method of aggregating neighbor embeddings of a project using the knowledge graph and learning the attention weights of all neighbor embeddings of the project through the attention layer specifically includes the following steps: For each entity e in the knowledge graph that belongs to item d f , the entity e f Paired with item d, it is represented as <v d , e f >, its attention weight ζ df Expressed as: g df =Attention(W3v d ,W3e f )=LeakyReLU(D T (W3v d ||W3e f ]); Among them, D represents the attention layer parameter, is a linear mapping matrix; According to df , calculate the attention weights of all neighbors of item d:
8. A federated recommendation method based on a knowledge graph attention network according to claim 7, characterized in that: The method of obtaining the final embedding representation of the project based on the attention weight of the project embedding and its associated entity embedding specifically includes the following steps: Perform graph aggregation on the item embedding and its associated entity embedding to obtain the aggregated hidden embedding h d : in, represents the mapping weight matrix; Combine hidden embeddings with the semantics of the included item itself ψ d and associated entity semantics ψ e The relationship vectors are connected and the attention weights are calculated using the attention mechanism: Among them, ε item and ε knowledge Represent the attention weights of the current project and the associated entities in the knowledge graph, is the weight vector of the attention layer; T is the transpose of the attention layer parameters, h e Is the item hidden embedded; According to ε item and ε knowledge Get the final project embedding v final for: v final =e item v d +e knowledge h d 。 9. A federated recommendation system based on knowledge graph attention network, characterized in that include: The construction module is used to build the interaction graph between users and projects, the social relationship graph between users, and the knowledge graph between projects and their entities; The interaction graph, social relationship graph, and knowledge graph are input into the graph neural network, and the embedding of users, items, and entities is obtained by encoding them. The user embedding representation module is used to aggregate the user's neighbor embeddings using the social relationship graph and use the attention layer to learn the attention weight of each user's neighbor embedding; Aggregate the embeddings of users and items through the interaction graph, and use the attention layer to learn the attention weights of the item neighbor embeddings; aggregate the attention weights of each user's neighbor embedding and the item neighbor embedding to obtain the hidden embeddings of the aggregated user's neighbors and item neighbors; An attention layer is used to calculate the attention weights of the hidden embeddings of the current user, user neighbors, and item neighbors to obtain the final embedding representation of the user; The item embedding representation module is used to aggregate the neighbor embeddings of items using the knowledge graph and learn the attention weights of all the neighbor embeddings of an item through the attention layer; Aggregate the embeddings of an item and its entity to obtain the hidden embedding of the aggregated item; Concatenate the hidden embedding of the item with the relation vector containing the semantics of the item itself and the semantics of the associated entity to obtain the attention weight of the item embedding and the embedding of its associated entity in the knowledge graph; based on the attention weight of the item embedding and the embedding of its associated entity, obtain the final embedding representation of the item; The prediction module is used to predict the user's score for the item based on the final embedding representation of the user and the final embedding representation of the item, and recommend the item based on the score.