Title: FEDERATED LEARNING WITH MATCHED AVERAGING

Abstract: Federated learning allows edge devices to collaboratively learn a shared model while keeping the training data on device, decoupling the ability to do model training from the need to store the data in the cloud. We propose the Federated matched averaging (FedMA) algorithm designed for federated learning of modern neural network architectures e.g. convolutional neural networks (CNNs) and LSTMs. FedMA constructs the shared global model in a layer-wise manner by matching and averaging hidden elements (i.e. channels for convolution layers; hidden states for LSTM; neurons for fully connected layers) with similar feature extraction signatures. Our experiments indicate that FedMA not only outperforms popular state-of-the-art federated learning algorithms on deep CNN and LSTM architectures trained on real world datasets, but also reduces the overall communication burden. 1

1. INTRODUCTION:

Edge devices such as mobile phones, sensors in a sensor network, or vehicles have access to a wealth of data. However, due to data privacy concerns, network bandwidth limitation, and device availability, it's impractical to gather all the data from the edge devices at the data center and conduct centralized training. To address these concerns, federated learning is emerging (McMahan et al., 2017; Li et al., 2019; Smith et al., 2017; Caldas et al., 2018; Bonawitz et al., 2019; Kairouz et al., 2019) as a paradigm that allows local clients to collaboratively train a shared global model.

The typical federated learning paradigm involves two stages: (i) clients train models with their local datasets independently, and (ii) the data center gathers the locally trained models and aggregates them to obtain a shared global model. One of the standard aggregation methods is FedAvg (McMahan et al., 2017) where parameters of local models are averaged element-wise with weights proportional to sizes of the client datasets. FedProx (Sahu et al., 2018) adds a proximal term to the client cost functions, thereby limiting the impact of local updates by keeping them close to the global model. Agnostic Federated Learning (AFL) (Mohri et al., 2019) , as another variant of FedAvg, optimizes a centralized distribution that is a mixture of the client distributions.

One shortcoming of FedAvg is coordinate-wise averaging of weights may have drastic detrimental effects on the performance of the averaged model and adds significantly to the communication burden. This issue arises due to the permutation invariance of neural network (NN) parameters, i.e. for any given NN, there are many variants of it that only differ in the ordering of parameters. Probabilistic Federated Neural Matching (PFNM) (Yurochkin et al., 2019b) addresses this problem by matching the neurons of client NNs before averaging them. PFNM further utilizes Bayesian nonparametric methods to adapt to global model size and to heterogeneity in the data. As a result, PFNM has better performance and communication efficiency than FedAvg. Unfortunately, the method only works with simple architectures (e.g. fully connected feedforward networks).

Our contribution In this work, we demonstrate how PFNM can be applied to CNNs and LSTMs, but we find that it only gives very minor improvements over weight averaging. To address this issue, we propose Federated Matched Averaging (FedMA), a new layers-wise federated learning algorithm for modern CNNs and LSTMs that appeal to Bayesian nonparametric methods to adapt to heterogeniety in the data. We show empirically that FedMA not only reduces the communcations burden, but also outperforms state-of-the-art federated learning algorithms.

2. FEDERATED MATCHED AVERAGING OF NEURAL NETWORKS:

In this section we will discuss permutation invariance classes of prominent neural network architectures and establish the appropriate notion of averaging in the parameter space of NNs. We will begin with the simplest case of a single hidden layer fully connected network, moving on to deep architectures and, finally, convolutional and recurrent architectures.

Permutation invariance of fully connected architectures A basic fully connected (FC) NN can be formulated as ŷ = σ(xW 1 )W 2 (without loss of generality, biases are omitted to simplify notation), where σ is the non-linearity (applied entry-wise). Expanding the preceding expression

ŷ = L i=1 W 2,i• σ( x, W 1,•i )

, where i• and •i denote ith row and column correspondingly and L is the number of hidden units. Summation is a permutation invariant operation, hence for any {W 1 , W 2 } there are L! practically equivalent parametrizations if this basic NN. It is then more appropriate to write

ŷ = σ(xW 1 Π)Π T W 2 , where Π is any L × L permutation matrix.

(1)

Recall that permutation matrix is an orthogonal matrix that acts on rows when applied on the left and on columns when applied on the right. Suppose {W 1 , W 2 } are optimal weights, then weights obtained from training on two homogeneous datasets X j , X j are

{W 1 Π j , Π T j W 2 } and {W 1 Π j , Π T j W 2 }.

It is now easy to see why naive averaging in the parameter space is not appropriate: with high probability Π j = Π j and (W 1 Π j + W 1 Π j )/2 = W 1 Π for any Π. To meaningfully average neural networks in the weight space we should first undo the permutation

