{'fraction_non_alphanumeric': 0.032253715749384924, 'fraction_numerical': 0.009234606181119612, 'mean_word_length': 4.873317498020586, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
FedMR: Fedreated Learning via Model Recombination

As a promising privacy-preserving machine learning method, Federated Learning (FL) enables global model training across clients without compromising their confidential local data. However, existing FL methods suffer from the problem of low inference performance for unevenly distributed data, since most of them rely on Federated Averaging (FedAvg)-based aggregation. By averaging model parameters in a coarse manner, FedAvg eclipses the individual characteristics of local models, which strongly limits the inference capability of FL. Worse still, in each round of FL training, FedAvg dispatches the same initial local models to clients, which can easily result in stuck-at-local-search for optimal global models. To address the above issues, this paper proposes a novel and effective FL paradigm named FedMR (Federating Model Recombination). Unlike conventional FedAvg-based methods, the cloud server of FedMR shuffles each layer of collected local models and recombines them to achieve new models for local training on clients. Due to the fine-grained model recombination and local training in each FL round, FedMR can quickly figure out one globally optimal model for all the clients. Comprehensive experimental results demonstrate that, compared with state-of-the-art FL methods, FedMR can significantly improve the inference accuracy without causing extra communication overhead.


I. INTRODUCTION
Along with the increasing popularity of Artificial Intelligence (AI), Federated Learning (FL) [17] has been widely acknowledged as a promising means to design large-scale distributed AI applications, e.g., AI Internet of Things (AIoT) applications [25], [5], healthcare systems [16], [24], and recommender systems [11], where the data on clients are assumed to be secure and cannot be accessed by other clients. Unlike conventional Deep Learning (DL)-based methods, FL supports the collaborative training of a global DL model across clients without compromising their data privacy [2], [26], [27]. In each FL training round, the cloud server firstly dispatches an intermediate model to its selected clients for local training and then gathers the corresponding gradients of trained models from clients for aggregation. In this way, only clients can touch their own data, thus the client privacy can be guaranteed.
Based on the cloud-client architecture, FL enables effective collaborative training towards a global optimal model for all the involved clients. However, when dealing with the unevenly distributed data on clients, existing main-stream FL methods suffer from the notorious problem of "weight divergence" [9]. Especially when the data on clients are non-identically and independently distributed (Non-IID) [21], [1], the convergence directions of local models on the devices and the aggregated global model on the cloud are significantly inconsistent, thus inevitably resulting in the inference performance degradation and slow convergence of global models. Aiming to mitigate such a phenomenon and improve FL performance in non-IID scenarios, various FL methods have been studied, e.g., client grouping-based methods [23], global control variable-based methods [10], [8], [14], and Knowledge Distillation (KD)based methods [15], [28]. The basic ideas of these solutions are to guide the local training on clients [10], [8] or adjust parameters weights for model aggregation [23], [15], [28].
Although more and more FL methods are proposed to alleviate the impact of data heterogeneity, most of them adopt the well-known Federated Averaging (FedAvg)-based aggregation, which strongly limits their inference capability. This is mainly because FedAvg operations conducted by the cloud server only average the parameters of collected local models in a coarse manner, where the specific characteristics of client data learned by local models are almost neglected. As a result, an intermediate global model based on simple statistical averaging cannot accurately reflect both the individual efforts and potential of local models in searching for global optimal models. Worse still, after FedAvg the cloud server will dispatch the same global model to the selected clients for the next round of local training. Due to the same initial models for local training, existing FL methods can easily get stuck-atlocal-search for optimal global models, thus further degrading the overall inference performance (i.e., classification accuracy and convergence rate) of obtained global models. Clearly, how to break through the prevalent FedAvg-based aggregation paradigm to achieve better inference performance is becoming an urgent issue in the design of modern FL applications.
To address the above challenge, this paper presents a novel FL paradigm named FedMR based on our proposed Federated Model Recombination method. Instead of using FedAvg for model aggregation, in each FL training round, FedMR decouples each local model into multiple layers and recombines them to form new local models. Based on a new round of local training on clients, the dependencies between the layers of recombined models will be reconstructed. In this way, since the decomposed layers consist of partial knowledge learned by previous local models and each FL training round adopts different models for local training on different clients, FedMR can effectively escape from the stuck-at-local-search and guide the evolution of local models towards global optimal models, thus improving the overall FL performance. This paper makes the following three major contributions: • We present a novel FL paradigm named FedMR and its implementation details, which enable fine-grained model recombination and local training to achieve better FL performance than traditional FedAvg-based methods. • We introduce a two-stage training scheme for FedMR, which not only accounts for the individual efforts of local models during the training but also combines the merits of FedAvg-based aggregration and model recombination to accelerate the overall FL traning process. • We conduct comprehensive experiments using various models and datasets to evaluate the effectiveness and pervasiveness of FedMR in both IID and non-IID scenarios.

II. PRELIMINARIES AND RELATED WORK
A. Preliminaries to Federated Learning Typically, FL adopts the cloud-based architecture to enable the aggregation of local models. To achieve a global model that best fits for all the clients, each FL training round typically consists of three step: i) model dispatching step where the cloud server dispatches an intermediate global model to multiple clients; ii) the local training step that trains local models based on the local data of clients; and iii) the aggregation step where the cloud server aggregates all the uploaded gradients to update the original global model. So far, almost FL methods aggregate local models based on FedAvg [17] defined as follows: where N is the total number of clients, n i is the number of data samples hosted by the i th client, denotes the customerdefined loss function (e.g., cross-entropy loss), x j denotes a sample, and y j is the label of x j .

