Multi-center federated learning: clients clustering for better personalization

Personalized decision-making can be implemented in a Federated learning (FL) framework that can collaboratively train a decision model by extracting knowledge across intelligent clients, e.g. smartphones or enterprises. FL can mitigate the data privacy risk of collaborative training since it merely collects local gradients from users without access to their data. However, FL is fragile in the presence of statistical heterogeneity that is commonly encountered in personalized decision making, e.g., non-IID data over different clients. Existing FL approaches usually update a single global model to capture the shared knowledge of all users by aggregating their gradients, regardless of the discrepancy between their data distributions. By comparison, a mixture of multiple global models could capture the heterogeneity across various clients if assigning the client to different global models (i.e., centers) in FL. To this end, we propose a novel multi-center aggregation mechanism to cluster clients using their models’ parameters. It learns multiple global models from data as the cluster centers, and simultaneously derives the optimal matching between users and centers. We then formulate it as an optimization problem that can be efficiently solved by a stochastic expectation maximization (EM) algorithm. Experiments on multiple benchmark datasets of FL show that our method outperforms several popular baseline methods. The experimental source codes are publicly available on the Github repository (GitHub repository: https://github.com/mingxuts/multi-center-fed-learning).


Introduction
The widespread of social networks and mobile APPs has witnessed a huge volume of data generated by end-users on mobile devices [1].Generally, a service provider on the server side collect users' data and train a global machine learning model such as deep neural networks.Such a centralized machine learning approach causes severe practical issues, e.g., communication costs, consumption of device batteries, and the risk of violating the privacy and of user data.Moreover, each user or client may have different decision making preferences that may caused by the changes of their life events and dynamic networks.
The modern decision-making system is generally empowered by various deep neural network-based intelligent models that include two components: embedding and decision.The embedding component could be a backbone is composed of CNN [2,3], GCN [4,5], RNN/LSTM [6,7], or Self-attention/Transformer modules [8,9] to transform the multi-modal data, such as images, graphs, time series, sequential behavior and texts, into numeric vectors for further processing.The decision component usually takes a multi-layer fully connected neural network to model the complex relationship between inputs and decisions (outputs).Then, the embedding and decision components will be connected to form an entire deep learning model to be trained in an end-to-end manner.
Federated learning (FL) [10] is a new machine learning paradigm that learns models collaboratively using the training data distributed on remote devices to boost communication efficiency.There are three advantages that can make FL be the best option to implement a personalized decision-making system.First, the deep learning model requires a huge volume of training data that is usually impractical for a single client, thus, the FL-based framework enables the clients to collaboratively train a model with abundant training data.Second, the FL separates the model training and data storage, which can greatly reduce the privacy risk for participating clients.Third, each client can take part in the model training process of the FL system, and then it can take the opportunity to train a personalized decision-making model by leveraging both the globally shared knowledge and locally stored data.
The vanilla FL addresses a practical setting of distributed learning, where 1) the central server is not allowed to access any user data which protects users' privacy, and 2) the data distribution over different users is non-IID, which is a natural assumption of real-world applications.However, early FL approaches [10] [11] use only one global model as a single-center to aggregate the information of all users.The stochastic gradient descent (SGD) for single-center aggregation is designed for IID data, and therefore, conflicts with the non-IID setting in FL.The observed data in each device are generated or produced by the user.The dataset across devices are usually non-IID that reflects different preferences or decision logic of users.We assume the whole population could be partitioned into different clusters or groups in which the users have similar preferences.Therefore, learning an intelligent model customised for each group with non-IID data can assist users to make decision-making by considering personal preferences.
Recently, the non-IID or heterogeneity challenge of FL has been studied to improve the robustness of global models against outlier/adversarial users and devices [12][13][14].Moreover, [15] proposed an idea of clustered FL (FedCluster) that addresses the non-IID issue by dividing the users into multiple clusters.However, the hierarchical clustering in FedCluster is achieved by multiple rounds of bipartite separation, each requiring the federated SGD algorithm to run until convergence.Hence, its computational and communication efficiency will become bottlenecks when applied to a large-scale FL system.More recently, [16] and [17] proposed to cluster the local models according to the loss of hypothesis.In particular, each user will try all K global models representing K clusters, and then select the best global model as the cluster ID by considering the lowest loss of running the global model on local data.However, this posts high communication and computation overheads because the selected nodes will spend more resources for receiving and running multiple global models.
In this paper, we propose a novel multi-center FL framework that updates multiple global models by aggregating information from multiple user groups.In particular, the datasets of the users in the same group are likely to be generated or derived from the same or similar distribution.We formulate the problem of the multicenter FL as the joint clustering of users, and then optimizing of the global model for users in each cluster.In particular, (1) each user's local model is assigned to its closest global model, and (2) the global model in each cluster leads to the smallest loss over all the associated users.The proposed multi-center FL not only inherits the communication efficiency of the federated SGD but also retains the capability of handling non-IID data on heterogeneous datasets.Lastly, we propose a new optimization method in line with EM algorithm to train our model.