(W 1 Π j Π T j + W 1 Π j Π T j )/2 = W 1 .

2.1. MATCHED AVERAGING FORMULATION:

In this section we formulate practical notion of parameter averaging under the permutation invariance. Let w jl be lth neuron learned on dataset j (i.e. lth column of W (1) Π j in the previous example), θ i denote the ith neuron in the global model, and c(•, •) be an appropriate similarity function between a pair of neurons. Solution to the following optimization problem are the required permutations:

EQUATION

Then Π T jli = π j li and given weights {W j,1 , W j,2 } J j=1 provided by J clients, we compute the federated neural network weights

W 1 = 1 J j W j,1 Π T j and W 2 = 1 J j Π j W j,2

. We refer to this approach as matched averaging due to relation of equation 2 to the maximum bipartite matching problem. We note that if c(•, •) is squared Euclidean distance, we recover objective function similar to k-means clustering, however it has additional constraints on the "cluster assignments" π j li necessary to ensure that they form permutation matrices. In a special case where all local neural networks and the global model are assumed to have same number of hidden neurons, solving equation 2 is equivalent to finding a Wasserstein barycenter (Agueh & Carlier, 2011) of the empirical distributions over the weights of local neural networks. Concurrent work of Singh & Jaggi (2019) explores the Wasserstein barycenter variant of equation 2.

Solving matched averaging Objective function in equation 2 can be optimized using an iterative procedure: applying the Hungarian matching algorithm (Kuhn, 1955) to find permutation {π j li } l,i corresponding to dataset j , holding other permutations {π j li } l,i,j =j fixed and iterating over the datasets. Important aspect of Federated Learning that we should consider here is the data heterogeneity. Every client will learn a collection of feature extractors, i.e. neural network weights, representing their individual data modality. As a consequence, feature extractors learned across clients may overlap only partially. To account for this we allow the size of the global model L to be an unknown variable satisfying max j L j ≤ L ≤ j L j where L j is the number of neurons learned from dataset j. That is, global model is at least as big as the largest of the local models and at most as big as the concatenation of all the local models. Next we show that matched averaging with adaptive global model size remains amendable to iterative Hungarian algorithm with a special cost.

At each iteration, given current estimates of {π j li } l,i,j =j , we find a corresponding global model {θ i = arg min θi j =j ,l π j li c(w jl , θ i )} L i=1 (this is typically a closed-form expression or a simple optimization sub-problem, e.g. a mean if c(•, •) is Euclidean) and then we will use Hungarian algorithm to match this global model to neurons {w j l } L j l=1 of the dataset j to obtain a new global model with L ≤ L ≤ L + L j neurons. Due to data heterogeneity, local model j may have neurons not present in the global model built from other local models, therefore we want to avoid "poor" matches by saying that if the optimal match has cost larger than some threshold value , instead of matching we create a new global neuron from the corresponding local one. We also want a modest size global model and therefore penalize its size with some increasing function f (L ). This intuition is formalized in the following extended maximum bipartite matching formulation:

EQUATION

C j li = c(w j l , θ i ), i ≤ L + f (i), L < i ≤ L + L j .

(3)

The size of the new global model is then L = max{i : π j li = 1, l = 1, . . . , L j }. We note some technical details: after the optimization is done, each corresponding Π T j is of size L j × L and is not a permutation matrix in a classical sense when L j = L. Its functionality is however similar: taking matrix product with a weight matrix W

(1) j Π T j implies permuting the weights to align with weights learned on the other datasets and padding with "dummy" neurons having zero weights (alternatively we can pad weights W

(1) j first and complete Π T j with missing rows to recover a proper permutation matrix). This "dummy" neurons should also be discounted when taking average. Without loss of generality, in the subsequent presentation we will ignore these technicalities to simplify the notation.

To complete the matched averaging optimization procedure it remains to specify similarity c(•, •), threshold and model size penalty f (•). Yurochkin et al. (2019a; b; c) studied fusion, i.e. aggregation, of model parameters in a range of applications. The most relevant to our setting is Probabilistic Federated Neural Matching (PFNM) (Yurochkin et al., 2019b) . They arrived at a special case of equation 3 to compute maximum a posteriori estimate (MAP) of their Bayesian nonparametric model based on the Beta-Bernoulli process (BBP) (Thibaux & Jordan, 2007) , where similarity c(w jl , θ i ) is the corresponding posterior probability of jth client neuron l generated from a Gaussian with mean θ i , and and f (•) are guided by the Indian Buffet Process prior (Ghahramani & Griffiths, 2005) . Instead of making heuristic choices, this formulation provides a model-based specification of equation 3. We refer to a procedure for solving equation 2 with the setup from Yurochkin et al. (2019b) as BBP-MAP. We note that their PFNM is only applicable to fully connected architectures limiting its practicality. Our matched averaging perspective allows to formulate averaging of widely used architectures such as CNNs and LSTMs as instances of equation 2 and utilize the BBP-MAP as a solver.