B. Performance Optimization Methods for FL
Although FL enables distributed training of a global model for clients without compromising their data privacy, it still suffers from the problem of uneven data distributions on clients. To address this problem, numerous solutions have been proposed to improve the performance of FL , which can be classified into three categories, i.e., client groupingbased methods, global control variable-based methods, and knowledge distillation-based methods.
The device grouping-based methods group and select clients for aggregation based on the data similarity between clients. For example, FedCluster [4] divides clients into multiple clusters and performs multiple cycles of meta-update to boost the overall FL convergence. Based on either sample size or model similarity, CluSamp [6] groups clients to achieve a better client representativity and a reduced variance of client stochastic aggregation parameters in FL. By modifying the penalty terms of loss functions during FL training, the global control variable-based methods can be used to smooth the FL convergence process. For example, FedProx [14] regularizes local loss functions with the squared distance between local models and the global model, which can stabilize the model convergence. Similarly, SCAFFOLD [10] uses global control variables to correct the "client-drift" problem in the local training process. By inferring the composition of training data in each FL round, Wang et al. [22] presented a novel FL architecture to alleviate the impact of the data imbalance issue. As a promising FL optimization technology, Knowledge Distillation (KD)-based methods adopt soft targets generated by the "teacher model" to guide the training of "student models". For example, by leveraging a proxy dataset, Zhu et al. ( [28]) proposed a data-free knowledge distillation method named FedGen to address the heterogeneous FL problem using a built-in generator. With ensemble distillation, FedDF [15] accelerates the FL training by training the global model through unlabeled data on the outputs of local models. Based on transfer learning, FedMD [12] trains models on both public datasets and private datasets to mitigate the data heterogeneity.
Although the above methods can effectively optimize FL performance from different perspectives, most of them cannot avoid non-negligible communication and computation overheads or the risk of data privacy exposure. Notably, all the above methods are based on FedAvg, which only conducts coarse-grained model aggregation. Consequently, the inference capabilities of local models are strongly restricted. To the best of our knowledge, FedMR is the first attempt that uses model recombination and different models for fine-grained FL. Since FedMR considers the specific characteristics and efforts of local models, it can further mitigate the weight divergence problem, thus achieving better inference performance than state-of-the-art FL methods.