Related work 2.1 Personalized Decision-making
Decision making is the process of making choices by identifying a decision, gathering information, and assessing alternative resolutions.In most of the scenarios, each individual person usually makes a personal choice given the collected information.To model the personalized decision-making process [18,19], a general solution is to collect the user's personal characteristics, e.g.demographics [20], behavior history [21], and social networks [22], as part of the input to be considered by a centralized intelligent model.This solution usually train a large-scale machine learning or recommendation models at cloud server using the collected personal data from users, thus it will cause privacy concerns.In recent, a new service architecture has been proposed to provide service based on a standalone on-device intelligent [23] in each smart device.In particular, a unique intelligent model customized for each user will be deployed to the user's smart device, so as to provide service independently while not relying on the decision from the cloud server.The user's personal data will be stored locally to train the intelligent model, thus no personal data will be uploaded to the server.

Federated Learning
Federated learning (FL) enables users to leverage rich data for machine learning models without compromising their data.It has attracted a significant amount of research interest since 2017, with many studies investigating FL from several aspects, e.g., system perspective, personalized models, scalability [24], communication efficiency [25], and privacy [26].Most of the related work addresses a particular concern such as security or privacy [27][28][29].It has been applied to various industry applications, such as banking [30], healthcare [31][32][33], and mobile internet applications [34].
FL is designed for specific scenarios that can be further expanded to a standard framework to preserve data privacy in large-scale machine learning systems or mobile edge networks [35].For example, [11] expanded FL by introducing a comprehensive, secure FL framework that includes horizontal FL, vertical FL, and federated transfer learning.The work in [36,37] surveyed the FL systems in relation to their functions on privacy protection and security threats.[38] discussed the advances and open problems in FL. [39] proposed LEAF -a benchmark for federated settings with multiple datasets.[40] proposed an object detection-based dataset for FL.
Heterogeneity is a core challenge in the federated setting and has been widely studied from various perspectives.[41] conducted theoretical convergence analysis for FL with heterogeneous data.[42] measured the effects of non-IID data for federated visual classification.[43] proposed a heterogeneity-aware platform design for FL.[44] discussed the local representations that enable data to be processed on new devices in different ways according to their source modalities instead of using a single global model.The single global model might not generalize to unseen modalities and distributions of data.[45] proposed a new federated setting composed of a shared global dataset and many heterogeneous datasets from devices.[46] and [47] proposed to integrate knowledge distillation with FL to tackle the model heterogeneity.[48] proposed a general FL framework to align heterogeneous model architectures and functional neurons.[49] proposed to a prototype learning-based FL framework to tackle the challenges of task heterogeneity across devices.Particularly, it aggregates the prototypes rather than model parameters, and then the communication efficiency is much higher than gradient-based algorithm, such as FedAvg.
To solve the problem caused by non-IID data in a federated setting [39], [15] proposed clustered FL (FedCluster) by integrating FL and bi-partitioning-based clustering into an overall framework, and [16,17] proposed a hypothesis-based federated clustering that assigns the cluster by considering the loss of running the global model on local data.[12] proposed a robust FL comprising three steps: 1) learning a local model on each device, 2) clustering model parameters to multiple groups, each being a homogeneous dataset, and 3) running a robust distributed optimization [50] in each cluster.[51] propose a general form to model the clustered FL problem into a bi-level optimization framework, and then conduct theoretical analysis on the convergence.[14] proposed FedDANE by adapting the DANE [52] to a federated setting.In particular, FedDANE is a federated Newton-type optimization method.[13] proposed FedProx for the generalization and re-parameterization of FedAvg [10].It adds a proximal term to the objective function of each device's supervised learning task, and the proximal term is to measure the parameter-based distance between the server and the local model.[53] added a personalized layer for each local model, i.e., FedPer, to tackle heterogeneous data.[54] propose to a structure-based model aggregation mechanism to enhance the personalized federated learning.

