scieee AI-readable full text Open interactive document viewer

Benchmark and framework for byzantine machine learning

Gonzalez Vidal, Marc

Abstract

The application of distributed machine learning is becoming increasingly prevalent in the training of large-scale machine learning models. A further issue is that not all clients engaged in model training always have benevolent intentions. In such cases, it is imperative that we are able to defend ourselves against any attacks that may be launched by these clients. Indeed, there are already a number of proposed defences that claim to be highly effective; however, they have yet to be subjected to exhaustive testing. The objective of this project is to demonstrate that, despite the efficacy of state-of-the-art aggregations in certain environments, there are others where the model is unable to learn and where it is not possible to defend against malicious clients. The objective of this project is to demonstrate the efficacy of a novel protocol and methodology for evaluating existing defenses. This approach will enable us to determine the extent to which these defenses are effective in diverse environments.

Full text

École Polytechnique Fédérale de Lausanne Universitat Politècnica de Catalunya Benchmark and Framework for Byzantine Machine Learning Author: Marc Gonzalez Vidal Director: Pr. Rachid Guerraoui Co-Director & Tutor: Dr. Geovani Rizk & John Stephan Specialisation: Computer Science Spring 2024 Abstract The application of distributed machine learning is becoming increasingly prevalent in the training of large-scale machine learning models. A further issue is that not all clients engaged in model training always have benevolent intentions. In such cases, it is imperative that we are able to defend ourselves against any attacks that may be launched by these clients. Indeed, there are already a number of proposed defences that claim to be highly effective; however, they have yet to be subjected to exhaustive testing. The objective of this project is to demonstrate that, despite the efficacy of state-of-the-art aggregations in certain environments, there are others where the model is unable to learn and where it is not possible to defend against malicious clients. The objective of this project is to demonstrate the efficacy of a novel protocol and methodology for evaluating existing defenses. This approach will enable us to determine the extent to which these defenses are effective in diverse environments. 1 Contents 1 Introduction 4 1.1 Introduction to Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.2 Introduction to Federated Learning and Byzantine Machine Learning . . . . . . . . 4 2 Target and Contributions 5 3 Planning 5 4 Background 6 4.1 Background on Machine Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 6 4.2 Background on Federated Learning . . . . . . . . . . . . . . . . . . . . . . . . . . 8 4.3 Background on Byzantine Machine Learning . . . . . . . . . . . . . . . . . . . . 10 5 Framework 11 5.1 Frameworktargets .................................. 11 5.2 Frameworktechnologies ............................... 12 5.3 Frameworkmodules ................................. 12 5.4 Frameworktesting .................................. 13 6 Benchmark setup 14 6.1 Benchmarkmotivation ................................ 14 6.2 Algorithm and aggregation rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 6.3 ByzantineAttacks................................... 14 6.4 Datasets and Data Heterogeneity . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 6.5 Models ........................................ 15 6.6 Machine and Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 6.7 SummaryofBenchmark ............................... 16 7 Experimental Protocol and Evaluation 17 8 Results of Benchmark 17 8.1 VanillaResults .................................... 18 8.2 Coordinate-wiseMedian ............................... 18 8.3 Coordinate-wise Trimmed Mean . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 8.4 GeometricMedian .................................. 22 8.5 Multi-Krum...................................... 24 8.6 CenteredClipping................................... 26 8.7 RealByzantineBorder ................................ 28 9 Conclusions of Benchmark 30 9.1 Evaluation of results and limitation of existing methods . . . . . . . . . . . . . . . 30 2 9.2 Rankingofaggregations ............................... 30 10 New Attacks 32 10.1Label-Sliding ..................................... 32 10.2Betrayal........................................ 32 11 Future Work 33 12 Cost of performing the benchmark 33 13 Apendices 38 13.1Settingofexperiment................................. 38 3 1 Introduction 1.1 Introduction to Machine Learning Supervised machine learning is a paradigm of artificial intelligence that diverges from traditional programming methods. Instead of explicitly telling the computer how to perform a task through code, we employ a model, typically a neural network, and define the task it needs to accomplish. Model performance is evaluated based on a predefined metric, providing feedback on how well or poorly it is performing. This approach essentially shifts the paradigm from telling the computer how to perform a task to specifying what the task is. The computer, or more specifically the model, then learns the best way to accomplish the task based on the feedback it receives during training. This new paradigm has enabled the development of countless new applications and improvements to existing ones that would not be possible with traditional algorithms. Examples include autonomous driving and medical image analysis for diagnosis in the field of computer vision, as well as enabling a robot to perform acrobatics in the real world in the field of robotics. However, enhancing our current capabilities or even attempting new tasks will always entail a cost. This cost is contingent upon the scale of the models employed or the data required to train these models. The larger the model, the greater the number of parameters it possesses, and the more parameters, the more operations must be performed. For context, in 1988, LeNet-5 [ 23 ] was proposed as a model that could classify images of handwritten digits and had approximately 60,000 parameters. A few years later, in 2012, AlexNet [ 22 ] was proposed to also solve image classification tasks. However, in contrast to LeNet-5, this latter model comprises approximately 60 million parameters, representing a 1,000-fold increase in size. Although the examples provided are both for image classification, it is evident that this trend is not exclusive to computer vision. Indeed, numerous other fields of machine learning are following a similar trajectory, with the consequence that larger models are becoming increasingly prevalent. These models, however, entail significantly higher computational costs than their predecessors. To train these models, some of the techniques that are used are Gradient Descent [ 32 ] or Stochastic Gradient Descent [ 25 ]. These methods aim to optimize the model’s parameters to minimize the distance between the model’s predictions and the real data, thereby improving the model’s performance. We will examine these techniques in greater detail in the following sections. These techniques have proven effective for models with fewer parameters, but as previously discussed, the trend is towards models with millions of parameters. Unfortunately, these techniques are not efficient enough to train a model within a reasonable timeframe, even with advances in hardware. As has been observed in the field of technology on previous occasions, when the bottleneck is determined by computation time and it is not possible to make the algorithm faster, the solution is to add more units for computation. This is a strategy that has been employed in the case of CPUs and GPUs. Consequently, it can be argued that machine learning cannot be an exception to this rule. 1.2 Introduction to Federated Learning and Byzantine Machine Learning Federated learning (FL) has emerged as a forefront solution for modern machine learning to train extremely large models. This is due to its capacity to distribute the workload and its ability to train a model without the necessity of storing the training data centrally [ 19 ]. In FL, training data is disseminated among several machines (known as clients), and the training procedure is coordinated by a central server that iteratively queries the clients for individual model contributions (typically in the form of gradients) obtained from their local training data and the central server aggregates the information and updates the parameters of the model. After that, the central server broadcast another time the model parameters to all the clients that are participating in the training and we repeat the process. This learning paradigm enables clients to retain control over their local data (as they do not share their raw data with the server) and to share the computational load between them during the learning procedure. 4 However, standard FL approaches usually assume that all clients behave correctly and, therefore, do not consider the possibility of faulty clients. This typically leaves these algorithms vulnerable to misbehaving clients that could intentionally or inadvertently sabotage the learning procedure by deviating from the prescribed protocol [ 2 , 34 ]. Such clients are commonly referred to as Byzantine or adversarial [ 31 ]. To address this critical issue, a large body of research has been devoted to enhancing the robustness of FL algorithms in the presence of (a fraction of) adversarial clients. In contexts where clients may exhibit erratic behaviour, this phenomenon is referred to as Byzantine Machine Learning. A number of existing defences have been developed that permit the continuation of training in the presence of a certain proportion of Byzantine clients. Consequently, the optimal objective is to identify a defence that is effective in any type of environment. The aim of this project is to examine the state-of-the-art defences and diverse techniques that are available for the mitigation of the effects of the presence of Byzantine clients, and to evaluate them in order to ascertain their efficacy. 2 Target and Contributions The principal targets of this thesis will be as follows: • Develop a framework for simulating distributed machine learning environments and to provide researchers in this field with an efficient and user-friendly tool for testing their defenses against Byzantine behaviour. • Propose a new standard protocol for evaluating defenses utilising the aforementioned framework. • Use this new protocol to evaluate state of art defenses over Byzantine behaviour. • Conduct a benchmark to determine if certain defenses are more effective than others. 3 Planning This section will present a description of the project planning undertaken over the 16-week period during which the project has been in development. The preparation for the project commenced prior to the official commencement of the project. Given that the framework was to be developed with PyTorch[ 29 ], I elected to undertake a preliminary PyTorch course in advance, with the objective of expediting the initial process and reducing the number of new concepts to be learned, as the field was relatively novel to me. In addition, I perused the paper [ 31 ] to gain an introductory grasp of the field in which I was about to embark on the project. This served two purposes: firstly, to become familiar with the terminology of the field, and secondly, to streamline the project’s commencement. During the initial two-week period, I initiated my investigation into the subject matter, commenced the process of acquiring knowledge and comprehension of the theoretical underpinnings and operational principles of the algorithms that were essential for my understanding. Furthermore, to enhance my comprehension and gain insight into the functioning of these algorithms, I undertook a detailed examination of the code that had been developed to simulate environments that were analogous to those that we sought to simulate within our framework. In essence, it was at this juncture that I had acquired the requisite knowledge to enable me to fully develop the framework. Once the requisite knowledge had been acquired, the framework development process commenced. This phase lasted for approximately eight weeks, during which time considerable time was invested in developing a robust yet modifiable code architecture, with the specific objectives of the framework in mind. Once this had been achieved, the necessary features for the project to be fully functional were developed, and preliminary tests were conducted using other codes. Subsequently, new features were incorporated and the project was completed, enabling the entire algorithm to be executed. Additionally, the potential for storing the results in a manner that would permit their utilisation at a later stage for the purpose of drawing inferences was considered. Once all the requisite elements had been incorporated into the code, it was subjected to a review, during which optimisations were implemented through vectorisation in order to achieve a more efficient code. Following the completion of the development phase, the testing phase commenced, which lasted approximately two weeks. 5 In order to provide comprehensive documentation, a dedicated week was allocated to the comprehensive documentation of the entire library. This was done with the intention of ensuring that all information was clearly and unambiguously presented for the benefit of external developers to the framework’s development. Over the following four weeks, experiments were conducted on the servers and a protocol was developed to describe the process of evaluating the aggregations. Consequently, the code necessary to implement this protocol was written, as were the scripts required to generate the graphs that were deemed potentially insightful during the course of the experiments. The results were subsequently generated using the developed code. The final week was devoted to analysing the outcomes of the preceding process and composing the requisite project documentation, including the inferences derived from the project’s execution. 4 Background The following section will introduce the fundamental concepts and theoretical framework that are necessary to comprehend the entirety of the thesis and the code of the framework. 4.1 Background on Machine Learning In essence, the objective of machine learning models is to minimise a loss function L , which quantifies the discrepancy between the model’s performance and the set of real targets Y . A model can be conceptualised as a function f parametrised with θ , which generates outputs given a set of inputs X . The problem we are attempting to resolve is as follows: ˆ θ= arg min θL(f(X, θ), Y ) The function, f , is typically represented by a deep neural network, wherein each layer performs a non-linear transformation of the input data. This enables the network to learn complex representations of the data, which in turn facilitates the model’s ability to predict the target using a dataset comprising N instances. The loss function is averaged for each entry, xi , and compared to the corresponding real target, yi. L(f(X, θ), Y ) = 1 N N X i=1 ℓ(f(xi, θ), yi) The approximation ˆ θ is achieved using Gradient Descent [ 32 ], algorithm which at each iteration k computes the gradients of the loss function ∇L(f(X, θk), Y ) . This provides insight into the direction of steepest ascent, i.e., where the loss function increases most rapidly. However, the target is to minimize the loss function, therefore, we proceed in the opposite direction, aiming to minimize the loss function most effectively. This direction is determined by the negative gradient at the current point. The size of the step taken in this direction is governed by a parameter known as the learning rate, denoted as γ , repeating this process m steps until convergence. Convergence is typically determined based on the change in loss function value between iterations falling below a pre-specified threshold. Algorithm 1 Gradient Descent (GD) 1: Input: Random initial model θ1∈Rd,learning rate γ∈R+,steps m∈N 2: for k= 1 to mdo 3: θk+1 =θk−γ∇L(f(X, θk), Y ) 4: end for This algorithm let the approximation of optimal parameters for f , and it consistently selects the optimal step, because L is computed over the entire dataset. However, as the size of the datasets increases, the cost of computing L becomes prohibitively high. One solution, is to compute L only over one randomly chosen example on the dataset, this technique is called Stochastic Gradient 6 Descent (SGD) [ 25 ], which is considerably more efficient. Nevertheless, what it is done in practise, rather than computing L over one single example, it is computed over a subset of n randomly chosen elements with n << N called batch, this algorithm is also called Mini-Batch Gradient Descent and is one of the most used algorithms nowadays to train models but we will refer to this technique as SDG. For these last algorithm, Lis computed as follows: L(f(Xn;θ), Yn) = 1 n n X i=1 ℓ(f(xi;θ), yi) Although this technique usually takes a small portion of the dataset it has been demonstrated that it is highly effective and it has been observed that introduction of randomness can assist the algorithm in reaching lower values of L . This variability can potentially uncover trajectories that continue to decrease L , even when the algorithm is converging towards a local minimum. This phenomenon suggests that the randomness in SGD can serve as a mechanism to escape shallow local minima, thereby facilitating the discovery of deeper, and potentially global, minima. This characteristic of SGD underscores its utility in complex optimization tasks, where traditional methods may falter. [24]. Another technique that have been proved to be highly beneficial, not necessarily in reducing computations but in expediting convergence, is momentum. Momentum is a method that introduces an auxiliary term that accumulates a fraction of the preceding updates, thereby facilitating a smoother and accelerated convergence process. This term, represented as mt , is updated in the following manner: mt=βmt−1+ (1 −β)∇L(θt) 0 ≤β < 1 where β is a hyperparameter that determines the weight of the momentum. The parameters θ are then updated using this term: θt+1 =θt−γmt This could be employed as a beneficial mechanism in the context of optimization for a number of reasons. In optimisation scenarios characterised by noisy gradients, momentum facilitates the reduction of the variance instigated by the noise by providing a means of smoothing the updates. This results in a more stable direction of updates, thereby facilitating faster convergence with less erratic behaviour. Secondly, in regions of the error surface where the gradients are minimal (such as valleys or flat expanses), momentum harnesses the force from previous updates, thereby enabling the optimizer to traverse these regions more rapidly than is possible with standard Stochastic Gradient Descent (SGD). This is of particular benefit in cases where the error surface comprises numerous narrow valleys and flat expanses, where standard SGD may become stalled or progress at a slow pace. Finally, in regions with oscillatory error shapes, momentum assists in mitigating oscillations by incorporating a fraction of the previous update. This counteracts updates in opposing directions that transpire in consecutive iterations, leading to a more direct trajectory towards the minimum.[27] Henceforth, all references to Stochastic Gradient Descent (SGD) will be made in the context of momentum. Algorithm 2 Stochastic Gradient Descent (SGD) 1: Input: Random initial model θ1∈Rd,learning rate γ∈R+,steps m∈N 2: for k= 1 to mdo 3: Sample a random data point (x, y)uniformly from (X, Y ). 4: Compute stochastic gradient gt:=∇ℓ(f(x, θt), y). 5: Update momentum: mt:= (1 −β)gt+βmt−1. 6: θk+1 =θk−γmt 7: end for 7 4.2 Background on Federated Learning In this context, the one who desires to learn the parameters θ∈Rd is a server, but in this case, the server does not have any data. To solve this problem, it will need to collaborate with different clients who do have data and will be able to calculate the gradients. An enviroment with n clients is considered, where each client i∈ {1,2, . . . , n} has acces to their own data distribution Di . Every client i is trying to learn the parameters of a model θ(i)∈Rd , that reaches the minimum loss accuracy over Di . To do that, each client samples a data point in Di and compute their local loss: Li(θ) = l(f(x, θ), y) (x, y)∼Di∀θ∈Rd Given that, the target of every client is to compute the optimal parameters ˆ θ(i)∈Rd that minimizes the loss over all clients: ˆ θ(i)= arg min θ 1 n n X i=1 Li(θ)∀θ∈Rd In this optimization problem, the heterogeneity in data distribution necessitates a collaborative approach among all nodes to identify optimal parameters. This collaboration is not solely beneficial in heterogeneous settings. Even in scenarios where the data distribution is identical, referred to as homogeneity, the distributed setting offers advantages. Specifically, it reduces the workload for each worker node compared to a centralized setting, thereby enhancing overall efficiency and performance. The problem presented above could be solved using the Distributed Stochastic Gradient Descent (D-SGD) algorithm, which is a variant with of the SGD for distributed enviroments. In this thesis we are only going to focus in the Server-Based Architecture, the nature of the D-SDG is the same for other architectures but the algorithm needs some modifications to adapt it to other architectures. It is also important to know, that all the workers and either the server are using exactly the same model architecture, so all of them have exactly the same number of parameters. In this architectural framework, the central server, also referred to as the server, initiates the model parameters, denoted as θ0 . The initialization of these parameters could be entirely random or could employ a specific technique deemed appropriate by the server to expedite the training process. At every iteration t , the server brodcasts the parameter vector θt to all client nodes. Each client node then updates their local parameter vector such that θt(i)=θt . Subsequently, the algorithm proceeds in a consistent manner as follows: • Local computations: given the current model θ(i) t , each client i samples a data point (x, y)∼Diand computes their gradients g(i) t=∇l(f(θt(i), x), y). • Communication: each client transmits their computed stochastic gradients g(i) t to the server. • Global model update: upon receiving all the gradients from the clients, the server computes the average of all gradients ˆgt=1 nPn i=1 g(i) t . Subsequently, a step similar to centralized SGD is performed: θt+1 =θt−γtˆgtγt>0 Following this step, the server broadcasts θt+1 to all clients and each client i updates their local parameters as θ(i) t+1 =θt+1. This procedure is iteratively repeated until convergence. However, due to time constraints, the procedure is sometimes parameterized by a maximum number of iterations T , resulting in the algorithm being repeated Ttimes. [31] In the preceding section, the concept of momentum and its role in accelerating convergence were introduced. This principle is corroborated by various studies [ 14 ] in the context of federated learning. To incorporate momentum into the algorithm previously described, a slight modification is required. The computation of momentum occurs locally within each client during the local computations phase. It is calculated using the formula m(i) t=βm(i) t−1+(1−β)g(i) t , where m(i) t represents the momentum at time t,βis the momentum factor, g(i) trepresents the gradients and where irepresents ith client. 8 period of steps the variance in the information send by each client and selects the client with the highest variance as the target to mimic. • FOE: the byzantine clients send (1 −τ)mt in step t to the server, where τ≥0 is a fixed real number representing the attack factor. When τ= 2, this attack is equivalent to SF. • ALIE: the byzantine clients send mt+τσt in step t to the server, where τ≥0 is a fixed real number representing the attack factor, and σtis the coordinate-wise standard deviation of mt. Given that the FOE and ALIE attacks have the parameter τ , we implement in our experiments enhanced and adaptive versions of these attacks. These versions feature a non-constant attack factor, which may vary from one iteration to the next. In each step t , the optimal attack factor, denoted by τt , is determined through a grid search over a predefined range of values. More specifically, in every step t , τt takes the value that maximizes the damage inflicted by the adversarial clients, i.e., that maximizes the l2 norm of the difference between the average of the honest momentums mt and the output of the aggregation Rtat the server. 6.4 Datasets and Data Heterogeneity We consider MNIST [ 10 ] image classification dataset. MNIST consists on 28x28 images of handwritten digits across 10 classes [0-9]. The input images of MNIST are normalized with mean 0.1307 and standard deviation 0.3081 .It is commonly accepted that this dataset is not a very challenging learning problem. While learning on MNIST is straightforward in the typical honest setting, defending against a fraction of misbehaving clients aiming to disrupt the learning makes the problem significantly more difficult. In order to simulate a realistic distributed setting where clients could have different data distributions, we split the datasets across clients in a heterogeneous fashion. To simulate data heterogeneity among clients, we use γ -similarity [ 17 ] and α -Dirichlet[ 18 ] distributions. γ -similarity captures a broader spectrum of heterogeneity by allowing us to go from a completely homogeneous distribution with γ= 1 to an extremely heterogeneous distribution across the clients with γ= 0 . The α -Dirichlet method, on the other hand, is effective for distributing data across clients but results in datasets of varying sizes among clients, which introduces an additional layer of complexity. Most state-of-the-art robust algorithms do not address the challenges posed by unbalanced datasets, and by consequence do not have the associated guarantees. 6.5 Models To address this task, we will consider a simple convolutional neural network (CNN) model with the architecture described in the following table. We will see in the vanilla case that this architecture is sufficient to achieve very good accuracies in this dataset. Layer (Type) Input Shape Output Shape Number of Parameters Conv2d (5x5) [1, 28, 28] [20, 24, 24] 520 ReLU [20, 24, 24] [20, 24, 24] 0 MaxPool2d (2x2) [20, 24, 24] [20, 12, 12] 0 Conv2d (5x5) [20, 12, 12] [50, 8, 8] 25,050 ReLU [50, 8, 8] [50, 8, 8] 0 MaxPool2d (2x2) [50, 8, 8] [50, 4, 4] 0 Linear [800] [500] 400,500 ReLU [500] [500] 0 Linear [500] [10] 5,010 LogSoftmax [10] [10] 0 Total Parameters: 431,080 Table 1: Architecture of Convolutional Model for MNIST 15 6.6 Machine and Environment This benchmark was executed on two distinct machines, the CPU and GPU were the following: Server 1 Server 2 CPU 2 x Intel Xeon Platinum 8358P Intel i7-8700k GPU 2 x NVIDIA A10 2 x GeForce GTX 1080 Ti Table 2: Machines used to run experiments The versions of the software used was: • CUDA 11.4 • Python 3.10.12 • PyTorch 2.0.1 • TorchVision 0.15.2 • Numpy 1.26.4 6.7 Summary of Benchmark The following are all the variables that will be explored in the various training sessions: • Dataset = MNIST • Honest clients = 10 • Byzantine clients = [1, 3, 5, 7, 9] • Aggregations = [CWTM, CWMed, GM, MK, CC] • PreAggregations = [∅, Clipping, NNM, Clipping + NNM] • Learning Rate = [0.1, 0.25] • Momentum = [0.0, 0.9, 0.99] • Weight Decay = 1e−4 • Loss = NLLLoss • Steps = 800 • Heterogeneity: –γ= 0.0, γ= 0.25, γ= 0.5, γ= 0.75, γ= 1.0 –α= 10, α= 1, α= 0.5, α= 0.25, α= 0.1 • Attacks = [SF, LF, Mimic, FOE, ALIE] In this entire benchmark, we will assume that the server is aware of the actual number of Byzantine clients in the environment and will utilise this information as parameters to defend against them. The reason why we to set f= [1,3,5,7,9] is because if we had set f= [2,4,6,8] , we would not have been able to test the exact limit case before not being able to ensure robustness, which in this case is n 2−1. Since we cannot test all fvalues, we decided to use only the odd numbers. It is important to understand that each setting will be runned on five different training seeds, but with a fixed seed for the data distribution. This approach is done to mitigate the impact of a favourable or unfavourable batch in the SGD algorithm. It should be also noted that with all the variables we presented above we need to run 30000 settings (in fact only 27000 as CC does not require clipping because it incorporates this functionality). However, it must be run over 5 seeds which means that the real number of training we have to run is 150000 (135000 in reality). That is why the grid search conducted on the hyperparameters is not exhaustive, but the cost of exploring an exhaustive grid search is prohibitively high. 16 7 Experimental Protocol and Evaluation In many existing studies, model performance is reported based on the highest test accuracy achieved during training. This approach is problematic because the test dataset should not influence model selection or training decisions; it should only be used for final performance evaluation. To address this issue, we split each training dataset into two parts: 80% for actual training and 20% as a validation set. The validation set is used to compute validation accuracy and select the best model during training. This ensures that the test dataset remains an unbiased measure of the model’s performance. To ensure a fair comparison of each aggregation rule, we conduct a grid search for hyperparameters, including different values of learning rate and momentum. This allows us to identify the optimal hyperparameters for each aggregation method. The model trained with these optimal hyperparameters is selected based on the validation set performance. The hyperparameters that were selected were those that yielded the greatest accuracy when subjected to the most powerful attack. In other words, for each hyperparameter configuration, the maximum accuracy achieved during training was recorded, and subsequently, we take the lowest accuracy over attacks. Once this process was complete, the configuration with the highest value, as previously described, it’s selected. Once the best model for each aggregation method is selected, we evaluate them on the test set and present the results in the form of performance plots. An important metric that we use to evaluate the robustness of an algorithm using a specific aggregation is the worst-case accuracy. Given the different existing Byzantine attacks, we show the worst performance across those attacks, previously described. It should be noted that in order to obtain the most accurate results, all of the mentioned metrics will be averaged across different seeds. This is done to mitigate the impact of batch randomness in the algorithm. 8 Results of Benchmark This section presents the results of the benchmark run conducted with the developed framework. Most of all the results will be presented as a heatmap. This approach was selected as one of the project’s key objectives was to identify the efficacy of the aggregations and identify areas for improvement. The use of this type of plot enabled the visualization of the Byzantine Border, which represents the point at which the Byzantine clients achieve their target. The results will be presented as follows. For each aggregation rule, eight heat map will be presented. The byzantine border will be evaluated with four different preaggregations, using two different distributions to evaluate aggregations. As previously said, the distributions will be α -dirichlet and γ -similarity and the different preaggregations will be with no preaggregations, only NNM, only Clipping and Clipping + NNM. To understand the interpretation of heatmaps, it is essential to know that this process is done to evaluate both heterogeneity and the number of Byzantine clients. To achieve this target, the horizontal axis will be used to evaluate the number of Byzantine clients, while the vertical axis will be used to evaluate the parameter of the distribution. It is important to bear in mind that, despite the varying the number of Byzantine clients, the number of honest clients is fixed to 10. This implies that the total number of clients, if we have f = 1, is 11; if f = 3, it is 13, and so forth. Once the level of heterogeneity and the number of Byzantine clients have been identified, a cell can be refered, and the number in that cell represents accuracy value, which ranges from 0 to 1. The numbers are also reflected in the cell’s colour, which is an interpolation from warm to cool colours, with the coolest and warmest colours corresponding to the maximum and minimum values, respectively. 17 8.1 Vanilla Results Prior to examining the results of the experiments, our starting point should be known. In this section, we present the results obtained when there are no Byzantine clients presented, using average as aggregation method (standard in FL). Furthermore, the grid search in the hyperparameters will be done, performing the same protocol as when byzantine clients will be presented. The results show that we could solve this task in a very satisfactory way, almost perfect in terms of accuracy in both distributions, with an accuracy of 0.99. This indicates that a robust starting point has been found, and that the hyperparameters being tested in the grid search are optimal for the model and the task at hand. As expected, accuracy curves are identical, which suggests heterogeneity doesn’t affect in a big scale the accuracy. 0 100 200 300 400 500 600 700 800 Round 0.2 0.4 0.6 0.8 1.0 Accuracy Figure 2: Test Accuracy 0 100 200 300 400 500 600 700 800 Round 0.0 0.5 1.0 1.5 2.0 2.5 Loss Figure 3: Training Loss 8.2 Coordinate-wise Median This is the inaugural review of a robust aggregation. The inital observation is that individual preaggregations are not very beneficial; in fact, they can have a detrimental impact, as seen in NNM which is expanding the Byzantine frontier in α -dirichlet. However, it is seen that applying both techniques yields a symbiosis, as they demonstrate the biggest impact reducing the Byzantine frontier. In light of the previously observations, it can be concluded that CWMed exhibits a high degree of robustness regardless the presence of Byzantine clients in homogeneous environments. For example, it can be seen that Clipping + NNM setting (the best), only a proportion of 3 13 reduces the accuracy to 0.6 when γ= 0 . This result indicates that even a modest proportion of Byzantine nodes can have a significant impact on the accuracy of our model in heterogeneous environments. It is also quite notable that heterogeneity caused by the γ -similarity distribution has a more pronounced effect on this aggregation than that caused by the α -Dirichlet distribution, where the changes are more gradual. Furthermore, a comparison of the two distributions reveals that the pre-aggregations affect the distributions in different ways. To illustrate, when utilising only NNM, as previously mentioned, the α -Dirichlet distribution exhibits a deterioration in all aspects. However, in the case of γ -similarity, despite experiencing losses when there are 1 11 Byzantine clients in environments that are almost heterogeneous ( γ = 0.25), it is possible to tolerate more Byzantine clients in mixed environments ( γ = 0.5). In general, the Byzantine region obtained in α -Dirichlet is observed to be relatively small in its optimal setting (Clipping + NNM), which contributes to the robustness of CWMed in a majority of the environments tested. However, when examining γ -similarity, this region exhibits expansion, which is anticipated given that α -Dirichlet is not designed to simulate environments with extreme heterogeneity. 18 13579 0.10.250.51.010.0 0.79 0.27 0.19 0.12 0.1 0.92 0.67 0.31 0.14 0.13 0.97 0.91 0.58 0.2 0.14 0.98 0.97 0.92 0.58 0.14 0.99 0.98 0.97 0.94 0.91 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 4: Best accuracy in α -dirichlet using CWMed 13579 0.00.250.50.751.0 0.15 0.12 0.12 0.11 0.11 0.92 0.17 0.14 0.11 0.12 0.97 0.92 0.23 0.15 0.14 0.99 0.98 0.96 0.92 0.59 0.99 0.98 0.98 0.96 0.93 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 5: Best accuracy in γ -distribution using CWMed 13579 0.10.250.51.010.0 0.63 0.26 0.17 0.14 0.1 0.91 0.61 0.33 0.16 0.11 0.93 0.69 0.5 0.29 0.16 0.98 0.95 0.84 0.51 0.25 0.99 0.98 0.97 0.96 0.91 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 6: Best accuracy in α -dirichlet using CWMed with NNM 13579 0.00.250.50.751.0 0.18 0.11 0.1 0.098 0.1 0.37 0.32 0.24 0.12 0.1 0.98 0.89 0.77 0.36 0.14 0.99 0.98 0.96 0.95 0.69 0.99 0.98 0.98 0.97 0.95 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 7: Best accuracy in γ -distribution using CWMed with NNM 13579 0.10.250.51.010.0 0.71 0.35 0.15 0.1 0.1 0.92 0.71 0.27 0.12 0.11 0.97 0.86 0.45 0.1 0.1 0.98 0.96 0.87 0.45 0.1 0.99 0.98 0.96 0.94 0.83 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 8: Best accuracy in α -dirichlet using CWMed with Clipping 13579 0.00.250.50.751.0 0.15 0.097 0.097 0.1 0.097 0.9 0.23 0.18 0.12 0.11 0.97 0.9 0.15 0.13 0.12 0.98 0.97 0.95 0.9 0.5 0.99 0.98 0.98 0.96 0.94 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 9: Best accuracy in γ -distribution using CWMed with Clipping 19 13579 0.10.250.51.010.0 0.98 0.86 0.71 0.18 0.1 0.98 0.92 0.83 0.55 0.22 0.98 0.95 0.88 0.76 0.38 0.99 0.95 0.92 0.86 0.72 0.99 0.98 0.97 0.96 0.9 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 10: Best accuracy in α -dirichlet using CWMed with Clipping+NNM 13579 0.00.250.50.751.0 0.94 0.6 0.15 0.097 0.097 0.98 0.93 0.39 0.12 0.097 0.98 0.96 0.9 0.41 0.12 0.99 0.98 0.97 0.94 0.68 0.99 0.98 0.98 0.97 0.95 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 11: Best accuracy in γ -distribution using CWMed with Clipping+NNM In order to gain insight into the performance of the system, we will present a graph displaying the accuracy curves over the test set for f= 3 with γ= 0.0 , with Clipping + NNM, over different attacks. The graph will help us in the comprehension of the behaviors of the different attacks in this setting with CWMed. This setting is presented initially, as it is the one in which Clipping + NNM is most effective, and also because it allows for the demonstration of an experiment that is situated at the threshold of robustness. Subsequently, the addition of further Byzantine clients will result in the deterioration of all training curves, indicating a lack of learning. 0 100 200 300 400 500 600 700 800 Round 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy SignFlipping LabelFlipping FallOfEmpires LittleIsEnough Mimic Figure 12: Accuracy curves on test set using CWMed with Clipping + NNM (γ= 0.0and f= 3) 8.3 Coordinate-wise Trimmed Mean The following robust aggregation is CWTM. In this aggregation, we observe once again witness the synergy provided by the combination of Clipping + NNM, yielding much better results than all other settings. It is also noteworthy how the case without pre-aggregations appears quite similar between both distributions. However, as previously explained, with γ= 0 a single Byzantine client has a greater impact than with α= 0.1 . However, as previously explained, this is expected given that α -Dirichlet cannot achieve a 100% heterogeneous environment. Consequently, a single Byzantine client has a greater impact than with α= 0.1. It is also notable that the environment with only NNM does not outcomes an improvement in either of the two data distributions, which does not happen with other aggregations. In this case, clipping also has the same effect, with both distributions being negatively affected by this technique. Nevertheless, it can be asserted that this aggregation is robust in homogeneous environments, independently of the proportion of byznatine and the pre-aggregations employed. As can be observed, the utilization of Clipping + NNM results in a smoother transition for α -dirichlet. Furthermore, setting the robustness threshold at 0.5 accuracy, there are only 4 cells where robustness is not achieved. However, if we observe at γ -similarity, the number of regions increases to 6, indicating 20 that this aggregation is more affected by the type of heterogeneity generated by γ -similarity than by α-dirichlet. 13579 0.10.250.51.010.0 0.95 0.39 0.12 0.12 0.1 0.98 0.83 0.34 0.14 0.13 0.98 0.93 0.61 0.19 0.14 0.99 0.96 0.91 0.5 0.14 0.99 0.98 0.96 0.93 0.91 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 13: Best accuracy in α -dirichlet using CWTM 13579 0.00.250.50.751.0 0.55 0.13 0.12 0.12 0.11 0.96 0.5 0.19 0.13 0.12 0.98 0.92 0.48 0.13 0.14 0.98 0.97 0.95 0.9 0.59 0.99 0.98 0.97 0.96 0.93 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 14: Best accuracy in γ -distribution using CWTM 13579 0.10.250.51.010.0 0.88 0.34 0.22 0.13 0.1 0.97 0.63 0.4 0.23 0.11 0.98 0.86 0.6 0.36 0.16 0.99 0.97 0.87 0.65 0.25 0.99 0.98 0.97 0.97 0.91 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 15: Best accuracy in α -dirichlet using CWTM with NNM 13579 0.00.250.50.751.0 0.2 0.13 0.11 0.1 0.1 0.6 0.4 0.29 0.15 0.1 0.98 0.93 0.76 0.38 0.14 0.99 0.98 0.97 0.95 0.69 0.99 0.98 0.98 0.97 0.95 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 16: Best accuracy in γ -distribution using CWTM with NNM 13579 0.10.250.51.010.0 0.95 0.24 0.1 0.1 0.1 0.98 0.82 0.15 0.12 0.11 0.98 0.93 0.6 0.13 0.1 0.99 0.97 0.9 0.42 0.1 0.99 0.98 0.96 0.94 0.83 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 17: Best accuracy in α -dirichlet using CWTM with Clipping 13579 0.00.250.50.751.0 0.23 0.097 0.097 0.097 0.097 0.96 0.1 0.097 0.097 0.11 0.98 0.9 0.27 0.23 0.12 0.98 0.97 0.95 0.89 0.5 0.99 0.98 0.97 0.96 0.94 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 18: Best accuracy in γ -distribution using CWTM with Clipping 21 13579 0.10.250.51.010.0 0.98 0.87 0.75 0.1 0.1 0.98 0.93 0.86 0.59 0.18 0.98 0.96 0.89 0.78 0.34 0.99 0.97 0.94 0.86 0.72 0.99 0.98 0.97 0.96 0.9 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 19: Best accuracy in α -dirichlet using CWTM with Clipping+NNM 13579 0.00.250.50.751.0 0.96 0.62 0.14 0.097 0.097 0.98 0.94 0.79 0.11 0.097 0.98 0.96 0.92 0.64 0.12 0.99 0.98 0.97 0.95 0.68 0.99 0.98 0.98 0.97 0.95 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 20: Best accuracy in γ -distribution using CWTM with Clipping+NNM The accuracy curves on the test set for this aggregation are presented herewith. As with the previous aggregation, we will use γ= 0.0 with f= 3 , as this is again the point where the Byzantine border lies for extreme heterogeneity. As was also observed in the heatmap, the worst-case accuracy (FOE) is very close to the accuracy obtained with the previous aggregation. 0 100 200 300 400 500 600 700 800 Round 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy SignFlipping LabelFlipping FallOfEmpires LittleIsEnough Mimic Figure 21: Accuracy curves on test set using TrMean with Clipping + NNM (γ= 0.0and f= 3) 8.4 Geometric Median The third aggregation that we will examine is GM. Prior to examining the results, it is important to know that this aggregation use two hyperparameters that can alter its behaviour. Due to the high computational cost of exploring a larger number of hyperparameters, we have been unable to perform a grid search or optimise these parameters based on the number of Byzantine nodes. Nevertheless, we have selected hyperparameters that demonstrated efficacy in the base case. Surprisingly, this aggregation has already yielded a relatively well-defined and reduced Byzantine region without any pre-aggregation. This may be attributed to the fact that this aggregation is not coordinate-wise, which could be a potential area for improvement. Additionally, it can be observed that neither of the two pre-aggregations alone manage to improve the initial setting, although the synergy between Clipping+NNM occurs again, once more giving us the best result. By focusing on the optimal setting (Clipping + NNM), it becomes evident that the outcomes are favourable, particulary in α -dirichlet. Upon establishing a threshold for robustness at 0.5 accuracy, it is observed that there are only three regions where robustness is lacking. This results in a very good scenario although it is still far from the desired level of perfection. A similar observation can be made in γ-similarity, although here, as expected, the Byzantine region is a bit larger. 22 However, despite these good results, it must also be said that this aggregation seems more affected by the presence of many Byzantine clients in homogeneous environments when we do not use both pre-aggregations, which does not happen in other aggregations. Nevertheless, despite the drop in accuracy, it is not very significant. The worst case is when no pre-aggregation is used in γ -similarity, and the accuracy obtained is 0.79, which, although far from being nearly perfect accuracy, is not bad enough to be of much concern. 13579 0.10.250.51.010.0 0.98 0.9 0.13 0.11 0.099 0.99 0.96 0.83 0.12 0.1 0.99 0.98 0.93 0.15 0.15 0.99 0.98 0.97 0.87 0.12 0.99 0.98 0.97 0.93 0.84 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 22: Best accuracy in α -dirichlet using GM 13579 0.00.250.50.751.0 0.89 0.53 0.12 0.11 0.1 0.98 0.97 0.13 0.12 0.1 0.99 0.98 0.94 0.11 0.1 0.99 0.98 0.97 0.91 0.12 0.99 0.98 0.97 0.94 0.79 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 23: Best accuracy in γ -distribution using GM 13579 0.10.250.51.010.0 0.68 0.25 0.22 0.14 0.12 0.92 0.67 0.36 0.19 0.11 0.97 0.72 0.55 0.32 0.2 0.99 0.97 0.82 0.59 0.24 0.99 0.98 0.98 0.96 0.89 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 24: Best accuracy in α -dirichlet using GM with NNM 13579 0.00.250.50.751.0 0.18 0.12 0.11 0.099 0.098 0.42 0.36 0.26 0.14 0.099 0.98 0.93 0.84 0.45 0.2 0.99 0.98 0.97 0.95 0.91 0.99 0.98 0.98 0.97 0.95 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 25: Best accuracy in γ -distribution using GM with NNM 13579 0.10.250.51.010.0 0.97 0.81 0.34 0.1 0.1 0.98 0.96 0.63 0.19 0.1 0.99 0.97 0.92 0.26 0.1 0.99 0.98 0.96 0.85 0.15 0.99 0.98 0.96 0.93 0.84 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 26: Best accuracy in α -dirichlet using GM with Clipping 13579 0.00.250.50.751.0 0.89 0.32 0.097 0.097 0.097 0.98 0.76 0.13 0.097 0.097 0.99 0.97 0.39 0.11 0.097 0.99 0.98 0.96 0.92 0.21 0.99 0.98 0.97 0.93 0.84 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 27: Best accuracy in γ -distribution using GM with Clipping 23 13579 0.10.250.51.010.0 0.98 0.88 0.59 0.29 0.1 0.98 0.92 0.88 0.5 0.37 0.98 0.95 0.89 0.86 0.58 0.99 0.97 0.94 0.88 0.81 0.99 0.98 0.97 0.96 0.92 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 28: Best accuracy in α -dirichlet using GM with Clipping+NNM 13579 0.00.250.50.751.0 0.95 0.64 0.13 0.097 0.097 0.98 0.93 0.7 0.12 0.097 0.98 0.96 0.94 0.86 0.4 0.99 0.98 0.97 0.96 0.9 0.99 0.98 0.98 0.97 0.95 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 Figure 29: Best accuracy in γ -distribution using GM with Clipping+NNM We again observe a scenario that is analogous to the previous one, in which the frontier for extreme heterogeneity was in gamma = 0.0 for f= 3 . However, in this case, the value of this frontier is slightly higher than in the previous instances. As can be observed, the efficacy of the various attacks against this configuration with GM is comparable to that observed previously.. 0 100 200 300 400 500 600 700 800 Round 0.0 0.2 0.4 0.6 0.8 1.0 Accuracy SignFlipping LabelFlipping FallOfEmpires LittleIsEnough Mimic Figure 30: Accuracy curves on test set using GM with Clipping + NNM (γ= 0.0and f= 3) 8.5 Multi-Krum The fourth aggregation that we will examine is MK. Similar to GM, MK is not coordinate-wise, although unlike GM, However, in contrast to GM, differences are observable in both distributions for the case without pre-aggregations, diverging from GM, generally being worse in this case. It is also very noteworthy that, of all the aggregations we have seen so far, the use of NNM and Clipping individually worsened the results compared to when they were not used, or at least worsened one of the distributions (generally γ ). However, in this case, they improve the results in both distributions. It appears that this aggregation greatly benefits from the effects of these pre-aggregations. Additionally, as we have seen previously, the best result is obtained when both pre-aggregations are used together. Like GM, it also seems to be an aggregation that generally suffers in the presence of a large proportion of Byzantine clients, even in a homogeneous environment. One of the most striking things is that it seems to be the first aggregation that is equally or more affected by the type of heterogeneity generated by α -Dirichlet than by γ -similarity, whereas in the others, it was completely the opposite, for all cases except Clipping + NNM. In any case, the area of the Byzantine frontier is quite large compared to other aggregations. 24 13579 0.1 Median_0.9775_0.0019 TrMean_0.9774_0.0017 GeometricMedian_0.9771_0.0032 MultiKrum_0.9773_0.0027 MultiKrum_0.8749_0.0071 TrMean_0.8626_0.0395 GeometricMedian_0.8741_0.009 TrMean_0.7415_0.0717 Median_0.7008_0.0886 GeometricMedian_0.5843_0.416 No Robust No Robust 0.25 TrMean_0.9802_0.0007 Median_0.9801_0.0011 GeometricMedian_0.9791_0.0011 MultiKrum_0.9798_0.0006 TrMean_0.9246_0.03 Median_0.9097_0.013 GeometricMedian_0.91_0.0206 MultiKrum_0.9044_0.0305 GeometricMedian_0.8727_0.0242 TrMean_0.858_0.033 MultiKrum_0.7436_0.3034 TrMean_0.58_0.064 Median_0.5447_0.0869 GeometricMedian_0.4956_0.1814 MultiKrum_0.1993_0.3421 No Robust 0.5 GeometricMedian_0.9804_0.0009 Median_0.9801_0.0009 TrMean_0.98_0.0021 MultiKrum_0.9802_0.0026 TrMean_0.9527_0.0145 Median_0.9467_0.0036 GeometricMedian_0.9475_0.0085 MultiKrum_0.9359_0.0263 TrMean_0.8882_0.0173 Median_0.8767_0.0051 GeometricMedian_0.8854_0.014 MultiKrum_0.8802_0.0147 GeometricMedian_0.8598_0.0091 GeometricMedian_0.5812_0.4136 Median_0.3771_0.1989 TrMean_0.3391_0.1909 1.0 GeometricMedian_0.9836_0.001 Median_0.983_0.001 TrMean_0.9827_0.0017 MultiKrum_0.9829_0.0012 TrMean_0.969_0.0041 GeometricMedian_0.9642_0.009 MultiKrum_0.9674_0.0034 GeometricMedian_0.937_0.018 Median_0.911_0.0323 TrMean_0.9307_0.0295 MultiKrum_0.9333_0.0131 GeometricMedian_0.8743_0.0036 MultiKrum_0.8499_0.025 GeometricMedian_0.8032_0.0444 Median_0.7182_0.284 TrMean_0.7182_0.284 MultiKrum_0.5679_0.2345 10.0 Median_0.9858_0.0012 TrMean_0.9854_0.001 GeometricMedian_0.9849_0.0015 MultiKrum_0.9856_0.0006 GeometricMedian_0.9786_0.0029 Median_0.9771_0.0035 TrMean_0.9782_0.0016 MultiKrum_0.9784_0.0032 TrMean_0.9694_0.0017 Median_0.9676_0.0046 GeometricMedian_0.9674_0.0042 MultiKrum_0.967_0.0027 TrMean_0.9575_0.0039 Median_0.9514_0.0068 GeometricMedian_0.9525_0.011 GeometricMedian_0.9124_0.0269 Median_0.8929_0.0369 TrMean_0.8929_0.0369 MultiKrum_0.8579_0.0289 Figure 54: Best aggregations using Clipping + NNM in α-dirichlet distribution 13579 0.0 TrMean_0.957_0.005 MultiKrum_0.9545_0.0067 GeometricMedian_0.9499_0.0192 MultiKrum_0.6813_0.0454 TrMean_0.6148_0.0489 GeometricMedian_0.6385_0.0483 No Robust No Robust No Robust 0.25 TrMean_0.9811_0.0015 Median_0.981_0.0011 MultiKrum_0.9809_0.0015 GeometricMedian_0.981_0.0018 TrMean_0.9361_0.0031 Median_0.9269_0.0195 MultiKrum_0.9337_0.0146 GeometricMedian_0.927_0.0181 TrMean_0.7871_0.3422 Median_0.3923_0.4167 MultiKrum_0.4531_0.2277 GeometricMedian_0.6917_0.051 No Robust No Robust 0.5 MultiKrum_0.9827_0.0008 Median_0.9824_0.001 TrMean_0.9827_0.001 GeometricMedian_0.9822_0.0013 TrMean_0.9592_0.0039 Median_0.954_0.003 MultiKrum_0.9551_0.0064 GeometricMedian_0.9566_0.0028 GeometricMedian_0.9315_0.0102 TrMean_0.9178_0.0152 GeometricMedian_0.8591_0.0262 No Robust 0.75 Median_0.9849_0.001 TrMean_0.9838_0.0015 MultiKrum_0.9846_0.0016 GeometricMedian_0.9846_0.0011 CenteredClipping_0.9848_0.0013 GeometricMedian_0.977_0.001 Median_0.9731_0.0041 TrMean_0.9763_0.0015 MultiKrum_0.9765_0.0024 GeometricMedian_0.9675_0.0029 Median_0.963_0.0053 TrMean_0.9662_0.0016 MultiKrum_0.9613_0.0043 GeometricMedian_0.953_0.004 Median_0.9363_0.0146 TrMean_0.9466_0.0067 GeometricMedian_0.8982_0.0179 1.0 MultiKrum_0.9861_0.0005 Median_0.9859_0.001 TrMean_0.9861_0.001 GeometricMedian_0.9861_0.0009 CenteredClipping_0.9859_0.0009 GeometricMedian_0.9808_0.0016 Median_0.9804_0.0018 TrMean_0.9801_0.0014 MultiKrum_0.9806_0.0008 GeometricMedian_0.9768_0.0017 TrMean_0.9739_0.0022 GeometricMedian_0.9689_0.0035 Median_0.9639_0.0033 TrMean_0.9665_0.0048 Median_0.9498_0.0083 TrMean_0.9498_0.0083 MultiKrum_0.9423_0.012 GeometricMedian_0.9462_0.0054 Figure 55: Best aggregations using Clipping + NNM in γ-similarity distribution 31 10 New Attacks During the development of this project, we also had ideas and possible improvements to existing attacks that, despite not being the main focus of this project, we would like to share. It should be noted that the time constraints imposed by the project did not allow for the exhaustive experimentation with these attacks, which is why this section will not present the results of the attacks. Instead, it will simply explain the improvements made and the rationale behind the attacks in a theoretical manner. Both new attacks that we will present are variants of LF[4], which is explained here 6.3. 10.1 Label-Sliding The proposed attack suggests that, rather than modifying the labels as l′=n−l , where n is the class with the highest number, they should be modified as l′= (l+ 1)%n . This is because, in sliding the label to the following one, we are effectively moving it to the next class. Therefore, the attack is named accordingly. The rationale behind this attack is that in the event of an odd number of total classes, if we pair l with l’, there will be a class where l=l′ , which is problematic because we will be utilising the genuine target after applying the transformation, resulting in accurate gradients. However, the newly proposed transformation function ensures that all mappings will always be to a different number from the original. Consequently, regardless of the number of targets in our dataset, each target will always be mapped to a completely different one. 10.2 Betrayal This attack represents a further modification of LF. and its name comes from the fact that this attack use the information provided by the model against itself, hence ’betrayal’. The idea of this attack is based on the fact that the neural network is ultimately trying to simulate a probability distribution of belonging to a class in the output layer. LF chooses the mapping from l to l′ through a function without any heuristic, and in this attack, we are going to introduce a heuristic to harm the model as much as possible at each step. The primary objective of this attack is to implement label poisoning, which serves to reinforce instances where the model is making mistakes or attempting to make mistakes when it is not actually doing so. To achieve this, we simply pass the input to the model and then examine its targets, which are the probability distributions it generates. In this case, we will ascertain which class has the highest probability for that input and also which class has the second-highest probability. In the event that the model makes a correct prediction, the target with the second highest probability will be substituted for the real target. This is done with the intention of inducing confusion by making the model believe that it has incorrectly identified the target, when in fact it was correct, and attempting to persuade it to change its opinion to one that is incorrect but more probable. Conversely, if the model is incorrect, the real target will be substituted for the target that the model said. This is done in order to reinforce the model’s prediction and to ensure that the model continues to assign greater weight to the erroneous target in question. In constrast to other attacks, this attack will have the peculiarity that it will be much more powerful at the beginning of training than at the end. This is due to the fact that the attack will be particularly potent when the model has not yet acquired the requisite probability distribution knowledge, but once this is acquired, the attack is likely to be relatively mild. This also opens the possibility in the future of creating or exploring hybrid attacks that take the best of each and choose the attack that is most likely to interfere with training. For instance, Betrayal could be employed at the beginning, and once the probability distribution starts to be well defined, if it succeeds, switch to an attack that is more powerful in later stages than Betrayal. 32 11 Future Work The development of this project, especially of the framework, opens up the possibility of many future steps that should be taken. It is evident that the most crucial objective is to persist in investigating this domain with the intention of designing an aggregation or a combination of aggregation and pre-aggregation that can effectively minimise or even eliminate the Byzantine region. It can be asserted that only when this has been achieved can the assertion of robust distributed machine learning be substantiated. However, it would appear that there is still a considerable amount of work to be done in this regard. Furthermore, it would be beneficial to conduct theoretical studies on the enhancements observed when specific combinations of pre-aggregations are employed in training. Given the significant improvements observed, it would be advantageous to expand the limits of heterogeneity and Byzantine clients that an aggregation can withstand. Further work is required to adapt the framework to a real distributed environment. Currently, the framework is only capable of simulating a distributed environment, with a server and different clients within the program’s environment, but the entire program is running on a single, centralized machine. Ideally, this library would offer support for distributed execution on different machines, thus enabling real distributed training. In fact, if this feature were to be implemented, it would be possible to use the library for real distributed machine learning. The only additional step would be to set the number of Byzantine clients to 0 and select the aggregation to be used in training. This approach would result in the creation of a hybrid library that could be used for both real distributed training and the original purpose for which it was developed, namely testing attacks and aggregations or pre-aggregations. Alternatively, it could be used for purely simulated distributed environments. A further task is to perform the same benchmark using alternative datasets and models. This will enable us to identify any patterns and, if appropriate, to reach a conclusion regarding the superiority of one or more aggregations or pre-aggregations. A comprehensive investigation into the potential consequences of declaring a greater number of Byzantines than their actual quantity would be a valuable addition to the existing body of research. Provided that the accuracy of the results is not compromised, such an investigation could yield promising insights. One potential avenue for exploration would be to set the theoretical maximum that can be supported, with the aim of safeguarding against the emergence of a significant number of Byzantines. This could be achieved by identifying an aggregation that performs well in a diverse range of environments. 12 Cost of performing the benchmark This section will examine the principal expenses incurred in conducting this benchmark. Although the servers required for the experiments were provided by the Distributed Computing Laboratory from EPFL and did not entail any additional costs because they already had the CPUs and GPUs, we will assume the cost of acquiring them in case one wishes to replicate this experiment elsewhere. All prices were consulted in June 2024; they may vary in the future. Hardware Costs (C) 2 x Intel Xeon Platinum 8358P 8354 Intel i7-8700k 332 2 x NVIDIA A10 8730 2 x GeForce GTX 1080 Ti 626 Total 18042 Table 3: Costs of Hardware We have to take into account that the experiments were running for 4 weeks = 672 hours. In Switzerland the kWh in average costs 0.3049 CHF ≈ 0.3156C [ 35 ] (conversion done on 12 June of 2024) so the costs provided by electricity are as follows: 33 It is important to consider that the experiments were conducted for a period of four weeks, equating to 672 hours. In Switzerland, the cost of a kilowatt hour (kWh) 0.3049 CHF ≈ 0.3156C[ 35 ], as of 12 June 2024. Therefore, the costs associated with electricity can be calculated as follows: Hardware Avg Power x unit (W) Total Energy Consumed (kWh) Energy Cost (C) 2 x Intel Xeon Platinum 8358P 240 322.56 101.8 Intel i7-8700k 95 63.84 20.15 2 x NVIDIA A10 150 201.6 63.62 2 x GeForce GTX 1080 Ti 250 336 106.04 Total - 934 291.61 Table 4: Electricity Cost for Hardware Thus, if one were to replicate the experiments and lacked the requisite hardware, the cost would be 18,333.61. However, as we already had the requisite hardware, the cost was only 291.61. It is also worth noting that more economical hardware can be used to run these experiments, although the waiting time might be longer. Nevertheless, making such a large investment is not necessary to replicate or run the experiments we have conducted. 34 References [1] Encapsulation (computer programming), 2024. [Online; June 6, 2024]. [2] M. Abadi, A. Agarwal, P. Barham, E. Brevdo, Z. Chen, C. Citro, G. Corrado, A. Davis, J. Dean, M. Devin, S. Ghemawat, I. Goodfellow, A. Harp, G. Irving, M. Isard, Y. Jia, R. Jozefowicz, L. Kaiser, M. Kudlur, J. Levenberg, D. Mané, R. Monga, S. Moore, D. Murray, C. Olah, M. Schuster, J. Shlens, B. Steiner, I. Sutskever, K. Talwar, P. Tucker, V. Vanhoucke, V. Vasudevan, F. Viégas, O. Vinyals, P. Warden, M. Wattenberg, M. Wicke, Y. Yu, and X. Zheng. Tensorflow: Large-scale machine learning on heterogeneous distributed systems, 2015. [3] D. Alistarh, Z. Allen-Zhu, and J. Li. Byzantine stochastic gradient descent, 2018. [4] Z. Allen-Zhu, F. Ebrahimianghazani, J. Li, and D. Alistarh. Byzantine-resilient non-convex stochastic gradient descent. In International Conference on Learning Representations, 2020. [5] Y. Allouah, S. Farhadkhani, R. Guerraoui, N. Gupta, R. Pinot, and J. Stephan. Fixing by mixing: A recipe for optimal byzantine ml under heterogeneity. In F. Ruiz, J. Dy, and J.-W. van de Meent, editors, Proceedings of The 26th International Conference on Artificial Intelligence and Statistics, volume 206 of Proceedings of Machine Learning Research, pages 1232–1300. PMLR, 25–27 Apr 2023. [6] G. Baruch, M. Baruch, and Y. Goldberg. A little is enough: Circumventing defenses for distributed learning. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. [7] D. Bertsekas and J. Tsitsiklis. Parallel and distributed computation: numerical methods. Athena Scientific, 2015. [8] P. Blanchard, E. M. El Mhamdi, R. Guerraoui, and J. Stainer. Machine learning with adversaries: Byzantine tolerant gradient descent. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems 30, pages 119–129. Curran Associates, Inc., 2017. [9] Y. Chen, L. Su, and J. Xu. Distributed statistical machine learning in adversarial settings: Byzantine gradient descent. Proceedings of the ACM on Measurement and Analysis of Computing Systems, 1(2):1–25, 2017. [10] L. Deng. The mnist database of handwritten digit images for machine learning research. IEEE Signal Processing Magazine, 29(6):141–142, 2012. [11] E. M. El Mhamdi, R. Guerraoui, and S. Rouault. The hidden vulnerability of distributed learning in Byzantium. In J. Dy and A. Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 3521–3530. PMLR, 10–15 Jul 2018. [12] S. Farhadkhani, R. Guerraoui, N. Gupta, L.-N. Hoang, R. Pinot, and J. Stephan. Robust collaborative learning with linear gradient overhead. In A. Krause, E. Brunskill, K. Cho, B. Engelhardt, S. Sabato, and J. Scarlett, editors, Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 9761–9813. PMLR, 23–29 Jul 2023. [13] S. Farhadkhani, R. Guerraoui, N. Gupta, R. Pinot, and J. Stephan. Byzantine machine learning made easy by resilient averaging of momentums. In K. Chaudhuri, S. Jegelka, L. Song, C. Szepesvari, G. Niu, and S. Sabato, editors, Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, pages 6246–6283. PMLR, 17–23 Jul 2022. [14] J. Gao, X.-W. Liu, Y.-H. Dai, Y. Huang, and J. Gu. Distributed stochastic gradient tracking methods with momentum acceleration for non-convex optimization. Computational Optimization and Applications, 2023. [15] GeeksforGeeks. Unit testing - software testing, 2024. Accessed: June 7, 2024. 35 [16] R. Guerraoui, N. Gupta, and R. Pinot. Byzantine machine learning: A primer. ACM Computing Surveys, 2023. [17] R. Guerraoui, R. Pinot, G. Rizk, J. Stephan, and F. Taiani. Overcoming the challenges of batch normalization in federated learning. arXiv preprint arXiv:2405.14670, May 2024. Batch normalization has proven to be a very beneficial mechanism to accelerate the training and improve the accuracy of deep neural networks in centralized environments. Yet, the scheme faces significant challenges in federated learning, especially under high data heterogeneity. Essentially, the main challenges arise from external covariate shifts and inconsistent statistics across clients. We introduce in this paper Federated BatchNorm (FBN), a novel scheme that restores the benefits of batch normalization in federated learning. Essentially, FBN ensures that the batch normalization during training is consistent with what would be achieved in a centralized execution, hence preserving the distribution of the data, and providing running statistics that accurately approximate the global statistics. FBN thereby reduces the external covariate shift and matches the evaluation performance of the centralized setting. We also show that, with a slight increase in complexity, we can robustify FBN to mitigate erroneous statistics and potentially adversarial attacks. [18] T.-M. H. Hsu, H. Qi, and M. Brown. Measuring the effects of non-identical data distribution for federated visual classification, 2019. [19] P. Kairouz, H. B. McMahan, B. Avent, A. Bellet, M. Bennis, A. N. Bhagoji, K. Bonawitz, Z. Charles, G. Cormode, R. Cummings, R. G. L. D’Oliveira, H. Eichner, S. E. Rouayheb, D. Evans, J. Gardner, Z. Garrett, A. Gascón, B. Ghazi, P. B. Gibbons, M. Gruteser, Z. Harchaoui, C. He, L. He, Z. Huo, B. Hutchinson, J. Hsu, M. Jaggi, T. Javidi, G. Joshi, M. Khodak, J. Konecný, A. Korolova, F. Koushanfar, S. Koyejo, T. Lepoint, Y. Liu, P. Mittal, M. Mohri, R. Nock, A. Özgür, R. Pagh, H. Qi, D. Ramage, R. Raskar, M. Raykova, D. Song, W. Song, S. U. Stich, Z. Sun, A. T. Suresh, F. Tramèr, P. Vepakomma, J. Wang, L. Xiong, Z. Xu, Q. Yang, F. X. Yu, H. Yu, and S. Zhao. Advances and open problems in federated learning. Foundations and Trends® in Machine Learning, 14(1–2):1–210, 2021. [20] S. P. Karimireddy, L. He, and M. Jaggi. Learning from history for Byzantine robust optimization. International Conference On Machine Learning, Vol 139, 139, 2021. [21] S. P. Karimireddy, L. He, and M. Jaggi. Byzantine-robust learning on heterogeneous datasets via bucketing. In International Conference on Learning Representations, 2022. [22] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. Burges, L. Bottou, and K. Weinberger, editors, Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. [23] Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998. [24] Y. Lecun, L. Bottou, G. Orr, and K.-R. Müller. Efficient backprop. 08 2000. [25] I. Loshchilov and F. Hutter. SGDR: stochastic gradient descent with restarts. CoRR, abs/1608.03983, 2016. [26] NumPy Contributors. Numpy - the fundamental package for scientific computing with python, 2024. Accessed: June 6, 2024. [27] B. T. Polyak. Some methods of speeding up the convergence of iteration methods. Ussr computational mathematics and mathematical physics, 4(5):1–17, 1964. [28] Python Software Foundation. Python programming language – official website, 2024. Accessed: June 6, 2024. [29] PyTorch Contributors. Pytorch - an open source machine learning framework, 2024. Accessed: June 6, 2024. [30] PyTorch Contributors. torchvision - datasets, transforms, and models specific to computer vision, 2024. Accessed: June 6, 2024. 36 [31] R. P. Rachid Guerraoui, Nirupam Gupta. Byzantine machine learning: A primer. 2023. [32] S. Ruder. An overview of gradient descent optimization algorithms. CoRR, abs/1609.04747, 2016. [33] Sphinx Developers. Sphinx - Python Documentation Generator, 2024. Accessed: June 6, 2024. [34] L. Su and N. H. Vaidya. Fault-tolerant multi-agent optimization: optimal iterative distributed algorithms. In Proceedings of the 2016 ACM symposium on principles of distributed computing, pages 425–434, 2016. [35] Swissgrid. Electricity price. Accessed: Insert Date Accessed. [36] TensorFlow Authors. Tensorflow - an open source machine learning framework for everyone, 2024. Accessed: June 6, 2024. [37] C. Xie, O. Koyejo, and I. Gupta. Fall of empires: Breaking byzantine-tolerant sgd by inner product manipulation. In R. P. Adams and V. Gogate, editors, Proceedings of The 35th Uncertainty in Artificial Intelligence Conference, volume 115 of Proceedings of Machine Learning Research, pages 261–270. PMLR, 22–25 Jul 2020. [38] D. Yin, Y. Chen, R. Kannan, and P. Bartlett. Byzantine-robust distributed learning: Towards optimal statistical rates. In International Conference on Machine Learning, pages 5650–5659. PMLR, 2018. 37 13 Apendices 13.1 Setting of experiment This section will present an overview of the design of the settings.json file, which will be used to prepare the experiments to be conducted. Additionally, the settings used to run the benchmark will be demonstrated. The file is divided into seven distinct sections: • General: – training_seed: starting training seed for the different seeds will be used. – nb_training_seeds: how many seeds will be done starting from the training_seed. – device: device used in pytorch to do the computations with torch tensors. – nb_workers: how many workers the training will have, in case of null, this number will be nb_honest + nb_byz. – nb_honest: how many honest clients are. – nb_byz: how many real byzantine clients are. – declared_nb_byz: how many byzantine clients the server is protecting against. – declared_equal_real: boolean to filter the configurations that don’t have the same declared byzantine clients as the real ones. – evaluate_on_test: boolean to configurate if test accuracy should be computed. – store_training_accuracy: boolean to set if training accuracies will be stored. – store_training_loss: boolean to set if training losses will be stored. – save_models: boolean to set if we should store the state dict of the pytorch models every evaluation delta. – size_train_set: proportion of the training set that will be used for training, otherwise will be used as the validation set. – nb_steps: number of iterations that the learning algorithm will perform. – evaluation_delta: number of steps between evaluations of the model over validation set or test set. – batch_size_validation: batch size for the validation and test datasets, but not for training set. – data_folder: where the datasets will be stored. – results_directory: where the information we desire to save of the training will be stored. • Model – name: name of the model we want to use in the training. This name must be the name of a class in models.py file. – dataset_name: name of the dataset will be used in training. Must be one of dataset.py. – nb_labels: number of different targets that used dataset has. – data_distribution: *name: name of the data distribution that will be used. *parameters: dictionary with the parameters required by the data distribution used. – loss: training loss. • Aggregator – name: name of the aggregation used by the server. Must be one of the aggregators.py – parameters: dictionary with the parameters required by the aggregation used. • PreAggregators: list of preaggregations in order as they should be applied. – name: name of the preaggregation used by the server. Must be defined on preaggregators.py – parameters: dictionary with the parameters required by the pre-aggregations used. • Server – learning_rate_decay: factor of learning rate decay that will be applied every milestone. – milestones: lists of steps that the learning rate decay should be applied. • Honest Nodes 38 – momentum: momentum value used in the training algorithm. – batch_size: batch size for the SGD algorithm. – learning_rate: learning rate value. – weight_decay: weight decay value to avoid overfitting. • Attack – name: name of the attack used by the server. Must be defined on attacks.py – parameters: dictionary with the parameters required by the attack used. – attack_optimizer: *name: name of the optimizer that will be used to optimize the attack factor. *parameters: dictionary with the parameters required by the optimizer. As can be observed in the code below, there are places where lists are provided instead of values. This means that all values will be tested, i.e., all possible combinations with each element of the lists will be made, unless the expected value is a list. In that case, the previously described process will be followed if it is a list of lists. Below is the settings.json that was used to carry out the benchmark. 1{ 2"general": { 3" training_seed ":0, 4"nb_training_seeds":5, 5"device":" cuda", 6" nb_workers ":null, 7" nb_honest ":10, 8"nb_byz": [1,3,5,7,9], 9"declared_nb_byz": [1,3,5,7,9], 10 "declared_equal_real":true, 11 "evaluate_on_test":true, 12 "store_training_accuracy":true, 13 "store_training_loss":true, 14 "save_models":false , 15 "size_train_set":0.8, 16 " nb_steps ":800, 17 "evaluation_delta":50, 18 "batch_size_validation":100, 19 "data_folder":null , 20 "results_directory":"results" 21 }, 22 " model ": { 23 "name ":" cnn_mnist ", 24 "dataset_name":" mnist " , 25 " nb_labels ":10, 26 "data_distribution": [ 27 { 28 "name ":"gamma_similarity_niid", 29 " parameters ": { 30 "distribution_parameter": [1.0,0.75,0.5,0.25,0.0] 31 } 32 }, 33 { 34 "name ":"dirichlet_niid", 35 " parameters ": { 36 "distribution_parameter": [10.0,1.0,0.5,0.25,0.1] 37 } 38 } 39 ], 40 "loss ":"NLLLoss", 41 }, 42 " aggregator ": [ 43 { 44 "name ":"Median", 45 " parameters ": {} 46 }, 39 47 { 48 "name ":"TrMean", 49 " parameters ": {} 50 }, 51 { 52 "name ":" MultiKrum ", 53 " parameters ": {} 54 }, 55 { 56 "name ":" GeometricMedian ", 57 " parameters ": { 58 "nu ":0.1, 59 "T":3 60 } 61 }, 62 { 63 "name ":"CenteredClipping", 64 " parameters ": { 65 "L_iter":1, 66 "clip_thresh":100 67 } 68 } 69 ], 70 "pre_aggregators": [ 71 [ 72 { 73 "name ":" Clipping ", 74 " parameters ": { 75 "clip_factor":2 76 } 77 }, 78 { 79 "name ":" NNM", 80 " parameters ": {} 81 } 82 ], 83 [ 84 { 85 "name ":" Clipping ", 86 " parameters ": { 87 "clip_factor":2 88 } 89 } 90 ], 91 [ 92 { 93 "name ":" NNM", 94 " parameters ": {} 95 } 96 ], 97 [] 98 ], 99 "server": { 100 "learning_rate_decay":1.0, 101 " milestones ": [] 102 }, 103 "honest_nodes": { 104 " momentum ": [0,0.9,0.99], 105 " batch_size ":25, 106 " learning_rate ": [0.1,0.25], 107 "weight_decay":0.0001 108 }, 109 "attack": [ 110 { 111 "name ":"SignFlipping", 40