2.2. PERMUTATION INVARIANCE OF KEY ARCHITECTURES:

Before moving onto the convolutional and recurrent architectures, we discuss permutation invariance in deep fully connected networks and corresponding matched averaging approach. We will utilize this as a building block for handling LSTMs and CNN architectures such as VGG (Simonyan & Zisserman, 2014) widely used in practice.

Permutation invariance of deep FCs:

We extend equation 1 to recursively define deep FC network:

x

EQUATION

where n = 1, . . . , N is the layer index, Π 0 is identity indicating non-ambiguity in the ordering of input features x = x 0 and Π N is identity for the same in output classes. Conventionally σ(•) is any non-linearity except for ŷ = x N where it is the identity function (or softmax if we want probabilities instead of logits). When N = 2, we recover a single hidden layer variant from equation 1. To perform matched averaging of deep FCs obtained from J clients we need to find permutations for every layer of every client. Unfortunately, permutations within any consecutive pair of intermediate layers are coupled leading to a NP-hard combinatorial optimization problem. Instead we consider recursive (in layers) matched averaging formulation. Suppose we have {Π j,n-1 }, then plugging {Π T j,n-1 W j,n } into equation 2 we find {Π j,n } and move onto next layer. The recursion base for this procedure is {Π j,0 }, which we know is an identity permutation for any j.

Permutation invariance of CNNs:

The key observation in understanding permutation invariance of CNNs is that instead of neurons, channels define the invariance. To be more concrete, let Conv(x, W ) define convolutional operation on input x with weights W ∈ R C in ×w×h×C out , where C in , C out are the numbers of input/output channels and w, h are the width and height of the filters. Applying any permutation to the output dimension of the weights and then same permutation to the input channel dimension of the subsequent layer will not change the corresponding CNN's forward pass. Analogous to equation 4 we can write:

EQUATION

Note that this formulation permits pooling operations as those act within channels. To apply matched averaging for the nth CNN layer we form inputs to equation 2 as

{w jl ∈ R D } C out n l=1 , j = 1, . . . , J, where D is the flattened C in n × w × h dimension of Π T j,n-1 W j,n

. This result can be alternatively derived taking the IM2COL perspective. Similar to FCs, we can recursively perform matched averaging on deep CNNs. The immediate consequence of our result is the extension of PFNM (Yurochkin et al., 2019b) to CNNs. Empirically, see Figure 1 , we found that this extension performs well on MNIST with a simpler CNN architecture such as LeNet (LeCun et al., 1998 ) (4 layers) and significantly outperforms coordinate-wise weight averaging (1 round FedAvg). However, it breaks down for more complex architecture, e.g. VGG-9 (Simonyan & Zisserman, 2014) (9 layers), needed to obtain good quality prediction on a more challenging CIFAR-10.

Permutation invariance of LSTMs Permutation invariance in the recurrent architectures is associated with the ordering of the hidden states. At a first glance it appears similar to fully connected architecture, however the important difference is associated with the permutation invariance of the hidden-to-hidden weights H ∈ R L×L , where L is the number of hidden states. In particular, permutation of the hidden states affects both rows and columns of H. Consider a basic RNN h t = σ(h t-1 H + x t W ), where W are the input-to-hidden weights. To account for the permutation invariance of the hidden states, we notice that dimensions of h t should be permuted in the same way for any t, hence

EQUATION

To match RNNs, the basic sub-problem is to align hidden-to-hidden weights of two clients with Euclidean similarity, which requires minimizing Π T H j Π -H j 2 2 over permutations Π. This is a quadratic assignment problem known to be NP-hard (Loiola et al., 2007) . Fortunately, the same permutation appears in an already familiar context of input-to-hidden matching of W Π. Our matched averaging RNN solution is to utilize equation 2 plugging-in input-to-hidden weights {W j } to find {Π j }. Then federated hidden-to-hidden weights are computed as

H = 1 J j Π j H h Π T j

and input-to-hidden weights are computed as before. We note that Gromov-Wasserstein distance (Gromov, 2007) from the optimal transport literature corresponds to a similar quadratic assignment problem. It may be possible to incorporate hidden-to-hidden weights H into the matching algorithm by exploring connections to approximate algorithms for computing Gromov-Wasserstein barycenter (Peyré et al., 2016) . We leave this possibility for future work.

