An adaptive clustering federated learning method and system based on neighbor interaction

By adopting an adaptive clustering federated learning method based on proximity interaction in federated learning, using the federated aggregation algorithm of graph structure and voter model, the client adaptive clustering and information interaction are realized, and data heterogeneity in federated learning is solved The resulting model performance degradation and communication overhead problems improve model accuracy and convergence speed.

CN118378730BActive Publication Date: 2024-12-10HUAZHONG AGRI UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410289833.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-14
Publication Date
2024-12-10
Estimated Expiration
2044-03-14

AI Technical Summary

Technical Problem

Data heterogeneity in existing federated learning leads to the problem of model overfitting, performance degradation and slow convergence speed. In addition, traditional clustered federated learning methods require the participation of third-party servers, which has problems such as data privacy leakage and communication overhead.

Method used

Adaptive clustering federated learning method based on proximity interaction is adopted, and the graph structure of edge clients is constructed, and the federated aggregation algorithm of adaptive clustering and information interaction is realized on the basis of client, thereby reducing communication overhead. Improve model accuracy and convergence speed.

Benefits of technology

It realizes that the client adaptive clustering and information interaction without relying on third-party servers, reduces communication volume, improves model accuracy, and accelerates model convergence, solving the deviation utilization and communication overhead caused by data heterogeneity. question.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378730B_ABST
    Figure CN118378730B_ABST
Patent Text Reader

Abstract

The present invention discloses an adaptive clustering federated learning method and system based on neighbor interaction, the method comprising: constructing N edge clients, abstracting the underlying physical network containing all edge clients into a graph; training a local network model; using an adaptive clustering algorithm ACAS, calculating model similarity through KL divergence, realizing automatic clustering based on the minimum spanning forest algorithm, reducing the deviation caused by the fixed number of clusters, and selecting cluster heads based on the maximum influence theory; using a FedVM algorithm based on a voter model, FedVM uses the neighbor interaction idea of ​​the voter model to perform intra-cluster aggregation; repeating the training until the termination condition is reached, calculating the final parameters and the accuracy and optimal loss function of the model, obtaining a trained DCFL model, and outputting it to the corresponding service of the mobile device in real time. The present invention can update the model through edge device information interaction, which can maximize the parallelism in aggregation, save communication costs and reduce delays, and accelerate the training convergence speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of mobile communication users collaboratively processing heterogeneous data analysis, and in particular to an adaptive clustering federated learning method and system based on neighbor interaction. Background Art

[0002] With the widespread application of lightweight mobile smart devices and the improvement of service quality requirements, data of various categories are becoming more diverse. Federated learning (FL), as an optimized distributed framework, can learn a shared model through multi-party collaboration without exposing the original data, providing a potential solution for scenarios with small amounts of data and low training accuracy on a single device. However, in FL, the category differences of clients bring about data heterogeneity, that is, data is not independent and identically distributed (Non-IID), which may lead to problems such as overfitting, performance degradation, or slow convergence in FL, and cannot meet the user dynamic requirements in mobile computing.

[0003] In order to solve the data heterogeneity problem in FL, existing research can be divided into three categories: global FL optimization, personalized federated learning (PFL) and clustered federated learning (CFL). Global FL optimization mainly reduces global data heterogeneity and generalizes the global model through two methods: data enhancement and client selection. Data enhancement is to improve accuracy through data sharing, for example: distribute a small amount of global data to each client in a balanced manner by class or generate additional data for some data samples of minority classes through the GAN model. The client selection mechanism is to optimize the subset of clients participating in the aggregation in each round of FL training to reduce the bias introduced by Non-IID data and improve the generalization performance of the model. This method is easy to implement, but its data sharing will lead to privacy leakage and increase the communication computing overhead to a certain extent. The goal of personalized federated learning is to perform personalized processing on each client based on the learned global model to improve the adaptability of the local model. The main methods are concentrated on regularization, meta-learning, transfer learning and knowledge distillation. However, this type of algorithm is suitable for extremely heterogeneous data and is no longer applicable when interconnected devices have homogeneous data.

[0004] The first two methods mainly generalize the model by reducing the bias caused by data heterogeneity. CFL effectively utilizes the bias of Non-IID data and trains a FL model for each homogeneous customer group based on the data characteristics of different categories. Considering the different data distribution of clients, the literature [] first migrated multi-task learning to cluster federated learning to verify the effectiveness of cluster federation, but it used a one-time clustering algorithm and could not solve the dynamic update problem. Moreover, the general distance-based clustering analysis method [] has serious limitations in similarity modeling of machine learning models because they are only applicable to models with convex loss functions. In order to better deal with the situation of frequent user joining and offline in FL, the literature [] proposed an iterative clustering algorithm based on the similarity of model training parameters. However, most of these methods use traditional K-Means for clustering, and the number of clusters needs to be set in advance. In practical applications, it is impossible to obtain data categories in advance, and the random setting of the number of clusters will lead to large errors. In order to dynamically adjust the number of clusters K, some literatures are based on the idea of ​​DBSCAN and iteratively increase the optimal K value from 1, but the process requires multiple rounds of federated training, which will bring large overhead.

[0005] The above-mentioned CFL-based work all arranges cluster allocation by a third-party central server, which has the problems of data privacy leakage and high communication overhead. The voter model (VM) in the field of sociology is a decentralized random consensus process. Simply put, each node has its own state and interacts with its neighbors under certain rules to eventually reach a consensus and achieve global balance. The update step of VM includes selecting a pair of neighbor nodes and providing the state of one node to the other. This process is similar to the clustering and information interaction ideas in CFL, and the influence of neighbors will be greater than that of other points. Therefore, there is a potential feasibility to migrate the neighbor interaction idea of ​​VM to CFL. However, there is no research on the combination of intelligent Internet of Things and VM. Most of the research on VM is in the fields of sociology, celestial rotation, physics, etc., and VM usually uses abstract concepts to illustrate dynamic balance. It is very challenging to quantify it into specific rules and apply it to specific dynamic networks.

[0006] Although there are many works in the existing FL to solve the problem of data heterogeneity, most of them are limited to eliminating the bias caused by heterogeneity rather than utilizing these biases, which easily leads to the neglect and loss of unique data features. How to design an efficient FL learning algorithm to make full use of Non-IID data while improving model accuracy, reducing communication overhead, and accelerating model convergence is crucial. First, FL can collaborate with lightweight mobile devices to share information and reduce the impact of too little data. However, in mobile communication scenarios, various types of data are heterogeneous, which can easily lead to global model performance degradation and slow convergence. Secondly, although CFL can effectively utilize the characteristics of heterogeneous data, group clients with homogeneous data into a group, and conduct effective intra-group federated training and learning, data heterogeneity cannot be judged in advance in reality. The existing CFL algorithm using K-Means clustering requires the number of clusters to be set and fixed in advance, which will bring large random errors. In addition, the frequent joining and offline of clients in mobile communication scenarios makes it impossible for users to fully adapt to the fixed cluster structure, resulting in limited accuracy. Finally, in CFL, clustering and federation aggregation are arranged by a third-party central server, which has the problem of long-distance communication overhead. Migrating the decentralization and neighbor dynamic interaction ideas in the voter model to CFL can well assist the information sharing of clients in FL, reduce the communication distance, and accelerate model convergence. Therefore, how to realize client adaptive clustering and schedule aggregation operations to edge devices while considering Non-IID data is a certain challenge. Summary of the invention