A. Overview of FedMR
FedMR adopts the same cloud-based architecture as the one used by conventional FL methods, where the cloud server conducts model recombination operations and clients perform the local training. Figure 1 presents the framework and workflow of FedMR, where each FedMR training round involves three specific steps as follows: • Step 1 (Model Dispatching): The cloud server dispatches K recombined models to K selected clients according to their indices, where K is the number of clients that participate in the FL training. Note that, unlike traditional FedAvg-based FL methods, in FedMR different clients will receive different local models for the local training purpose. • Step 2 (Model Upload): Once the local training is finished, a client needs to upload the parameters of its trained local model to the cloud server. can be reconstructed by the cloud server. Note that any decomposed layer of the uploaded model will be eventually used by one and only one of the recombined models.

B. FedMR Implementation
Algorithm 1 presents the implementation details of FedMR. Line 1 initializes the model list L m , which includes K initial models. Lines 2-10 performs rnd rounds of FedMR training. In each round, Line 3 selects K random clients to participate the model training and creates a client list L r . Lines 4-7 conduct the local training on clients in parallel, where Line 5 applies the local model L m [i] on client L r [i] for local training by using the function ClientUpdate, and Line 6 achieves a new local model after the local training. After the cloud server receives all the K local models, Line 8 uses the function ModelRcombine to recombine local models and generate K new local models, which are saved in L m as shown in Line 9. Finally, Line 11 generates an optimal global model based on the local models in L m , which will be reported by Line 12.
The following parts will give the detailed implementation of the functions used in FedMR.
1) Local Model Training (ClientUpdate).: Unlike conventional FL methods that conduct local training on clients starting from the same aggregated model, in each training round FedMR uses different recombined models (i.e., K models in the model list L m ) for the local training purpose. Note that, in the whole training phase, FedMR only uses K (K ≤ |S c |) models, since there are only K devices selected in each training round. Let w c r be the parameters of some model that is dispatched to the c th client in the r th training round. In the r th training round, we dispatch the i th model in L m to its corresponding client as follows: Algorithm 1 Implementation of FedMR Input: i) rnd, # of training rounds; ii) S c , the set of clients; iii) K, # of clients participating in each FL round. L r ← Random select K clients from S c /*parallel for block*/ 4: end for 8: where v indicates parameters of the trained local model, D Lr[i] denotes the dataset of client L r [i], η is the learning rate, () is the loss function, x j is the j th sample in D Lr [i] , and y j is the label of x j . Once the local training is finished , the client needs to upload the parameters of its trained local model to the cloud server by updating L m using Note that, similar to traditional FL methods, in each training round FedMR needs to transmit the parameters of 2K models between the cloud server and its selected clients.
2) Model Recombination (ModelRecombine).: Typically, a DL model consists of multiple layers, e.g., convolutional layers, pooling layers, Fully Connected (FC) layers. In our model recombination method, we do not take the pooling layers into account, since they are constant. To simplify the description of our model recombination method, we do not explicitly present the layer types here. Let w In each FL round, FedMR needs to conduct the model recombination base on L m to obtain new models for the local training. Figure 2 shows an example of model recombination based on the shuffling of model layers. When receiving all the trained local models (i.e., m 1 ,m 2 ,...,m K ) from clients, firstly the cloud server needs to decouple the layers of these models individually. For example, the model m 1 can be decomposed into four layers. Assuming that the local models are with an architecture of w, to enable the recombination, FedMR then constructs n lists, where the k th (k ∈ [1, n]) list contains all the k th layers of the models in L m . As an example shown in Figure 2, FedMR constructs four lists (i.e., list 1 -list 4 ) for the K models (i.e., m 1 -m K ), where each list consists of K elements (i.e., K layers with the same index). Next, FedMR shuffles the elements within each list, and generates |L m | recombined models based on shuffled results. For example, the top three layers of the recombined model m 1 come from the models m 1 , m 2 and m K , respectively.
3) Global Model Generation (GlobalModelGen).: Although there are only K models involved in each local training round, the goal of FedMR is to obtain a global model that can accommodate all the |S c | clients. When the local training finishes, in FedMR the cloud server will collect all the parameters of local models and conduct FedAvg-style aggregation on them to achieve the expected global model as follows: where w i rnd+1 is parameters of the i th model in L m when the whole local training completes. Note that the global model will be dispatched by the cloud server to all the clients for the purpose of inference rather than local training.