Overall framework
This section will introduce the overall framework of the proposed multi-center Federated Learning.As shown in Fig. 1, each client could be an intelligent device or computer in an enterprise, and they will collaboratively train an intelligent model via a coordinating server.First, the client initializes its local model using the global model from the federated learning server.Second, the client trains the local model using its own data.Third, the trained model will be uploaded into the server that will conduct client clustering across clients' model parameters, and then conduct model aggregation in each cluster.Fourth, the model in each cluster will be dispatched to the corresponding clients.The multi-center FL framework will repeat these four steps till convergence or the stop condition is satisfied.
In the following subsections, we will give a formal formulation of the proposed problem, and then explain the motivation of the design.The detailed method and optimization procedure is provided in Section 4.

Problem Setting
In FL, each device-i has a private dataset where X i and Y i denote the input features and corresponding gold labels respectively.Each dataset D i will be used to train a local supervised learning model M i : X i → Y i .M denotes a deep neural model parameterized by weights W .It is built to solve a specific task, and all devices share the same model architecture.
For the i-th device, given a private training set D i , the training procedure of M i is represented in brief as where L s (•) is a general definition of the loss function for any supervised learning task, and its arguments are model structure, training data and learnable parameters respectively, and W denotes the parameters after training.In general, the data from one device is insufficient to train a data-driven neural network with satisfactory performance.An FL framework optimizes the local models in a distributed manner and minimizes the loss of the local data on each device.Hence, the optimization in vanilla FL over all the local models can be written as where m denotes the number of devices, and α i = |Di| j |Dj | is an importance weight that is measured by the number of samples on each clients.
On the server side, the vanilla FL aggregates all local models into a global one M global which is parameterized by W g .In particular, it adopts a weighted average of the local model parameters which is the nearest center for all {W i } m i=1 in terms of a weighted L2 distance: More generally, we can replace the L2 distance in Eq. ( 3) by other distance metric Dist(•, •) and minimize the difference between the global model and all the local models, i.e., The above aims to find a consistent solution across global model and local models.Note that a direct macro average is used here regardless of the weight of each device, which treats every device equally.The weights used in Eq. (3.2) can easily be incorporated for a micro average.
The divergence Dist(•, •) between the global model and local models plays an essential role in the FL objective.The simple L2 distance for Dist(•, •) does not take into account the fact that two models can be identical under the arbitrary permutation of neurons in each layer.
Hence, the lack of neuron matching may cause misalignment in that two neurons with similar functions and different indexes cannot be aligned across models [55].However, the index-based neuron matching in FL [52] is the most widely used method and works well in various real applications.One potential reason for this is that the index-based neuron matching can also slowly align the function of neurons by repeatedly initializing all local models with the same global model.To simplify the description, we will discuss our method for index-based neuron matching.