[0007] The technical problem to be solved by the present invention is to provide an adaptive clustering federated learning method and system based on neighbor interaction in view of the defects in the prior art.

[0008] The technical solution adopted by the present invention to solve its technical problem is:

[0009] The present invention provides an adaptive clustering federated learning method based on neighbor interaction, by which an adaptive clustering federated learning framework model based on neighbor interaction, namely, a DCFL model, is constructed; the method comprises the following steps:

[0010] S1. Build N edge clients ES, denoted as e i , i∈[1,N], the underlying physical network containing all edge clients is abstracted into a graph G=(V,E), where the node V represents ES, the edge E represents the network connection between edge clients, and the edge in the graph has a weight, which is the weight of any two nodes e i and e j The similarity between ij , two nodes connected by an edge are called neighbors;

[0011] S2, perform local network model training. In the e-th round of federated tasks, the edge client e i According to the parameters Based on its local data D i , and perform T rounds of local training to obtain the model accuracy by minimizing the loss function Loss value parameter In the first round of federated tasks, the parameters of N clients are initialized to w 0 ;

[0012] S3, in the clustering stage, the adaptive clustering algorithm ACAS is used: the edge client calculates the client e through KL divergence i With e j Local training parameters and The similarity S ij , automatically clustering based on the minimum spanning forest algorithm, determining neighbors, the number of clusters is set to C, and the cluster head is selected based on the maximum influence theory;

[0013] S4. In the federated information interaction phase, the FedVM algorithm based on the voter model is adopted: all edge clients calculate the transfer probability p based on the neighbor interaction and consensus idea in the voter model. ij , node e i Its neighbor e in the same cluster j Using p ij , update the parameters Until every node in the cluster has exchanged information with its neighbors and updated the local network model again;

[0014] S5. Repeat steps S2-S4 until the termination condition is reached. All edge clients calculate the final parameters, extract features based on the data collected from multiple mobile users, calculate the accuracy of the model and the optimal loss function, and obtain the trained DCFL model. The entire training process is completed and output to the corresponding service of the mobile device in real time.

[0015] Furthermore, in step S2 of the present invention, the specific method of training the local network model is:

[0016] Using the deep neural network CNN model, the local model uses user data as input for end-to-end feature learning and classification training, and uses mini-batch GD to minimize the loss value in each iteration; the client e i The local training parameters in the tth round of the federated task in the eth round are abbreviated as e i Get update parameters based on neighbor client information And collect data packets D from end users iTo conduct local training, each round of training gets the loss In the first round, when no clusters are divided, the global parameter w is initialized. 0 ;

[0017] Gradient G i,t Calculated as:

[0018]

[0019] e i According to the gradient renew And continue training the local model:

[0020]

[0021] Where η is the learning rate;

[0022] In e i After T rounds of local training, the accuracy is Loss value Updated parameters

[0023] Furthermore, in step S3 of the present invention, the specific method of the ACAS algorithm is:

[0024] In the stage of calculating the similarity of model weight parameters, Kullback-Leibler divergence KLD is used to measure the similarity of model weights, so that N ESs can share similarity and achieve self-grouping;

[0025] Select the parameters of each model and perform similarity calculation. Then the client e i With e j The model parameters w i and w j The KLD is described as:

[0026]

[0027]

[0028] in, represents the model parameter w j For input data The pre-softmax output, D KL (w i ,w j )≥0. The smaller KLD is, the higher S ij The smaller it is, the node e i and e j The closer the relationship between the models is. Since D calculated by formula (7) KL (wi ,w j )≠D KL (w j ,w i ), but in reality, node e i and e j There is no direction between them. So the mean of the two node parameters KLD is calculated as the similarity judgment criterion, and the node e i and e j The similarity between them is S ij :

[0029]

[0030] Then, we calculate the D between any two models KL (w i ,w j ), and obtain the similarity matrix S∈R N×N ; S is a symmetric matrix with all zeros on the diagonal; after obtaining the similarity matrix S, the clients are clustered based on the minimum spanning forest according to the client similarities in S.

[0031] Furthermore, in step S3 of the present invention, the specific method for the client to perform clustering is:

[0032] Due to S ij The smaller the node e i and e j The closer the relationship between the models is, the goal is to connect these nodes into C minimum spanning trees by connecting some edges to form a minimum spanning forest. Since there is no cycle in each tree, there are n edges in cluster c. c -1, n c is the number of clients in cluster c, then N nodes have NC edges in C clusters, and the system graph is guaranteed not to form a cycle;

[0033] Considering the time complexity, the greedy idea in the minimum spanning forest Kruskal algorithm is used to cluster. First, N discrete nodes are selected from the lower left corner of S as the edge of the node. If the newly added edge does not cause a loop in the spanning forest, the new edge is added to the spanning forest until all points are included in the spanning forest. At this time, all nodes have at least one edge connected to their neighbors. N nodes and edges constitute a spanning forest V = (G, E). Each minimum spanning tree is a group. The number of trees C is the number of groups. The node e is recorded. i The cluster c where the label is k c,i , k c,i =1 represents client e i Belongs to cluster c; at the same time, record all nodes e i The edge weight of , at this time, a round of clustering is completed;

[0034] Since the participating members in DCFL are dynamic, it is necessary to select cluster heads as cluster representatives for new members to choose without the cooperation of a third-party server, thereby reducing the computational overhead of new users joining the cluster;

[0035] Since the degree of a node in a graph represents the connection between nodes, the larger the degree, the greater the possibility that the opinion will be adopted from the perspective of the voter model, see Theorem 1. Therefore, in a cluster c, nodes with large degrees are preferred as cluster heads; if e i With e j In the same cluster c, all nodes have the maximum degree. Calculate the relative distance between other nodes in the cluster and this node e. i With e j The sum of the similarities is denoted by S i and S j , S i and S j The node with the smaller value is the cluster head; if S i =S j , then the node with the larger model accuracy is selected as the cluster head, so the cluster head H c The selection rules are:

[0036]

[0037]

[0038] Among them, J c is the label of all nodes in cluster c; the cluster head only serves as a cluster representative, so there is no need for a strong connection between the cluster head and cluster members in the same cluster; even if the cluster head is selected, the information interaction within the same cluster is still carried out according to the predetermined graph connection method.

[0039] Furthermore, in step S3 of the present invention, Theorem 1 is specifically:

[0040] In the process of information interaction, nodes are more likely to connect to high-degree nodes than low-degree nodes because high-degree nodes have greater influence.

[0041] Furthermore, the proof method of Theorem 1 of the present invention includes:

[0042] For any two nodes e in the graph i With e j , within a given time step, node e j The state is assigned to node e i The probability is p ij :

[0043] p ij = x ij λ(k i ,kj )

[0044] Among them, χ ij To select the connection node e i With e j The probability of the edge; λ(k i ,k j ) is the degree k j The node whose state is handed over to the node with degree k i The probability of a node with degree k is stimulated by comparing the update dynamics of nodes in an unrelated network; during the state update process, i Node e i Assign degree k j Node e j The probability of the state is:

