{'fraction_non_alphanumeric': 0.035067719783948105, 'fraction_numerical': 0.011861140515158918, 'mean_word_length': 4.459179137650022, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
FedSoft: Soft Clustered Federated Learning with Proximal Local Updating

Traditionally, clustered federated learning groups clients with the same data distribution into a cluster, so that every client is uniquely associated with one data distribution and helps train a model for this distribution. We relax this hard association assumption to soft clustered federated learning, which allows every local dataset to follow a mixture of multiple source distributions. We propose FedSoft, which trains both locally personalized models and high-quality cluster models in this setting. FedSoft limits client workload by using proximal updates to require the completion of only one optimization task from a subset of clients in every communication round. We show, analytically and empirically, that FedSoft effectively exploits similarities between the source distributions to learn personalized and cluster models that perform well.


Introduction
Federated learning (FL) is an innovative privacy-preserving machine learning paradigm that distributes collaborative model training across participating user devices without users' sharing their raw training samples. In the widely used federated learning algorithm FedAvg (McMahan et al. 2017), clients jointly train a shared machine learning model by iteratively running local updates and synchronizing their intermediate local models with a central server. In spite of its success in applications such as next word prediction (Hard et al. 2018) and learning on electronic health records (Brisimi et al. 2018), FL is known to suffer from slow model training when clients' local data distributions are heterogeneous, or non-IID (non-independently and identically distributed). In response to this challenge, some recent works propose to bypass data heterogeneity by performing local model personalization. Instead of pursuing one universally applicable model shared by all clients, these algorithms' training objective is to create one model for each client that fits its local data. Personalization methods include local fine tuning (Sim, Zadrazil, and Beaufays 2019), model interpolation (Mansour et al. 2020), and multi-task learning (Smith et al. 2017). In this paper, we focus on an alternative approach: clustered federated learning, which we generalize to train both cluster and personalized models on realistic distributions of client data.
Copyright © 2022, Association for the Advancement of Artificial Intelligence (www.aaai.org). All rights reserved.
Clustered FL relaxes the assumption of FL that each client has an unique data distribution; instead, it allows different clients to share one data distribution, with fewer source data distributions than clients. The objective of clustered FL is to train one model for every distribution. In traditional clustered FL, a client can only be associated with one data distribution. We thus call this method hard clustered federated learning. Under the hard association assumption, the non-IID problem can be easily resolved: simply group clients with the same data distribution into one cluster, then conduct conventional FL on each cluster, within which the data distribution is now IID among clients. Unlike other personalization methods, clustered FL thus produces centrally available models that can be selectively migrated to new users that are unwilling, or unable, to engage in the subsequent local adaptation process (e.g. fine tuning) due to privacy concerns or resource limitations. This convenience in model adoption is particularly valuable for the current training-testingdeployment lifecycle of FL where deployment, rather than the training itself, is the end goal (Kairouz et al. 2019).
However, hard clustered FL faces two fundamental problems in practice. First, multiple clients may be unlikely to possess identical data distributions. In fact, the real-world user data is more likely to follow a mixture of multiple distributions (Marfoq et al. 2021). E.g., if each client is a mobile phone and we wish to model its user's content preferences, we might expect the clients to be clustered into adults and children. However, adult users may occasionally view children's content, and devices owned by teenagers (or shared by parents and children) may possess large fractions of data from both distributions. Similarly, content can be naturally grouped by users' interests (e.g., genres of movies), each of which may have a distinct distribution. Data from users with multiple interests then reflects a mixture of these distributions. Since the mixture ratios can vary for different clients, they may have different overall distributions even though the source distributions are identical. Clustering algorithms like the Gaussian mixture model (Reynolds 2009) use a similar rationale. Clients may then require models personalized to their distributions to make accurate predictions on their data, in addition to the cluster models used for new users.
Hard clustered FL's second challenge is that it cannot effectively exploit similarities between different clusters. Though FL clients may have non-IID data distributions, two different distributions may still exhibit some similarity, as commonly assumed in personalization works (Smith et al. 2017). For example, young people may have more online slang terms in their chatting data, but all users (generally) follow the same basic grammar rules. Thus, the knowledge distilled through the training on one distribution could be transferred to accelerate the training of others. However, in most hard clustered FL algorithms, different cluster models are trained independently, making it difficult to leverage the potential structural likeness among distributions. Note that unlike in other personalization methods where the discussion of similarity is restricted to similarities between individual clients, here we focus on the broader similarities between source cluster distributions. Thus, we can gain better insight into the general data relationship rather than just the relationships between participating clients.
To overcome clustered FL's first challenge of the hard association assumption, in this paper, we utilize soft clustered federated learning. In soft clustered FL, we suppose that the data of each client follows a mixture of multiple distributions. However, training cluster models using clients with mixed data raises two new challenges. First, the workload of clients can explode. When all the data of a client comes from the same distribution, as in hard clustered FL, it ideally only needs to contribute towards one training task: training that distribution's model. However, in soft clustered FL, a client has multiple data sources. A natural extension of hard clustered FL is for the client to help train all cluster models whose distributions are included in its mixture (Marfoq et al. 2021). However, the workload of participating clients then grows linearly with the number of clusters, which can be large (though typically much smaller than the number of clients) for some applications. This multiplying of client workload can make soft clustered FL infeasible, considering the resource restrictions on typical FL user devices and the long convergence time for many FL models (McMahan et al. 2017). Second, the training of cluster models and the local personalization are distinct. In hard clustered FL, client models are the same as cluster models since a client is uniquely bound to one cluster. In soft clustered FL, local distributions differ from individual cluster distributions, and thus training cluster models does not directly help the local personalization. Complicating things further, these local distributions and their exact relationships to the cluster models are unknown a priori. Combining the training of cluster and personalized models is then challenging.
To solve these two challenges, and handle the second disadvantage of hard clustered FL discussed above, we utilize the proximal local updating trick, which is originally developed in FedProx (Li et al. 2018) to grant clients the use of different local solvers in FL. During the course of proximal local updating, instead of working on fitting the local model to the local dataset, each client optimizes a proximal local objective function that both carries local information and encodes knowledge from all cluster models. We name this proposed algorithm FedSoft.
In FedSoft, since the fingerprints of all clusters are integrated into one optimization objective, clients only need to solve one single optimization problem, for which the work-load is almost the same as in conventional FL. In addition, by combining local data with cluster models in the local objective, clients can perform local personalization on the fly. Eventually, the server obtains collaboratively trained cluster models that can be readily applied to new users, and each participating client gets one personalized model as a byproduct. Proximal local updating allows a cluster to utilize the knowledge of similar distributions, overcoming the second disadvantage of the hard clustered FL. Intuitively, with all clusters present in the proximal objective, a client can take as reference training targets any cluster models whose distributions take up non-trivial fractions of its data. These component distributions, co-existing in the same dataset, are similar by nature. Thus, a personalized local model integrating all its component distributions can in turn be utilized by the component clusters to exploit their similarities.
Our contributions are: We design the FedSoft algorithm for efficient soft clustered FL. We establish a convergence guarantee that relates the algorithm's performance to the divergence of different distributions, and validate the effectiveness of the learned cluster and personalized models in experiments under various mixture patterns. Our results show the training of cluster models converges linearly to a remaining error determined by the cluster heterogeneity, and that FedSoft can outperform existing FL implementations in both global cluster models for future users and personalized local models for participating clients.

Related Works
The training objective of hard clustered FL is to simultaneously identify the cluster partitions and train a model for each cluster. Existing works generally adopt an Expectation-Maximization (EM) like algorithm, which iteratively alternates between the cluster identification and model training. Based on how the partition structure is discovered, these algorithms can be classified into four types: The first type leverages the distance between model parameters, e.g., Xie et al. (2021) propose to determine client association based on the distances between client models and server models. Similarly, Briggs et al. (2020) suggest to apply a distance-based hierarchical clustering algorithm directly on client models. The second type determines the partition structure based on the gradient information, e.g., the CFL (Sattler, Müller, and Samek 2020) algorithm splits clients into bi-partitions based on the cosine similarity of the client gradients, and then checks whether a partition is congruent (i.e., contains IID data) by examining the norm of gradients on its clients. Likewise, the FedGroup (Duan et al. 2020) algorithm quantifies the similarity among client gradients with the so-called Euclidean distance of decomposed cosine similarity metric, which decomposes the gradient into multiple directions using singular value decomposition. The third type utilizes the training loss, e.g., in Hy-perCluster (Mansour et al. 2020), each client is greedily assigned to the cluster whose model yields the lowest loss on its local data. A generalization guarantee is provided for this algorithm. Ghosh et al. (2020) propose a similar algorithm named IFCA, for which a convergence bound is established under the assumption of good initialization and all clients having the same amount of data. The fourth type uses exogenous information about the data, e.g., Huang et al. (2019) and Qayyum et al. (2021) group patients into clusters respectively based on their electronic medical records and imaging modality. This information usually entails direct access to the user data and thus cannot be applied in the general case.
Recently, Marfoq et al. (2021) propose a multi-task learning framework similar to soft clustered FL that allows client data to follow a mixture of distributions. Their proposed FedEM algorithm adopts an EM algorithm and estimates the mixture coefficients based on the training loss. However, FedEM requires every client to perform a local update for each cluster in each round, which entails significantly more training time than conventional FedAvg. Their analysis moreover assumes a special form of the loss function with all distributions having the same marginal distribution, which is unrealistic. In contrast, FedSoft requires only a subset of clients to return gradients for only one optimization task in each round. Moreover, we show its convergence for generic data distributions and loss functions.
The proximal local updating procedure that we adopt incorporates a regularization term in the local objective, which is also used for model personalization outside clustered settings. Typical algorithms include FedAMP (Huang et al. 2021), which adds an attention-inducing function to the local objective, and pFedMe (Dinh, Tran, and Nguyen 2020), which formulates the regularization as Moreau envelopes.

Formulation and Algorithm
Mixture of distributions. Assume that each data point at each client is drawn from one of the S distinct data distributions P 1 , · · · , P S . Similar to general clustering problems, we take S as a hyperparameter determined a priori. Data points from all clients that follow the same distribution form a cluster. In soft clustered FL, a client may possess data from multiple clusters. Given a loss function l(w; x, y), the (real) cluster risk F s (w) is the expected loss for data following P s : (1) We then wish to find S cluster models c * 1 · · · c * S such that all cluster objectives are minimized simultaneously. These cluster models will be co-trained by all clients through coordination at the central server: Suppose a client k ∈ [N ] with local dataset D k has |D k | = n k data points, among which n ks data points are sampled from distribution P s . The real risk of a client can thus be written as an average of the cluster risks: Here we define u ks ∆ = n ks /n k ∈ [0, 1] as the importance weight of cluster s to client k. In general, u ks 's are unknown in advance and the learning algorithm attempts to estimate their values during the learning iterations. It is worth noting that while we directly work on real risks, our formulation and analysis can be easily extended to empirical risks by introducing local-global divergences as in (Li et al. 2018).
Proximal local updating. Since f k is a mixture of cluster risks, minimizing (3) alone does not help solve (2). Thus, we propose each client instead optimize a proximal form of (3): Here λ is a hyperparameter and u t ks denotes the estimation of u ks at time t. In the local updating step, every client searches for the optimal local model w * k that minimizes h k given the current global estimation of cluster models {c t s }. As in (Li et al. 2018), clients may use any local solver to optimize h k . This design of the proximal objective entails cluster models {c t s } be shared among all clients through the server, as is usual in clustered FL (Ghosh et al. 2020). We thus alternatively call {c t s } the centers. The regularization term λ 2 S s=1 u t ks w k − c t s 2 in the proximal objective serves as a reference point for the local model training. It allows clients to work on their own specific dataset while taking advantage of and being guided by the globally shared knowledge of the centers. The regularization is weighted by the importance weights u ks , so that a client will pay more attention to distributions that have higher shares in its data. To see why compounded regularization helps identify individual centers, assume we have a perfect guess of u t ks ≡ u ks . The minimization of (4) can then be decoupled as a series of sub-optimization problems Thus, after h k is minimized, the sub-problems corresponding to large u ks will also be approximately solved. We can hence utilize the output local model w t k * to update these centers with large u ks . Moreover, w t k * trained in this manner forges all its component distributions {D s |u t ks = 0}, which may share some common knowledge. Thus, the training of these clusters are bonded through the training of their common clients, exploiting similarities between the clusters.
The output model w t k * is itself a well personalized model that leverages both local client knowledge and the global cluster information. Marfoq et al. (2021) show that under certain conditions, the optimal client model for soft clustered FL is a mixture of the optimal cluster models. The same implication can also be captured by our proximal updating formulation. When s u t ks = 1, the gradient ∇h k is which implies that w * k should be centered on s u ks c * s . As a result, through the optimization of all h k , not only will the server obtain the trained cluster models, but also each client will obtain a sufficiently personalized local model.
Algorithm design. We formally present FedSoft in Algorithm 1. The first step of the algorithm is to estimate the importance weights {u t ks } for each client k (lines 3-14). The for each data point ( Send u t ks = max{ Server computes v t sk as in (6) ;

16
Server selects S sets of clients Sel t s ⊂ [N ] at random for each cluster, where |Sel t s | = K, and each client gets selected with probability v t sk ; 17 Selected clients download {c t s }, then compute and report w t+1 algorithm obtains them by finding the center that yields the smallest loss value for every data point belonging to that client, and counting the number of points {n t ks } matched to every cluster s. If a client k has no samples matched to s (n t ks = 0), the algorithm sets u t ks = σ, where 0 < σ 1 is a pre-defined smoothing parameter.
Once the server receives the importance weights {u t ks }, it computes the aggregation weights v t sk as follows (line 15): i.e., a client that has higher importance weight on cluster s will be given higher aggregation weight, and vice versa. The introduction of the smoother σ avoids the situation where k u t ks = 0 for some cluster, which could happen in the very beginning of the training when the center does not exhibit strength on any distributions. In that case, v t sk = 1 N , i.e., the cluster will be updated in a manner that treats all clients equally. Otherwise, since σ is very small, a client with u t ks = σ will be assigned a v t sk ≈ 0, and the aggregation weights of other clients will not be affected.
Though calculating and reporting {u t ks } is computationally trivial compared to the actual training procedure, sending centers to all clients may introduce large communication costs. FedSoft thus allows the estimations of u ks to be used for up to τ ≥ 1 iterations (line 3). In practice, a client can start computing u t ks for a cluster before it receives all other centers, the delay of transmission is thus tolerable.
Next, relevant clients run proximal local updates to find the minimizer w t+1 k for the proximal objective h t k , which entails solving only one optimization problem (line 17).
In the case when all clients participate, the cluster models are produced by aggregating all client models: c t+1 s = N k=1 v t sk w t+1 k . However, requiring full client participation is impractical in the federated setting. We thus use the client selection trick (McMahan et al. 2017) to reduce the training cost (lines 16). For each cluster s, the algorithm randomly selects a small subset of clients Sel t s to participate in the local updating at time t, where |Sel t s | = K < N . Clustered FL generally entails more clients to be selected compared to conventional FL, to ensure the convergence of all cluster models. Since FedSoft clients can contribute to multiple centers, however, we select only | ∪ s Sel t s | clients instead of s |Sel t s | = SK clients in the usual clustered FL. For example, if each distribution has the same share in every client, then in expectation only N 1 − 1 − K N S clients will be selected. This number equals 2K − K 2 N when S = 2, i.e., K 2 N clients are selected by both clusters. Once the server receives the local models {w t+1 k } for selected clients, it produces the next centers by simply averaging them (line 18). After completion, the algorithm yields trained cluster models {c T s } as outputs, and each client obtains a personalized local model w T k as a byproduct.

Convergence Analysis
In this section, we provide a convergence guarantee for Fed-Soft. First, note that we can rewrite (4) as follows: h ks (w k ; c t s ) Here h ks is only defined for u ks = 0, and we call optimizing each h ks a sub-problem for client k.
Our analysis relies on the following assumptions: Assumption 1. (γ 0 -inexact solution) Each client produces a γ 0 -inexact solution w t+1 k for the local minimization of (4): Assumption 2. (β-similarity of sub-problems) The subproblems h ks of each client k have similar optimal points: s u ks ∇h ks (w * ks ; c t s ) 2 ≤ β ∇h ks (c t s ; c t s ) 2 , ∀s (10) for some β > 0, where w * ks = argmin w ks h ks (w ks ; c t s ). Assumption 3. (Strong convexity and smoothness) Cluster risks are µ F strongly convex and L F smooth. Assumption 4. (Bounded initial error) At a certain time of the training, all centers have bounded distance from their optimal points. We begin our analysis at that point: ) where 0 < α 0 ≤ 0.5.
Assumption 1 assumes significant progress is made on the proximal minimization of h k , which is a natural extension from assumptions in FedProx (Li et al. 2018). Assumption 2 ensures the effectiveness of the joint optimization of h k , i.e., solving one sub-problem can help identify the optimal points of others. Intuitively, if the sub-problems are highly divergent, we would not expect that solving them together would yield a universally good solution. This assumption quantifies our previous reasoning that different distributions coexisting in one local dataset have some similarities, which is the prerequisite for local models to converge and cluster models to be able to learn from each other. Assumption 3 is standard (Ghosh et al. 2020), and Assumption 4 is introduced by Ghosh et al. (2020) in order to bound the estimation error of u t ks (Lemma 1). Note that with Assumption 3, each sub-problem h ks is also µ λ strongly convex and L λ smooth, where µ λ ≥ µ F , L λ ≥ L F , and the subscript λ indicates they increase with λ.
To measure the distance of different clusters, we quantify As we will see later, soft clustered FL performs best when δ and ∆ are close. Intuitively, a very small δ indicates two clusters are almost identical, and thus might be better combined into one distribution. On the other hand, a very large ∆ implies that two clusters are too divergent, making it hard for one model to acquire useful knowledge from the other.
Next, we bound E[u t ks ] with respect to the true u ks , for which we reply on the following lemma (Ghosh et al. 2020): Lemma 1. Suppose Assumptions 3 and 4 hold. Denoting by E j,j t the event that a data point (x j , y j ) ∼ P j is incorrectly classified into cluster j = j at t, there exists a c such that Based on Lemma 1, we can bound E[u t ks ] as follows Theorem 1. (Bounded estimation errors) The expectation of u t ks is bounded as Here p = p + σ, and the expectation is taken over the randomness of samples.
Next, we seek to characterize each sub-problem h ks at the γ 0 -inexact solution w t+1 k that approximately minimizes h k . Intuitively, w t+1 k should perform better for sub-problems with larger u ks . On the other hand, if u ks = 0, we generally cannot expect that w t+1 k will be close to c * s . We summarize this intuition in Theorems 2 and 3.
Theorem 3. (Divergence of local model to centers) If Assumptions 1, 3, and 4 hold, we have where r = γS+1 4 L F µ F + 1 2 µ F L F + 1. Theorem 2 indicates that if the h k is solved with high quality w t+1 k (small γ 0 ), and the sub-problems are sufficiently similar (small β), then sub-problems with u ks > 0 can also be well solved by w t+1 k . It also justifies using v t sk ∝ u t ks as aggregation weights in (6). In the case u ks = 0, according to Theorem 3 (which holds for any u ks ), approaching c t s with w t k will introduce an error of at most O(∆). Finally, we show the convergence of F s (c t s ). The following analysis does not depend on τ ; we show how τ affects the convergence in Appendix B. Theorem 4. (Convergence of centers) Suppose Assumptions 1 to 4 hold, and define the quantities: n at any time t, where the expectation is taken over the selection of clients and all {u t ks }.
The choices of λ to make ρ > 0 is discussed in (Li et al. 2018). From Corollary 1, the gradient norm converges to a remaining error controlled by p . Intuitively, when c t s = c * s , further updating c t s with misclassified models will inevitably move c t s away from c * s . This bias cannot be removed unless we have a perfect guess of u ks . Recall that p = O( 1 δ 4 ), and thus the remaining term is O( ∆ 2 δ 4 ), which decreases as ∆ approaches δ. Thus, FedSoft performs better when the divergences between clusters are more homogeneous. Note that Corollary 1 seems to imply the remaining error will explode if δ → 0, but Lemma 1 is only valid when p < 1. Thus when δ is very small, i.e., there exist two distributions that are extremely similar, the remaining error is determined by the maximum divergence of the other distributions. Furthermore, the divergence ∆ determines the degree of non-IID of a local dataset (not among clients), which also implicitly affects the accuracy of local solutions γ 0 . Intuitively, a larger ∆ implies it is more difficult to exactly solve a local problem involving multiple distributions, resulting in a greater γ 0 .
To see the role of cluster heterogeneity, suppose c * 1 − c * 2 is closer than the distance of all other centers to c 1 , then the misclassified samples for cluster 1 are more likely to be matched to cluster 2. Thus, cluster 2 gets more updates from data that it does not own, producing greater remaining training error that drags its center towards cluster 1. On the other hand, if the cluster divergence is homogeneous, then the effect of mis-classification is amortized among all clusters, resulting in a universally smaller remaining error. Theorem 4 shows the convergence of cluster models {c s } in terms of the cluster risks {F s }. For the local models {w k }, we focus on how clients integrate global knowledge into their local personalizations, which cannot be captured only with the original client risk functions {f k (w)}. Thus, we are interested in the convergence performance of {w k } with respect to the proximal objective {h k }. Note that under Assumption 3, FedSoft is effectively a cyclic block coordinate descent algorithm on a jointly convex objective function of {w k } and {c s }, for which the convergence is guaranteed: Theorem 5. (Joint convergence of cluster and client models) For fixed importance weightsũ, let w * , c * = argmin N k=1 h k (w k ; c,ũ k ), and w T , c T be the outputs of FedSoft. Then w T → w * , c T → c * linearly with T .

Experiments
In this section, we verify the effectiveness of FedSoft with two base datasets under various mixture patterns. For all experiments, we use N = 100 clients, and the number of samples in each client n k is chosen uniformly at random from 100 to 200. For ease of demonstration, for every base dataset, we first investigate the mixture of S = 2 distributions and then increase S. In the case with two distributions, suppose the cluster distributions are named D A and D B . We evaluate the following partition patterns: • 10:90 partition: 50 clients have a mixture of 10% D A and 90% D B , and 50 have 10% D B and 90% D A . • 30:70 partition: Same as above except the ratio is 30:70. • Linear partition: Client k has (0.5 + k)% data from D A and (99.5 − k)% data from D B , k = 0, · · · , 99.
We further introduce the random partition, where each client has a random mixture vector generated by dividing the [0, 1] range into S segments with S − 1 points drawn from Uniform(0, 1). We use all four partitions for S = 2, and only use the random partition when S > 2 for simplification. Each partition produces non-IID local distributions, i.e., clients have different local data distributions. Specifically, the 10:90 and 30:70 partitions yield 2 local distributions, while the linear and random partitions yield 100. Unless otherwise noted, we choose FedSoft's estimation interval τ = 2, client selection size K = 60, counter smoother σ = 1e-4, and all experiments are run until both cluster and client models have fully converged. All models are randomly initialized with the Xavier normal (Glorot and Bengio 2010) initializer without pre-training, so that the association among clients, centers, and cluster distributions is built automatically during the training process. Figure 1: Evolution of the test mean squared error of centers (top) and the importance weight estimation of clients (bottom) over time for the mixture of two synthetic distributions under the 10:90 partition. The left/right columns represent the first/second distributions. Center indices are assigned randomly in the beginning. The importance weight estimationsū t a:b are averaged on clients with the mixture coefficients a : b (i.e., they have the same local distribution).
We compare FedSoft with two baselines: IFCA (Ghosh et al. 2020) and FedEM (Marfoq et al. 2021). Both baseline algorithms produce one center for each cluster, but they do not explicitly generate local models as in FedSoft. Nevertheless, they also estimate the importance weights for each client, we thus use the center corresponding to the largest importance weight as a client's local model. Since we expect cluster models will be deployed to new users, we evaluate their test accuracy/error on holdout datasets sampled from the corresponding cluster distributions. For local models, they are expected to fit the local data of participating clients, we hence evaluate their accuracy/error on local training datasets. Throughout this section, we usec andw to represent the average accuracy/error of the cluster and client models, not the accuracy/error of the averaged models.
We use three datasets to generate the various distributions: Synthetic, EMNIST and CIFAR-10. Due to the space limit, we put the details of experiment parameters and CIFAR-10 results in Appendix C.
• EMNIST Letters. We use the handwritten images of English letters in the EMNIST dataset to create 2 distributions for the lower and uppercase letters (Guha, Talwalkar, and Smith 2019), each with 26 classes. Then we rotate these images counterclockwise by 90 • (Lopez-Paz and Ranzato 2017), resulting in 4 total distributions. In the S = 2 setting we compare the two 0 • distributions.
A rotation variant CNN model is used for this dataset.
In general, the letter distributions share more similarities with each other, while the synthetic distributions are more divergent, e.g., letters like "O" have very similar upper and Table 1: MSE or accuracy of cluster models for the mixture of two distributions. Each row represents the distribution of a test dataset. The center with the smallest error or highest accuracy is underlined for each test distribution.  Table 2: Comparison between FedSoft and baselines on the letters data. c * lo /c * up represents the accuracy of the center that performs best on the lower/upper distribution, and the number in the parenthesis indicates the index of that center.w is the accuracy of local models averaged over all clients. lowercase shapes and are invariant to rotations. On the other hand, data generated from y = x and y = −x can be easily distinguished. We thus expect the mixture of synthetic data to benefit more from the personalization ability of FedSoft.
The typical convergence process of FedSoft is shown in Figure 1. In this example of the synthetic data, FedSoft is able to automatically distinguish the two cluster distributions. After around 5 global epochs, center 1 starts to exhibit strength on the first cluster distribution, and center 0 concentrates on the other, which implies a correct association between centers and cluster distributions. Similarly, the importance weight estimations u t ks , which are initially around 50:50, soon converge to the real mixture ratio 10:90. Table 1 lists the mean squared error (MSE) or accuracy of the output cluster models. FedSoft produces high quality centers under all mixture patterns. In particular, each center exhibits strength on one distribution, which indicates that FedSoft builds correct associations for the centers and cluster distributions. The performance gap between two distributions using the same center is larger for the synthetic data. This is because the letter distributions have smaller divergence than the synthetic distributions. Thus, letter models can more easily transfer the knowledge of one distribution to another, and a center focusing on one distribution can perform well on the other. Notably, the 30:70 mixture has the worst performance for both datasets, which is due to the degrading of local solvers when neither distribution dominates. Thus, the local problems under this partition are solved less accurately, resulting in poor local models and a large value of γ in Theorem 2, which then produces high training loss on cluster models according to Theorem 4. Table 2 compares FedSoft with the baselines. Not only does FedSoft produce more accurate cluster and local models, but it also achieves better balance between the two trained centers. Similarly, Figure 2 shows the importance estimation of clients for the first cluster. FedSoft and IFCA are able to build the correct association (though the latter is a hard partition), while FedEM appears to be biased to the other center by putting less weights (< 0.5) on the first one.
Next, we evaluate the algorithm with the random partition for the mixture of more distributions. Tables 3 and 4 show the MSE or accuracy of cluster models for the mixture of 8 and 4 distributions on synthetic and letters data, where we still observe high-quality outcomes and good association between centers and cluster distributions. Table 3: Test MSE of centers for the mixture of 8 synthetic distributions with randomly generated weights θ 0 · · · θ 7 .

Conclusion
This paper proposes FedSoft, an efficient algorithm generalizing traditional clustered federated learning approaches to allow clients to sample data from a mixture of distributions. By incorporating proximal local updating, FedSoft enables simultaneous training of cluster models for future users, and personalized local models for participating clients, which is achieved without increasing the workload of clients. Theoretical analysis shows the convergence of FedSoft for both cluster and client models, and the algorithm exhibits good performance in experiments with various mixture patterns.

A Proof of Theorems
Proof of Theorem 1 Let G ki , i = 1, 2 · · · be some virtual group of client k's data points that follow the same distribution. Thus, Proof.

Proof of Theorem 2
Proof. For simplification we drop the dependency of c t s in h k and h ks . Take w * ks = argmin w ks h ks (w ks ), we have Thus, Reorganizing, we have

Proof of Theorem 3
Proof. Let s = argmax s u ks , we have u ks ≥ 1 S , thus

Proof of Theorem 4
We first introduce the following lemma: where the expectation is taken over {u t ks }.
Proof. Let r t = k =k u t k s n k , and note that u t ks ⊥ r t since each client estimates its u t ks independently. Thus, We then formally prove Theorem 4: Proof. For u ks = 0, define using Theorem 2, we have e t+1 Next we bound w t+1 k − c t s for u ks = 0, Therefore, = 1 k u t ks n k k,u ks =0 u ks n k ∇F s (w t+1 k ) − ∇F s (c t s ) − u ks n k e t+1 Taking expectations over {u t ks }, and applying Lemma 2, we have then Next we incorporate the client selection. We can write c t+1 s = 1 K K l=1ĉ t+1 s,l , whereĉ t+1 s,l = N k=1 1(k ∈ Sel t s,l )w t+1 k , and P(k ∈ Sel t s,l ) = u t ks n k k u t k s n k Thus, We then bound the difference between F s (c t+1 s ) and F s (c t+1 s ) Thus, we only need to bound E[Q t s ] Note that E v t s [w t+1 k ] =c t+1 s , we have