A federated dynamic graph learning optimization method based on knowledge distillation and prototype learning
The federated dynamic graph learning optimization method, which utilizes knowledge distillation and prototype learning, addresses the issues of temporal evolution and data heterogeneity in dynamic graph data. This improves the model's generalization ability and adaptability, while enhancing model performance while ensuring data privacy.
Patent Information
- Application Number
- CN202411529942.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-10-30
AI Technical Summary
Existing federated graph learning methods cannot accurately capture temporal evolution features when processing dynamic graph data, and the model's generalization ability is limited in federated learning environments due to data heterogeneity, making it unable to adapt to diverse dynamic graph data.
We adopt a federated dynamic graph learning optimization method based on knowledge distillation and prototype learning. By preserving temporal evolution features through global knowledge distillation and combining regularization constraints and personalized aggregation mechanisms of global prototypes, we can improve the generalization ability and adaptability of the model.
It effectively captures the temporal evolution features in dynamic graphs, reduces the impact of data heterogeneity, improves the generalization ability of the global model and the model inference ability of each client, and improves the performance of the model while ensuring data privacy.
Smart Images

Figure CN119293294B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a federated dynamic graph learning optimization method based on knowledge distillation and prototype learning and belongs to the technical field of federated learning. BACKGROUND
[0002] With the increasing demand for data privacy protection, federated learning (FL) as a machine learning method capable of protecting data privacy in a distributed environment has been widely applied. In particular, in the graph data scene, federated graph learning (FGL) effectively improves the performance of the model by aggregating the structural information of local graph data between different clients. However, most of the existing federated graph learning methods are designed for static graph data, ignoring the characteristics of dynamic changes of graph data in real applications. The static graph learning method cannot accurately capture the time evolution characteristics when processing dynamic nodes and edges, resulting in poor performance of the model in processing dynamic scenes. Therefore, how to handle the time evolution problem in dynamic graph data without leaking data privacy has become a key technical challenge in federated learning.
[0003] On the other hand, dynamic graph learning (DGL) as a technology to solve the problem of graph data changing over time has shown strong application potential in the fields of social network analysis, recommendation systems and the like in recent years. The DGL method introduces time information so that the model can adapt to the dynamic changes of nodes and edges. However, most of the existing dynamic graph learning methods are based on centralized learning architecture and cannot cope with the data heterogeneity problem in the federated learning scene, that is, the distribution of graph data between different clients is quite different. Due to the uneven distribution of data of each client, the generalization ability of the existing method in the federated learning environment is limited, and the model is prone to performance degradation when facing diversified dynamic graph data. SUMMARY
[0004] The technical problem to be solved by the application is to provide a federated dynamic graph learning optimization method based on knowledge distillation and prototype learning, which effectively captures the time evolution characteristics in dynamic graphs, reduces the influence of data heterogeneity between each client on the performance of the model, ensures the data privacy, improves the generalization ability of the global model, and through the individualized aggregation mechanism, makes the model of each client adapt to different data distribution, thereby improving the reasoning ability of the model.
[0005] The application adopts the following technical scheme to solve the above technical problems: the application designs a federated dynamic graph learning optimization method based on knowledge distillation and prototype learning, a server combines local data node graphs of each client changing with time steps, initializes a time step t=0, and performs the following steps A to F, for a feature extraction model initialized by the server and distributed to each client, performs federated learning training to obtain a trained feature extraction model, and the local data node graph includes each node, the real category of each node under the preset classification, and the edge between each two nodes with contact;
[0006] Step A. Each client applies the local data node graph of the corresponding time step t to the feature extraction model for training to obtain the trained parameter group of the corresponding time step t of the client, and uploads the server; the server aggregates the trained parameter group of the corresponding time step t of each client to obtain the global parameter group of the corresponding time step t and distributes it to each client, and each client forms the parameter group of the first iteration of the corresponding time step t+1 from the global parameter group of the corresponding time step t, updates the t value by 1, and enters step B;
[0007] Step B. Each client filters the local analysis node set of the corresponding time step t of the client based on the local data node graph of the corresponding time step t, then initializes the iteration number l=1, and enters step C;
[0008] Step C. Each client applies the feature extraction model of the corresponding time step t under the first iteration parameter group of the corresponding time step t based on the local data node graph of the corresponding time step t, combines the processing and return of the server, obtains the global prototype of each category under the first iteration of the corresponding time step t, and then enters step D;
[0009] Step D. Each client applies the feature extraction model of the corresponding time step t under the first iteration parameter group of the corresponding time step t, and the feature extraction model under the global parameter group of the corresponding time step t-1, calculates the distillation loss of the first iteration of the corresponding time step t of the client for the local analysis node set of the corresponding time step t;
[0010] Each client applies the feature extraction model of the corresponding time step t under the first iteration parameter group of the corresponding time step t, calculates the classification loss of the first iteration of the corresponding time step t of the client for the node set of the local data node graph of the corresponding time step t;
[0011] Each client calculates the regularization term loss of the first iteration of the corresponding time step t, and then enters step E;
[0012] Step E. Each client respectively synthesizes the sum of the distillation loss, the classification loss and the regularization term loss of the corresponding time step t under the lth iteration to form the comprehensive loss of the corresponding time step t under the lth iteration of the client, and judges whether the difference between the comprehensive losses of each group of adjacent iterations in the continuous preset b iteration steps from the lth iteration to the historical iteration direction is less than the preset loss threshold. If yes, the client completes the training of the feature extraction model at the time step t, the parameter group of the lth iteration of the client at the time step t is the trained parameter group of the client at the time step t, the accuracy of the feature extraction model under the trained parameter group is obtained, and the server is uploaded. Then, step F is entered. If no, the parameter group of the lth iteration of the client at the time step t is updated according to the comprehensive loss of the lth iteration of the client at the time step t, the parameter group of the l+1th iteration of the client at the time step t is formed, and the value of l is updated by 1. Then, step C is returned.
[0013] Step F. The server obtains the average accuracy of the accuracy of the feature extraction model of the trained parameter group of each client at the time step t, judges whether the average accuracy is greater than the preset model accuracy threshold or the global training number reaches the preset global maximum training number. If yes, the federated learning training of the feature extraction model is completed, and each client respectively applies the feature extraction model under the trained parameter group of the corresponding time step t. If no, the server updates the trained parameter group of each client at the time step t, and aggregates the global parameter group at the time step t and sends it to each client. Each client respectively forms the parameter group of the 1th iteration at the time step t+1 of the corresponding time step t by using the received global parameter group at the time step t, updates the value of t by 1, and returns to step B.
[0014] As a preferred technical solution of the application: in step B, the following steps are performed respectively for each client:
[0015] Step B1. Traverse the node set of the local data node graph of the client at the time step t In each node, judge whether the node belongs to the local data node graph of any historical time step before the time step t. If yes, mark the activity degree of the node as 0, otherwise mark the activity degree of the node as 1, and update the node set K represents the number of clients, represents the node set of the local data node graph of the kth client at the time step t.
[0016] Step B2. Screening obtains the node set In the node set of the L-hop neighborhood node set of any node with an activity degree of 1 denotes a set of nodes in the local data node graph corresponding to the kth client at time step t, which do not belong to the L-hop neighborhood node set of any active degree 1 node, L denotes the number of network layers of the feature extraction model;
[0017] Step B3. According to the following formula:
[0018]
[0019] Obtain the node set The loss value under the local data node graph corresponding to the kth client at time step t-1 And the node set Each node The loss value under the local data node graph corresponding to the kth client at time step t-1 Wherein, denotes, denotes the adjacency matrix of the edge in the local data node graph corresponding to the kth client at time step t-1, I denotes the unit matrix, denotes the standardized adjacency matrix of, denotes the parameter group after training corresponding to the kth client at time step t-1, denotes the feature vector extracted by the feature extraction model based on the parameter group with as input, obtain the set of predicted classifications of each node in denotes the set of real classifications corresponding to each node in denotes the loss function, denotes the i th node in the node set denotes the feature vector extracted by the feature extraction model based on the parameter group with as input, obtain the predicted classification of the i th node in denotes the real classification corresponding to the i th node in the node set
[0020] Step B4. Screen the node set in which each node meets to form the candidate node set and further according to the following formula:
[0021]
[0022] Obtain the candidate node set Each node in Loss values under the local data node graph at time step t of the k-th client in, Represents the set of candidate nodes The j-th node, Let represent the adjacency matrix of the edges in the local data node graph corresponding to time step t of the k-th client. express The standardized adjacency matrix, Indicates As input, based on parameter set The feature vectors extracted by the feature extraction model yield a set of candidate nodes. The predicted classification of the j-th node. Represents the set of candidate nodes The true classification corresponding to the j-th node in the middle;
[0023] Step B5. Calculate the candidate node set Each node Corresponding to The difference is used as the influence value of each node, and the candidate nodes are sorted from largest to smallest influence value. The nodes in the set are sorted to form a candidate node set. The corresponding node sorting;
[0024] Step B6. Select a set of candidate nodes The corresponding node sorting is the first These nodes constitute the local analysis node set for the k-th client at time step t. in, Represents the set of candidate nodes The number of nodes, where 'a' represents the preset ratio, 0 <a<1, This indicates rounding up to the nearest integer.
[0025] As a preferred embodiment of the present invention, step C includes the following steps:
[0026] Step C1. Each client applies its corresponding time step t to the l-th iteration parameter set. The feature extraction model performs forward propagation on each node in the local data node graph at time step t to obtain the feature vector of each node. Then, it divides each node into different ground truth classes and obtains the average feature vector of each node in each ground truth class. This average feature vector serves as the local prototype for each class in the l-th iteration at time step t for the client. Uploaded to the server; This represents the parameter set for the l-th iteration at time step t corresponding to the k-th client. This represents the local prototype of category c in the l-th iteration at time step t for the k-th client;
[0027] Step C2. The server applies the local prototypes of each category uploaded by each client at the corresponding time step t for the lth iteration. Using the category of the local prototype as input and the local prototype as output, the neural network model H in the server is trained again to obtain the trained model H at time step t in the l-th iteration. (t,l) ;
[0028] Step C3. The server applies the trained model H from the l-th iteration at time step t to each category. (t,l) Processing is performed to obtain the global prototypes of each category in the l-th iteration at time step t. And then distributed to each client separately; This represents the global prototype of category c in the l-th iteration at time step t.
[0029] As a preferred embodiment of the present invention: in step D, the following steps are performed for each client:
[0030] Step D1. The client applies its corresponding time step t for the l-th iteration parameter set. The feature extraction model below is used to analyze the local analysis node set at its corresponding time step t. Each node m is processed to obtain the local feature vector of each node at time step t in the l-th iteration. And the global parameter group applied at the corresponding time step t-1 The feature extraction models below are designed for the local analysis node sets at the corresponding time step t. Each node m is processed to obtain the global feature vector of each node at time step t-1.
[0031] Step D2. The client uses the following formula:
[0032]
[0033] Obtain the distillation loss of the l-th iteration at time step t on the client side. in, Let m represent the distillation loss of the l-th iteration at time step t corresponding to the k-th client. c Represents the set of local analysis nodes The nodes that belong to category c; This represents the parameter set of the l-th iteration at time step t for the k-th client application. The feature extraction model below is used for the set of local analysis nodes at the corresponding time step t. The nodes belonging to the category c are processed to obtain the local feature vectors of the nodes corresponding to the time step t and the lth iteration, respectively; The prediction category of the node is denoted as C, and the set of preset categories is denoted as The prediction category of the node is denoted as C, and the set of preset categories is denoted as The m c The real category of the node is denoted as, and the preset distillation coefficient is denoted as
[0034] Step D3. The client applies the feature extraction model corresponding to the parameter group of the time step t and the lth iteration to process each node in the node set of the local data node graph corresponding to the time step t of the client, and calculates the classification loss of the client corresponding to the time step t and the lth iteration Step D3. The client applies the feature extraction model corresponding to the parameter group of the time step t and the lth iteration to process each node in the node set of the local data node graph corresponding to the time step t of the client, and calculates the classification loss of the client corresponding to the time step t and the lth iteration
[0035] Step D4. The client calculates the regularization term loss of the client corresponding to the time step t and the lth iteration according to the following formula:
[0036]
[0037] Step D4. The client calculates the regularization term loss of the client corresponding to the time step t and the lth iteration according to the following formula: The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as The regularization term loss of the kth client corresponding to the time step t and the lth iteration is denoted as, the different category set to which each node in the local data node graph corresponding to the time step t of the kth client belongs is denoted as, the number of categories in the set is denoted as, and the cosine similarity between and is denoted as
[0038] As a preferred technical solution of the present application, in step E, each client obtains the distillation loss of the client corresponding to the time step t and the lth iteration according to the following formula:
[0039]
[0040] As a preferred technical solution of the present application, in step E, each client obtains the distillation loss of the client corresponding to the time step t and the lth iteration according to the following formula: As a preferred technical solution of the present application, in step E, each client obtains the distillation loss of the client corresponding to the time step t and the lth iteration according to the following formula: As a preferred technical solution of the present application, in step E, each client obtains the distillation loss of the client corresponding to the time step t and the lth iteration according to the following formula: As a preferred technical solution of the present application, in step E, each client obtains the distillation loss of the client corresponding to the time step t and the lth iteration according to the following formula:
[0041] According to the comprehensive loss of the client corresponding to the time step t and the lth iteration, the parameter group of the client corresponding to the time step t and the lth iteration is updated according to the following formula:
[0042]
[0043] According to the comprehensive loss of the client corresponding to the time step t and the lth iteration, the parameter group of the client corresponding to the time step t and the lth iteration is updated according to the following formula: According to the comprehensive loss of the client corresponding to the time step t and the lth iteration, the parameter group of the client corresponding to the time step t and the lth iteration is updated according to the following formula: η represents model hyperparameters, denotes derivation.
[0044] As a preferred technical solution of the application: in step F, the server updates the trained parameter set corresponding to each client at time step t according to the following steps:
[0045] Step F1. The server updates the trained parameter set corresponding to each client at time step t according to the following formula:
[0046]
[0047] Obtain the cosine similarity between the local prototype and the global prototype of each client at time step t
[0048] Step F2. The server updates the trained parameter set corresponding to each client at time step t according to the following formula: Normalize the cosine similarity
[0049]
[0050] Obtain the cosine similarity normalization result of each client at time step t, and construct the personalized weight of each client at time step t
[0051] Step F3. The server updates the trained parameter set corresponding to each client at time step t according to the following formula:
[0052]
[0053] Update the trained parameter set corresponding to the client at time step t uploaded by the client
[0054] The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning provided by the application has the following technical effects compared with the prior art by adopting the above technical solution:
[0055] (1) The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning is designed to solve the problems of time evolution capture and data heterogeneity in dynamic graph learning. Through the global knowledge distillation technology, the previously learned knowledge is retained, and the time evolution feature relationship of the graph snapshot is effectively captured. The regular term constraint method based on the global prototype is used to reduce the influence of data differences between clients on the model performance, and the contrast learning is introduced to generate the global class prototype, which improves the intra-class compactness and inter-class separability of the model. On the premise of ensuring data privacy, not only the generalization ability of the global model is improved, but also the model of each client can adapt to different data distribution through the personalized aggregation mechanism, which improves the reasoning ability of the model. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 is a flow chart of the federated dynamic graph learning optimization method based on knowledge distillation and prototype learning designed by the present application;
[0057] Figure 2 is a schematic diagram of a federated training algorithm of the federated dynamic graph learning optimization method based on knowledge distillation and prototype learning designed by the present application. DETAILED DESCRIPTION
[0058] The specific embodiments of the present application will be further described in detail below in conjunction with the drawings of the specification.
[0059] The present application designs a federated dynamic graph learning optimization method based on knowledge distillation and prototype learning, which is initialized by the server in combination with the local data node graph of each client changing with time step, such as Brain, at time step t=0, according to Figure 1 and Figure 2 As shown, the following steps A to F are performed for the feature extraction model initialized by the server and distributed to each client, and the federated learning training is performed to obtain the trained feature extraction model. The local data node graph includes each node, the real category of each node under the preset classification, and the edge between each two nodes with contact.
[0060] Step A. Each client applies its local data node graph at time step t to train the feature extraction model and obtains the trained parameter group of the client at time step t, and uploads it to the server. The server aggregates the trained parameter group of each client at time step t to obtain the global parameter group at time step t and distributes it to each client. Each client forms the parameter group of the first iteration at time step t+1 from the global parameter group at time step t, updates the value of t by 1, and enters step B.
[0061] Step B. Each client filters the local analysis node set of the client at time step t from the local data node graph at time step t, initializes the iteration number l=1, and enters step C.
[0062] The above step B is specifically designed to perform the following steps for each client in actual application.
[0063] Step B1. Traverse each node in the node set of the local data node graph of the client at time step t. Determine whether the node belongs to the local data node graph at any historical time step before time step t. If yes, mark the activity of the node as 0, otherwise mark the activity of the node as 1, and update the node set K represents the number of clients, denotes the node set of the local data node graph corresponding to the kth client at time step t.
[0064] Step B2. Screening to obtain the node set denotes the node set of the local data node graph corresponding to the kth client at time step t. denotes the node set of the local data node graph corresponding to the kth client at time step t, L denotes the number of network layers of the feature extraction model.
[0065] Step B3. According to the following formula:
[0066]
[0067] obtaining the node set the loss value of the local data node graph corresponding to the kth client at time step t-1 and the node set each node the loss value of the local data node graph corresponding to the kth client at time step t-1 wherein, denotes, denotes the adjacency matrix of the edge in the local data node graph corresponding to the kth client at time step t-1, I denotes the unit matrix, denotes the standardized adjacency matrix of, denotes the parameter group after training corresponding to the kth client at time step t-1, denotes the feature vector extracted by the feature extraction model based on the parameter group with as input, obtaining the set of predicted classifications of each node in ; denotes the set of real classifications corresponding to each node in , denotes the loss function, denotes the i th node in the node set , denotes the feature vector extracted by the feature extraction model based on the parameter group with as input, obtaining the predicted classification of the i th node in , denotes the real classification corresponding to the i th node in the node set .
[0068] Step B4. Screening to obtain the node set each node in that meets and further according to the following formula:
[0069]
[0070] obtain a candidate node set each node in the loss value of the local data node graph corresponding to the kth client at the time step t wherein, denotes the candidate node set the jth node in denotes the adjacency matrix of the edge in the local data node graph corresponding to the kth client at the time step t, denotes the standardized adjacency matrix of denotes the feature vector extracted by the feature extraction model based on the parameter group as input, obtain the predicted classification of the jth node in the candidate node set denotes the true classification corresponding to the jth node in the candidate node set
[0071] Step B5. Calculate the difference between the of each node in the candidate node set and its corresponding as the affected degree value of the node, and sort the nodes in the candidate node set according to the influence degree value from large to small to form the node ranking corresponding to the candidate node set
[0072] Step B6. Select the top nodes in the node ranking corresponding to the candidate node set to form the local analysis node set wherein, denotes the number of nodes in the candidate node set a denotes a preset proportion, 0 < a < 1, denotes the ceiling function.
[0073] Step C. Each client applies the feature extraction model under the lth iteration parameter group at the corresponding time step t based on the local data node graph corresponding to the time step t, combines the processing and return of the server, and obtains the global prototype of each category under the lth iteration at the corresponding time step t, and then enters Step D.
[0074] The above step C is specifically designed and executed as follows: steps C1 to C3.
[0075] Step C1. Each client applies the feature extraction model under the parameter group of the lth iteration of the corresponding time step t to the nodes in the local data node graph of the corresponding time step t, performs forward propagation, obtains the feature vectors of the nodes, and divides the nodes according to the real categories to obtain the average feature vectors of the nodes in each real category as the local prototypes of each category of the client in the lth iteration of the corresponding time step t. upload to the server; denotes the parameter group of the kth client in the lth iteration of the corresponding time step t, denotes the local prototype of category c of the kth client in the lth iteration of the corresponding time step t.
[0076] Step C2. The server applies the local prototypes of each category uploaded by each client in the lth iteration of the corresponding time step t with the category of the local prototype as the input and the local prototype as the output, continues to train the neural network model H in the server to obtain the trained model H in the lth iteration of the corresponding time step t. (t,l) .
[0077] Step C3. The server applies the trained model H in the lth iteration of the corresponding time step t (t,l) to process each category to obtain the global prototype of each category in the lth iteration of the corresponding time step t and respectively issues to each client; denotes the global prototype of category c in the lth iteration of the corresponding time step t.
[0078] Step D. Each client applies the feature extraction model under the parameter group of the lth iteration of the corresponding time step t and the feature extraction model under the global parameter group of the corresponding time step t-1 to the local analysis node set of the corresponding time step t to calculate the distillation loss of the client in the lth iteration of the corresponding time step t.
[0079] Each client applies the feature extraction model under the parameter group of the lth iteration of the corresponding time step t to the node set of the local data node graph of the corresponding time step t to calculate the classification loss of the client in the lth iteration of the corresponding time step t.
[0080] Each client calculates the regularization term loss in the lth iteration of the corresponding time step t, and then enters Step E.
[0081] In the above step D, for each client, the following steps D1 to D4 are specifically designed and executed.
[0082] Step D1. The client applies the parameter group of the lth iteration of the corresponding time step t the feature extraction model under the parameter group of the kth client corresponding to the time step t-1, respectively processes the nodes belonging to the class c in the local analysis node set of the time step t corresponding to the kth client, and obtains the global feature vector of each node corresponding to the time step t-1, respectively. the feature extraction model under the parameter group of the kth client corresponding to the time step t-1, respectively processes the nodes belonging to the class c in the local analysis node set of the time step t corresponding to the kth client, and obtains the global feature vector of each node corresponding to the time step t-1, respectively. the feature extraction model under the parameter group of the kth client corresponding to the time step t-1, respectively processes the nodes belonging to the class c in the local analysis node set of the time step t corresponding to the kth client, and obtains the global feature vector of each node corresponding to the time step t-1, respectively. the feature extraction model under the parameter group of the kth client corresponding to the time step t-1, respectively processes the nodes belonging to the class c in the local analysis node set of the time step t corresponding to the kth client, and obtains the global feature vector of each node corresponding to the time step t-1, respectively. the feature extraction model under the parameter group of the kth client corresponding to the time step t-1, respectively processes the nodes belonging to the class c in the local analysis node set of the time step t corresponding to the kth client, and obtains the global feature vector of each node corresponding to the time step t-1, respectively.
[0083] Step D2. The client calculates the distillation loss of the kth client corresponding to the time step t and the lth iteration according to the following formula:
[0084]
[0085] Step D3. The client applies the feature extraction model under the parameter group of the kth client corresponding to the time step t and the lth iteration to process each node in the node set of the local data node graph of the kth client corresponding to the time step t, and calculates the classification loss of the kth client corresponding to the time step t and the lth iteration. wherein, denotes the distillation loss of the kth client corresponding to the time step t and the lth iteration, and m c denotes the nodes belonging to the class c in the local analysis node set . denotes the distillation loss of the kth client corresponding to the time step t and the lth iteration, and m denotes the distillation loss of the kth client corresponding to the time step t and the lth iteration, and m denotes the distillation loss of the kth client corresponding to the time step t and the lth iteration, and m denotes the predicted classification of , C denotes a set of preset classes, denotes the real class of the m c node, and γ denotes a preset distillation coefficient.
[0086] Step D3. The client applies the feature extraction model under the parameter group of the kth client corresponding to the time step t and the lth iteration to process each node in the node set of the local data node graph of the kth client corresponding to the time step t, and calculates the classification loss of the kth client corresponding to the time step t and the lth iteration.
[0087] Step D4. The client calculates the regularization term loss of the kth client corresponding to the time step t and the lth iteration according to the following formula:
[0088]
[0089] Step D4. The client calculates the regularization term loss of the kth client corresponding to the time step t and the lth iteration according to the following formula: wherein, denotes the regularization term loss of the kth client corresponding to the time step t and the lth iteration, denotes the different category set to which each node in the local data node graph of the kth client corresponding to the time step t belongs, denotes the set the number of categories in the set denotes the cosine similarity between and
[0090] Step E. Each client respectively obtains the distillation loss of the kth client corresponding to the time step t and the lth iteration according to the following formula:
[0091]
[0092]
[0093] If the difference between the comprehensive losses of each group of adjacent iterations in the preset b consecutive iteration steps from the lth iteration to the historical iteration direction is less than the preset loss threshold, the client completes the training of the feature extraction model corresponding to the time step t, the parameter group of the kth client corresponding to the time step t and the lth iteration is the trained parameter group of the kth client corresponding to the time step t, and the accuracy of the feature extraction model under the trained parameter group is obtained, uploaded to the server, and then step F is entered; otherwise, according to the comprehensive loss of the kth client corresponding to the time step t and the lth iteration, the parameter group of the kth client corresponding to the time step t and the lth iteration is updated according to the following formula:
[0094]
[0095] η denotes a model hyperparameter, denotes the derivative, and the value of l is updated by 1, and the process returns to step C.
[0096] Step F. The server obtains the average accuracy of the feature extraction model accuracy of each client corresponding to the parameter set after training at time step t, and determines whether the average accuracy is greater than the preset model accuracy threshold or the global training number reaches the preset global maximum training number. If yes, the federated learning training for the feature extraction model is completed, and each client applies the feature extraction model under the parameter set after training at time step t corresponding to it; otherwise, the server updates the parameter set after training at time step t corresponding to each client according to steps F1 to F3 below, and aggregates the global parameter set at time step t and issues it to each client. Each client forms the parameter set of the first iteration at time step t+1 corresponding to it by using the received global parameter set at time step t corresponding to it, updates the value of t by 1, and returns to step B.
[0097] Step F1. The server respectively updates each client according to the following formula:
[0098]
[0099] Obtain the cosine similarity between the local prototype and the global prototype of each client at time step t
[0100] Step F2. The server respectively updates each client according to the following formula: Normalize the cosine similarity
[0101]
[0102] Obtain the cosine similarity normalization result of each client at time step t, and form the personalized weight of each client at time step t
[0103] Step F3. The server respectively updates each client according to the following formula:
[0104]
[0105] Update the parameter set after training at time step t corresponding to the client uploaded
[0106] In actual application, each client respectively applies the local data node graph corresponding to the time step t, and before training the feature extraction model, the data set corresponding to the local data node graph is preprocessed, and the preprocessing operation of the data set includes normalization Normalize, so that the model converges faster; tensorization ToTensor, so that the data can be calculated on a general GPU to speed up. The node feature matrix and the edge feature matrix are normalized to ensure that they have similar scales and distributions. Among them, the data augmentation methods for the training set include random node drop RandomNodeDrop, random edge drop RandomEdgeDrop, node feature perturbation FeaturePerturbation, and subgraph sampling SubgraphSampling, etc. These methods can enhance the complexity of the data and prevent the neural network model from overfitting during the convergence process.
[0107] The above design scheme aims to solve the problems of time evolution capture and data heterogeneity in dynamic graph learning. 1) The global knowledge distillation technology effectively preserves the time evolution knowledge, accelerates the model convergence and improves the generalization ability; 2) The global prototype-based regularization term constraint method solves the data heterogeneity problem between clients, greatly improving the consistency and stability of the global model; 3) The global class prototype generated by contrastive learning enhances the intra-class compactness and inter-class separability of the features, significantly improving the classification accuracy; 4) The personalized aggregation method enables the model to adapt to the data distribution of different clients, with stronger adaptability.
[0108] The embodiments of the application are described in detail above in combination with the drawings, but the application is not limited to the above embodiments, and various changes can be made within the knowledge of those skilled in the art without departing from the purpose of the application.
Claims
1. A federated dynamic graph learning optimization method based on knowledge distillation and prototype learning, characterized in that: The server combines the local data node graphs of each client with the local data node graphs that change over time steps, initializes the time step t=0, and executes the following steps A to F: For the feature extraction model that was initialized by the server and distributed to each client, federated learning training is performed to obtain the trained feature extraction model. The local data node graph includes each node, the true category of each node under the preset classification, and the edges between any two nodes that are related. Step A. Each client uses its local data node graph at its corresponding time step t to train the feature extraction model, obtains the training parameter set for the client at the corresponding time step t, and uploads it to the server. The server aggregates the trained parameter sets for each client at time step t, obtains the global parameter set for time step t, and distributes it to each client. Each client uses the global parameter set for time step t to form the parameter set for the first iteration of time step t+1, updates the t value by 1, and proceeds to step B. Step B. Each client filters its local data node graph for its corresponding time step t to obtain the set of local analysis nodes for that client's corresponding time step t, then initializes the iteration count l = 1, and proceeds to step C; Step C. Each client, based on its local data node graph at its corresponding time step t, applies the feature extraction model under the parameter group of the l-th iteration at its corresponding time step t, and combines the server's processing and return to obtain the global prototype of each category under the l-th iteration at the corresponding time step t, and then proceeds to step D. Step D. Each client applies its feature extraction model under the parameter set of the l-th iteration at its corresponding time step t, and its feature extraction model under the global parameter set at its corresponding time step t-1, to calculate the distillation loss of the l-th iteration at its corresponding time step t for the local analysis node set. Each client applies its feature extraction model under the parameter set of the l-th iteration at its corresponding time step t, and calculates the classification loss of the l-th iteration at the corresponding time step t for the node set of its local data node graph. Each client calculates the regularization loss for the l-th iteration at its corresponding time step t, and then proceeds to step E; Step E. Each client combines the sum of distillation loss, classification loss, and regularization loss in the l-th iteration at its corresponding time step t to form the comprehensive loss for the l-th iteration at the client's corresponding time step t. It then determines whether the difference in comprehensive loss between adjacent iterations in each group within a preset set of b iterations from the l-th iteration towards the historical iteration direction is less than a preset loss threshold. If so, the client completes the training of the feature extraction model at time step t, and the parameter set for the l-th iteration at the client's corresponding time step t becomes the post-trained parameter set for the client's corresponding time step t. The accuracy of the feature extraction model under the post-trained parameter set is obtained, uploaded to the server, and then proceeds to step F. Otherwise, based on the comprehensive loss of the l-th iteration at the client's corresponding time step t, the parameter set for the l-th iteration at the client's corresponding time step t is updated to form the parameter set for the (l+1)-th iteration at the client's corresponding time step t, and the value of l is incremented by 1. The process then returns to step C. Step F. The server obtains the average accuracy of the feature extraction model after training the parameter group at time step t for each client, and determines whether the average accuracy is greater than the preset model accuracy threshold or whether the global training count has reached the preset global maximum training count. If so, the federated learning training for the feature extraction model is completed, and each client applies the feature extraction model under its corresponding time step t training parameter group. Otherwise, the server updates the training parameter group for each client at time step t, aggregates the global parameter group for time step t, and sends it to each client. Each client uses the received global parameter group for time step t to form the parameter group for the first iteration of its corresponding time step t+1, increments the t value by 1, and returns to step B.
2. The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning according to claim 1, characterized in that: In step B, the following steps are performed for each client: Step B1. Traverse the node set of the local data node graph of the client at the corresponding time step t. For each node in the graph, determine whether it belongs to the local data node graph of any historical time step before time step t. If it does, mark the node's activity level as 0; otherwise, mark the node's activity level as 1 and update the node set. K represents the number of clients. This represents the set of nodes in the local data node graph corresponding to time step t for the k-th client; Step B2. Filter to obtain the node set The set of nodes that are not part of the set of L-hop neighbors of any node with an activity level of 1. Let L represent the set of nodes in the local data node graph of the k-th client at time step t that do not belong to the set of L-hop neighbor nodes of any node with an activity level of 1, where L represents the number of network layers in the feature extraction model. Step B3. Use the following formula: Get the set of nodes Loss value of the local data node graph at time step t-1 corresponding to the k-th client and node set Each node Loss values of local data nodes at time step t-1 for the k-th client Wherein, it means, Let I represent the adjacency matrix of the edges in the local data node graph corresponding to the k-th client at time step t-1, and let I denote the identity matrix. express The standardized adjacency matrix, This represents the set of parameters trained at time step t-1 for the k-th client. Indicated by As input, based on parameter set The feature vector extracted by the feature extraction model is obtained. The set of predicted classifications for each node in the dataset; express The set of true classifications corresponding to each node in the algorithm, where l() represents the loss function. Represents a set of nodes The i-th node in the middle, Indicates As input, based on parameter set The feature vector extracted by the feature extraction model is obtained. The predicted classification of the i-th node. Represents a set of nodes The true category corresponding to the i-th node in the dataset; Step B4. Filter to obtain the node set China conforms Each node constitutes a candidate node set. And further according to the following formula: Obtain the set of candidate nodes Each node Loss values under the local data node graph at time step t of the k-th client in, Represents the set of candidate nodes The j-th node, Let represent the adjacency matrix of the edges in the local data node graph corresponding to time step t of the k-th client. express The standardized adjacency matrix, Indicates As input, based on parameter set The feature vectors extracted by the feature extraction model yield a set of candidate nodes. The predicted classification of the j-th node. Represents the set of candidate nodes The true classification corresponding to the j-th node in the middle; Step B5. Calculate the candidate node set Each node Corresponding to The difference is used as the influence value of each node, and the nodes are ranked from largest to smallest influence value for the candidate node set. The nodes in the list are sorted to form a candidate node set. The corresponding node sorting; Step B6. Select a set of candidate nodes The corresponding node sorting is the first These nodes constitute the local analysis node set for the k-th client at time step t. in, Represents the set of candidate nodes The number of nodes, where 'a' represents a preset ratio, 0 < a < 1. This indicates rounding up to the nearest integer.
3. The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning according to claim 1, characterized in that: Step C includes the following steps: Step C1. Each client applies its corresponding time step t to the l-th iteration parameter set. The feature extraction model performs forward propagation on each node in the local data node graph at time step t to obtain the feature vector of each node. Then, it divides each node into different ground truth classes and obtains the average feature vector of each node in each ground truth class. This average feature vector is used as the local prototype for each class in the l-th iteration at time step t on the client side. Uploaded to the server; This represents the parameter set for the l-th iteration at time step t corresponding to the k-th client. This represents the local prototype of category c in the l-th iteration at time step t for the k-th client; Step C2. The server applies the local prototypes of each category uploaded by each client at the corresponding time step t for the lth iteration. Using the category of the local prototype as input and the local prototype as output, the neural network model H in the server is trained again to obtain the trained model H at time step t in the l-th iteration. (t,l) ; Step C3. The server applies the trained model H from the l-th iteration at time step t to each category. (t,l) Processing is performed to obtain the global prototypes of each category in the l-th iteration at time step t. And then distributed to each client separately; This represents the global prototype of category c in the l-th iteration at time step t.
4. The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning according to claim 3, characterized in that: In step D, the following steps are performed for each client: Step D1. The client applies its corresponding time step t for the l-th iteration parameter set. The feature extraction model below is used to analyze the local analysis node set at its corresponding time step t. Each node m is processed to obtain the local feature vector of each node at time step t in the l-th iteration. And the global parameter group applied at the corresponding time step t-1 The feature extraction models below are designed for the local analysis node sets at the corresponding time step t. Each node m is processed to obtain the global feature vector of each node at time step t-1. Step D2. The client uses the following formula: Obtain the distillation loss of the l-th iteration at time step t on the client side. in, Let m represent the distillation loss of the l-th iteration at time step t corresponding to the k-th client. c Represents the set of local analysis nodes The nodes that belong to category c; This represents the parameter set of the l-th iteration at time step t for the k-th client application. The feature extraction model below is used for the set of local analysis nodes at the corresponding time step t. The nodes belonging to category c are processed to obtain the local feature vectors of the nodes corresponding to the l-th iteration at time step t. express The predicted classification, where C represents the set of predefined categories. m c The actual category of the node, where γ represents the preset distillation coefficient; Step D3. The client applies its corresponding time step t for the l-th iteration parameter set. The feature extraction model below processes each node in the node set of the local data node graph at the corresponding time step t, and calculates the classification loss for the l-th iteration at the corresponding time step t of the client. Step D4. The client uses the following formula: Calculate the regularization loss of the l-th iteration at time step t for the client. in, This represents the regularization loss for the l-th iteration at time step t corresponding to the k-th client. This represents the set of different categories to which each node in the local data node graph corresponding to time step t of the k-th client belongs. Represents a set The number of categories express and Cosine similarity between them.
5. The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning according to claim 1, characterized in that: In step E, each client operates according to the following formula: Obtain the distillation loss for the l-th iteration at time step t. Classification loss Regularization loss sum Based on the comprehensive loss of the l-th iteration at the corresponding time step t of the client, it is calculated using the following formula: For the parameter set of the l-th iteration at time step t on the client side The update is performed to form the parameter set for the (l+1)th iteration at the corresponding time step t on the client side. η represents the model hyperparameters. This indicates differentiation.
6. The federated dynamic graph learning optimization method based on knowledge distillation and prototype learning according to claim 1, characterized in that: In step F, the server updates the post-training parameter set for each client at time step t according to the following steps; Step F1. The server applies the following formula to each client: Obtain the cosine similarity between the local prototype and the global prototype for each client at time step t. Step F2. The server, for each client, applies the following formula to each... Perform cosine similarity normalization Obtain the cosine similarity normalized results for each client at time step t, and use them to construct the personalized weights for each client at time step t. Step F3. The server applies the following formula to each client: The client uploads the trained parameter set at the corresponding time step t. Update.
Citation Information
Patent Citations
Efficient encrypted voice traffic recognition method
CN116186512A
Power grid abnormal mode data identification method and system based on genetic LM algorithm
CN117807542A