[0045]

[0046] Among them, A ij is an element of the adjacency matrix. If the nodes share an edge, then A ij =1, otherwise A ij =0; that is, select node e i The probability is 1 / n c , n c is the number of nodes in the same cluster c, and the probability of following an edge is 1 / k i ;

[0047] Since only the influence of node degree is considered, the direction is ignored and the influence of a specific node on e i With e j By selecting e i and follow an edge to e j Or select e j and follow an edge to e i To select, select the connection node e i With e j The probability of the edge χ ij for:

[0048]

[0049] λ(k i ,k j )for:

[0050]

[0051] Therefore, this further verifies that λ(k i ,k j ) is a probability, indicating degree k j The node whose state is handed over to the node with degree k iThe probability of a node; use parameter β to expand the influence of node degree, and the function λ(k i ,k j ) to generalize, then λ(k i ,k j ,β) is:

[0052]

[0053] For β>0, a pair of nodes, a node with a high degree k j More likely to give its state to a low-degree node k i , that is, in a pair of clients, the client with more connections is more likely to share its state. This deviation increases with β. For β<0, the opposite is true. When the node selection pair is determined and β=0, the node update dynamics occurs. When β=0, λ(k i ,k j ,β)=1 / 2, that is, the topology is ignored when determining the direction of interaction; if all nodes of the network have the same degree, that is, the data are identically distributed, such as in a mean field or lattice topology, then λ(k i ,k j ,β) are the same.

[0054] Furthermore, the step S3 of the present invention also includes a method for updating the cluster structure:

[0055] The dynamic update situations are divided into three categories: new users joining, old users leaving, and cluster dynamic update when no users join or are offline;

[0056] When a new user N+1 When joining, use local data to initialize the parameter w 0 Perform local training with C cluster head parameters to obtain C+1 accuracy values, compare and select the cluster corresponding to the maximum accuracy to join;

[0057] If the accuracy of cluster head parameter training is greater than a certain threshold, the cluster head is directly added to the cluster without adding additional clusters; if the initialization parameter w 0 If the accuracy is the largest, a new cluster is added, so the update rule of cluster data C is:

[0058]

[0059] in, for e i At the current parameter w i Considering the computational overhead, only the training accuracy of C cluster head parameters is compared to find the appropriate cluster, and then the most similar cluster member in the cluster is connected to realize information interaction.

[0060] When the number of clients in a cluster is reduced to 1, it is compared to a new user, and C=C-1 is set. It is determined whether to reserve a cluster for this user. If it cannot merge with other clusters, it forms a cluster by itself. If the cluster head falls behind, it exits the change and re-selects a cluster head for this cluster.

[0061] After each round of cluster aggregation, T rounds of local training are performed, and then the neighbor relationship within the cluster is updated using the ACAS algorithm, and the nodes in each cluster form an acyclic graph to complete the cluster structure update. Then, this cycle is repeated.

[0062] Furthermore, in step S4 of the present invention, the specific method of the FedVM algorithm is:

[0063] In order to deal with Non-IID data in federated learning, the FedVM algorithm adopts the neighbor interaction and dynamic consensus ideas of the voter model to select suitable clients and optimal weight exchange parameters for parameter updates, so that connected users can interact with neighbors to achieve global consensus and accelerate model convergence.

[0064] Furthermore, in step S4 of the present invention, the specific method of the voter model is:

[0065] (1) State: Node e i The status is set to s i ={w i};

[0066] (2) Neighborhood division: According to the ACAS algorithm, the similarity matrix S of N models is obtained, and the clients are clustered and neighbors are divided. Two nodes with edge connections are neighbors.

[0067] (3) State update rule R: Parameter update process, select a pair of nodes and assign their state to another node with a certain probability; the node e in the cluster i According to the number of members in the cluster n c , node degree k i according to To calculate the transition probability p ij , node e i Parameter fusion neighbor e j The parameters after are updated as follows:

[0068] w i =(1-p ij ) i +p ij w j

[0069] Because p ij Indicates that node e is within a given time step j The state is assigned to node ei The probability that any node e i The shared edges with its neighbors, then A ij =1, n in the same cluster c Fixed, e i The transition probability with its neighbors is the same as 1 / n c k i , so in the eth round of federal tasks i At the same time, interact with all its neighbor nodes and update the parameters as follows:

[0070]

[0071] Among them, h i Represents node e i Neighbor nodes, the interaction process of each node in the cluster is parallel;

[0072] Since node e i With node e j The neighbors are different, that is, the degree of the node is different, corresponding to e i With e j The transition probabilities are also different, p ij ≠p ji , as follows, node e j Select Neighbor i The parameters of are combined as follows:

[0073] w j =(1-p ji ) j +p ji w i

[0074] In node selection, e i With e j They all select each other for information fusion, so the fusion between nodes takes direction into consideration;

[0075] In the same cluster, cluster members fuse information with all their neighbors until all nodes have completed parameter update, that is, one round of intra-cluster aggregation is completed; then, T rounds of local training are continued; after that, the parameters of each node in the cluster have been transformed, and the neighbor relationship is re-established according to the self-update of the intra-cluster structure; the cycle is repeated until E rounds of intra-cluster aggregation are completed.

[0076] The present invention provides an adaptive clustering federated learning system based on neighbor interaction, comprising the following units:

[0077] Edge client network graph construction unit, used to build N edge clients ES, denoted as e i, i∈[1,N], the underlying physical network containing all edge clients is abstracted into a graph G=(V,E), where the node V represents ES, the edge E represents the network connection between edge clients, and the edge in the graph has a weight, which is the weight of any two nodes e i and e j The similarity between ij , two nodes connected by an edge are called neighbors;

[0078] The local network model training unit is used for edge client e in the e-th round of federated tasks. i According to the parameters Based on its local data D i , and perform T rounds of local training to obtain the model accuracy by minimizing the loss function Loss value parameter In the first round of federated tasks, the parameters of N clients are initialized to w 0 ;

[0079] Adaptive Clustering Algorithm ACAS unit, used to calculate client e through KL divergence i With e j Local training parameters and The similarity S ij , automatically clustering based on the minimum spanning forest algorithm, determining neighbors, the number of clusters is set to C, and the cluster head is selected based on the maximum influence theory;

[0080] The FedVM algorithm unit based on the voter model is used to calculate the transition probability p for all edge clients based on the neighbor interaction and consensus ideas in the voter model. ij , node e i Its neighbor e in the same cluster j Using p ij , update the parameters Until every node in the cluster has exchanged information with its neighbors and updated the local network model again;

[0081] The DCFL model training unit is used to repeat the training until the termination condition is reached. All edge clients calculate the final parameters, extract features based on the data collected by multiple mobile users, calculate the accuracy of the model and the optimal loss function, obtain the trained DCFL model, complete the entire training process, and output it to the corresponding service of the mobile device in real time.

[0082] The beneficial effects produced by the present invention are:

[0083] (1) An adaptive clustering federated learning framework (DCFL) based on neighbor interaction is proposed. The underlying network is abstracted into a graph, in which all nodes are edge devices, and the similarity between device data is used as the edge weight. The parameter update operation is scheduled to the edge device, and there is no need for a third-party central server to participate in parameter update and propagation, which can achieve short-distance information interaction and reduce communication volume. Under this DCFL framework, the adaptive clustering algorithm and the federated aggregation algorithm based on the voter model are integrated to improve the model accuracy and accelerate the model convergence.