To finalize matched averaging of LSTMs, we discuss several specifics of the architecture. LSTMs have multiple cell states, each having its individual hidden-to-hidden and input-to-hidden weights. In out matched averaging we stack input-to-hidden weights into SD × L weight matrix (S is the number of cell states; D is input dimension and L is the number of hidden states) when computing the permutation matrices and then average all weights as described previously. LSTMs also often have an embedding layer, which we handle like a fully connected layer. Finally, we process deep LSTMs in the recursive manner similar to deep FCs.

2.3. FEDERATED MATCHED AVERAGING (FEDMA) ALGORITHM:

Defining the permutation invariance classes of CNNs and LSTMs allows us to extend PFNM (Yurochkin et al., 2019b) to these architectures, however our empirical study in Figure 1 demonstrates that such extension fails on deep architectures necessary to solve more complex tasks. Our results suggest that recursive handling of layers with matched averaging may entail poor overall solution. To alleviate this problem and utilize the strength of matched averaging on "shallow" architectures, we propose the following layer-wise matching scheme. First, data center gathers only the weights of the first layers from the clients and performs one-layer matching described previously to obtain the first layer weights of the federated model. Data center then broadcasts these weights to the clients, which proceed to train all consecutive layers on their datasets, keeping the matched federated layers frozen. This procedure is then repeated up to the last layer for which we conduct a weighted averaging based on the class proportions of data points per client. We summarize our Federated Matched Averaging (FedMA) in Algorithm 1. The FedMA approach requires communication rounds equal to the number of layers in a network. In Figure 1 we show that with layer-wise matching FedMA performs well on the deeper VGG-9 CNN as well as LSTMs. In the more challenging heterogeneous setting, FedMA outperforms FedAvg, FedProx trained with same number of communication rounds (4 for LeNet and LSTM and 9 for VGG-9) and other baselines, i.e. client individual CNNs and their ensemble.

FedMA with communication We've shown that in the heterogeneous data scenario FedMA outperforms other federated learning approaches, however it still lags in performance behind the entire data training. Of course the entire data training is not possible under the federated learning constraints, but it serves as performance upper bound we should strive to achieve. To further improve the performance of our method, we propose FedMA with communication, where local clients receive the matched global model at the beginning of a new round and reconstruct their local models with the size equal to the original local models (e.g. size of a VGG-9) based on the matching results of the previous round. This procedure allows to keep the size of the global model small in contrast to a naive strategy of utilizing full matched global model as a starting point across clients on every round.

Algorithm 1: Federated Matched Averaging (FedMA)

Input : local weights of N -layer architectures {W j,1 , . . . , W j,N } J j=1 from J clients Output: global weights {W 1 , . . . , W N } n = 1; while n ≤ N do if n < N then {Π j } J j=1 = BBP-MAP {W j,n } J j=1 ; // call BBP-MAP to solve Eq. 2 W n = 1 J j W j,n Π T j ; else W n = K k=1 j p jk W jl,n

where p k is fraction of data points with label k on worker j; end for j ∈ {1, . . . , J} do W j,n+1 ← Π j W j,n+1 ; // permutate the next-layer weights Train {W j,n+1 , . . . , W j,L } with W n frozen; end n = n + 1; end

3. EXPERIMENTS:

We present an empirical study of FedMA with communication and compare it with state-of-the-art methods i.e. FedAvg (McMahan et al., 2017) and FedProx (Sahu et al., 2018) ; analyze the performance under the growing number of clients and visualize the matching behavior of FedMA to study its interpretability. Our experimental studies are conducted over three real world datasets. Summary information about the datasets and associated models can be found in supplement Table 3 .

Experimental Setup:

We implemented FedMA and the considered baseline methods in PyTorch (Paszke et al., 2017) . We deploy our empirical study under a simulated federated learning environment where we treat one centralized node in the distributed cluster as the data center and the other nodes as local clients. All nodes in our experiments are deployed on p3.2xlarge instances on Amazon EC2. We assume the data center samples all the clients to join the training process for every communication round for simplicity.

For the CIFAR-10 dataset, we use data augmentation (random crops, and flips) and normalize each individual image (details provided in the Supplement). We note that we ignore all batch normalization (Ioffe & Szegedy, 2015) layers in the VGG architecture and leave it for future work.

For CIFAR-10, we considered two data partition strategies to simulate federated learning scenario: (i) homogeneous partition where each local client has approximately equal proportion of each of the classes; (ii) heterogeneous partition for which number of data points and class proportions are unbalanced. We simulated a heterogeneous partition into J clients by sampling p k ∼ Dir J (0.5) and allocating a p k,j proportion of the training instances of class k to local client j. We use the original test set in CIFAR-10 as our global test set for comparing performance of all methods. For the Shakespeare dataset, we treat each speaking role as a client (Caldas et al., 2018) resulting in a natural heterogeneous partition. We preprocess the Shakespeare dataset by filtering out the clients with less than 10k datapoints and sampling a random subset of J = 66 clients. We allocate 80% of the data for training and amalgamate the remaining data into a global test set.

