{'fraction_non_alphanumeric': 0.028050490883590462, 'fraction_numerical': 0.008366784349760603, 'mean_word_length': 4.640480087288598, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
FedGraph: an Aggregation Method from Graph Perspective

With the increasingly strengthened data privacy act and the difficult data centralization, Federated Learning (FL) has become an effective solution to collaboratively train the model while preserving each client's privacy. FedAvg is a standard aggregation algorithm that makes the proportion of dataset size of each client as aggregation weight. However, it can't deal with non-independent and identically distributed (non-i.i.d) data well because of its fixed aggregation weights and the neglect of data distribution. In this paper, we propose an aggregation strategy that can effectively deal with non-i.i.d dataset, namely FedGraph, which can adjust the aggregation weights adaptively according to the training condition of local models in whole training process. The FedGraph takes three factors into account from coarse to fine: the proportion of each local dataset size, the topology factor of model graphs, and the model weights. We calculate the gravitational force between local models by transforming the local models into topology graphs. The FedGraph can explore the internal correlation between local models better through the weighted combination of the proportion each local dataset, topology structure, and model weights. The proposed FedGraph has been applied to the MICCAI Federated Tumor Segmentation Challenge 2021 (FeTS) datasets, and the validation results show that our method surpasses the previous state-of-the-art by 2.76 mean Dice Similarity Score. The source code will be available at Github.


Introduction
With the increasing demand for the precise medical data analysis, deep learning methods are widely used in the medical image field. However, with the promulgation of the data act and the strengthening of data privacy, especially in the medical field, it has become more difficult to train models in large-scale centralized medical datasets. As one of the solutions, federated learning has attracted a lot of attention from researchers. Federated learning(FL) [1] [2] is a distributed machine learning paradigm in which all clients train a global model collaboratively while preserving their data locally. The naive repeat steps of FL are: (i) each client trains its model with local data; (ii) the server collects and aggregates the models from clients to get a global model, then delivers the global model to clients. The data flow between clients and server is the trained models rather than the original data, which avoids the leak of data privacy. As a crucial core of them, aggregation algorithm plays an important role in releasing data potential and improving global model performance. FedAvg [1], as pioneering work, is a simple and effective aggregation algorithm, which makes the proportions of local datasets size as the aggregation weights of local models. [3] proposed FedProx to limit the updates between local and global models by modifying the training loss of local models. FedMA [4] matches and averages the hidden elements with similar feature extraction signatures to construct the shared global model in a layer-wise manner. Federated learning has attracted the attention of scholars in more research fields.
In medical image segmentation, Since [5] and [6] explored the feasibility of FL in brain tumor segmentation(BraTS), FL on medical image segmentation is in full swing. Liu et al. [7] proposed FedDG to make the model generalize to unseen target domains via episodic learning in continuous frequency space in retinal fundus image segmentation. Xia et al. [8] proposed Auto-FedAvg, where the aggregation weights are dynamically adjusted according to the data distribution, to accelerate the training process and get better performance in COVID-19 lesion segmentation. Zhang et al. [9] proposed SplitAVG to overcome the performance drops from data heterogeneity in FL by network split and feature map concatenation strategies in the BraTS task. More than this, the first computational competition on federated learning, Federated Tumor Segmentation(FeTS) Challenge 1 [10] is held to measure the performance of different aggregation algorithms on glioma segmentation [11,12,13,14]. Leon et al. [15] proposed FedCost-WAvg to get a notable improvement compared to FedAvg by including the cost function decreased during the last round and won the challenge. However, most of these methods only study the single granularity or add other regular terms to the aggregation method, without considering the finer granularity factors, which limit the performance of global model. Different from the above methods, in this paper, we propose a novel aggregation strategy, FedGraph, which attempts to explore the aggregation algorithm of FL from the topological perspective of neural networks. After the server collects the local models, the FedGraph explores the internal correlations between local models by three aspects from coarse to fine: the proportion of each local dataset size, the topology structure of model graphs, and the model weights. The proportion of local dataset size factor is similar to FedAvg. We compute the topological correlation by mapping the local models into topological graphs. Meanwhile, the finer grain model weights correlations are taken into account. Through the weighted combination of three different granularity factors from Weighted sum and aggregation coarse to fine, the proposed method promotes the more effective aggregation of local models. The primary contributions of this paper can be summarized as: (1) We propose FedGraph, a novel aggregation strategy which takes coarse-to-fine three factors: the sample size, the topology of model graphs and the model weights, especially from the topological perspective of neural network; (2) We propose an aggregation method which introduce the concept of graph into federated learning, and the aggregation weights can be adjusted adaptively; (3) The superior performance is achieved by the proposed method, on the public FeTS challenge datasets.

Related Work
Federated Learning The FedAvg [1] plays a cornerstone role in federated learning tasks because of its efficient algorithm design, and the proportion of each client's dataset is taken as weight during the aggregation process. Recently, Some methods [19][20][21][22][23][24] based on FedAvg are proposed because of the poor performance caused by heterogeneous data distribution across clients in the real world. For example, FedProx [3] limits the bias between global model and local model by imposing additional regularization terms. FedDyn introduces a regularization term for local training based on the global model to address the problem. FedNova improves the aggregation stage by normalizing and scaling the local updates of each client according to their local steps before updating the global model. SCAFFOLD addresses non-i.i.d problem by introducing variance among clients and employing the variance reduction technique. These methods have not been evaluated by real world datasets, although they have strict mathematical proof and good experimental results on manually created toy datasets.
Federated Learning in Medical Image Segmentation Because the data act tightens data privacy and federal learning has the natural attribute of protecting data privacy, the researches of federated learning in the field of medical images have been impressive. [5] and [6] take the lead in discussing the application and safety of federated learning in brain tumor segmentation(BraTS). To solve the non-i.i.d challenges of FL in medical image field, FedDG [7] and FedMRCM [25] is proposed to address the domain shift issue between the source domain and the target domain, but the sharing of latent features may cause privacy concerns. Auto-FedRL [26] and Auto-FedAvg [8] is proposed to deal with the non-i.i.d problem by using an optimization algorithm to learn super parameters and aggregate weights. IDA [27] introduces the Inverse Distance of local models and the average model of all clients to handle non-i.i.d data. FedCostWAvg [15] overcome this issue to introducing the ratio of local loss of two adjacent rounds based on FedAvg as the aggregation weights of local models. While these methods study the single granularity or add other regular terms to the aggregation method alone, without considering the finer granularity factors.

Method
This section describes the overall pipline and the specific process of FedGraph first, and then we introduce the topology of neural networks. After that, we describe the details of FedGraph.

Overview
Suppose K clients with private data cooperate to train a global model and share the same neural network structure, 3D-Unet [16], which was provided by FeTS challenge and keep unchanged. For the clients, every client trains a local model w i for local E epochs, and then delivers the local model to the server. The server aggregates local models to global model by computing the aggregation weights with the proposed FedGraph and assign to all clients. Repeat and until T rounds or other limits. An overview of the method is shown in Fig.1.

FedGraph
Clients send the updated local model back to the server each round. In round t, the global model w t g is aggregated by the server, The process of graph mapping.
In FedGraph, the computation of α k goes through the following steps: Graph mapping. Suppose the server has received local models trained by local data, and we map them into the topological graph. Inspired by [17], take the j-th convolutional layer of k-th local model with 3D-Unet structure as an example, whose kernel dimension is 3 × 3 × 3 × C in × C out , it means this layer has C in × C out nodes with 3 × 3 × 3 filter, we can obtain C in × C out weight matrices of size 3 × 3 × 3. Thus, we get C in × C out nodes W ∈R 27 . And then, we make every node W as scalar by averaging or summing, which can be formulated as: It can be mapped into a graph whose structure is similar to the full connection layer after scalarization of convolutional layer. Given a 3 × 3 × 3 × C in × C out convolutional layer, the dimensions of its input and output are C in and C out respectively. So, we obtain a weight matrix W t ∈R Cin×Cout after averaging or summing the weights of convolution kernel. We take the C in and C out as the number of node, and the weight summation w sum is the edge. The process of graphical model is shown in Fig. 2. Graph pruning. The server collects local models from clients and makes the graph mapping on them to get K graphs which have same structure except the edge weights. To make the graphs more distinctive, the graph binarization is conducted. In detail, we differentiated these graphs by setting a threshold δ, where the edge will be removed if the weight difference of each layer between the local models and global model in the last round is less than the threshold, otherwise, the edge will exist and the weight will be reset to 1. It can be simplified as: where in Eq. 3, 0 denotes the edge is removed and 1 denotes the edge exists and its weight is 1, w t kj denotes edge weight of the j-th layer from the k-th graph in t-th round, also the weight summation of the j-th layer from the kth local model in in t-th round, w t gj is the the weight summation of the j-th layer from the global model in t-th round. The threshold δ varies adaptively with the weights of local models, and λ is responsible for adjusting the degree of pruning. Sort denotes that we sort weights in ascending order. After that we Graph gravitational force In order to measure the degree of correlation between graphs and assign corresponding aggregation weights to local models, the further analysis is required on K graphs obtained. In detail, we first measure the gravitational force between pairs of graphs to get the Graph Gravitational Force Matrix C ∈ R K×K by computing a matching between their sets of embeddings, where the Pyramid Match Graph Kernel [18] is employed. Then the Graph Gravitational Force Matrix C is analyzed to compute the aggregation weights.
For the completeness and readability of the article, we will briefly review the algorithm of Pyramid Match Graph Kernel [18]. Graph kernels is a powerful tool for graph comparison. The Pyramid Match Graph Kernel focuses on global properties of graph compared with other graph kernels based on local properties. The algorithm represent each graph as a bag-of-vectors, and then map this vector to multi-resolution histograms to campare the histograms with a weighted histogram intersection measure in order to find an approximate correspondence between the two sets of vectors. In detail, given a pair of graph G 1 , G 2 ∈ G, H l G1 and H l G2 is the histograms of G 1 and G 2 at level l, and H l G1 (i), H l G2 (i) is the number of vertices of G 1 , G 2 that lie in the i th cell. The number of matched points in two sets is computed by the histogram intersection function: The number of new matches at each level is I(H l G1 , H l G2 ) − I(H l+1 G1 , H l+1 G2 ) for l = 0, ...L − 1, L is the max level. The number of new matches found at each level in the pyramid is weighted according to the size of that level's cells, and the weight for level l is 1 2 L−l . The pyramid match kernel is defined as follows: more details can be found in [18]. Graph weight According to the above method, the Graph Gravitational Force Matrix C is obtained and C is a symmetric matrix, and the element c kj in matrix C denotes the gravitational force of G k and G j , so the elements of the k-th row represents the gravitational force between G k and all graphs, so we can get the average gravitational force of k-th graph with all graphs: last, we normalize c k as the aggregation weight of the k-th local model, which we refer to as the topological weight: coarse-to-fine In our FedGraph, we take three factors from coarse to fine into consideration: the factor of sample size in local dataset α s , the factor of gravitational force between graphs α top and the factor of model weights α w , where α s is a rough adjustment of the aggregation weights of the overall model from the perspective of sample size, α top is a moderate adjustment from the perspective of model topology, and α w is a further detailed adjustment from the perspective of more refined model weights. Through the effective combination of them, more relevant information between local models is uncovered and more differentiated to promote the local models to be assigned more appropriate aggregation weights and aggregated a better global model. It can be denoted as: where ω s , ω top , ω w are the weight coefficients of three factors: the factor of local dataset size proportion α s , the factor of topology α top and the factor of model weights α w , and ω s + ω top + ω w = 1.

Algorithm
We describe the algorithm of FedGraph in Algorithm 1. In each communicaition round t, the server send the global model w t g to all clients, and then collects and aggragates the local models w t 1 , ..., w t K with a set of weights α t = [α t 1 , ..., α t K ] to get an updated global model w t+1 g after the clients train and update their local models in parallel. The α t is determined by three factors α t s , α t top in Eq. 8 and α t w in Eq. 9, where the α t top is found by three steps: graph mapping in Eq. 2, graph pruning in Eq. 3 and graph gravitational force in Eq. 6. After the weighted combination in Eq. 10, the server gets the new global model w t g and deliver it to all clients to begin the next round.

Dateset and Settings
The dataset used in experiments is provided by the FeTS Challenge organizer, which is the training set of the whole dataset about brain tumor segmentation. In order to evaluate the performance of FedGraph, we divide the dataset composed of 341 data samples into training set and validation set according to the ratio of 8:2, and the data is unevenly distributed between 17 data clients.

Algorithm 1 FedGraph
Input: initial global model w 0 g , the global model weights in last round w t−1 g , the local trained model weights w t 1 , ..., w t K , and the local epochs E in each client. Output: The aggregation global model weights w T g .
Sample batch x from client k's training data Compute loss loss(w; x) Compute gradient of w and update w end for return w The segmentation network, 3D-Unet, is provided by FeTS and kept unchanged, the learning rate is 1e-4 and the models train 10 epochs per round. Limited by the framework and official code mechanism, the total number of rounds of training is set to 70, although the performance of the algorithm does not converge to the best. The dice similarity coefficient and hausdorff distance-95th percentile(HD95) are utilized to evaluate the performance of the global aggregated model. In the proposed FedGraph, the weight coefficients of three factors ω s , ω top , ω w are 0.4, 0.3, 0.3 respectively.

Results and Discussion
In this section, we compare our FedGraph with other state-of-the-art methods on the FeTS Challenge dataset.
We evaluate the performance of our algorithm by comparing six indicators: the Dice Similarity Coefficient and Hausdorff Distance-95th percentile(HD95) of whole tumor(WT), enhancing tumor(ET), and tumor core(TC). As is shown in Table 1, we list the FedAvg, FedCostWAvg, the champion method of FeTS Chal-  lenge, and the proposed FedGraph. Different from the original FedCostWAvg which changed the activation function of networks, our re-implemented version made the network unchanged to ensure a fair comparison. Through the quantitative comparison in Table 1, we can find that the proposed method FedGraph has achieved the best results in all indicators except the HD95 TC. Moreover, compared with FedCostWAvg, FedGraph has significantly improved the evaluation of segmentation performance, especially in enhancing tumor segmentation.
In addition, we counted the evaluation performance of these methods in the training process, as shown in Figure 3. We can observe that the FedGraph is in a leading position in almost all evaluation indicators after the training process tends to converge, which proved that the proposed method FedGraph can explore the correlations of local models better and achieved more excellent aggregation performance compared with other methods.

Ablation Study
To evaluate the effectiveness of each factor and the better configuration of Fed-Graph, we conduct the ablation study on the FeTS dataset and the results are shown in Table 2. First, we verified the impact of each factor. The FedGraph would degenerate into FedAvg when it contains only the proportion of local dataset size factor, and the topology factor can promote the performance of enhancing tumor segmentation effectively. With the gradual refinement of the granularity of the aggregation factor, the model weights factor cooperates the first two factors to make significant improvements of the test indicators, because the model weights factor is a finer granularity, and form effective complementarity with the first two factors to explore the more detailed relationship of the local models. Besides, we also test the different threshold δ to find the better configuration of FedGraph. The different values of δ denote the loose degree of topology, the smaller the δ, the greater difference of topology. We can observe that it is a suitable degree when δ = 0.01 in our task, looser or stricter will lead to performance degradation. Fig.4 shows the comparison of dice in WT, ET, and TC for more intuitive representation. Besides, in order to further explore the impact of local model gravitational force aggregation and repulsive force aggregation on the final global model in the aggregation process, we conduct ablation experiments under the condition of δ = 0.001, and the results are shown in table 3. Both gravitational force aggregation and repulsive force aggregation methods show better results than FedAvg, and the repulsive force aggregation method is more suitable for the non-i.i.d datasets in our experiment. We will continue to study the aggregation method of the combination of the two in our future work.

Conclusion
In this paper, we introduced FedGraph, which improves the local model aggregation by taking coarse-to-fine three factors into account: the proportion of each local dataset size, the topology factor of graphic models, and the model weights. It can explore the correlations of local models better by an appropriately weighted combination of these factors. The further experiment results on MICCAI Federated Tumor Segmentation Challenge (FeTS) dataset demonstrate the superiority of the FedGraph.