C. Two-Stage Training Scheme for FedMR
Traditional FedAvg-based methods conduct coarse-grained model aggregation by periodically learning local knowledge from clients using the same models. Unlike these methods, FedMR can learn the knowledge from all the global data based on our proposed model recombination method. For model recombination, FedMR needs to break the dependencies between layers of each local model first, and then reconstruct the new dependencies between newly shuffled layers for different recombined models via respective local training. Based on continuous iterations of the coupling of model recombination and local training, each layer of a local model will gradually adapt to all the data across clients. Since FedMR conducts FL based on the recombination of model layers, it can be considered as a fine-grained FL paradigm.
Although FedMR enables finer FL training, when starting from blank models, FedMR converges more slowly than traditional FL methods at the beginning. This is mainly because, due to the low matching degree between layers in the recombined models, the model recombination operation in this stage requires more local training time to re-construct the new dependencies between layers. To accelerate the overall convergence, we propose a two-stage training scheme for FedMR, consisting of both the aggregation-based pre-training stage and model recombination stage. In the first stage, we train the local models coarsely using the FedAvg-based aggregation, which can quickly form a pre-trained global model. In the second stage, starting from the pre-trained models, FedMR dispatches recombined models to clients for local training. Due to the synergy of both FL paradigms, the overall FedMR training time can be reduced.

A. Experimental Settings
To evaluate the effectiveness of FedMR, we implemented FedMR on top of a cloud-based architecture. Since it is impractical to allow all the clients to get involved in the training processes simultaneously, we assumed that there are only 10% of clients participating the local training in each FL round. To enable fair comparison, all the investigated FL methods including FedMR set their SGD optimizer with a learning rate of 0.01 and a momentum of 0.9. For each client, we set the batch size of local training to 50, and performed five epochs for each local training. All the experimental results were obtained from an Ubuntu workstation with Intel i9 CPU, 32GB memory, and NVIDIA RTX 3080 GPU.