Communication Efficiency and Convergence Rate:

In this experiment we study performance of FedMA with communication. Our goal is to compare our method to FedAvg and FedProx in terms of the total message size exchanged between data center and clients (in Gigabytes) and the number of communication rounds (recall that completing one FedMA pass requires number of rounds equal to the number of layers in the local models) needed for the global model to achieve good performance on the test data. We also compare to the performance of an ensemble method. We evaluate all methods under the heterogeneous federated learning scenario on CIFAR-10 with J = 16 clients with VGG-9 local models and on Shakespeare dataset with J = 66 clients with 1-layer LSTM net- work. We fix the total rounds of communication allowed for FedMA, FedAvg, and FedProx i.e. 11 rounds for FedMA and 99/33 rounds for FedAvg and FedProx for the VGG-9/LSTM experiments respectively. We notice that number of local training epochs is a common parameter shared by the three considered methods, we thus tune this parameter (denoted E; comprehensive analysis will be presented in the next experiment) and report the convergence rate under E that yields the best final model accuracy over the global test set. We also notice that there is another hyper-parameter in FedProx i.e. the coefficient µ associated with the proxy term, we also tune the parameter using grid search and report the best µ we found (0.001) for both VGG-9 and LSTM experiments. FedMA outperforms FedAvg and FedProx in all scenarios (Figure 2 ) with its advantage especially pronounced when we evaluate convergence as a function of the message size in Figures 2(a ) and 2(c). Final performance of all trained models is summarized in Tables 1 and 2 . 

Effect of local training epochs:

As studied in previous work (McMahan et al., 2017; Caldas et al., 2018; Sahu et al., 2018) , the number of local training epochs E can affect the performance of FedAvg and sometimes lead to divergence. We conduct an experimental study on the effect of E over FedAvg, FedProx, and FedMA on VGG-9 trained on CIFAR-10 under heterogeneous setup. The candidate local epochs we consider are E ∈ {10, 20, 50, 70, 100, 150}. For each of the candidate E, we run FedMA for 6 rounds while FedAvg and FedProx for 54 rounds and report the final accuracy that each methods achieves. The result is shown in Figure 3 . We observe that training longer benefits FedMA, supporting our assumption that FedMA performs best on local models with higher quality. For FedAvg, longer local training leads to deterioration of the final accuracy, which matches the observations made in the previous literature (McMahan et al., 2017; Caldas et al., 2018; Sahu et al., 2018) . FedProx only partially alleviates this problem. The result of this experiment suggests that FedMA is the only method that local clients can use to train their model as long as they want. Handling data bias Real world data often exhibit multimodality within each class, e.g. geodiversity. It has been shown that an observable amerocentric and eurocentric bias is present in the widely used ImageNet dataset (Shankar et al., 2017; Russakovsky et al., 2015) . Classifiers trained on such data "learn" these biases and perform poorly on the under-represented domains (modalities) since correlation between the corresponding dominating domain and class can prevent the classifier from learning meaningful relations between features and classes. For example, classifier trained on amerocentric and eurocentric data may learn to associate white color dress with a "bride" class, therefore underperforming on the wedding images taken in countries where wedding traditions are different (Doshi, 2018) . The data bias scenario is an important aspect of federated learning, however it received little to no attention in the prior federated learning works. In this study we argue that FedMA can handle this type of problem. If we view each domain, e.g. geographic region, as one client, local models will not be affected by the aggregate data biases and learn meaningful relations between features and classes. FedMA can then be used to learn a good global model without biases. We have already demonstrated strong performance of FedMA on federated learning problems with heterogeneous data across clients and this scenario is very similar. To verify this conjecture we conduct the following experiment.

We simulate the skewed domain problem with CIFAR-10 dataset by randomly selecting 5 classes and making 95% training images in those classes to be grayscale. For the remaining 5 we turn only 5% of the corresponding images into grayscale. By doing so, we create 5 grayscale images dominated classes and 5 colored images dominated classes. In the test set, there is half grayscale and half colored images for each class. We anticipate entire data training to pick up the uninformative correlations between greyscale and certain classes, leading to poor test performance without these correlations. In Figure 4 we see that entire data training performs poorly in comparison to the regular (i.e. No Bias) training and testing on CIFAR-10 dataset without any grayscaling. This experiment was motivated by Olga Russakovsky's talk at ICML 2019.