Motivation
Federated learning (FL) usually aggregates all local models to a single global model.However, this single-center aggregation is fragile under heterogeneity.In contrast, we consider FL with multiple centers to better capture the heterogeneity by assigning nodes to different centers so only similar local models are aggregated.Consider two extreme cases for the number of centers, K: (1) when K = 1, it reduces to the FedAvg with a single global model, which cannot capture the heterogeneity and the global model might perform poorly on specific nodes; (2) When K = m, the heterogeneity problem can be avoided by assigning each node to one global model.But the data on each device used to update each global model can be insufficient and thus we lose the main advantage of FL.Our goal is to find a sweet point between these two cases to balance the advantages of federated averaging and the degradation caused by underlying heterogeneity.Learning one unique model for each node has been discussed in some recent FL studies for better personalized models.They focus on making a trade-off between shared knowledge and personalizing.The personalizing strategy either applies fine-tuning of the global model [56] for each node, or only updates a subset of personalized layers for each node [44,53], or deploys a regularization term in the objective [57][58][59].In contrast, Multi-center FL in this paper mainly focuses to address the heterogeneity challenge by assigning nodes to different global models during aggregation.But it can be easily incorporated in these personalization strategies.In the following, we will start from the problem setting for the the vanilla FL, and then elucidate our motivation of improving FL's tolerance to heterogeneity by multi-center design.

Multi-Center Model Aggregation
To overcome the challenges arising from the heterogeneity in FL, we propose a novel model aggregation method with multiple centers, each associating with a global model W (k) updated by aggregating a cluster of user's models with nearly IID data.In particular, all the local models will be grouped to K clusters, denoted as j=1 .An intuitive comparison between the vanilla FL and our multi-center FL is illustrated in Fig. 2. As shown in the left figure, there is only one center model in vanilla FL.In contrast, the multi-center FL shown in the right has two centers, W (1) and W (2) , and each center represents a cluster of devices with similar data distributions and models.Obviously, the right one has a smaller intra-cluster distance than the left one.As discussed in the following Section 4, intra-cluster distance directly reflects the possible loss of the FL.Hence, a much smaller intra-cluster distance indicates our proposed approach potentially reduces the loss of FL.