[0084] (2) Adaptive clustering algorithm (ACAS). In order to reduce the training divergence and improve the model accuracy, the KL divergence (KLD) is used to calculate the model similarity, and automatic clustering is implemented based on the minimum spanning forest algorithm to reduce the deviation caused by the fixed number of clusters. The cluster head is selected based on the maximum influence theory. The cluster head acts as the cluster representative to adjust the addition of new users, thereby reducing the computing overhead and ensuring the dynamics of the system.

[0085] (3) FedVM based on voter model. FedVM uses the neighbor interaction idea of ​​the voter model to perform intra-cluster aggregation. In the same cluster, nodes set the weight of the optimal exchange parameter based on the degree and the number of nodes in the cluster, that is, the transition probability P ij , according to P ij Information is exchanged with neighbors to update parameters within the cluster, thereby learning more similar information and accelerating model convergence. BRIEF DESCRIPTION OF THE DRAWINGS

[0086] The present invention will be further described below with reference to the accompanying drawings and embodiments, in which:

[0087] Figure 1 is a DCFL framework of an embodiment of the present invention;

[0088] Figure 2 is a flow chart of a DCFL system according to an embodiment of the present invention;

[0089] Figure 3 is the ACAS algorithm of an embodiment of the present invention;

[0090] Figure 4 is the accuracy of the No-IID MNIST data of the embodiment of the present invention;

[0091] Figure 5 is the accuracy of the No-IID CAFIR-10 data of the embodiment of the present invention. DETAILED DESCRIPTION

[0092] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.

[0093] Example 1

[0094] The parameters involved in the embodiments of the present invention are described as follows:

[0095] Table 1 Parameter Description

[0096]

[0097] The adaptive clustering federated learning framework based on neighbor interaction in the Internet of Vehicles of the embodiment of the present invention includes the following steps:

[0098] S1. Build multiple N edge devices ES, denoted as e i (i∈[1,N]). The underlying physical network containing all edge devices is abstracted into a graph G=(V,E), where the node V represents ES and the edge E represents the network connection between edge devices. The edges in the graph have weights, which are any two nodes e i and e j The model parameter similarity S between ij , two nodes connected by an edge are called neighbors;

[0099] S2. In the e-th round of federated tasks, the edge client e i According to the parameters Based on its local data D i , and perform T rounds of local training to obtain the model accuracy by minimizing the loss function Loss value parameter In the first round of federated tasks (e=0), the parameters of N clients are initialized to w 0 ;

[0100] S3, the edge client calculates the client e through KL divergence (KLD) i With client e j Local training parameters and The similarity S ij , based on the minimum spanning forest algorithm, automatic clustering is realized, neighbors are determined, and the number of clusters is set to C, which reduces the deviation caused by the fixed number of clusters. And the cluster head is selected based on the maximum influence theory. The cluster head acts as a cluster representative to adjust the addition of new users, thereby reducing the computational overhead and ensuring the dynamics of the system.

[0101] S4. All edge clients calculate the transition probability p based on the neighbors and consensus ideas in the voter model. ij, Section e i Its neighbor e in the same cluster j Using p ij , update the parameters Until every node in the cluster has exchanged information with its neighbors and updated the local model again;

[0102] S5. Repeat steps S2-S4 until the termination condition is reached and the entire training process is completed. The termination condition can be the maximum number of training cycles, the convergence of the loss function, or other user-defined conditions. Finally, the optimal loss function F(W) can be obtained according to the following formula (1).

[0103]

[0104] Among them, f(w i ) is client e in cluster c i The loss value of local training, k c,i =1 represents client e i Belongs to cluster c.

[0105] The specific method of local training is:

[0106] To speed up the convergence, the local model uses user data as input for end-to-end feature learning and classification training, and uses mini-batch GD to minimize the loss value in each iteration. For convenience, this section uniformly omits the symbolic expression of a specific cluster c. The specific client e i The local training parameters in the tth round of the federated task in the eth round are abbreviated as e i Get update parameters based on neighbor client information And collect data packets D from end users i To conduct local training, each round of training gets the loss (In the first round when no clusters are divided, initialize the global parameter w 0 ).

[0107] Gradient G i,t Calculated as:

[0108]

[0109] e i According to the gradient renew And continue training the local model:

[0110]

[0111] Where η is the learning rate.

[0112] In e iAfter T rounds of local training, the accuracy is Loss value Updated parameters

[0113] The specific method of ACAS algorithm is as follows Figure 3 shown.

[0114] In order to reduce the communication overhead caused by the third-party central server participating in client clustering and the random error caused by the pre-set number of clusters, clients in DCFL share weight information, and the Kruskal algorithm based on the minimum spanning forest adaptively groups data according to data similarity to achieve dynamic update of clusters, thereby minimizing the global training loss and improving model accuracy.

[0115] When the parameter w is fixed, formula (1) can be regarded as a clustering problem on the model parameter w. When using the model weights of nodes to adaptively learn the clustering relationship of nodes, there are three challenges: quantification of the similarity of model weight parameters, self-clustering, determination of the number of clusters C, and dynamic update of clusters.

[0116] (1) Model weight parameter similarity calculation

[0117] Kullback-Leibler divergence (KLD) is used to measure the difference between one probability distribution and another probability distribution, and is suitable for solving similarity measurement in non-convex loss function models. Therefore, KLD is used to measure the similarity of model weights, so that N ESs can share similarity and achieve self-grouping.

[0118] Here we select the parameters of each model and perform similarity calculation. Then the client e i With e j The model parameters w i and w j The KLD is described as:

[0119]

[0120]

[0121] in, represents the model parameter w j For input data The pre-softmax output, D KL (w i ,w j )≥0. The smaller KLD is, the higher S ij The smaller it is, the node e i and e j The closer the relationship between the models is. Since D calculated by formula (4) KL (w i,w j )≠D KL (w j ,w i ), but in reality, node e i and e j There is no direction between them. So the mean of the two node parameters KLD is calculated as the similarity judgment criterion, and the node e i and e j The similarity between them is S ij ,

[0122]

[0123] Then, the KLD between any two models is calculated according to formula (6), thus obtaining the similarity matrix S∈R N×N S is a symmetric matrix with all zeros on the diagonal, so in subsequent calculations, the data in the lower left corner of the diagonal of S is used.

[0124] (2) Clustering

[0125] Due to S ij The smaller the node e i and e j The closer the relationship between the models is, the more nodes are connected. The goal here is to connect these nodes into C minimum spanning trees by connecting some edges to form a minimum spanning forest. Since there is no cycle in each tree, there are n edges in cluster c. c -1(n c is the number of clients in cluster c), then the N nodes have NC edges in C clusters, and the system graph is guaranteed not to form a cycle.