1) Baseline Method Settings:
We compared the test accuracy of FedMR with six baseline methods, i.e., FedAvg [17], FedProx [14], SCAFFOLD [10], MOON [13], FedGen [28], and CluSamp [6]. Here, FedAvg is the most classical FL method, while the other five methods are the state-of-the-art (SOTA) representatives of the three kinds of FL optimization methods introduced in the related work section. Specifically, FedProx, SCAFFOLD, and MOON are global control variablebased methods, FedGen is a KD-based approach, and CluSamp is a device grouping-based method. For FedProx, we used a hyper-parameter µ to control the weight of its proximal term, where the best values of µ for CIFAR-10, CIFAR-100, and FEMNIST are 0.01, 0.001, and 0.1, respectively. For FedGen, we adopted the same sever settings presented in [28]. For CluSamp, the clients were clustered based on the model gradient similarity as described in [6].
2) Dataset Settings: We investigated the performance of our approach on three well-known datasets, i.e., CIFAR-10, CIFAR-100 [19], and FMNIST [3]. We adopted the Dirichlet distribution [7] to control the heterogeneity of client data for both CIFAR-10 and CIFAR-100. Here, the notation Dir(α) indicates a different Dirichlet distribution controlled by α, where a smaller α means higher data heterogeneity of clients. Note that, different from datasets CIFAR-10 and CIFAR-100, the raw data of FEMNIST are naturally non-IID distributed. Since FEMNIST takes various kinds of imbalances (e.g., data heterogeneity, data imbalance and class imbalance) into account, we did not apply the Dirichlet distribution on FEMNIST. For both CIFAR-10 and CIFAR-100, we assumed that there are 100 clients in total participating in FL. For FEMNIST, we only considered one non-IID scenario involving 180 clients, where each client hosts more than 100 local data samples 1 .
3) Model Settings: To demonstrate the pervasiveness of our approach, we developed different FedMR implementations based on three different DL models (i.e., CNN, ResNet-20, VGG-16). Here, we obtained the CNN model from [17], which consists of two convolutional layers and two FC layers. When conducting FedMR based on the CNN model, we directly applied the model recombination for local training on it without pre-training a global model, since CNN here only has four layers. We obtained both ResNet-20 and VGG-16 models from Torchvision [20]. When performing FedMR based on ResNet-20 and VGG-16, due to the deep structure of both models, we adopted the two-stage training scheme, where the first stage lasts for 100 rounds based on model aggregation to obtain a pre-trained global model.
1) Comparison of Test Accuracy: Table I compares FedMR with the SOTA FL methods considering both non-IID and IID scenarios based on three different DL models. The first two columns denote the model type and dataset type, respectively. Note that to enable fair comparison, we cluster the test accuracy results generated by the FL methods based on the same type of local models. The third column shows different distribution settings for client data, indicating the data 1 The settings were obtained from LEAF benchmark by using the command: ./preprocess.sh -s niid -sf 0.05 -k 100 -t sample. heterogeneity of clients. The fourth column has seven subcolumns, which present the test accuracy information together with its standard deviation for all the investigated FL methods, respectively.
From Table I, we can observe that FedMR can achieve the highest test accuracy in all the scenarios regardless of model type, dataset type and data heterogeneity. For datasets CIFAR-10 and CIFAR-100, we can find that FedMR outperforms the six baseline methods significantly in both non-IID and IID scenarios. For example, when dealing with a non-IID CIFAR-10 scenario (α = 0.1) using ResNet-20-based models, FedMR achieves test accuracy with an average of 62.09%, while the second highest average test accuracy obtained by SCAFFOLD is only 50.46%. Note that the performance of FedMR on FEMNIST is not as notable as the one on both CIFAR-10 and CIFAR-100. This is mainly because the classification task on FEMNIST is much simpler than the ones applied on datasets CIFAR-10 and CIFAR-100, which lead to the high test accuracy of the six baseline methods. However, even in this case, FedMR can still achieve the best test accuracy among all the investigated FL methods.
2) Comparison of Model Convergence: Figure 3 presents the convergence trends of the seven ResNet-20-based FL methods (including FedMR) on the CIFAR-100 dataset. Note that here the training of FedMR is based on our proposed two-stage training scheme, where the first stage uses 100 FL training rounds to achieve a pre-trained model. Here, to enable fair comparison, the test accuracy of FedMR at some FL training round is calculated by an intermediate global model, which is an aggregated version of all the local models within that round. The four sub-figures show the results for different data distributions of clients. From this figure, we can find that FedMR outperforms the other six FL methods consistently in both non-IID and IID scenarios. This is mainly because FedMR can easily escape from the stuck-at-localsearch due to the model recombination operation in each FL round. Moreover, due to the fine-grained local training, we can observer that the learning curves in each sub-figure is much smoother than the ones of other FL methods. We also conducted the comparison for CNN-and VGG-16-based FL methods, and found the similar observations from them. Please refer to Appendix for more details.
3) Comparison of Communication Overhead: Let K be the number of clients that participate each FL training round. Since the cloud server needs to send K recombined models to K clients and receive K trained local models from K clients in an FL round, the communication overhead of FedMR is 2K models in each round, which is the same as FedAvg, FedPeox, and CluSamp. Since the cloud server needs to dispatch an extra global control variable to each client and clients also need to update and upload these global control variables to the cloud server, the communication overhead of SCAFFOLD is 2K models plus 2K global control variables in each FL training round. Unlike the other FL methods, the cloud server of FedGen needs to dispatch an additional built-in generator to the selected clients, the communication overhead of FedGen in each FL training round is 2K models plus K generators. Base on the above analysis, we can find that FedMR does not cause any extra communication overhead. Therefore, FedMR requires the least communication overhead among all the investigated FL methods in each FL training round. Note that, as shown in Figure 3, although FedMR requires more rounds to achieve the highest test accuracy, to achieve the highest accuracy of other FL methods, FedMR generally requires less FL rounds. In other words, to achieve the same test accuracy, FedMR requires much less overall communication overhead.