Next we compare the federated learning based approaches. We split the images from color dominated classes and grayscale dominated classes into 2 clients. We then conduct FedMA with communication, FedAvg, and FedProx with these 2 clients. FedMA noticeably outperforms the entire data training and other federated learning approach as shown in Figure 4 . This result suggests that FedMA may be of interest beyond learning under the federated learning constraints, where entire data training is the performance upper bound, but also to eliminate data biases and outperform entire data training.

We consider two additional approaches to eliminate data bias without the federated learning constraints. One way to alleviate data bias is to selectively collect more data to debias the dataset. In the context of our experiment, this means getting more colored images for grayscale dominated classes and more grayscale images for color dominated classes. We simulate this scenario by simply doing a full data training where each class in both train and test images has equal amount of grayscale and color images. This procedure, Color Balanced, performs well, but selective collection of new data in practice may be expensive or even not possible. Instead of collecting new data, one may consider oversampling from the available data to debias. In Oversampling, we sample the underrepresented domain (via sampling with replacement) to make the proportion of color and grayscale images to be equal for each class (oversampled images are also passed through the data augmentation pipeline, e.g. random flipping and cropping, to further enforce the data diversity). Such procedure may be prone to overfitting the oversampled images and we see that this approach only provides marginal improvement of the model accuracy compared to centralized training over the skewed dataset and performs noticeably worse than FedMA. Data efficiency It is known that deep learning models perform better when more training data is available. However, under the federated learning constraints, data efficiency has not been studied to the best of our knowledge. The challenge here is that when new clients join the federated system, they each bring their own version of the data distribution, which, if not handled properly, may deteriorate the performance despite the growing data size across the clients. To simulate this scenario we first partition the entire training CIFAR-10 dataset into 5 homogeneous pieces. We then partition each homogeneous data piece further into 5 sub-pieces heterogeneously. Using this strategy, we partition the CIFAR-10 training set into 25 heterogeneous small sub-datasets containing approximately 2k points each. We conduct a 5-step experimental study: starting from a randomly selected homogeneous piece consisting of 5 associated heterogeneous sub-pieces, we simulate a 5-client federated learning heterogeneous problem. For each consecutive step, we add one of the remaining homogeneous data pieces consisting of 5 new clients with heterogeneous subdatasets. Results are presented in Figure 6 . Performance of FedMA (with a single pass) improves when new clients are added to the federated learning system, while FedAvg with 9 communication rounds deteriorates.

Interpretability One of the strengths of FedMA is that it utilizes communication rounds more efficiently than FedAvg. Instead of directly averaging weights element-wise, FedMA identifies matching groups of convolutional filters and then averages them into the global convolutional filters. It's natural to ask "How does the matched filters look like?". In Figure 5 

4. CONCLUSION:

We presented Federated Matched Averaging (FedMA), a layer-wise federated learning algorithm designed for modern CNNs and LSTMs architectures that accounts for permutation invariance of the neurons and permits global model size adaptation. Our method significantly outperforms prior federated learning algorithms in terms of its convergence when measured by the size of messages exchanged between server and the clients during training. We demonstrated that FedMA can efficiently utilize well-trained local modals, a property desired in many federated learning applications, but lacking in the prior approaches. We have also presented an example where FedMA can help to resolve some of the data biases and outperform aggregate data training.

In the future work we want to extend FedMA to improve federated learning of LSTMs using approximate quadratic assignment solutions from the optimal transport literature, and enable additional deep learning building blocks, e.g. residual connections and batch normalization layers. We also believe it is important to explore fault tolerance of FedMA and study its performance on the larger datasets, particularly ones with biases preventing efficient training even when the data can be aggregated, e.g. Inclusive Images (Doshi, 2018) .

Mikhail Yurochkin, Zhiwei Fan, Aritra Guha, Paraschos Koutris, and XuanLong Nguyen. Scalable inference of topic evolution via models for latent geometric structures. In Advances in Neural Information Processing Systems, pp. 5949-5959, 2019c.

A SUMMARY OF THE DATASETS USED IN THE EXPERIMENTS:

The details of the datasets and hyper-parameters used in our experiments are summarized in Table 3 . In conducting the "freezing and retraining" process of FedMA, we notice when retraining the last FC layer while keeping all previous layers frozen, the initial learning rate we use for SGD doesn't lead to a good convergence (this is only for the VGG-9 architecture). To fix this issue, we divide the initial learning rate by 10 i.e. using 10 -4 for the last FC layer retraining and allow the clients to retrain for 3 times more epochs. We also switch off the 2 weight decay during the "freezing and retraining" process of FedMA except for the last FC layer where we use a 2 weight decay of 10 -4 . For language task, we observe SGD with a constant learning rate works well for all considered methods.

In our experiments, we use FedAvg and FedProx variants without the shared initialization since those would likely be more realistic when trying to aggregate locally pre-trained models. And FedMA still performs well in practical scenarios where local clients won't be able to share the random initialization. 