Problem Formulation
Solving a joint optimization on a distributed network.
The multi-center FL problem can be formulated as an optimisation framework as below.
where λ controls the trade-off between supervised loss and distance.We solve it by applying an alternative optimization between server and user: (1) on each node-i, we optimize the above objective w.r.t.W i while fixing all the other variables; and (2) on the server, we optimize {r while fixing all local models {W i }.
Multi-center assignment at the server end.
The second term in Eq. ( 5) aims to minimize the distance between each local model and its nearest global model.Under the non-IID assumption, the data located at different devices can be grouped into multiple clusters where the on-device data in the same cluster are likely to be generated from one distribution.As illustrated on the right of Fig. 2, we optimizes the assignments and global models by minimizing the intra-cluster distance, i.e, where cluster assignment r (k) i , as defined in Eq. ( 8), indicates whether devicei belongs to cluster-k, and W (k) is the parameters of the aggregated model for cluster-k.

Distance-constrained loss for local model optimization.
Because the distance between the local model and the global model are essential to our new loss, we don't expect the local model will be changed too much during the local updating stage.The new loss consists of a supervised learning loss and a regularization term to constrain the local model to ensure it is not too far from the global model.This kind of regularization term is also known as the proximal term in [13] that can effectively limit the impact of the variable local updates in FL.We minimize the loss below for each local model W i as follows:

Optimization Algorithm
In general, Expectation-Maximization (EM) [60] is an optimisation framework to solve alternative updating of multiple parameters, for example, K-Means clustering with updates on cluster centers and cluster assignments.However, in contrast to the general objective of clustering, our proposed objective, as described in Eq. 6, has a dynamically changing W i during optimization.Therefore, we adapt the Stochastic Expectation Maximization (SEM) [61] optimization framework by adding one step, i.e., updating W i .In the modified SEM optimization framework, named federated SEM (FeSEM), we will iterative conduct a sequence of actions as below.
Firstly, for the E-Step, we update cluster assignment r (k) i with fixed W i .We calculate the distance between the cluster center and nodes -each node is the model's parameters W i , then update the cluster assignment r Secondly, for the M-Step, we update the cluster center W (k) according to the W i and r Thirdly, to update the local models, the global model's parameters W (k) are sent to each device in cluster k to update its local model, and then we can fine-tune the local model's parameters W i using a supervised learning algorithm on its own private training data while considering the new loss as described in Eq. 7. The local training procedure is a supervised learning task by adding a distance-based regularization term.The local model is initialized by the global model W (k) which belong to the cluster associated with the node.
Lastly, we repeat the three stochastic updating steps above until convergence.The sequential executions of the three updates comprise the iterations in FeSEM's optimization procedure.In particular, we sequentially update three variables r (k) i , W (k) , and W i while fixing the other factors.These three variables are jointly used to calculate the objective of our proposed multi-center FL in Eq. 6.
We implement FeSEM in Algorithm 1 which is an iterative procedure.As elaborated in Section 4.2, each iteration comprises of three steps to update three sets of variables that are cluster assignment r for each client, the representation of cluster centre W , and the local models' parameters W , respectively.In particular, the update of the local model is executed on the client by fine-tuning the model as in Algorithm 2.
while stop condition is not satisfied do 3: E-Step: Update cluster assignment r (k) i using d ik (Eq.8) 6: M-Step: and W i (Eq.9) 8: for each cluster k = 1, . . .K do 9: Send W (k) to device i 11: end for

Some Possible Extensions
To further handle heterogeneous data in FL scenario, our multi-center FL approach can be easily extended with other packages.We discuss two beneficial techniques here.

Model Aggregation with Neuron Matching
The vanilla FL algorithm, FedAvg [10], uses model aggregation with index-based neuron matching which may cause the incorrect alignment.Neurons with similar functions usually take different indexes in two models.Recently, a function-based neuron matching [62] in FL is proposed to align two models by matching the neurons with similar functions.In general, the index-based neuron matching can gradually align the neuron's functionality across nodes by repeatedly forcing each local model to be initialized using the same global model.However, the function-based neuron matching can speed up the convergence of neuron matching and preserve the unique functional neuron of the minority groups.In this work, we integrate layer-wise matching and then averaging(MA) [62] into ours to increase the capacity to handle heterogeneous challenges.In the model aggregation step at the FL server, we need to align the layer-wise parameters among models from different clients.For example, given a layer with three neurons {A1, A2, A3} in model A, and a layer with neurons {B1, B2, B3} in model B, the neuron matching is to find an alignment between two sets that could be seen as a bi-party alignment problem.If we use index-based neuron matching, e.g.FedAvg [10], we just simply aggregate the parameters of A1 and B1 according to their index number in each model.If we choose function-based neuron matching, e.g.FedAvg [62], we probably will aggregate the neuron A1 to B3 that they maybe share similar functions with different indexes in each model.The distance between the local model and the global model is the neuron matching score that is calculated by estimating the maximal posterior probability of the j-th client neuron l generated from a Gaussian with mean W i , and and f (•) are guided by the Indian Buffet Process prior [55].

Selection of K
The selection of K, the number of centers, is essential for a multi-center FL.In general, the K is defined based on the prior experience or knowledge of data.If there is no prior knowledge, the most straightforward solution is to run the algorithm using different K and then select the K with the best performance in terms of accuracy or intra-cluster distance.Selecting the best K in a large-scale FL system is time consuming, hence we simplify the process by running the algorithm on a small number of sampled nodes with several communication rounds.For example, we can randomly select 100 nodes and test K in FL with three communication rounds only, and then apply the K to the large-scale FL.

Experiments
As a proof-of-concept scenario to demonstrate the effectiveness of the proposed method, we experimentally evaluate and analyze FeSEM on two datasets.

Datasets.
We employed two publicly-available federated benchmarks datasets introduced in LEAF [39].LEAF is a benchmarking framework for learning in federated settings.
The datasets used are Federeated Extended MNIST (FEMNIST)1 [63] and Federated CelebA (FedCelebA)2 [64].We follow the setting of the benchmark data in LEAF.In FEMNIST, images is split according to the writers.For FedCelebA, images are extracted for each person and developed an on-device classifier to recognize whether the person smiles or not.A statistical description of the datasets is described in Table 1.

Local model
We use a CNN with the same architecture from [64].Two data partition strategies are used: (a) an ideal IID data distribution using randomly shuffled data, (b) a non-IID partition by use a p k ∼ Dir J (0.5).Part of the code is adopted from [62].For FEMINST data, the local learning rate is 0.003 and epoch is 5. and for FedCelebA, 0.03 and 10 respectively.

Baselines.
In the scenario of solving statistical heterogeneity, we choose FL methods as follows: 1. NonFed: We will conduct the supervised learning task at each device without the FL framework.2. FedSGD: uses SGD to optimize the global model.3. FedAvg: is an SGD-based FL with weighted averaging.[10] .4. FedCluster: is to enclose FedAvg into a hierarchical clustering framework [15]. 5. HypoCluster(K): is a hypothesis-based clustered-FL algorithm with different K [16].6. Robust our implementations based on the proposed method in [12], see this baseline settings in Appendix.7. FedDANE: this is an FL framework with a Newton-type optimization method.
[14].8. FedProx: this is our our own implementations following [13].We set scaler of proximal term to 0.1.9. FedDist: we adapt a distance based-objective function in Reptile meta-learning [65] to a federated setting.10.FedDWS: a variation of FedDist by changing the aggregation to weighted averaging where the weight depends on the data size of each device.11.FeSEM(K): our multi-center FL implemented on federated SEM with K clusters.

Training settings.
We used 80% of each device's data for training and 20% for testing.For the initialization of the cluster centers in FeSEM, we conducted pure clustering 20 times with randomized initialization, and then the "best" initialization, which has the minimal intra-cluster distance, was selected as the initial centers for FeSEM.For the local update procedure of FeSEM, we set N to 1, meaning we only updated W i once in each local update.

Evaluation metrics.
Given numerous devices, we evaluated the overall performance of the FL methods.We used classification accuracy and F1 score as the metrics for the two benchmarks.In addition, due to the multiple devices involved, we explored two ways to calculate the metrics, i.e., micro and macro.The only difference is that when computing an overall metric, "micro" calculates a weighted average of the metrics from devices where the weight is proportional to the data amount, while "macro" directly calculates an average over the metrics from devices.2: Comparison of our proposed FeSEM(K) algorithm with the baselines on FEMNIST.Note the number in parenthesis following "FeSEM" denotes the number of clusters, K.

Comparison study
As shown in Table 2 and 3, we compared our proposed FeSEM with the baselines and found that FeSEM achieves the best performance in most cases.But, it is observed that the proposed model achieves an inferior performance for Micro F1 score on the FedCelebA dataset.A possible reason for this is that our objective function defined in Eq. 6 does not take into account the number of samples per device as important weights.Hence, our model is able to deliver a significant improvement in terms of "macro" metrics.Furthermore, as shown in the last four rows in Table 2 and 3, we found that FeSEM with a larger number of clusters empirically achieves a better performance, which verifies the correctness of the non-IID assumption of the data distribution.It is worth noting that the FeSEM-MA is comparable or worsen than FeSEM in our experiment.Because the Matched Averaging method usually works well that each client is randomly initialised while the FedAvg and our FeSEM initialized all clients using the global model.Different initialization strategies will cause different scales of diversity across local models, thus contributing to the performance in different ways.
We also notice that FedAvg and NoFed perform better than some clustered FL baseline.The reason is that our experiment using the original federated learning setting that only split the dataset according to users or by the random split.Therefore, the non-IID and clustering assumption is not obvious in this situation.Therefore, the FedAvg and noFed perform well.In recent, some advanced data split methods have been used to further disturb the non-IID distribution across clients.For example, exaggerate the label distribution across devices by aggregating sample imbalance, or randomly assign different label set to each device.In these new settings, the FedAvg will perform worse, and the clustered FL methods will perform relatively better.Due to the limited space, we will use the original FL setting, and leave the new setting for future work.

Convergence
To verify the convergence of the proposed approach, we conducted a convergence analysis by running FeSEM with different cluster numbers K (from 2 to 4) in 100 iterations.As shown in Fig. 3, FeSEM can efficiently converge on both datasets and it can achieve the best performance with the cluster number K = 4.

Clustering analysis
To check the effectiveness of our proposed optimization method and whether the devices grouped into one cluster have similar model, we conducted a clustering analysis via an illustration.We used two-dimensional figures to display the clustering results of the local models derived from FeSEM(4) on the FEMNIST dataset.In particular, we randomly chose 400 devices from the dataset and plotted each device's local model as one point in the 2D space after PCA dimension reduction.As shown  in Fig. 4, the dataset suitable for four clusters that are distinguishable to each other.It is worth noting that the clustering algorithm will converge very fast.In general, it takes no more than 10 iterations to converge.One can find detailed theoretical and empirical analyses on the convergence for general clustered FL in a recent work [51].

Case study on clustering
To intuitively judge whether nodes grouped into the same cluster have a similar data distribution, we conducted case studies on a case of two clusters that are extracted from a trained FeSEM(2) model.For FMNIST, as shown on the top of Fig. 5, cluster on the right consists writers who are likely to recognize hand-writings with a smaller font, and on the left consists writers who are likely to recognize hand-writing with a bolder and darker font.For FedCelebA, see full face images in Appendix section 2, the face recognition task in cluster1 is likely to handle the smiling faces with a relatively simple background, also exhibits to be young people.While cluster on the right is likely to handle the faces with more diverse background and also seems to be more older people.

Case study
The cluster results are based on the distance metric for client-wise model parameters.The model could be viewed as a map function f : x → y that is to map the input x into an output y.The function is parameterised by model parameters w, thus a similar w pair indicate that the two clients are likely to have similar preferences in decisionmaking.As shown in Figure 5, there are two clusters for FEMNIST and CIFAR-10 datasets respectively.The left part shows the clustering effect of FeSEM on dataset MINIST by writers, on the red rectangle (upper) are three writers handwritten digits which are smaller and lighter than those in the blue rectangle (bottom).The right figure shows the clustering of CIFAR-10 data with 10 classes in which one class is about people.In the class of people, our algorithm finds one cluster to represent young beauties as shown in the red rectangle (upper) and another cluster to represent the aging people in the blue rectangle (bottom).

Conclusion
This work proposes a novel FL algorithm to tackle the non-IID challenge, which is towards better personalization of decision-making in non-IID FL.Since the proposed method uses Kmeans as the clustering algorithm, it also suffers the drawbacks of Kmeans, e.g., computational efficiency for high dimension data and robustness to outliers.Moreover, the clustering algorithm usually requires the full participation of all clients in the training process.A more practical clustered federated learning could be developed to address the large-scale federated learning system, and also to explore how to adapt to new clients out of the training set.

Fig. 2 :
Fig.2: Comparison between single-center aggregation in vanilla FL (left) and multi-center aggregation in the proposed one (right).Each W i represents the local model's parameters collected from the i-th device, which is denoted as a node in the space.W represents the aggregation result of multiple local models.

Fig. 3 :
Fig. 3: Convergence analysis for the proposed FeSEM with different cluster number (in parenthesis) in terms of micro-accuracy.
(k) -the model parameters from server W i -updated local model Initialization: W i ← W (k) for N local training steps do Update W i with training data D i (Eq.7) end for Return W i to server i -device index W

Table 1 :
Statistics of datasets.

Table 3 :
Comparison of our proposed FeSEM(K) algorithm with the baselines on FedCelebA.Note the number in parenthesis following "FeSEM" denotes the number of clusters, K.