C. Ablation Study
To demonstrate the effectiveness of key components of our FedMR approach, we conducted two ablation studies for model recombination and our two-stages FedMR training scheme, respectively. 1) Model Recombination: To evaluate the effectiveness of model recombination, we developed a variant of FedMR named "FedMR w/o MR" without taking model recombination into account. In other words, in "FedMR w/o MR" local models are directly dispatched to clients in a random manner with neither model aggregation nor model recombination. Figure 4 presents the ablation study results on CIFAR-10 dataset using ResNet-20-based FedMR, where the data on client are IID distributed. Note that all the FedMR results in Figure 4 are obtained from intermediate global models in differnt FL training rounds. From this figure, we can find that without using model recombination, the performance of "FedMR w/o MR" degrades greatly. In other words, the model recombination operation is the key of FedMR to achieve high classification performance. Moreover, since FedMR outperforms FedAvg significantly, it means that the model recombination operation is more helpful than the model aggregation operation in searching for better global models.  2) Two-stage Training Scheme: To demonstrate the effectiveness of our proposed two-stage training scheme, we conducted experiments on CIFAR-10 dataset using ResNet-20-based FedMR, where the data on client are non-IID distributed (α = 0.1). Figure 5 presents the learning curves of FedAvg and FedMR, where FedMR adopts three different twostage training settings. Here, we use the notation "FedMRn" to denote that the first stage involves n rounds of model aggregation-based local training to obtain a pre-trained global model, while the remaining rounds conduct local training based on our proposed model recombination-based method. From Figure 5, we can observe that the two-stage trainingbased FedMR methods (i.e., FedMR-100 and FedMR-200) achieve the best performance from the perspectives of test accuracy and convergence rate.
D. Discussions 1) Privacy Preserving: Similar to traditional FedAvg-based FL methods, FedMR does not require clients to send their data to the cloud server, thus the data privacy can be mostly guaranteed by the secure clients themselves. Someone may argue that dispatching the recombined models to adversarial clients may expose the privacy of some clients by attacking their specific layers. However, since our model recombination operation breaks the dependencies between model layers and conducts the shuffling of layers among models, in practice it is hard for adversaries to restore the confidential data from a fragmentary recombined model without knowing the sources of layers. Note that, since the model update and dispatching operations of FedMR are the same as the ones of FedAvgbased methods, any privacy-preserving techniques used in traditional FL method can be easily integrated into FedMR to further reduce the privacy risks.
2) Limitations: As a novel FL paradigm, FedMR shows much better inference performance than most SOTA FL methods. Although this paper proposed an efficient two-stage training scheme to accelerate the overall FL training processes, there still exists numerous chances (e.g., client selection strategies, dynamic combination of model aggregation and model recombination operations) to enable further optimization on the current version of FedMR. Meanwhile, the current version of FedMR does not take the personalization into account, which is also a very important topic that is worthy of studying in the future.
V. CONCLUSION Due to coarse-grained aggregation of FedAvg, when dealing with uneven data distribution among clients, existing Federated Learning (FL) methods greatly suffer from the problem of low inference performance. To address this problem, this paper presented a new FL paradigm named FedMR, which enables different layers of local models to be trained on different clients in different FL training rounds based on our proposed federated model recombination method. Since our approach allows both fine-grained model recombination and different models for local training in each FL training round, FedMR can search for globally optimal models for all the clients in a more efficient manner. Comprehensive experimental results show both the effectiveness and pervasiveness of our propose methods in term of inference accuracy and convergence rate.