B DETAILS OF MODEL ARCHITECTURES AND HYPER-PARAMETERS:

The details of the model architectures we used in the experiments are summarized in this section. Specifically, details of the VGG-9 model architecture we used can be found in Table 4 and details of the 1-layer LSTM model used in our experimental study can be found in Table 5 .

C DATA AUGMENTATION AND NORMALIZATION DETAILS:

In preprocessing the images in CIFAR-10 dataset, we follow the standard data augmentation and normalization process. 

:

https://github.com/cheind/py-lapsolver

Figures and Tables:

Figure 1: Comparison among various federated learning methods with limited number of communications on LeNet trained on MNIST; VGG-9 trained on CIFAR-10 dataset; LSTM trained on Shakespeare dataset over: (a) homogeneous data partition (b) heterogeneous data partition.

Figure 2: Convergence rates of various methods in two federated learning scenarios: training VGG-9 on CIFAR-10 with J = 16 clients and training LSTM on Shakespeare dataset with J = 66 clients.

Figure 3: The effect of number of local training epochs on various methods.

Figure 4: Performance on skewed CIFAR-10 dataset.

Representations generated by the first convolution layers of locally trained models, FedMA global model and the FedAvg global model.

Figure 6: Data efficiency under the increasing number of clients.

we visualize the representations generated by a pair of matched local filters, aggregated global filter, and the filter returned by the FedAvg method over the same input image. Matched filters and the global filter found with FedMA are extracting the same feature of the input image, i.e. filter 0 of client 1 and filter 23 of client 2 are extracting the position of the legs of the horse, and the corresponding matched global filter 0 does the same. For the FedAvg, global filter 0 is the average of filter 0 of client 1 and filter 0 of client 2, which clearly tampers the leg extraction functionality of filter 0 of client 1.

For data augmentation, random cropping and horizontal random flipping are used. Each color channels are normalized with mean and standard deviation by µ r = 0.491372549, µ g = 0.482352941, µ b = 0.446666667, σ r = 0.247058824, σ g = 0.243529412, σ b = 0.261568627. Each channel pixel is normalized by subtracting the mean value in this color channel and then divided by the standard deviation of this color channel. D EXTRA EXPERIMENTAL DETAILS D.1 SHAPES OF FINAL GLOBAL MODEL Here we report the shapes of final global VGG and LSTM models returned by FedMA with communication.

Trained models summary for VGG-9 trained on CIFAR-10 as shown in Figure2

Table content: <table><tr><td>Method</td><td colspan="4">FedAvg FedProx Ensemble FedMA</td></tr><tr><td>Final Accuracy(%)</td><td>86.29</td><td>85.32</td><td>75.29</td><td>87.53</td></tr><tr><td>Best local epoch(E)</td><td>20</td><td>20</td><td>N/A</td><td>150</td></tr><tr><td>Model growth rate</td><td>1×</td><td>1×</td><td>16×</td><td>1.11×</td></tr></table>

Trained models summary for LSTM trained on Shakespeare as shown in Figure2

Table content: <table><tr><td>Method</td><td colspan="4">FedAvg FedProx Ensemble FedMA</td></tr><tr><td>Final Accuracy(%)</td><td>46.63</td><td>45.83</td><td>46.06</td><td>49.07</td></tr><tr><td>Best local epoch(E)</td><td>2</td><td>5</td><td>N/A</td><td>5</td></tr><tr><td>Model growth rate</td><td>1×</td><td>1×</td><td>66×</td><td>1.06×</td></tr></table>

The datasets used and their associated learning models and hyper-parameters.

Table content: <table><tr><td>Method</td><td>MNIST</td><td>CIFAR-10</td><td>Shakespeare (McMahan et al., 2017)</td></tr><tr><td># Data points</td><td>60, 000</td><td>50, 000</td><td>1, 017, 981</td></tr><tr><td>Model</td><td>LeNet</td><td>VGG-9</td><td>LSTM</td></tr><tr><td># Classes</td><td>10</td><td>10</td><td>80</td></tr><tr><td># Parameters</td><td>431k</td><td>3, 491k</td><td>293k</td></tr><tr><td>Optimizer</td><td/><td>SGD</td><td>SGD</td></tr><tr><td colspan="3">Hyper-params. Init lr: 0.01, 0.001 (last layer)</td><td>lr: 0.8(const)</td></tr><tr><td/><td/><td colspan="2">momentum: 0.9, 2 weight decay: 10 -4</td></tr></table>