[0126] Considering the time complexity, the greedy idea in the minimum spanning forest Kruskal algorithm is used to cluster. The specific implementation is as follows Figure 3 As shown, first, N discrete nodes are selected from the lower left corner of S as the edge of the node. If the newly added edge does not cause a loop in the spanning forest, the new edge is added to the spanning forest until all points are included in the spanning forest. At this time, all nodes have at least one edge connected to their neighbors. N nodes and edges constitute the spanning forest V = (G, E). Each minimum spanning tree is a group. The number of trees C is the number of groups. Record the node e i The cluster c where the label is k c,i , k c,i =1 represents client e i Belongs to cluster c. At the same time, record all nodes e i At this time, a round of clustering is completed.

[0127] Since the participating members in DCFL are dynamic, it is necessary to select cluster heads as cluster representatives for new members to choose without the cooperation of a third-party server, thereby reducing the computational overhead of new users joining the cluster.

[0128] Since the degree of a node represents the connection between nodes, the larger the degree, the greater the possibility that the opinion will be adopted from the perspective of the voter model (see Theorem 1). Therefore, in a cluster c, nodes with large degrees are preferred as cluster heads. i With e j In the same cluster c, all nodes have the maximum degree. Calculate the relative distance between other nodes in the cluster and this node e. i With e j The sum of the similarities is denoted by S i and S j , S i and S j The node with the smaller value is the cluster head. i =S j , then the node with the larger model accuracy is selected as the cluster head, so the cluster head H c The selection rules are:

[0129]

[0130]

[0131] Among them, J c is the label of all nodes in cluster c. It should also be noted that in traditional clustering methods, connections usually need to be established between cluster heads and all cluster members. However, in the method, cluster heads are only cluster representatives, so there is no need for strong connections between cluster heads and cluster members in the same cluster. Even if cluster heads are selected, information interaction within the same cluster is still carried out according to the predetermined graph connection method.

[0132] Theorem 1: In the process of information interaction, nodes are more likely to connect to high-degree nodes than low-degree nodes because high-degree nodes have greater influence.

[0133] Proof: For any two nodes e in the graph i With e j , within a given time step, node e j The state is assigned to node e i The probability is p ij ,

[0134] p ij = x ij λ(k i ,k j ) (9)

[0135] Among them, χ ijTo select the connection node e i With e j The probability of the edge; λ(k i ,k j ) is the degree k j The node whose state is handed over to the node with degree k i The probability of a node with degree k is stimulated by comparing the update dynamics of nodes in an unrelated network. i Node e i Assign degree k j Node e j The probability of the state is:

[0136]

[0137] Among them, A ij is an element of the adjacency matrix. If the nodes share an edge, then A ij =1, otherwise A ij = 0. This can be understood as selecting node e i The probability is 1 / n c , where n c is the number of nodes in the same cluster c, and the probability of following an edge is 1 / k i .

[0138] Since we only consider the influence of node degree, we ignore the direction and the influence of a specific node on e i With e j You can select e i and follow an edge to e j Or select e j and follow an edge to e i To select, select the connection node e i With e j The probability of the edge χ ij for:

[0139]

[0140] Then, from formula (10), we can get: i ,k j )for:

[0141]

[0142] Therefore, this further verifies that λ(k i ,k j ) is a probability with degree k j The node whose state is handed over to the node with degree k iThe probability of a node with high degree; considering that it is easier to express the influence of high-degree nodes, the parameter β is used to expand the influence of the node degree, and the function λ(k i ,k j ) to generalize, then λ(k i ,k j ,β) is:

[0143]

[0144] For β>0, a pair of nodes, a node with a high degree k j More likely to give its state to a low-degree node k i , that is, in a pair of clients, the client with more connections is more likely to share its state, and this deviation increases with β. For β<0, the opposite is true. When the node selection pair is determined and β=0, the node update dynamics occurs. When β=0, λ(k i ,k j ,β)=1 / 2, that is, the topology is ignored when determining the interaction direction. If all nodes of the network have the same degree, that is, the data are identically distributed (IID), such as in a mean field or lattice topology, then λ(k i ,k j ,β) are the same.

[0145] This process describes the situation where there is a certain connection between the agent's behavior and the underlying network on which it depends. In CFL, because high-degree nodes have greater influence, the state is more likely to be adopted by low-degree nodes, so that their neighborhoods can be quickly sorted, and then represent the global model in a small range, so they are more likely to become cluster heads, and these influential cluster head nodes are less likely to change. This is also the advantage of CFL, which clusters models with non-independent and identically distributed data features and performs local optimization, ultimately reaching a global consensus.

[0146] (3) Cluster update

[0147] Since FL usually faces a changing environment and user groups, old users may not be able to continue to participate in federated learning due to device failure, network disconnection or connection problems. On the contrary, new participants may join the federated learning system at any time, and they may have different data distributions and characteristics. Therefore, dynamically updating clusters can better adapt to these changes, help new participants to be assigned to appropriate clusters, and cooperate with other participants.

[0148] The situations that require dynamic updates here are divided into three categories: new users joining, old users leaving, and cluster dynamic updates when no users join or are offline.

[0149] 1) Cluster increase

[0150] When a new user N+1 When joining, use local data to initialize the parameter w 0 Local training is performed with C cluster head parameters to obtain C+1 accuracy values, and the cluster corresponding to the maximum accuracy is compared and selected to be added.

[0151] If the cluster head parameter training accuracy is high, then the cluster head is directly added to the cluster without adding additional clusters. 0 If the accuracy is the largest, a new cluster is added, so the update rule of cluster data C is:

[0152]

[0153] in, for e i At the current parameter w i Considering the computational overhead, there is no need to compare the accuracy of the parameters of N users, but only to compare the training accuracy of the parameters of C cluster heads to find a suitable cluster. Then connect with the most similar cluster member in the cluster to achieve information exchange.

[0154] Because in the following cluster structure self-update, the structure will be self-updated after each round of cluster optimization, so the detailed connection status of the node with the nodes in the cluster or the situation where other users change to the C+1 cluster is not considered at this time, which can reduce the comparison and calculation overhead of users frequently joining at any time.

[0155] 2) Cluster deletion

[0156] Similarly, when the number of clients in a cluster decreases to 1, it is analogized to a newly added user, and C=C-1 is set. According to formula (14), it is determined whether to reserve a cluster for this user. If it cannot merge with other clusters, it forms a cluster by itself. Note that if the cluster head falls behind or exits, it is necessary to re-select the cluster head for this cluster.

[0157] 3) Self-updating of cluster structure

[0158] After a round of cluster aggregation, the parameters of each node in the cluster have changed, and the neighbor relationship can no longer be defined based on the similarity calculated by the previous parameters. Therefore, after each round of cluster aggregation, T rounds of local training are performed, and then the ACAS algorithm is used to update the neighbor relationship in the cluster, forming an acyclic graph of the nodes in each cluster to complete the cluster structure update. Then, this cycle is repeated. It should be noted that in order to retain the user's opportunity to modify the cluster in case of entering the wrong cluster at the beginning, it is set that at a certain round of federal tasks, all clients are clustered again according to the parameters to achieve a global cluster structure update.

[0159] The specific method of the FedVM algorithm is:

[0160] In order to deal with Non-IID data in federated learning, FedVM adopts the neighbor interaction and dynamic consensus ideas of the voter model to select suitable clients and optimal weight exchange parameters for parameter updates, so that connected users can better interact with neighbors to achieve global consensus and accelerate model convergence.

