F ED PSE:
P ERSONALIZED
S
PARSIFICATION
WITH
E LEMENT - WISE
A GGREGATION
FOR
F
EDERATED
L EARNING
Anonymous authors
Paper under double-blind review
A BSTRACT
Federated learning (FL) is a popular distributed machine learning framework in which clients aggregate models’ parameters instead of sharing their individual data.
In FL, clients communicate with the server under limited network bandwidth frequently, which arises the communication challenge.
To resolve this challenge, multiple compression methods have been proposed to reduce the transmitted parameters.
However, these techniques show that the federated performance degrades significantly with Non-IID (non-identically independently distributed) datasets.
To address this issue, we propose an effective method, called FedPSE, which solves the efficiency challenge of FL with heterogeneous data.
FedPSE compresses the local updates on clients using Top-K sparsification and aggregates these updates on the server by element-wise average.
Then clients download the personalized sparse updates from the server to update their individual local models.
We then theoretically analyze the convergence of FedPSE under the non-convex setting.
Moreover, extensive experiments on four benchmark tasks demonstrate that our FedPSE outperforms the state-of-the-art methods on NonIID datasets in terms of both efficiency and accuracy.
I NTRODUCTION
Federated learning (FL) is a prevailing distributed framework that can prevent sensitive data of clients from being disclosed (Kairouz et al., 2021;
McMahan et al., 2017b).
The naive FL includes three steps: uploading clients’ models to the server after local training, global aggregation, and downloading the aggregated model from the server.
In practice, weight updates ∆ W = W new − W old can be communicated instead of model weights W
(Asad et al., 2021;
Li et al., 2021a).
Recently, FL is increasingly applied in multiple tasks, such as computer vision, recommender systems, and medical diagnosis (Bibikar et al., 2021; Kairouz et al., 2021; Qayyum et al., 2020; Xu et al., 2021).
1. E XISTING PROBLEM
Despite the aforementioned advantage, the communication cost of FL is overburdened by the fact that the server and clients exchange massive parameters frequently (Asad et al., 2021; Kairouz et al., 2021).
Furthermore, there usually is a limited upstream/downstream bandwidth between the server and clients, such as wireless connection in the cross-device (ToC) FL and dedicated network in the cross-silo (ToB) setting, which further decreases the communication efficiency (Li et al., 2021a;
Sattler et al., 2019).
FL is much more time-consuming than traditional centralized machine learning, especially when the model parameters are massive under the cross-silo FL scenarios (Qayyum et al., 2020; Shi et al., 2020).
Therefore, it is necessary to optimize the bidirectional communication cost to minimize the training time of FL (Bernstein et al., 2018; Philippenko & Dieuleveut, 2021;
Sattler et al., 2019; Wen et al., 2017).
In order to resolve the aforementioned challenge, various methods have been proposed, such as matrix decomposition (Li et al., 2021c; McMahan et al., 2017b), quantization (Li et al., 2021a; Sattler et al., 2019), and sparsification (Gao et al., 2021;
Mostafa & Wang, 2019; Wu et al., 2020; Yang et al., 2021b).
Although these novel algorithms can reduce the quantity of communicated information significantly, most of them can only work well
[Figure]
under the ideal condition with IID (identically and independently distributed) datasets (Li et al., 2021c; Sattler et al., 2019;
Wen et al., 2017).
In fact, the isolated datasets in clients are usually heterogeneous, due to the reason that each dataset belongs to a particular client with a specific geographic location and time window of data collection Kairouz et al.
; Kulkarni et al.
Xu & Huang (2022); Yang et al.
(2021a).
Hence, the current compression techniques, ignoring the personalization of clients, face a significant performance degradation on Non-IID datasets Liu et al.
(2022); Sattler et al.
; Wu et al.
1. S OLUTION
To bridge this gap, we propose a Personalized Sparsification with Element-wise aggregation for the cross-silo federated learning (FedPSE) paradigm, as shown in Figure 1.
For the first step of
FedPSE, under the concern of efficiency and personalization, clients train their models with local datasets and upload the sparse updates to the server, as shown in Figure 1(a).
The kept indices of these compressed updates are probably different from each other due to the heterogeneity of clients’ datasets.
Secondly, we leverage element-wise averaging to aggregate the collected sparse updates on the server, which can relieve the bias of the traditional aggregation method, as shown in Figure 1(b).
Lastly, the server sparsifies the downstream parameters for each client in a personalized manner, as shown in Figure 1(c).
Especially, the downstream updates, transferred from the server to each client, also possess individual k elements to keep the overall compression ratio.
Please see Section 4 for more details.
To this end, FedPSE compresses both upstream and downstream communication overhead with personalization concerns.
1. C ONTRIBUTION
We summarize our main contributions as follows:
• We propose a novel personalized sparsification with an element-wise aggregation framework for FL, which resolves the bidirectional communication challenge on Non-IID datasets.
• We propose an element-wise aggregation method, which can promote the performance of FL with sparse aggregated matrices.
• We propose a downstream selection mechanism to personalize the clients’ models, which adapts to various distributions and significantly increases the performance in the Non-IID setting.
• We provide a convergence analysis of our method as well as extensive experiments on four benchmark datasets, and the results demonstrate that our proposed FedPSE outperforms the existing state-of-the-art FL framework on Non-IID datasets in terms of both efficiency and accuracy.
R ELATED WORK
In this section, we briefly review optimization methods that focus on the core challenges in FL.
2. C OMMUNICATION EFFICIENCY
Although FedAVG (McMahan et al., 2017a), the naive federated algorithm, can decrease the communication cost by allowing multiple local steps, the massive transmitted parameters in one communication step are still a critical bottleneck.
In general, there are three kinds of compression approaches to tackle this problem, i.e. matrix decomposition (Huang et al., 2022;
Li et al., 2021c), quantization (Bernstein et al., 2018;
Li et al., 2021a), and sparsification (Gao et al., 2021; Sattler et al., 2019; Wu et al., 2020).
Firstly, the decomposition method, decomposing the transmitted matrix, is unpractical with a smaller compression ratio and more computation complexity.
Secondly, the quantization-based methods, limiting the number of bits, have the upper bound of the compression ratio and slow down the convergence speed in terms of training iterations (Chai et al., 2020).
Thirdly, the sparsification-based methods mask some elements of the transmitted matrices, among which the Top-K sparsification with residual error is most widely used due to its promising performance and convergence guarantee (Dan Alistarh et al., 2018;
Gao et al., 2021; Wu et al., 2020;
Yang et al., 2021b).
Therefore we leverage the error-compensated Top-K compressor to reduce the communication overhead in this article.
2. P ERSONALIZATION
Since FL relies on the stochastic gradient descent (SGD) algorithm to train neural networks, the performance of FL is easily biased by the Non-IID datasets, e.g. feature skew and label skew, etc (Kairouz et al., 2021; Zhu et al., 2021).
Different strategies have been applied to FL with heterogeneous concerns (e.g. data shuffling, multi-task learning, and local model optimization) (Achituve et al., 2021; Chen & Chao, 2021; Huang et al., 2021;
Li et al., 2021b; Ma et al., 2022;
Oh et al., 2021; T Dinh et al., 2020; Xu & Huang, 2022; Zhang et al., 2021).
Although these state-of-the-art methods perform well under the Non-IID condition, the communication efficiency is often ignored.
2. C OMPRESSION WITH PERSONALIZATION
In a word, few algorithms take both of the above two challenges into consideration.
To our best knowledge, FedSTC (Sattler et al., 2019) and FedSCR (Wu et al., 2020) declare that they resolve the communication overburden with Non-IID data in one shot.
Specifically, FedSTC compresses the clients’ updates by combining Top-K sparsification and ternary quantization.
Similarly, FedSCR compresses the transferred information by removing the redundant updates which are less than the adaptive threshold.
However, the clients in FedSTC and FedSCR share the same model, which decreases the federated performance significantly in the Non-IID setting.
In this paper, we propose a personalized compression paradigm for FL, which has competitive efficiency and promoted performance for heterogeneous data.
P RELIMINARY
In this section, we present some preliminary techniques of our proposal, including FedAVG and
Top-K sparsification.
3. F ED AVG
FedAVG (McMahan et al., 2017a), a basic FL algorithm, builds distributed machine learning models via model aggregation rather than data aggregation.
We suppose that there are N clients with their datasets { D 1 , D 2 , ..., D N } in FL.
Client i, i ∈ { 1 , . . .
, N } , trains the local model
W r − 1 i using n i samples individually and uploads the weight updates ∆ W ri to the server for aggregation during the r -th federated round.
Then the server leverage the averaging function to generate the global matrix: ∆ W rs ← (cid:80) Ni
= n i (cid:80) Ni =1 n i ∆ W ri .
In the end, the global matrix ∆ W rs is sent back to each client to update the local model W ri ← W r −
i
[Equation]
3. T OP -K SPARSIFICATION
Top-K Sparsification is the most widely used compression method in FL, which remains a stable performance even with a high proportion of ignored parameters (Gao et al., 2021;
Wu et al., 2020;
Sattler et al., 2019; Yang et al., 2021b).
The Top-K compressor selects K elements of the input matrix with the largest absolute values.
M ETHOD
In this section, we first give an overview of the proposed FedPSE paradigm.
We then present its three main components, i.e., Upstream Personalized Sparsification (UPS), Element-Wise Aggregation (EWA), and Downstream Personalized Sparsification (DPS).
Finally, we summarize the whole algorithm.
4. O VERVIEW
Our purpose of FedPSE is to design an FL paradigm that reduces the bidirectional communication cost while improving the performance on Non-IID datasets.
We optimize the steps of FL according to its training process, as shown in Figure 1.
Firstly, in order to reduce the upstream communication burden, we should compress the information from clients to the server.
Secondly, as the global updates may be biased due to the compression, it is worth developing a new aggregation method that is suitable for sparse matrices.
Thirdly, since clients with Non-IID datasets should have individual local models, the server needs to personalize the downstream information to each client while keeping the compression sparsity.
Then we propose the motivation of our methods in the following paragraphs.
Input: downstream personalized sparse updates ∆ ˆ W r − 1 s,i , sparsity ratio p
Output: upstream sparse updates ∆ ˆ W ri , samples number n ri 1 W r, 0 i =
W r − 1 ,
i + ∆ ˆ W r − 1 s,i 2 Reset n ri =3 for each local training step t = 1 , . .
, T do
Sample a batch: B r,ti ∼ D
i g r,ti = ▽ f i ( W r,t − 1 i , B r,ti )
W r,ti =
Opt ( W r,t − 1 i , g r,ti , α ) n ri = n ri + (cid:13)(cid:13) B r,ti (cid:13)(cid:13) 8 end 9 ∆ W ri = W r,Ti − W r,
i + e
[Equation]
The first step, upstream personalized sparsification, compresses clients’ updates after local training, which is inspired by the current work (Sattler et al., 2019; Wu et al., 2020).
According to the prior research Wu et al.
(2020), the matrices of weights updates are structuresparse, in which most elements are redundant in the Non-IID setting.
As a result, we leverage the Top-K sparsification operator with residual error to compress the weight updates, whose convergence rate has been theoretically proved (Gao et al., 2021; Haddadpour et al., 2021).
Apparently, the reserved indices of compressed updates have its personalized distributions on heterogeneous datasets.
Then each client transmits its individual updates to the server for the following aggregation.
The second step is proposing an appropriate aggregation method for the sparse updates.
We demonstrate the bias of FedAVG with two examples under IID/Non-IID settings in Appendix A, which is caused by the sparsification.
Then the effectiveness of the EWA method is proved, which is more suitable for sparse aggregation.
Please see more details in Appendix A.
Thirdly, the server should sparsify the downstream updates for each client under the concern of personalization.
In order to quantitatively measure the divergence between the global distribution and the local distribution, we compress the global updates, possessing k elements, and compute its correlation distances with clients’ upstream updates.
Apparently, the correlation distances are likely different from each other in the Non-IID setting.
Finally, the personalized downstream updates are selected by the correlation distances.
Further details can be found in Section 4.4.
4. U PSTREAM PERSONALIZED SPARSFICATION (UPS)
We suppose that there are N clients with their own training datasets {D 1 , D 2 , ..., D N } and a server participated in FL.
At the beginning of FL, client i ( ∀ i ∈ P , P = { 1 , 2 , ..., N } ) initializes its weights
W i with the same parameters W
(Zhao et al., 2018).
Algorithm 1 presents the process of local training on client i during r -th federated round, where the inputs, i.e. weight updates ∆ ˆ W r − 1 s,i and sparsity ratio p , are transmitted from the server.
The first step of local training is updating the client model with the received ∆ ˆ W r − 1 s,i (line 1).
Secondly, client i trains its individual model with n r i samples (lines 3-8), in which f i indicates the loss function and Opt (e.g., SGD or Adam) indicates the model’s optimizer with the learning rate α .
After that, the client i compresses the updates via the error-compensated Top-K compressor (lines 9-11).
Finally, the sparse updates ∆ ˆ W ri and the number of local training samples n ri are uploaded to the server for aggregation.
4. E LEMENT -W ISE AGGREGATION (EWA)
Algorithm
Input: sparse updates ∆ ˆ W ri , samples number n ri , i ∈ P
Output: aggregated updates: ∆ W rs 1 for i = 1 , . . .
, N do
Computes the index matrices of client updates:
M r agg,i =
Sign (cid:16)(cid:12) (cid:12)(cid:12)
∆ ˆ W r i (cid:12) (cid:12)(cid:12) (cid:17) 3 end 4 Sum matrix of training samples: 5 N = (cid:80) Ni =
1 n ri · M ragg,i 6 ∆ W rs = (cid:16)(cid:80)
Ni =1 n ri · ∆ ˆ W ri (cid:17)
⊘ N 7 return ∆ W rs
From the perspective of the selection mechanism in federated learning, the kept non-zero value in ∆ ˆ W ri indicates that the corresponding client i is selected by the server at this element location.
Apparently, each element of the aggregated matrix has its individual participating samples.
We introduce our Element-Wise
Aggregation (EWA) method in Algorithm 2.
Firstly, the server receives the sparse updates ∆ ˆ W ri from client i during r -th federated round, ∀ i ∈ P .
Then the server computes the indices of nonzero values M ragg,i for ∆
ˆ W ri , which is used to calculate the sum matrix N of training samples for each location (lines 1-5).
Finally, the server aggregates the global updates ∆ W rs , in which ⊘ indicates the element-wise division
operator (line 6)
4. D OWNSTREAM PERSONALIZED SPARSIFICATION (DPS)
This process can be separated into three sub-steps: measurement of the heterogeneity between the global distribution and local distribution, selection of the downstream indices, and computation of the downstream personalized updates.
First of all, during the r -th federated round, the server quantifies the heterogeneity of data distributions via the distance between ∆ ˆ W rs and ∆ ˆ W ri , ∀ i ∈ P (lines 1-4).
The server flattens the updates followed by normalization (lines 2-3).
Then we compute the distance via the cosine function, which can be replaced by the other correlation functions (line 4).
Secondly, we get the index matrix M rs of the global sparse updates ∆ ˆ W rs via the sign function.
In similarity, the index matrix M ri of client i is calculated (line 6).
The intersection matrix M ri,in of M rs and M ri can be regarded as the common information owned by both the server and client i , which will be wholly kept during downstream transmission (line 7).
As M ri,in has k i,in elements, we choose the rest k − k
i,in elements from the compensation matrices M ri,c and M rs,c .
In order to enhance the generalization of training, we leverage the random mechanism to choose d rs,i · ( k − k i,in ) elements from M ri,c , while selecting (1 . 0 − d rs,i ) · ( k − k i,in ) from M rs,c (lines 8-13).
Finally, we combine the personalized index matrix
M rs,i of client i (line 14) and calculate the downstream sparse updates ∆ ˆ W rs,i , from the server to client i (lines 15-16).
Apparently, each client uploads its unique sparse updates ∆ ˆ W ri , which means that the correlation distance d rs,i and the downstream sparse updates ∆ ˆ W rs,i are different from each other.
4. P UTTING ALL TOGETHER
To sum up, we conclude the FedPSE framework in the Algorithm 4, which executes the federated process, named PSE, for R times.
Before the training process, we initialize the model weights of clients as W 0 , the received updates ∆ W 0 s,i as zero and the sparsity ratio p for communication compression concern.
First of all, we get the personalized sparse updates ∆ ˆ W ri of each client i using
UPS method (Algorithm 1) with the last ∆ ˆ W r − 1 s,i and the sparsity ratio p (line 5).
Then we leverage the EWA operator (Algorithm 2) to compute the global updates ( ∆ W rs ) during r -th federated round
[Table]
M ri c =
Random ( M ri c d rs i · ( k − k i in ))
13 (cid:102)
M rs c = Random ( M rs,c , (1 − d rs i ) · ( k − k i in ))
[Table]
M rs i =
M ri in + (cid:102) M ri c + (cid:102)
M rs c
∆ ˆ W rs,i =
M rs,i ⊙ ∆ W rs 16 return ∆ ˆ W rs,i (line 8).
Furthermore, the server sparsifies the global updates ∆ W rs and generates the ∆ ˆ W rs with the compression rate p (line 9).
Finally, we get the personalized updates of each client via DPS method (Algorithm 3) with the inputs of sparse upstream updates
∆ ˆ W ri , global updates ∆ W rs and sparse global updates ∆ ˆ W rs (line 11).
4. T HEORETICAL ANALYSIS
1 Initialization: W 0 i = W 0 , ∆ W 0 s,i =
( ∀ i ∈ P ) , sparsity ratio p 2 for each federated round r = 1 , ..., R do # At clients: for each client i ∈ P do ∆ ˆ W r i , n r i ← UPS (∆ ˆ W r − 1 s,i , p ) end # At Server: ∆ W rs ← EWA (∆ W ri , n ri ) , ∀
i ∈ P ∆ ˆ W rs ← Top-K (∆ W rs , p ) for i ∈ P do ∆ ˆ W rs,i ←
DPS (∆ ˆ W ri , ∆ W rs , ∆ ˆ W rs ) end 13 end 14 return W R,Ti , ∀
i ∈ P
In this subsection, we analyze the convergence results of the FedPSE framework theoretically.
We suppose that the loss function ( f i : R n → R ) of client i ( ∀ i ∈ P ) is differentiable, where n is the dimension of parameters.
We consider the general setting in deep learning where f i is a non-convex function.
Our convergence results are proved under the following assumptions:
Assumption 1.
Lipschitz Smoothness :
The loss function f i ( ∀ i ∈ P ) is LLipschitz smooth (L-smooth), i.e., ||∇ f i ( W ui ) − ∇ f i ( W vi )
[Equation]
≤ L
[Equation]
W ui
[Equation]
W vi
[Equation]
, ∀ W ui , W vi ∈ R n .
Assumption 2.
Bounded Gradient :
The second moment of stochastic gradient G i calculated by a single sample within client i is bounded, i.e., E [ || (cid:80) Ni =
1 G i
( W i ) || 2 ] ≤ σ 2 , ∀ W i ∈ R n .
We aims to prove that min
[Equation]
E
[Equation]
||∇ f i
[Equation]
W ri )
||
[Equation]
] R →∞ −→ 0 , which is a normal convergence guarantee in the non-convex problem (Liu & Wright, 2015).
Similar to Dan Alistarh et al.
(2018), we use ˜ W ri to denote the auxiliary random variable during r -th federated round on client i , and ˜ W r +1 =
˜ W r − α r G ( W r ) , where G ( W r )
= 1 N (cid:80) Ni =
1 G i
( W ri ) and ˜ W
=
W
i ( ∀ i ∈ P ).
Lemma 1.
For any federated round r ≥ 1 : E [ |
[Equation]
where φ = 1 − kn , 0 < k ≤ n and ρ > 0 .
We propose the bound of the difference between ˜ W r and W ri during r -th federated round in Lemma 1.
Consequently, the convergence of FedPSE is guaranteed as shown below.
Theorem 1.
Choose the learning rate schedule α , s.t. (cid:80) rq =1 ( φ (1 + ρ ))
q ( α r − q ) 2 α r ≤ C ( ∀ r > 0) , then our proposed FedPSE satisfies:
[Equation]
where constant C > 0 and ˜ W ∗ denotes the optimal solution auxiliary variable.
Theorem 1 implies that client model W ri converges if federated round R is large enough when α r satisfies the following conditions: lim R
[Equation] [Equation]
= 0 .
Finally, we derive the convergence speed of our framework, please see more details and proofs in Appendix B.
E XPERIMENT
In this section, we empirically compare the performance of our proposed FedPSE framework with other federated learning paradigms for personalized compression.
We aim to answer the following questions.
• Q1: whether FedPSE outperforms other optimized algorithms on the Non-IID data?
• Q2: whether the convergence speed of FedPSE is acceptable in the Non-IID setting?
• Q3: whether the correlation distance can be adopted to quantitatively measure the divergence between the local distribution and the global distribution?
• Q4: whether the EWA method can promote the performance of FedPSE?
• Q5: how does the sparsity ratio influence the performance of FedPSE?
5. E XPERIMENTAL S ETTINGS
Datasets.
To test the effectiveness of our proposed model, we choose four widely used benchmark datasets: MNIST (Deng, 2012), Fashion-MNIST (FMNIST)
(Xiao et al., 2017), IMDB (Maas et al., 2011) and Cifar-10 (Krizhevsky et al., 2009).
We load these datasets using the Keras package in
Tensorflow2.8, keeping their original train/test samples (Abadi et al., 2016).
Non-IID Setting.
As most empirical work on synthetic Non-IID datasets partitions a ”flat” existing dataset based on the labels (Kairouz et al., 2021), we also use the label distribution skew as our
Non-IID setting.
Then we set a variable Non-IID ratio λ , ranging from 0.0 to 1.0, to simulate the Non-IIDness of clients’ datasets, which is the same with Beutel et al.
In this way, the distribution of clients’ datasets is becoming more heterogeneous with a larger λ .
Please see more details in Appendix C.1.
Metrics.
Following the existing work (Sattler et al., 2019; Wu et al., 2020), we use accuracy on the test dataset as the evaluation metric.
To compare the performance of different strategies in the decentralized scenario, we optimize their hyper-parameters and choose the average of metrics in all clients as the optimization target.
Please see more details in Appendix C.2 and C.3.
5. P ERFORMANCE COMPARISON OF ALGORITHMS WITH DIFFERENT N ON -IID RATIOS
To answer the proposed question Q1 , we firstly set different Non-IID ratios λ , i.e. 0.0, 0.5 and 1.0, to partition the original datasets for clients.
As shown in Table 1 and Appendix D.1, we set the different
[Table]
numbers of clients, ranging from 2 to 100, for the cross-silo federated learning, which is similar to previous studies (Gao et al., 2021; Wu et al., 2020).
Furthermore, we compare the accuracy of our proposed FedPSE and the three aforementioned algorithms, i.e. FedAVG McMahan et al.
(2017a),
FedSTC Sattler et al.
(2019), and FedSCR (Wu et al., 2020).
Among them, FedAVG is the baseline method without communication compression.
In addition, FedSTC and FedSCR are state-of-the-art methods to solve the communication efficiency problem in the Non-IID setting.
Especially, we set the same sparsity parameter p = 0 .
9 for FedSTC, FedSCR, and FedPSE, which means that only 10% parameters are transmitted between clients and the server compared with FedAVG.
Then we summarize the results in Table 1 and Appendix D.1, which compare the performance of FedAVG,
FedSTC, FedSCR
[Figure]
and FedPSE paradigms on these benchmark datasets.
[Figure]
From the results of the experiments
[Figure]
we conclude that our proposed FedPSE almost achieves the best performance of all algorithms in the Non-IID setting ( λ = 1 . 0 or 0 . 5 ), which is also robust to the number of clients.
For example
[Figure]
the average metric of FedPSE outperforms 6.85% for
FedSTC and 5.57% for FedSCR on FMNIST dataset as shown in Table 2 of Appendix D.1.
Besides, FedPSE is also robust to the Non-IID ratios, which can get very similar performance compared with FedAVG and FedSTC, while FedSCR has a weakness when the data distribution is more symmetrical ( λ = 0 . 0 ).
Furthermore, our method also outperforms other models with partial clients participation for aggregation as shown in
Appendix D.2.
5. C ONVERGENCE SPEED OF F ED PSE IN THE N ON -IID SETTING
[Figure]
To answer the proposed question Q
[Figure]
we plot the metric over the federated rounds on the Non-IID ( λ = 1 . 0 ) FMNIST dataset as shown in Figure 2, in which the compression ratio p is 0.9 with 5 participated clients.
We observe that the performance of FedAVG is unstable on
Non-IID datasets, which is also proposed in the previous result (Zhao et al., 2018), while other methods suffer the least from Non-IID data.
It is essential that our proposed FedPSE, compared with FedSTC and FedSCR, improves the performance with a faster convergence speed.
Furthermore, FedSCR performs best in the Non-IID setting, which is consistent with the former result (Wu et al., 2020).
5. C ORRELATION DISTANCE OF F ED PSE WITH DIFFERENT N ON -IID RATIOS
To answer the proposed question Q
[Figure]
we plot the correlation distance of participated clients with different Non-IID ratios (i
[Figure]
e. λ = 0 .
5 , 1 . 0 ) as shown in Figure 3.
Figure 3 shows that the average correlation distance increases over the Non-IID ratios, which demonstrates that the correlation distance is able to represent the heterogeneity between a local distribution and global distribution.
Furthermore, we compute the variance of correlation distance under diverse
Non-IID settings as shown in Appendix D.3.
Apparently, the variance is becoming larger with the growth of heterogeneity, which means that the correlation distance also has a relationship with the distribution divergence among each client
[Figure]
5. P ERFORMANCE COMPARISON OF F ED PSE WITH DIFFERENT AGGREGATION METHODS
[Figure]
To answer the proposed question Q4 , we vary sparsity ratio p from 0.1 to 0.9 on FMNIST dataset and report the average test accuracy on Non-IID datasets ( λ = 1 . 0 ) in Figure 4, in which FedPSE without EWA indicates
FedPSE using the naive aggregation method of FedAVG.
Figure 4 shows that FedPSE with EWA consistently outperforms FedPSE without EWA under different compression rates, which demonstrates the effectiveness of our proposed EWA method.
Besides, the average promotion of EWA is 0.002 on 2 clients, while the promotion is 0.0071 on 5 clients and 0.0143 on 10 clients.
We can indicate that the promotion of EWA increases with the number of clients.
Furthermore, we construct experiments on the FMNIST datasets over Non-IID ratios λ
(i.e. from 0.0 to 1.0) with a fixed p = 0 . 9 as shown in Figure 5.
The test accuracy of FedPSE with EWA exceeds the algorithm without EWA through different distributions.
The performance of FedPSE increases rapidly with the rising λ , which means that our proposed paradigm performs better under the extreme Non-IID condition.
In conclusion, the EWA method is useful for the sparse aggregation process in the server.
5. P ERFORMANCE COMPARISON OF F ED PSE WITH DIFFERENT SPARSITY RATIOS
Figure 4 can also answer the proposed question Q5 .
We can find that the accuracy of FedPSE over sparsity ratios changes individually on the different number of clients.
For instance, the accuracy keeps steady with most sparsity ratios on two clients, while the metric increases rapidly with the rising p from 0.1 to 0.7 on more clients.
We can optimize the sparsity hyper-parameter p of FedPSE to balance the performance and efficiency of FedPSE.
C ONCLUSION
We propose a personalized sparsification with element-wise aggregation for federated learning to solve the Non-IID isolated scenario.
We first sparsify the upstream updates of clients via the Top-K operator.
Then we propose the EWA aggregation method to promote the federated performance for sparse matrices.
Finally, we leverage the DPS method to keep the personalization and sparsification for the downstream information.
Experiments on real-world datasets demonstrate that our model significantly outperforms the current methods on the isolated Non-IID data.
A C OMPARISON OF DIFFERENT AGGREGATION METHODS
Dense Sparse
EWA   3 X
Y (a) IID   3 X
Y (b) Non-IID
In this section, we give two examples to compare the results of different aggregation methods under the IID and Non-IID settings.
For the IID setting, we suppose that there are three clients with their updates, i.e. ∆ W 1 = (1 , 1) , ∆ W 2 = (2 , 2) and ∆ W 3 = (3 , 3) .
It is evident that the original aggregation of these dense updates is (2 , 2) (red arrow) as shown in Figure 6(a), which is regarded as the accurate result.
We then generate the corresponding sparse updates, i.e. ∆ ˆ W 1 = (0 , 1) , ∆ ˆ W 2 = (2 , 0) and ∆ ˆ W 3 = (0 , 3) , whose biased result (cid:0) 23 , 43 (cid:1) (green arrow) is easily aggregated via the naive averaging method (McMahan et al., 2017b).
From a microcosmic perspective, if we compute the aggregated vector via the Element-Wise Aggregation (EWA) method as shown in Section 4.3, we would get the precise aggregation (2 , 2) (blue vector) with the above sparse updates.
In similarity, we assume that the clients’ updates are ∆ W
= (1 , 2) , ∆ W 2 = (3 , 2) and ∆ W 3 = (3 , 4) in the Non-IID setting.
Then we sparsify these updates via Top-K operator, i.e. ∆ ˆ W 1 = (0 , 2) , ∆ ˆ W 2 = (3 , 0) and ∆ ˆ W 3 = (0 , 4) .
It’s easy to calculate the accurate aggregation, (cid:0) 73 , 83 (cid:1) (red arrow), the naive result, (1 , 2) (green arrow), and the EWA vector, (3 , 3) (blue arrow).
Apparently, the EWA result is more close to the accurate dense aggregation than the naive sparse aggregation as shown in
Figure 6(b), when it refers to the direction and magnitude.
Overall, the original averaging approach is easily biased by the sparse matrices, while our proposed
EWA method is more suitable for the sparse aggregation.
B C ONVERGENCE ANALYSIS B. A NALYSIS P RELIMINARIES AND A SSUMPTIONS
The framework FedPSE is used to minimize the differentiable loss function f
i : R n → R ( ∀ i ∈ P ) individually, where n indicates the dimension of parameters.
We consider the general setting in deep learning where f i is a non-convex function.
Our convergence results are proved under the following assumptions:
Assumption 3.
Smoothness : The loss function f
i ( ∀ i ∈ P ) is L-Lipschitz smooth (L-smooth), i.e.,
[Equation]
Then we assume that client i trains its model W i with unbiased stochastic gradient, i.e.,
E [ G i ( W i )]
= ∇ f i ( W i ) , in which G i denotes the stochastic gradient with a batch of M samples.
Assumption 4.
Bounded Gradient : The second moment of local gradient G i is bounded, i.e., (cid:80)
Ni =1 E [ || G i
( W i ) || 2 ] ≤ σ 2 , ∀ W i ∈ R n , where || .
|| is ℓ 2 -norm.
As shown in Algorithm 5, FedPSE includes three steps, i.e., upstream personalized sparsification (UPS), element-wise aggregation (EWA), and downstream personalized sparsification (DPS).
The training steps of each federated round are termed as PSE collectively in the following sections.
The local model is updated during the ( r + 1) -th federated round by the following expression:
[Equation]
where α r is the learning rate.
According to Algorithm 2, e r − 1 i
[Equation]
[Equation] [Equation]
We then expand the PSE with the previous parameters and get
[Equation]
where Top-k ( · ) is the compress operator which is described in Algorithm 1, R( · ) denotes the random selection function in Algorithm 4 and W r = ⃗ 1 n ⊘ (cid:80)
Ni =1 Sign (cid:0)(cid:12)(cid:12)
[Equation]
k
[Equation]
W ri
[Equation]
) (cid:12)(cid:12)(cid:1) is the element weight matrix.
Similar to Dan Alistarh et al.
(2018), we use ˜ W ri to denote the auxiliary model weight with convergence guarantee during r -th federated round on client i , and get
[Equation]
where G ( W r )
= 1 N (cid:80) Ni =
1 G i
( W ri ) and ˜ W
=
W
i ( ∀ i ∈ P ).
The difference between the auxiliary model ˜ W r and the local model W ri can be represented by
[Equation]
Then we define a commonly used k -contraction operator (Gao et al
[Equation]
, 2021; Sebastian U. Stich, 2018) as shown below:
Definition 1.
For any vector W ∈ R n and 0 < k ≤ n , operator Q ( R n → R n ) is a k -contraction operator if it satisfies the following property:
[Equation]
Apparently, the Top-K compressor is a k -contraction operator
[Equation]
Lemma 2.
∀ W i ∈ R n and 0 < k ≤ n , we have
[Equation]
Proof.
Combining equation 2 and Definition 1, we obtain
[Equation]
[Equation]
B. M AIN P ROCESS
As a standard situation in non-convex settings (Liu & Wright, 2015), we want to guarantee the following convergence:
[Equation]
that is, the algorithm converges ergodically to the optimal point where gradients are zero.
Our purpose is to minimize the difference between the “real” model ˜ W ri and the viewed W ri observed at federated round r , which means decreasing the value of loss function f
i ( W ri ) .
Furthermore, we need to bound the following expression:
[Equation]
Then We get Lemma 3:
Lemma 3.
For any federated round r ≥ 1 :
[Equation]
where φ = 1 − kn , 0 < k ≤ n and ρ > 0 .
Proof.
We derive the difference between W r
+1 i and ˜ W r +1 :
E
[Equation]
≤ E [
[Equation]
N
[Equation]
=
[Equation]
e ri ||
[Equation]
From Lemma 2, we can obtain
E
[Equation]
E
[Equation]
e ri
[Equation]
|
[Equation]
From equation (4) and Lemma 2, we have
E
[Equation]
Top-k
[Equation]
PSE
[Equation]
e
[Equation]
≤ φ E ||
α r G ( W r )
||
[Equation]
φ E || W ri − ˜ W
r
||
[Equation]
(1 + φ ) E || W r
+
i − W r
+
i ||≤ (1 + 2 φ )(1 + 1 ρ ) E
|| α r G
[Equation]
Iterate the above inequality by r to get:
[Equation]
From Assumption 4 and Lemma
[Equation]
we have
[Equation]
Theorem 2.
Assume that our proposed FedPSE is applied to minimize the objective loss function f i that satisfies the assumptions in A
[Equation]
If we choose a learning rate schedule that satisfies:
[Equation]
then for some constant C >
[Equation]
we have the following result after R federated rounds:
[Equation]
where ˜ W ∗ is the optimal solution to f i .
Proof.
Under the Assumption
[Equation]
we have
[Equation] [Equation]
and
[Equation]
Taking the expectation at federated round r
[Equation]
we bonud
[Equation]
Taking the expectation before r
[Equation]
it yields
[Equation]
Apply (8) to the above inequality
[Equation]
we get
[Equation]
Combine with inequality (10), we can obtain
[Equation]
≤
[Equation]
Summing up the above inequality for r = 1 , 2 , · · · , R , we have
[Equation]
By dividing the summation of learning rates and therefore:
[Equation]
The condition (8) keeps right if φ (1 + ρ ) < 1 .
To derive the bound of ρ , we have
[Equation]
Therefore
[Equation]
one should choose ρ < kn − k to satisfy the above inequality.
Theorem 2 implies that each client’s model in the FedPSE framework will converge if federated round R is large enough when α r satisfies the following conditions:
[Equation]
Corollary 1.
Under the assumptions in Theorem 2, if τ = φ (1 + ρ ) and α r = θ (cid:113) MNR , ∀ r > 0 , where θ > 0 is a constant, we have the convergence speed of FedPSE:
[Equation]
Proof.
First we prove that α r = θ (cid:113) MNR , a constant step size, satisfies the inequality (8).
we set α r = α for simplification:
[Equation]
Since 0 ≤ r < 1 , we then obtain
[Equation]
Therefore, inequality (8) holds under the condition: C = ατ 1 − τ .
From Theorem 2, we obtain the inequality of the expected average-squared gradients of f i , i.e.,
[Equation]
From Corollary 1, we can conclude that the framework FedPSE has a convergence rate of O ( 1 √ R ) with a proper learning rate,.
It also indicates that the hyper-parameter k (in Top-K) has minor impacts on the convergence rate if R is large enough.
C D ETAILS OF EXPERIMENTS SETTINGS C. S EPARATION OF CLIENTS ’ DATASETS
In this section, we propose the details of the splitting method with a ”flat” existing dataset in the
Non-IID setting.
Firstly, the whole training/test samples are separated into two parts, including the heterogeneous subset with λ percent and the homogeneous subset with (1 . 0 − λ ) percent.
On one hand, the homogeneous subset is averaged partitioned into N clients randomly.
On the other hand, the heterogeneous subset is sorted by labels and split into N clients by order, which indicates that each client has its own distribution.
Finally, we combine the above-mentioned homogeneous part and heterogeneous part into the individual training/test dataset of each client.
C. M ODELS FOR DIFFERENT DATASETS
We establish an ConvNet2 model (Beutel et al., 2020) for MNIST and FMNIST datasets (Subramani et al., 2021).
In similarity, we construct a model with one Embedding layer, which is prebuilt in
Keras, followed by a fully-connected layer on the IMDB dataset.
Finally, we train the Resnet model (He et al., 2016) on the Cifar10.
C. H YPER - PARAMETERS OPTIMIZATION
We fix the architectures of models and the random seed as 1 .
Then we optimize the hyperparameters(e.g.
batch size ranging from 64 to 512 and learning rate ranging from 1 e − 3 to 1 e − 2 ) for different strategies to compare their best metrics in the following experiments.
Particularly, in order to accelerate the training process of Resnet18 on Cifar10, we use a pre-trained model to initialize the clients’ weights.
The experiments are conducted in a stand-alone PC to simulate the communication in federated learning.
D S UPPLEMENTARY EXPERIMENTS D. P ERFORMANCE COMPARISON OF ALGORITHMS WITH DIFFERENT NUMBERS OF CLIENTS
In order to prove the effectiveness of our method, we vary the number of clients from 2 to 100 and report their accuracy in Table 2, where we perform the experiments on the FMNIST and IMDB
[Figure]
a
[Figure]
datasets with λ = 1 . 0 .
Then we compute the promotion of our method compared to the SOTA methods via the following function:
[Equation]
Then we abbreviate the promotion of FedPSE compared to FedSTC as P1 and the promotion of
FedPSE compared to FedSCR as P2 as shown in Table 2.
From Table
[Table]
we have the conclusion that our proposed FedPSE achieves the best performance among all algorithms under the different numbers of clients, which is consistent with Section 5.2.
[Table]
D. P ERFORMANCE COMPARISON OF ALGORITHMS IN THE PARTIAL CLIENT PARTICIPATION SCENARIO
We take experiments with partial clients participation for aggregation on the FMNIST and IMDB datasets in the Non-IID setting ( λ = 1 . 0 ).
Specifically, the clients are randomly sampled by the server at different rates.
As shown in Figure 7, our method (red line) significantly outperforms other models, which is align with the conclusion in Section 5.2.
D. V ARIANCE OF CORRELATION DISTANCE
[Table]
5 clients 10 clients λ = 1 .5.8e6.3e2.0e2.8e1.2e1.7eλ
= 0 .3.6e4.7e4.0e2.3e4.5e1.3eλ
= 0 .1.0e3.3e2.9e1.7e2.0e4.1e-
In this section, we compute the variance of correlation distances with diverse Non-IID ratios λ as shown in Table 3, in which we perform the experiments on the FMNIST and IMDB datasets with a variable clients’ number.
Then we deduce our conclusion in section 5.4.
D. C ONTRIBUTION OF THE DPS ALGORITHM
[Figure]
In order to prove the effectiveness of the DPS algorithm, we construct experiments of FedPSE with different downstream updates on the FMNIST datasets over Non-IID ratios λ (i.e. from 0.0 to 1.0) as shown in Figure 5.
The FedPSE without the DPS algorithm indicates that the server sparsifies the global updates with the
TopK method and broadcasts the same sparse information to all clients.
Apparently, the accuracy of FedPSE with DPS exceeds the algorithm without DPS through different distributions in the Non-IID setting (i.e. λ ≥ 0 . 2 ).
In conclusion, the DPS method, personalizing the clients’ models, is useful for our paradigm with heterogeneous datasets.
E E XAMPLE CODE
We provide the example code for our framework in this section.
Figure 9 shows an example code of the UPS algorithm, while Figure 10 is an example implementation of the EWA algorithm and Figure 12 for the DPS algorithm.
Furthermore, we present the training process of FedPSE in Figure 13, in which we assume that there are two clients (a and b) with two-layers neural networks.
import tensorflow as ups algorithm class Client(ABC): def __init__ ( self , model, ds_train, ds_valid ): self .model = model self .ds_train
= ds_train self .ds_valid
= ds_valid
_weights =
[] downstream updates error residual
] merged_updates
for
] 44return element_wise_updates
import numpy as np  def merge_indices(server_indices , client_indices , dist): merged_indices = [] # compute the merged indices of each layer for s_ind, c_ind, d in zip(server_indices , client_indices , dist): # get the intersection of index matrices inter_ind = np.multiply(s_ind, c_ind)
i_nonzero_num = np.count_nonzero(inter_ind) inter_index
= np.flatnonzero(inter_ind) # compute the corresponding compensation s_nonzero_num
= np.count_nonzero(s_ind)
server_c =
s_ind - inter_ind client_c =
c_ind - inter_ind server_c_index = np.flatnonzero(server_c)
client_c_index =
np.flatnonzero(client_c) # select the indices from the compensations client_num =
round(d * (s_nonzero_num - i_nonzero_num)) server_num = round((1.0 - d) * (s_nonzero_num - i_nonzero_num))
server_index
= np.sort( np.random.choice(server_c_index , server_num, replace=False) ) client_index
= np.sort( np.random.choice(client_c_index , client_num, replace=False) )
# get the merged indices merge_index
= np.concatenate((inter_index, server_index, client_index))
indices_array =
np.zeros(s_ind.shape).flatten() indices_array[merge_index] = merged_indices.append(indices_array.reshape(s_ind.shape)) return merged_indices
import numpy as np from utils import
_indices # define the function of the DPS algorithm def dps(c_updates, s_updates, s_sparse_updates): clients_down_updates
= [] # get the index matrices of the server server_indices =
[ np.sign(np.absolute(layer)) for layer in s_updates ] s_norm = [w / np.linalg.norm(w) for w in s_updates] # get the downstream updates of each client for client_updates in c_updates:
# get the index matrices of the client client_indices =
[ np.sign(np.absolute(layer)) for layer in client_updates ] # compute the correlation distance client_norm = [w / np.linalg.norm(w) for w in c_updates] dist = [ 0.5 - 0.5 * cosine_distance(s_layer, c_layer) for s_layer, c_layer in zip(s_norm, client_norm) ]
# get the combined indices merged_indices =
merge_indices( server_indices , client_indices , dist ) # compute the downstream personalized updates client_down_updates =
[ np.multiply(layer, index) for layer, index in zip(s_updates, merged_indices) ] clients_down_updates.append(client_down_updates) return tuple(clients_down_updates)
import numpy as np import tensorflow as tf from ewa import ewa from dps import dps from ups import Client # define a neural network model def build_model(input_shape): model = tf.keras.
Sequential( [ tf.keras.
Input(shape=input_shape), tf.keras.layers.
Dense(50, activation="relu"), tf.keras.layers.
Dense(10, activation="relu"), ] ) model.compile( optimizer=tf.keras.optimizers.
Adam(), loss=tf.keras.losses.categorical_crossentropy , metrics=["accuracy"] ) return model # main process # initial hyper-parameters sparsity = 0.
max_round =
# clients load data a_ds_train, a_ds_valid, feature_dim = load_tf_datasets("data_a_location") b_ds_train, b_ds_valid, feature_dim = load_tf_datasets("data_b_location")
# define model model = build_model(feature_dim) client_a = Client(model, a_ds_train, a_ds_valid) client_b = Client(model, b_ds_train, b_ds_valid) a_down_updates =
[] b_down_updates =
[] for _ in range(max_round): a_up_updates, a_samples = client_a.ups(a_down_updates , sparsity) b_up_updates, b_samples =
client_b.ups(b_down_updates , sparsity) clients_updates
=
[a_up_updates, b_up_updates] clients_samples = [a_samples, b_samples] s_updates = ewa(clients_updates , clients_samples) s_sparse_updates = topk_algorithm(s_updates) a_down_updates , b_down_updates = dps( clients_updates , s_updates, s_sparse_updates ) 51client_a.model.save(’client_a_model.h5’) client_b.model.save(’client_b_model.h5’)