Peer review (iclr2020):
Post Rebuttal Summary --------------------------------- I have nudged my score up to an *Accept*, based on my comments to the rebuttal below. I hope the authors continue to improve the readability of Sec. 2.1 Review Summary -------------- Overall I think this is almost above the bar to be accepted, and I could be persuaded with a strong rebuttal. The strengths here are the extensive experiments and the easy-to-implement method. The primary weakness of this paper is that it is a *straightfoward* way to extend the BBP-MAP method to CNNs and RNNs, so the methodological novelty is weak relative to the BBP-MAP past work (Yurochkin et al. ICML 2019). Other technical weaknesses limit the ability to use this method on clients with diverse class distributions, which will be common in real deployments. Paper Summary ------------- This paper addresses the problem of federated learning, where J separate *clients* with disjoint datasets each train a neural network model for a supervised problem, and then try to aggregate all J individual client models into one *global model* in a coherent way. The natural problem is that due to hidden units being permutable within one network, naively taking parameter averages across two client models will lead to bad accuracy without first coming up with a consistent ordering of the units in each layer. Previous work (Yurochkin et al. ICML 2019) has developed a Bayesian nonparametric model based on the Beta-Bernoulli Process (BBP) for the case of federated learning of multi-layer perceptrons. However, the extension to convolutional layers or recurrent layers has yet to be solved, which is the focus of this paper. This paper*s algorithm (Federated Matched Averaging (FedMA), see Alg 1), proceeds by iteratively stepping thru the CNN or RNN layer by layer greedily from input to output. At each layer, we first solve a BBP-MAP optimization (bipartite matching using a BBP maximum a-posteriori objective as cost function, a subprocedure taken direclty from Yurochkin et al.). This obtains a consistent low-cost permutation for each client model. Then, the global model weights for that layer is the average of the aligned client weights. After the current layer update, each client keeps training, keeping all layers up to the current frozen but revising later layers. This layer-by-layer training can be applied to both CNNs and RNNs. The proposed approach is compared to FedAvg and FedProx on MNIST and CIFAR image classification tasks with CNNs, and Shakespeare text classification tasks with RNNs. Later experiments explore the effect of communication efficiency (MB transfered between client and master), effect of local training epochs, handling biased class distributions, and interpretabilty. Novelty & Significance ----------------------- Solving federated learning problems is of increasing practical importance, and certainly trying to do so for CNNs and RNNs (more than just large MLPs) is important. So I like where the paper is going. Although the method is *new*, it is more or less a straightforward extension of work by Yurochkin et al. (ICML 2019) to CNNs and RNNs. If you read the last few sentences of Yurochkin et al., you*ll see *Finally, it is of interest to extend our model-ing framework to other architectures such as Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs). The permutation invariance necessitating matching inference also arises in CNNs since any permutation of the filters results in the same output, however additional bookkeeping is needed due to the pooling operations.* I view this paper as a well-executed implementation of this *bookkeeping*. Certainly not trivial, but to some readers perhaps not clearly *above the bar* for a top conference like ICLR. Technical Concerns ------------------ ## Concern 1: Client models will not always be alignable after permutation My first concern is that there will not always be a one-to-one permutation of the neurons learned by two client models with different class distributions. Given fixed capacity at each layer, some clients may learn a filter for *horse hooves* (esp. if horse images are common to that client), while other clients may learn a filter for *snake skin* (if snakes are more common to that client). I wonder if we can quantify how well the aligned filters match in practice, and if there is any benefit to revising the alignment to allow some client-specific customizations (e.g. by having the global model can learn more units than the client model). ## Concern 2: Use of the BBP-MAP subprocedure poorly motivated The paper prioritizes a clean and easy-to-implement algorithm to resolve practical alignment issues between client CNN and RNN models. However, I was a bit underwhelmed that the BBP-MAP solution used by Yurochkin et al. was treated as a black-box subprocedure without much justification. I could see 2 preferable alternatives to the current use of BBP-MAP. Either a simpler approach using Eq. 2 with a squared error cost and the Munkres algorithm to solve bipartitite matching to obtain the permutation (which seems more in spirit of the rest of the paper). Or, a more sophisticated probabilistic approach (taking a Bayesian hierarchical model from Yurochkin et al. seriously and forming the estimated global weights from a weighted sums that includes both the clients (weighted by dataset size) and the assumed prior). As it is, I feel the BBP-MAP subprocedure in the current Algorithm 1 is poorly motivated for the task at hand. Experimental Evaluation ----------------------- Overall the experiments were extensive and demonstrated several apparent advantages (reduced need to transfer large memory during communication, etc.). Minor Presentation Concerns --------------------- Before Eq. 2, you should introduce the *	heta* notation I*m a bit confused about how *FedMA* differs from *FedMA with communication*, even after reading Sec. 2.3. How exactly are communicate costs kept down? What are you sending from master to client at beginning of every *round* if not the full global model (all weights of the CNN)?