[0161] After the client completes clustering, it needs to update parameters, i.e., cluster aggregation. Algorithm 2 gives the pseudo code of FedVM. Cluster aggregation includes two stages: node update and edge update, i.e., the selection of a pair of interacting nodes and the specification of which node merges the parameters of another neighboring node. The following are the basic elements and concepts in the dynamic voter model:

[0162] (1) State: Node e i The status is set to s i ={w i}.

[0163] (2) Neighborhood division: According to the ACAS algorithm, the similarity matrix S of N models is obtained, and the clients are clustered and neighbors are divided. Two nodes with edge connections are neighbors. Considering the status between neighbors instead of randomly selecting the status of other users for updating is because individuals in a group are more likely to be influenced by people with whom they have close connections.

[0164] (3) State update rule R: Parameter update process, select a pair of nodes and choose the appropriate probability to assign their state to the other node. And Theorem 1 shows that high-degree nodes are more likely to assign their state to low-degree nodes. According to the grouping results, the node e in the cluster i According to the number of members in the cluster n c , node degree k i According to formula (10) To calculate the transition probability p ij , node e i Parameter fusion neighbor e j The parameters after are updated as follows:

[0165] w i =(1-p ij ) i +p ij w j (15)

[0166] Because p ij Indicates that node e is within a given time step j The state is assigned to node e i The probability that any node e i The shared edges with its neighbors, then A ij =1, n in the same cluster c Fixed, ei The transition probability with its neighbors is the same as 1 / n c k i , so in the eth round of federal tasks i It can interact with all its neighbor nodes at the same time, and the parameters are updated as follows:

[0167]

[0168] Among them, h i Represents node e i Neighbor nodes, the interaction process of each node in the cluster is parallel.

[0169] It should be noted here that since node e i With node e j The neighbors are different, that is, the degree of the node is different, corresponding to e i With e j The transition probabilities are also different (p ij ≠p ji ), as follows, node e j Select Neighbor i The parameters of are combined as follows:

[0170] w j =(1-p ji ) j +p ji w i (17)

[0171] Formula (15) is different from (17), even in node selection, e i With e j They select each other for information fusion, and the final fusion results are also different, so the fusion between nodes takes direction into consideration.

[0172] Within the same cluster, cluster members use formula (16) to fuse information with all their neighbors until all nodes have completed parameter updates, which means one round of cluster aggregation is completed. Then, T rounds of local training are continued. After that, the parameters of each node in the cluster have been transformed, and the neighbor relationship is reestablished according to the self-update of the cluster structure. These three steps are repeated until E rounds of cluster aggregation are completed.

[0173] Although different clients frequently join and go offline, new states may appear and old states may disappear, and the number of clusters C in the state space is not fixed, dynamic consensus usually involves changes between users, and the group will eventually form a consistent state, so the DCFL system ultimately achieves dynamic consensus.

[0174] Example 2, experimental test example:

[0175] In order to verify the effectiveness of the proposed mechanism, in order to verify the effectiveness of the proposed framework DCFL, an experimental performance comparison was conducted with FedAvg, IFCA, and CFMTL from the perspective of accuracy (Acc) on two existing public datasets MNIST and Cifar-10. For MNIST and Cifar-10, different CNN models with two layers of 5×5 convolutional layers were used for verification, the learning rate was 0.1, and the training rounds were 100.

[0176] Since the performance of these algorithms on Non-IID data needs to be verified, the Non-IID data is divided proportionally in the experiment: the training and test images are initially divided. Each category is divided into two parts, A with 75% of the data and B with 25%, according to the specified ratio (for example, 0.75). Subsequently, each part is further divided into N fragments (N is the number of all clients). In part A, each fragment contains the same number of images in the same category, while in part B, each fragment contains the same number of images in different categories. Then, each client is assigned two data fragments, one from each of the two parts. The radios used in the experiment are 0.5 and 0.7 respectively.

[0177] The experiment compares DCFL with three benchmark algorithms: FedAvg, IFCA, and CFMTL in terms of accuracy performance. All experimental results are the average of 50 independent experiments in the following environment.

[0178] In this case, DCFL is evaluated and compared with FedAvg, IFCA and CFMTL in terms of accuracy under different Non-IID data distributions on MNIST and Cifar-10. The results are shown in Figure 4 and Figure 5 In the experiments, the number of clients is set to 20.

[0179] For the MNIST dataset, as the number of rounds increases, the accuracy changes as follows Figure 4 . Figure 4 (a)-(b) show the global accuracy of the four algorithms under the MNSIT data distribution (radio = 0.5, 0.75). Figure 5As shown in (a), the accuracy of the four algorithms continues to increase until they reach a stable value. For FedAvg, IFCA, CFTML and the proposed DCFL, the accuracy increases from 47.54% to 98.92%, 81.23% to 97.96%, 85.84% to 99.09% and 81.47% to 98.36%, respectively. When radio = 0.5, 50% of a client belongs to the same class. In this way, the distribution between multiple users is similar. The knowledge similarity obtained through FedAvg may be higher than the knowledge learned between the same class. CFTML combines intra-cluster interaction and inter-cluster interaction. Although clustering is performed first, it can also share learning with users in different clusters to a certain extent. Therefore, these three categories can achieve similar effects. The proposed method first adopts adaptive clustering, which can well cope with different data distributions and reduce the error of randomly setting the number of clusters. Then DCFL uses a federated aggregation algorithm based on the voter model. Although there is no inter-cluster optimization, exchanging information based on neighbor information within the same cluster can greatly utilize the similarities between clients, better achieve similar information interaction, and improve the accuracy of the model within the cluster. However, IFCA uses a random setting of the number of clusters K. Once the set number K is smaller than the category of data distribution, some clients will be assigned to clusters of different categories, which cannot be corrected later. Such random errors will greatly reduce the accuracy of the model.

[0180] When radio is 0.75, for FedAvg, the initial accuracy is 74.55%, and when the number of training rounds increases to 18, the accuracy reaches 96.94%, and continues to fluctuate, reaching the highest value of 97.81% at 93 rounds. With the continuous increase in rounds, the accuracy of IFCA and CFTML increases from 62.89% to 98.70% and 92.13% to 99.12%, respectively. The algorithm increases to 99.14%, slightly higher than the CFMTL algorithm. Similar results can be seen. The three types of algorithms of CFL are better, while the effect of FedAvg becomes worse, and the overall fluctuation is large.

[0181] from Figure 5 From (a) to (b), we can see that with the increase of radio, the accuracy values ​​of IFCA, CFTML and DCFL will increase with the increase of rounds, and the curves will be smoother. However, the accuracy of FedAvg decreases and the curve fluctuates more. Therefore, compared with FedAvg, the CFL algorithm can better cope with the Non-IID situation with homogeneous data. Compared with the IFCA and CFTML algorithms, the algorithm convergence is better. This is because the decentralized federated learning algorithm is adopted globally, which does not require a third-party central server, reducing the long-distance overhead of clustering and aggregation arranged by the central server. Moreover, with the increase of radio, the proposed DCFL algorithm has a more obvious effect, indicating the effectiveness of the neighbor interaction idea.

[0182] For the Cifar-10 dataset, as the rounds continue to increase in accuracy, Figure 5 (a)-(b) show the accuracy of DCFL with increasing number of training rounds under the Cifar-10 data distribution (radio=0.5, 0.75), respectively.

