Client Selection in Federated Learning: Convergence Analysis and Power-of-Choice Selection Strategies
Yae Jee Cho, Jianyu Wang, Gauri Joshi
Introduction
Until recently, machine learning models were largely trained in the data center setting using powerful computing nodes, fast inter-node communication links, and large centrally available training datasets. The future of machine learning lies in moving both data collection as well as model training to the edge. The emerging paradigm of federated learning considers a large number of resource-constrained mobile devices that collect training data from their environment. Due to limited communication capabilities and privacy concerns, these data cannot be directly sent over to the cloud. Instead, the nodes locally perform a few iterations of training using local-update stochastic gradient descent (SGD) , and only send model updates periodically to the aggregating cloud server. Besides communication limitations, the key scalability challenge faced by the federated learning framework is that the client nodes can have highly heterogeneous local datasets and computation speeds. The effect of data heterogeneity on the convergence of local-update SGD is analyzed in several recent works and methods to overcome the adverse effects of data and computational heterogeneity are proposed in , among others.
Partial Client Participation. Most of the recent works described above assume full client participation, that is, all nodes participate in every training round. In practice, only a small fraction of client nodes participate in each training round, which can exacerbate the adverse effects of data heterogeneity. While some existing convergence guarantees for full client participation and methods to tackle heterogeneity can be generalized to partial client participation , these generalizations are limited to unbiased client participation, where each client’s contribution to the expected global objective optimized in each round is proportional to its dataset size. In , the authors analyze the convergence with flexible device participation, where devices can freely join or leave the training process or send incomplete updates to the server. However, adaptive client selection that is cognizant of the training progress at each client has not been understood yet.
It is important to analyze and understand biased client selection strategies because they can sharply accelerate error convergence, and hence boost communication efficiency in heterogeneous environments by preferentially selecting clients with higher local loss values, as we show in this paper. This idea has been explored in a couple of recent empirical studies . proposed grouping clients based on hardware and wireless resources in order to save communication resources. (which we include as a benchmark in our experiments) proposed client selection with local loss, and proposed utilizing the progression of clients’ weights. But these schemes are limited to empirical demonstration without a rigorous analysis of how selection bias affects convergence speed.
Another relevant line of work employs biased selection or importance sampling of data to speed-up convergence of classic centralized SGD – they propose preferentially selecting samples with highest loss or highest gradient norm to perform the next SGD iteration. In contrast, proposes biased selection of lower loss samples to improve robustness to outliers. Generalizing such strategies to the federated learning setting is a non-trivial and open problem because of the large-scale distributed and heterogeneous nature of the training data.
Our Contributions. In this paper, we present the first (to the best of our knowledge) convergence analysis of federated learning with biased client selection that is cognizant of the training progress at each client. We discover that biasing the client selection towards clients with higher local losses increases the rate of convergence compared to unbiased client selection. Using this insight, we propose the Power-of-choice client selection strategy and show by extensive experiments that Power-of-choice yields up to faster convergence with higher test performance than the standard federated averaging with random selection. Power-of-choice is designed to incur minimal communication and computation overhead, enhancing resource efficiency in federated learning. In fact, we show that even with less clients participating in each round as compared to random selection, Power-of-choice gives faster convergence and 5% higher test accuracy.
Problem Formulation
Consider a cross-device federated learning setup with total clients, where client has a local dataset consisting data samples. The clients are connected via a central aggregating server, and seek to collectively find the model parameter that minimizes the empirical risk:
where is the composite loss function for sample and parameter vector . The term is the fraction of data at the -th client, and is the local objective function of client . In federated learning, the vectors , and for that minimize and respectively can be very different from each other. We define and .
Federated Averaging with Partial Client Participation. The most common algorithm to solve (1) is federated averaging (FedAvg) proposed in . The algorithm divides the training into communication rounds. At each round, to save communication cost at the central server, the global server only selects a fraction of clients to participate in the training. Each selected/active client performs iterations of local SGD and sends its locally updated model back to the server. Then, the server updates the global model using the local models and broadcasts the global model to a new set of active clients.
where denotes the local model parameters of client at iteration , is the learning rate, and is the stochastic gradient over mini-batch of size that is randomly sampled from client ’s local dataset . Moreover, denotes the global model at server. Although is only updated after every iterations, for the purpose of convergence analysis we consider a virtual sequence of that is updated at each iteration as follows:
with . Note that in 2 and 3 we do not weight the client models by their dataset fractions because is considered in the client selection scheme used to decide the set . Our convergence analysis can be generalized to when the global model is a weighted average instead of a simple average of client models, and we show in Appendix E that our convergence analysis also covers the sampling uniformly at random without replacement scheme proposed by . The set can be sampled either with or without replacement. For sampling with replacement, we assume that multiple copies of the same client in the set behave as different clients, that is, they perform local updates independently.
In this paper, we consider a class of biased client selection strategies that is cognizant of the global training progress which (to the best of our knowledge) has not been worked on before. For example, in the two-client example in Figure 1, we set , a single client with the highest local loss at the current global model. In this toy example, the selection strategy cannot guarantee the updates 3 equals to the full client participation case in expectation. Nevertheless, it gives faster convergence to the global minimum than the random one. Motivated by this observation, we define a client selection strategy as a function that maps the current global model to a selected set of clients .
Convergence Analysis
In this section we analyze the convergence of federated averaging with partial device participation for any client selection strategy as defined above. This analysis reveals that biased client selection can give faster convergence, albeit at the risk of having a non-vanishing gap between the true optimum and . We use this insight in Section 4 to design client selection strategies that strike a balance between convergence speed and bias.
First we introduce the assumptions and definitions utilized for our convergence analysis.
are all smooth, i.e., for all and , .
are all strongly convex, i.e., for all and , .
Next, we introduce two metrics, the local-global objective gap and the selection skew, which feature prominently in the convergence analysis presented in Theorem 3.1.
For the global optimum and local optimum we define the local-global objective gap as
Note that is an inherent property of the local and global objective functions, and it is independent of the client selection strategy. A larger implies higher data heterogeneity. If then it implies that the local and global optimal values are consistent, and there is no solution bias due to the client selection strategy (see Theorem 3.1). Next, we define another metric called selection skew, which captures the effect of the client selection strategy on the local-global objective gap.
For any we define,
Since is a function of versions of the global model and , which change during training, we define two related metrics that are independent of and . These metrics enable us to obtain a conservative error bound in the convergence analysis.
where . From (6), we have for any client selection strategy .
Effect of the Client Selection Strategy on and . For the unbiased client selection strategy we have for all and since the numerator and denominator of (5) become equal, and . For a client selection strategy that chooses clients with higher more often, and will be larger (and ). In the convergence analysis we show that a larger implies faster convergence, albeit with a potential error gap, which is proportional to . Motivated by this, in Section 4 we present an adaptive client selection strategy that prefers selecting clients with higher loss and achieves faster convergence speed with low solution bias.
2 Main Convergence Result
Here, we present the convergence results for any client selection strategy for federated averaging with partial device participation in terms of local-global objective gap , and selection skew .
Under Assumptions 3.1 to 3.4, for learning rate with , and any client selection strategy , the error after iterations of federated averaging with partial device participation satisfies
To the best of our knowledge, Theorem 3.1 provides the first convergence analysis of federated averaging with a biased client selection strategy . We also show the results for fixed learning rate in Appendix A. The proof is presented in Appendix C. In the following paragraphs, we discuss the effects of the two terms in (7) in detail.
Large and Faster Convergence. A key insight from Theorem 3.1 is that a larger selection skew results in faster convergence at the rate . Note that since we obtain (defined in (6)) by taking a minimum of the selection skew over , this is a conservative bound on the true convergence rate. In practice, since the selection skew changes during training depending on the current global model and the local models , the true convergence rate can be improved by a factor larger than and at least equal to .
Non-vanishing Bias Term. The second term in (7) denotes the solution bias, which is dependent on the selection strategy. By the definitions of and , it follows that , which implies that . For an unbiased selection strategy, we have , , and hence (7) recovers previous bound for unbiased selection strategy as . For , while we gain faster convergence rate by a factor of , we cannot guarantee . Thus, there is a trade-off between the convergence speed and the solution bias. Later in the experimental results, we show that even with biased selection strategies, the term in can be close to , and hence has a negligible effect on the final error floor.
Proposed Power-of-choice Client Selection Strategy
From (5) and (6) we discover that a selection strategy that prefers clients with larger will result in a larger , yielding faster convergence. Using this insight, a naive client selection strategy can be choosing the clients with highest local loss . However, a larger selection skew may result in a larger , i.e., a larger non-vanishing error term. This naive selection strategy has another drawback – to find the current local loss , it requires sending the current global model to all clients and having them evaluate and sending it back. This additional communication and computation cost can be prohibitively high because the number of clients is typically very large, and these clients have limited communication and computation capabilities.
In this section, we use these insights regarding the trade-off between convergence speed, solution bias and communication/computation overhead to propose the Power-of-choice client selection strategy. Power-of-choice is based on the power of choices load balancing strategy , which is extensively used in queueing systems. In the Power-of-choice client selection strategy (denoted by ), the central server chooses the active client set as follows:
Sample the Candidate Client Set. The central server samples a candidate set of clients without replacement such that client is chosen with probability , the fraction of data at the -th client for .
Estimate Local Losses. The server sends the current global model to the clients in set , and these clients compute and send back to the central server their local loss .
Select Highest Loss Clients. From the candidate set , the central server constructs the active client set by selecting clients with the largest values , with ties broken at random. These clients participate in the training during the next round, consisting of iterations , , ….
Variations of . The three steps of can be flexibly modified to take into account practical considerations. For example, intermittent client availability can be accounted for in step 1 by constructing set only from the set of available clients in that round. We demonstrate the performance of with intermittent client availability in Section G.3. The local computation cost and server-client communication cost in step 2 can be reduced or eliminated by the following proposed variants of (see Appendix F for their pseudo-codes).
Computation-efficient Variant : To save local computation cost, instead of evaluating the by going through the entire local dataset , we use an estimate , where is the mini-batch of samples sampled uniformly at random from .
Communication- and Computation-efficient Variant : To save both local computation and communication cost, the selected clients for each round sends their accumulated averaged loss over local iterations, i.e., when they send their local models to the server. The server uses the latest received value from each client as a proxy for to select the clients. For the clients that have not been selected yet, the latest value is set to .
Selection Skew of Power-of-choice Strategy. The size of the candidate client set is an important parameter which controls the trade-off between convergence speed and solution bias. With we have random sampling without replacement in proportion of . As increases, the selection skew increases, giving faster error convergence at the risk of a higher error floor. However, note that the convergence analysis replaces with to get a conservative error bound. In practice, the convergence speed and the solution bias is dictated by which changes during training. With which is biased towards higher local losses, we expect the selection skew to reduce through the course of training. We conjecture that this is why gives faster convergence as well as little or no solution bias in our experiments presented in Section 5.
Experimental Results
We evaluate our proposed and its practical variants and , by three sets of experiments: (1) quadratic optimization, (2) logistic regression on a synthetic federated dataset, Synthetic(1,1) , and (3) DNN trained on a non-iid partitioned FMNIST dataset . We also benchmark the selection strategy proposed by , active federated learning, denoted as . Details of the experimental setup are provided in Appendix F, and the code for all experiments are shared in the supplementary material.
Quadratic and Synthetic Simulation Results. In Figure 2(a), even with few clients (), converges faster than with nearly negligible solution bias for small . The convergence speed increases with the increase in , at the cost of higher error floor due to the solution bias. For , shows convergence speed-up as with , but the bias is smaller. Figure 2(b) shows the theoretical values and which represents the convergence speed and the solution bias respectively in our convergence analysis. Compared to , has higher for all implying higher convergence speed than . By varying we can span different points on the trade-off between the convergence speed and bias. For and , of and are approximately identical, but has higher , implying that can yield higher convergence speed with negligible solution bias. In Section G.1, we present the clients’ selected frequency ratio for and which gives novel insights regarding the difference between the two strategies.
For the synthetic dataset simulations, we present the global losses in Figure 3 for and for different and . We show that converges approximately 3 faster to the global loss than when , with a slightly higher error floor. Even with , we get 2 faster convergence to global loss than .
Experiments with Heterogeneously Distributed FMNIST. As elaborated in Appendix F, determines the data heterogeneity across clients. Smaller indicates larger data heterogeneity. In Figure 4, we present the test accuracy and training losses for the different sampling strategies from the FMNIST experiments with and . Observe that achieves approximately and higher test accuracy than and respectively for both and . For higher (less data heterogeneity) larger (more selection skew) performs better than smaller .
Figure 4(a) shows that this performance improvement due to the increase of eventually converges. For smaller , as in Figure 4(b), smaller performs better than larger which shows that too much solution bias is adversarial to the performance in the presence of large data heterogeneity. The observations on training loss are consistent with the test accuracy results.
Performance of the Communication- and Computation-Efficient variants. Next, we evaluate and which were introduced in Section 4. In Figure 5, for , and each yields approximately and higher accuracy than , but both yield lower accuracy than that utilizes the highest computation and communication resources. For , and perform as well as and give a accuracy improvement over . Moreover, and all have higher accuracy and faster convergence than .
We evaluate the communication and computation efficiency of Power-of-choice by comparing different strategies in terms of , the number of communication rounds required to reach test accuracy 60%, and , the average computation time (in seconds) spent per round. The computation time includes the the time taken by the central server to select the clients (including the computation time for the clients to compute their local loss values) and the time taken by selected clients to perform local updates. In Table LABEL:tab:comp, with only fraction of clients, and have about higher test accuracy than . The for is , , times that of respectively. This implies that even for which does not incur any additional communication cost for client selection, we can get a reduction in the number of communication rounds using of clients compared to and still get higher test accuracy performance. Note that the computation time for and with is smaller than that of with . In Section G.2, we show that the results for are consistent with the case shown in Table LABEL:tab:comp. In Section G.4, we also show that for , the results are consistent with the case.
Concluding Remarks
In this work, we present the convergence guarantees for federated learning with partial device participation with any biased client selection strategy. We discover that biasing client selection can speed up the convergence at the rate where is the selection skew towards clients with higher local losses. Motivated by this insight, we propose the adaptive client selection strategy Power-of-choice. Extensive experiments validate that Power-of-choice yields 3 faster convergence and higher test accuracy than the baseline federated averaging with random selection. Even with using fewer clients than random selection, Power-of-choice converges 2 faster with high test performance. An interesting future direction is to improve the fairness and robustness of Power-of-choice by modifying step 3 of the algorithm to use a different metric such as the clipped loss or the -fair loss proposed instead of .
This research was generously supported in part by the Doctoral Study Abroad Scholarship from the Korean Government (Yae Jee Cho) and the Qualcomm Innovation fellowship (Jianyu Wang), NSF grant CCF-1850029 and the 2018 IBM Faculty Research Award. Experiments were conducted on clusters provided by the Parallel Data Lab at CMU.
References
Appendix A Additional Theorem
Under Assumptions 3.1 to 3.4, a fixed learning rate where , and any client selection strategy as defined above, the error after iterations of federated averaging with partial device participation satisfies
As the first term in (8) goes to 0 and the second term becomes the bias term for the fixed learning rate case. For a small , we have that the bias term for the fixed learning rate case in Theorem A.1 is upper bounded by which is identical to the decaying-learning rate case. The proof is presented in Appendix D.
Appendix B Preliminaries for Proof of Theorem 3.1 and Theorem A.1
Suppose is smooth with global minimum at , then for any in the domain of , we have that
Observe from the update rule that are in the same set and hence the terms where in the summation in (14) will be zero resulting in (15). Moreover for any arbitrary there is a such that that since the selected clients are updated with the global model at every . Hence even for an arbitrary we have that the difference between is upper bounded by updates. With non-increasing over and , (15) can be further bounded as,
where (22) is because there can be at most pairs such that in . ∎
Appendix C Proof of Theorem 3.1
With as defined in Section 2, we have that
Lastly we can bound using the bound of variance of stochastic gradients as,
Using the bounds of above we have that the expectation of the LHS of (27) is bounded as
where (44) is due to Lemma B.3. Now we aim to bound in (44). First we can represent in a different form as:
Now with and , we have that can be rewritten and bounded as
where (48) is due to convexity, (49) is due to Lemma B.1 and the AM-GM inequality and Cauchy–Schwarz inequality, and (51) is due to the fact that . Hence using this bound of we can upper bound as
where (54) is due to the definition of in Definition 3.2 and (55) is due to the definition of in Definition 3.1 and the definitions of in Definition 3.2. We can expand in (55) as
where (60) is due to the convexity, (61) is due to , and (62) is due to . Hence we can finally bound as
By setting , and by induction we have that
Then by the L-smoothness of , we have that
Appendix D Proof of Theorem A.1
With fixed learning rate , we can rewrite (65) as
and with using recursion of (68) we have that
Using and -smoothness, we have that
Appendix E Extension: Generalization to different averaging schemes
While we considered a simple averaging scheme where , we can extend the averaging scheme to any scheme such that the averaging weights are invariant in time and satisfies for any . Note that includes the random sampling without replacement scheme introduced by where the clients are sampled uniformly at random without replacement with the averaging coefficients . With such averaging scheme , we denote the global model for the averaging scheme as , where , and the update rule changes to
where . We show that the convergence analysis for the averaging scheme is consistent with Theorem 3.1. In the case of the averaging scheme , we have that Lemma B.2 and Lemma B.3 shown in Appendix B, each becomes
Then, using the same method we used for the proof of Theorem 3.1, we have that
By defining the selection skew for averaging scheme similar to Definition 5 as
With , using the same methodology for proof of Theorem 3.1 we have that becomes upper bounded as
Again, by setting , and by induction we have that
Then by the L-smoothness of , we have that
With , and , we have that
Appendix F Experiment Details
Quadratic Model Optimization. For the quadratic model optimization, we set each local objective function as strongly convex as follows:
where the global model is defined as . We sample clients for every round where for each round the clients perform gradient descent local iterations with fixed learning rate and then these local models are averaged to update the global model. For all simulations we set .
For the estimation of and for the quadratic model, we get the estimates of the theoretical values by doing a grid search over a large range of possible for and respectively. The distribution of is estimated by simulating 10000 iterations of client sampling for each and .
Logistic Regression on Synthetic Dataset. We conduct simulations on synthetic data which allows precise manipulation of heterogeneity. Using the methodology constructed in , we use the dataset with large data heterogeneity, Synthetic(1,1). We assume in total 30 devices where the local dataset sizes for each device follows the power law. We set the mini batch-size to 50 with , and , where is decayed to every 300 and 600 rounds.
DNN on FMNIST Dataset. We train a deep multi-layer perceptron network with two hidden layers on the FMNIST dataset . We construct the heterogeneous data partition amongst clients using the Dirichlet distribution , where determines the degree of the data heterogeneity across clients (the data size imbalance and degree of label skew across clients). Smaller indicates larger data heterogeneity. For all experiments we use mini-batch size of 64, with and , where is decayed by half for every 150, 300 rounds. We experiment with three different seeds for the randomness in the dataset partition across clients and present the averaged results.
All experiments are conducted with clusters equipped with one NVIDIA TitanX GPU. The number of clusters we use vary by , the fraction of clients we select. The machines communicate amongst each other through Ethernet to transfer the model parameters and information necessary for client selection. Each machine is regarded as one client in the federated learning setting. The algorithms are implemented by PyTorch.
Pseudo-code of the variants of pow-d: cpow-d and rpow-d. We here present the pseudo-code for and . Note that the pseudo-code for in Algorithm 1 can be generalized to the algorithm for , by changing to .
Appendix G Additional Experiment Results
We further visualize the difference between our proposed sampling strategy and the baseline scheme by showing the selected frequency ratio of the clients for for the quadratic simulations in Figure 6. Note that the selected ratio for reflects each client’s dataset size. We show that the selected frequencies of clients for are not proportional to the data size of the clients, and we are selecting clients frequently even when they have relatively low data size like client 6 or 22. We are also not necessarily frequently selecting the clients that have the highest data size such as client 26. This aligns well with our main motivation of Power-of-choice that weighting the clients’ importance based on their data size does not achieve the best performance, and rather considering their local loss values along with the data size better represents their importance. Note that the selected frequency for is less biased than .
G.2 Communication and Computation Efficiency with larger data heterogeneity
In Table LABEL:tab:comp2, we show the communication and computation efficiency of Power-of-choice for , as we showed for in Table LABEL:tab:comp in Section 5. With fraction of clients, and have better test accuracy of at least approximately 10% higher test accuracy performance than . for is 0.61, 0.66, 0.73 times that of respectively. This indicates that we can reduce the number of communication rounds by at least 0.6 using 1/3 of clients compared to and still get higher test accuracy performance. The computation time for and with is smaller than that of .
G.3 Intermittent Client Availability
In real world scenarios, certain clients may not be available due to varying availability of resources such as battery power or wireless connectivity. Hence we experiment with a virtual scenario, where amongst clients, for each communication round, we select clients alternately from one group out of two fixed groups, where each group has clients. This altering selection reflects a more realistic client selection scenario where, for example, we have different time zones across clients. For each communication round, we select 0.1 portion of clients from the corresponding group uniformly at random and exclude them from the client selection process. This random exclusion of certain clients represents the randomness in the client availability within that group for cases such as low battery power or wireless connectivity. In Figure 7 we show that and achieves 10% and 5% test accuracy improvement respectively compared to for . For , both and shows 10% improvement. Therefore, we demonstrate that Power-of-choice also performs well in a realistic scenario where clients are available intermittently.
G.4 Effect of the fraction of selected clients
In Figure 8, for larger with , the test accuracy improvement for is even higher than the case of with approximately 15% improvement. performs slightly lower in test accuracy than but still performs better than and . performs as well as . For , , , and have approximately equal test accuracy performance, higher than by 5%. The Power-of-choice strategies all perform slightly better than . Therefore we show that Power-of-choice performs well for selecting a larger fraction of clients, i.e., when we have larger .