# pFedBASC: Personalized Federated Learning with Blockchain-Assisted Semi-Centralized Framework
## 5 Experiments  
### Experiment Settings  
**Datasets and models.** We use four common datasets: MNIST [36], FMNIST [37], CIFAR-10, and CIFAR-100 [38]. Each dataset is divided into an 80% training set and a 20%testing set. These datasets are distributed across 50 clients. The training set and testing set on each user have the same data distribution, with no overlap between the training and testing sets. We construct non-iid datasets using the Dirichlet distribution _Dir(0.5)_. We train a LeNet for MNIST and several Convolutional Neural Networks (CNN) for the FMNIST, CIFAR-10, and CIFAR-100 datasets. Each CNN comprises two convolutional layers and three fully-connected layers. The HN used in all three tasks is an MLP model with two hidden layers. To visualize the data heterogeneity among users, we described the heterogeneity for the first three datasets of 10 users using _Dir(0.5)_, as demonstrated in Figure 4. The presence or absence of dots indicates the existence of specific data, while the dot size reflects the quantity of that data.  
**Baselines.** We implement the following baseline algorithms: (1) Centralized training, where all data are concentrated for training. This method, while not guaranteeing data security, serves as an upper bound for FL accuracy. (2) FedAvg [2], an important FL algorithm that is effective in various data distributions. (3) Local training, which involves no parameter exchange, and users only use their own data for training. (4) FedProx [39], addressing non-iid data by adding approximation terms to prevent user models from deviating from global model. (5) FedGen [40], which improves FL accuracy by training feature generators. (6) FedBN, addressing FL data heterogeneity problems by adding batch normalization layers to local models. (7) FedBabu [28], an algorithm that updates and aggregates model bodies, requiring fine-tuning after convergence. (8) FedDyn [41], proposing a dynamic regularizer for each user in each round. (9) FedPer [27], which combats adverse effects of statistical heterogeneity by retaining a personalization layer locally. (10) FedRep [23], training classifiers and feature extractors sequentially, only aggregating feature extractors. (11) pFedSim [42], a personalized algorithm based on model similarity. (12) pFedLa [32], deploying a HN on the server-side for each user, granting users tiered aggregation weights. (13) FedFomo [29], providing the best weights for clients to aggregate models by assessing the benefits clients gain from other clients' models. (14) Fed-RoD [34] with HN, involving a feature extractor and two distinct headers for each client.  
**Settings.** Our experiments were conducted on an Ubuntu 18.04 system equipped with an Intel i7-8700K CPU, GTX 1080 Ti GPU, and 16 GB of RAM. We employed Golang for blockchain component development, while PyTorch 1.4.0 was used for developing and training FL network models. Communication between the Go-based blockchain and Python-based models was facilitated using the go-python library. A simulated blockchain network with multiple virtual nodes was run on a single machine, and training data were pre-processed in Python to ensure readiness for model training. We use SGD as the optimizer, setting Nesterov Momentum to 0.9, weight decay to \(5\times 10^{-4}\), batch size to 128, the total number of users to 50, global communication rounds for MNIST and FMNIST to 100, and for CIFAR-10 and CIFAR-100 to 150. We conducted several experiments to determine the best learning rates for all algorithms in each experiment. The learning rates considered include multi-step rates decaying from 0.1 and fixed rates of 0.1, 0.01, and  
Figure 4: Data distribution of _Dir(0.5)_.  
0.001. The optimal learning rate is chosen for all algorithms. In centralized FL, all clients participate in every round of aggregation. The default training process addresses non-iid data heterogeneity but does not include system heterogeneity situations.