[0183] like Figure 5 As shown in (a), the average accuracy of the four schemes increases with the increase of training rounds. For FedAvg, the average accuracy at the beginning is 32.23%. When the number of training rounds is 46, the accuracy increases to 50%. When the number of training rounds increases to 96, the average accuracy reaches a maximum of 54.97%, but the curve fluctuates greatly and the accuracy remains at around 50%. For IFCA, the average accuracy increases to 57.55%, and the curve fluctuation is smaller than that of FedAvg. For CFTML, the accuracy increases from 55.22% to 62.72% with the increase of rounds. For the proposed DCFL, as the number of training rounds increases, the average accuracy gradually increases to 65.34%, which is 10.37%, 7.79% and 2.62% higher than FedAvg, IFCA and CFTML, respectively. The reason is that DCFL uses adaptive clustering, which can reduce the probability of cluster misclassification and the error caused by randomly setting the number of clusters. At the same time, it can dynamically update cluster members and structures according to training, thereby reducing the sharing between different types of heterogeneous data and better learning homogeneous data. In addition, the proposed FedVM only updates parameters based on neighbor information, learns more similar and reliable information, and better improves model accuracy. At the same time, the decentralized structure can reduce communication overhead and speed up the model to achieve target accuracy.

[0184] When radio is increased to 0.75, similar results can be seen, and it is clear that DCFL is always more accurate than the other schemes. For FedAvg, IFCA, and CFTML, the accuracy increases from 17.27% to 52.15%, 19.38% to 77.86%, and 78.18% to 79.41%, respectively. For DCFL, the accuracy increases from 78.21% to 82.46%, which is 30.31%, 4.55%, and 3.05% higher than FedAvg, IFCA, and CFTML, respectively.

[0185] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0186] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.

Claims

1. An adaptive clustering federated learning method based on neighbor interaction, characterized in that: The method is used to construct an adaptive clustering federated learning framework model based on neighbor interaction, namely, the DCFL model. The method includes the following steps: S1. Build N edge clients ES, denoted as e i , i∈[1,N], the underlying physical network containing all edge clients is abstracted into a graph G=(V,E), where the node V represents ES, the edge E represents the network connection between edge clients, and the edge in the graph has a weight, which is the weight of any two nodes e i and e j The similarity between ij , two nodes connected by an edge are called neighbors; S2, perform local network model training. In the e-th round of federated tasks, the edge client e i According to the parameters Based on its local data D i , and perform T rounds of local training to obtain the model accuracy by minimizing the loss function Loss value parameter In the first round of federated tasks, the parameters of N clients are initialized to w 0 ; S3, in the clustering stage, the adaptive clustering algorithm ACAS is used: the edge client calculates the client e through KL divergence i With e j Local training parameters and The similarity S ij , automatically clustering based on the minimum spanning forest algorithm, determining neighbors, the number of clusters is set to C, and the cluster head is selected based on the maximum influence theory; In step S3, the specific method of the ACAS algorithm is: In the stage of calculating the similarity of model weight parameters, Kullback-Leibler divergence KLD is used to measure the similarity of model weights, so that N ESs can share similarity and achieve self-grouping; Select the parameters of each model and perform similarity calculation. Then the client e i With e j The model parameters w i and w j The KLD is described as: in, represents the model parameter w j For input data The pre-softmax output, D KL (w i ,w j )≥0; the smaller KLD is, the higher S ij The smaller it is, the node e i and e j The closer the relationship between the models is; the mean of the two node parameters KLD is calculated as the similarity judgment criterion, and the node e i and e j The similarity between them is S ij : Then, we calculate the D between any two models KL (w i ,w j ), and obtain the similarity matrix S∈R N×N ; S is a symmetric matrix with all zeros on the diagonal; after obtaining the similarity matrix S, the clients are clustered based on the minimum spanning forest according to the client similarities in S; S4. In the federated information interaction phase, the FedVM algorithm based on the voter model is adopted: all edge clients calculate the transfer probability p based on the neighbor interaction and consensus idea in the voter model. ij , node e i Its neighbor e in the same cluster j Using p ij , update the parameters Until every node in the cluster has exchanged information with its neighbors and updated the local network model again; In step S4, the specific method of the FedVM algorithm is: In order to deal with Non-IID data in federated learning, the FedVM algorithm adopts the neighbor interaction and dynamic consensus ideas of the voter model to select appropriate clients and optimal weight exchange parameters for parameter updates, so that connected users can interact with their neighbors to achieve global consensus and accelerate model convergence; S5. Repeat steps S2-S4 until the termination condition is reached. All edge clients calculate the final parameters, extract features based on the data collected from multiple mobile users, calculate the accuracy of the model and the optimal loss function, and obtain the trained DCFL model. The entire training process is completed and output to the corresponding service of the mobile device in real time.

2. The method for adaptive clustering federated learning based on neighbor interaction according to claim 1, characterized in that: In step S2, the specific method of training the local network model is: Using the deep neural network CNN model, the local model uses user data as input for end-to-end feature learning and classification training, and uses mini-batch GD to minimize the loss value in each iteration; the client e i The local training parameters in the tth round of the federated task in the eth round are abbreviated as e i Get update parameters based on neighbor client information And collect data packets D from end users i To conduct local training, each round of training gets the loss In the first round, when no clusters are divided, the global parameter w is initialized. 0 ; Gradient G i,t Calculated as: e i According to the gradient renew And continue training the local model: Where η is the learning rate; In e i After T rounds of local training, the accuracy is Loss value Updated parameters 3. The method for adaptive clustering federated learning based on neighbor interaction according to claim 1, characterized in that: In step S3, the specific method for the client to perform clustering is: Due to S ij The smaller the node e i and e j The closer the relationship between the models is, the goal is to connect these nodes into C minimum spanning trees by connecting some edges to form a minimum spanning forest. Since there is no cycle in each tree, there are n edges in cluster c. c -1, n c is the number of clients in cluster c, then N nodes have NC edges in C clusters, and the system graph is guaranteed not to form a cycle; Considering the time complexity, the greedy idea in the minimum spanning forest Kruskal algorithm is used to cluster. First, N discrete nodes are selected from the lower left corner of S as the edge of the node. If the newly added edge does not cause a loop in the spanning forest, the new edge is added to the spanning forest until all points are included in the spanning forest. At this time, all nodes have at least one edge connected to their neighbors. N nodes and edges constitute a spanning forest V = (G, E). Each minimum spanning tree is a group. The number of trees C is the number of groups. The node e is recorded. i The cluster c where the label is k c,i , k c,i =1 represents client e i Belongs to cluster c; at the same time, record all nodes e i The edge weight of , at this time, a round of clustering is completed; Since the participating members in DCFL are dynamic, it is necessary to select cluster heads as cluster representatives for new members to choose without the cooperation of a third-party server, thereby reducing the computational overhead of new users joining the cluster; Existing Theorem 1: In the process of information interaction, compared with low-degree nodes, nodes are more likely to connect to high-degree nodes because high-degree nodes have greater influence; Based on the above Theorem 1, the greater the degree of the connection between nodes in the graph, the greater the possibility that the opinion will be adopted from the perspective of the voter model. Therefore, in a cluster c, nodes with large degrees are preferred as cluster heads; if e i With e j In the same cluster c, all nodes have the maximum degree. Calculate the relative distance between other nodes in the cluster and this node e. i With e j The sum of the similarities is denoted by S i and S j , S i and S j The node with the smaller value is the cluster head; if S i =S j , then the node with the larger model accuracy is selected as the cluster head, so the cluster head H c The selection rules are: Among them, J c is the label of all nodes in cluster c; the cluster head only serves as a cluster representative, so there is no need for a strong connection between the cluster head and cluster members in the same cluster; even if the cluster head is selected, the information interaction within the same cluster is still carried out according to the predetermined graph connection method.

4. The method for adaptive clustering federated learning based on neighbor interaction according to claim 3, characterized in that: The step S3 also includes a method for updating the cluster structure: The dynamic update situations are divided into three categories: new users joining, old users leaving, and cluster dynamic update when no users join or are offline; When a new user N+1 When joining, use local data to initialize the parameter w 0 Perform local training with C cluster head parameters to obtain C+1 accuracy values, compare and select the cluster corresponding to the maximum accuracy to join; If the accuracy of cluster head parameter training is greater than a certain threshold, the cluster head is directly added to the cluster without adding additional clusters; if the initialization parameter w 0 If the accuracy is the largest, a new cluster is added, so the update rule of cluster data C is: in, for e i At the current parameter w i Considering the computational overhead, only the training accuracy of C cluster head parameters is compared to find the appropriate cluster, and then the most similar cluster member in the cluster is connected to realize information interaction. When the number of clients in a cluster is reduced to 1, it is compared to a new user, and C=C-1 is set. It is determined whether to reserve a cluster for this user. If it cannot merge with other clusters, it forms a cluster by itself. If the cluster head falls behind, it exits the change and re-selects a cluster head for this cluster. After each round of intra-cluster aggregation, T rounds of local training are performed. Then, the neighbor relationship within the cluster is updated using the ACAS algorithm, and the nodes in each cluster form an acyclic graph to complete the intra-cluster structure update; then, the update is cyclically performed.

5. The method for adaptive clustering federated learning based on neighbor interaction according to claim 3, characterized in that: In step S4, the specific method of the voter model is: (1) State: Node e i The status is set to s i ={w i }; (2) Neighborhood division: According to the ACAS algorithm, the similarity matrix S of N models is obtained, and the clients are clustered and neighbors are divided. Two nodes with edge connections are neighbors. (3) State update rule R: Parameter update process, select a pair of nodes and assign their state to another node with a certain probability; the node e in the cluster i According to the number of members in the cluster n c , node degree k i according to To calculate the transition probability p ij , node e i Parameter fusion neighbor e j The parameters after are updated as follows: w i =(1-p ij )w i +p ij w j Because p ij Indicates that node e is within a given time step j The state is assigned to node e i The probability that any node e i The shared edges with its neighbors, then A ij =1, n in the same cluster c Fixed, e i The transition probability with its neighbors is the same as 1 / n c k i , so in the eth round of federal tasks i At the same time, interact with all its neighbor nodes and update the parameters as follows: Among them, h i Represents node e i Neighbor nodes, the interaction process of each node in the cluster is parallel; Since node e i With node e j The neighbors are different, that is, the degree of the node is different, corresponding to e i With e j The transition probabilities are also different, p ij ≠p ji , as follows, node e j Select Neighbor i The parameters of are combined as follows: w j =(1-p ji )w j +p ji w i In node selection, e i With e j They all select each other for information fusion, so the fusion between nodes takes direction into consideration; In the same cluster, cluster members fuse information with all their neighbors until all nodes have completed parameter update, that is, one round of intra-cluster aggregation is completed; then, T rounds of local training are continued; after that, the parameters of each node in the cluster have been transformed, and the neighbor relationship is re-established according to the self-update of the intra-cluster structure; the cycle is repeated until E rounds of intra-cluster aggregation are completed.

6. An adaptive clustering federated learning system based on neighbor interaction, characterized in that: The following units are included: Edge client network graph construction unit, used to build N edge clients ES, denoted as e i , i∈[1,N], the underlying physical network containing all edge clients is abstracted into a graph G=(V,E), where the node V represents ES, the edge E represents the network connection between edge clients, and the edge in the graph has a weight, which is the weight of any two nodes e i and e j The similarity between ij , two nodes connected by an edge are called neighbors; The local network model training unit is used for edge client e in the e-th round of federated tasks. i According to the parameters Based on its local data D i , and perform T rounds of local training to obtain the model accuracy by minimizing the loss function Loss value parameter In the first round of federated tasks, the parameters of N clients are initialized to w 0 ; Adaptive Clustering Algorithm ACAS unit, used to calculate client e through KL divergence i With e j Local training parameters and The similarity S ij , automatically clustering based on the minimum spanning forest algorithm, determining neighbors, the number of clusters is set to C, and the cluster head is selected based on the maximum influence theory; In the adaptive clustering algorithm ACAS unit, the specific method is: In the stage of calculating the similarity of model weight parameters, Kullback-Leibler divergence KLD is used to measure the similarity of model weights, so that N ESs can share similarity and achieve self-grouping; Select the parameters of each model and perform similarity calculation. Then the client e i With e j The model parameters w i and w j The KLD is described as: in, represents the model parameter w j For input data The pre-softmax output, D KL (w i ,w j )≥0; the smaller KLD is, the higher S ij The smaller it is, the node e i and e j The closer the relationship between the models is; the mean of the two node parameters KLD is calculated as the similarity judgment criterion, and the node e i and e j The similarity between them is S ij : Then, we calculate the D between any two models KL (w i ,w j ), and obtain the similarity matrix S∈R N×N ; S is a symmetric matrix with all zeros on the diagonal; after obtaining the similarity matrix S, the clients are clustered based on the minimum spanning forest according to the client similarities in S; The FedVM algorithm unit based on the voter model is used to calculate the transition probability p for all edge clients based on the neighbor interaction and consensus ideas in the voter model. ij , node e i Its neighbor e in the same cluster j Using p ij , update the parameters Until every node in the cluster has exchanged information with its neighbors and updated the local network model again; In the FedVM algorithm unit based on the voter model, the specific method is: In order to deal with Non-IID data in federated learning, the FedVM algorithm adopts the neighbor interaction and dynamic consensus ideas of the voter model to select appropriate clients and optimal weight exchange parameters for parameter updates, so that connected users can interact with their neighbors to achieve global consensus and accelerate model convergence; The DCFL model training unit is used to repeat the training until the termination condition is reached. All edge clients calculate the final parameters, extract features based on the data collected by multiple mobile users, calculate the accuracy of the model and the optimal loss function, obtain the trained DCFL model, complete the entire training process, and output it to the corresponding service of the mobile device in real time.

Citation Information

Patent Citations

  • Online collaborative learning user grouping method based on user interaction trusted network

    CN113630461A

  • Client selection federal learning method based on DBSCAN clustering

    CN114819069A

  • Clustering federated learning method oriented to heterogeneous statistics

    CN115952860A

  • Decentralization federated learning method under cross-domain heterogeneous scene

    CN117556923A

  • Random sampling consensus federated semi-supervised learning

    US20230177812A1