title: Collaborative Fairness in Federated Learning
authors: Lingjuan Lyu Xinyi Xu Qian Wang
text: 
  NGC 2366 : An optical search for possible supernova remnants A search for SNR in NGC 2366
      E. AktekinAktekin
      December 30, 2023
  =========================================================================================
  
  
  
  
  
  In current deep learning paradigms, local training or the Standalone framework tends to result in overfitting and thus poor generalizability. This problem can be addressed by Distributed or Federated Learning (FL) that leverages a parameter server to aggregate model updates from individual participants. However, most existing Distributed or FL frameworks have overlooked an important aspect of participation: collaborative fairness. In particular, all participants can receive the same or similar models, regardless of their contributions. To address this issue, we investigate the collaborative fairness in FL, and propose a novel Collaborative Fair Federated Learning (CFFL) framework which utilizes reputation to enforce participants to converge to different models, thus achieving fairness without compromising the predictive performance. Extensive experiments on benchmark datasets demonstrate that CFFL achieves high fairness, delivers comparable accuracy to the Distributed framework, and outperforms the Standalone framework. Our code is available on https://github.com/XinyiYS/CollaborativeFairFederatedLearninggithub.
  
  
  
  
  
  
  
  
  § INTRODUCTION
  
  
  Training complex deep neural networks on large-scale datasets is computationally expensive so it may not be feasible by a single participant. Moreover, training a complex model on a limited local dataset may lead to poor generalizability. In this context, Federated Learning (FL) emerged as a promising paradigm, as it provides a way for multiple devices/participants to jointly train a model whiling keeping their datasets local. The objective of FL is to derive a global model with better generalizability by leveraging the local datasets from multiple participants <cit.>.
  
  However, most of the current FL paradigms <cit.> allow all participants to receive the same federated model in each communication round and in the end, regardless of their contributions. This is obviously unfair, because in practice not all participants contribute equally due to various reasons, such as the diverse quality/quantity of the data owned by different participants. Therefore, the data from some participants may lead to good model updates while updates from some other participants can even impair the model performance. Consider a motivating practical example: several banks may want to collaborate to build a credit score predictor for small and medium enterprises. However, larger banks with more data may be reluctant to train their local model based on high quality local data because sharing these high quality model parameters with smaller banks may potentially erode the market share of the larger bank <cit.>. Furthermore, as the paradigm cannot distinguish the participants with high contributions from the ones with relatively low contributions, it is vulnerable to free-riders. Hence, 
  lacking collaborative fairness may hinder the formation and progress of a healthy FL ecosystem. Existing research on fairness mostly focuses on mitigating potential bias introduced to the model towards certain attributes <cit.>. The problem of treating the FL participants fairly according to their contributions remains open <cit.>.
  
  For any proposed solution or framework to be practical, it is essential to achieve fairness not at the cost of model performance. In this work, we address this problem of treating FL participants fairly based on their contributions by proposing a Collaborative Fair Federated Learning (CFFL) framework. Unlike existing work such as <cit.> which requires external monetary incentives for good behaviour, CFFL makes fundamental changes to the learning process in FL so that the participants will receive models with performance commensurate with their contributions, instead of the same FL model. CFFL achieves collaborative fairness with a reputation mechanism, which evaluates the contributions of the participants in the learning process and iteratively updates their respective reputations. We highlight the practical relevance of our CFFL in horizontally federated learning (HFL) to businesses (H2B) <cit.>, such as biomedical or financial institutions to whom collaborative fairness is very important.
  
  Our work aims to achieve collaborative fairness in FL by adjusting the performance of the models allocated to each participant based on their contributions <cit.>. Experiments on benchmark datasets demonstrate that CFFL achieves the highest fairness. 
  In terms of utility, the accuracy of the most contributive participant in CFFL is comparable to that of the Distributed framework, and higher than that of the Standalone framework. In the following sections, we interchangeably use Distributed/Federated.
  
  
  
  
  
  § RELATED WORK
  
  
  In this section, we review the relevant literature on fairness in FL to position our research in relation to existing research.
  
  One existing approach for promoting collaborative fairness among federated participants is based on incentive schemes <cit.>. In principle, participants shall receive payoffs commensurate with their contributions. Equal division is an example of egalitarian profit-sharing <cit.>. Under this scheme, the available total payoff at a given round is equally divided among all participants. Under the Individual profit-sharing scheme <cit.>, each participant i's own contribution to the collective (assuming a singleton collective of i) is used to determine his share of the total payoff.
  
  The Labour Union game <cit.> profit-sharing scheme determines a participant's share of the total payoff based on his marginal contribution to the utility of the collective formed by his predecessors. 
  The Fair-value game scheme <cit.> is a marginal loss-based scheme. Under this scheme, a participant's share of the total payoff is determined according to the sequence of the participants leaving the collective. The Shapley game profit-sharing scheme <cit.> is also a marginal contribution-based scheme. Unlike the Labour Union game, Shapley game aims to eliminate the effect of the sequence in which the participants join the collective in order to obtain a fairer estimate of their marginal contributions to the collective. 
  However, the complexity of this approach is exponential in the number of participants, making it prohibitively expensive for large-scaled FL in practice.
  
  For gradient-based FL approaches, the gradient information can be regarded as a useful source of data. However, in these cases, output agreement-based rewards are hard to apply as mutual information requires a multi-task setting which is usually not present in such cases. Thus, among these three categories of schemes, model accuracy is the most relevant way of designing rewards for FL. There are two emerging federated learning incentive schemes focused on model improvement.
  
  Richardson  <cit.> proposed a scheme which pays for marginal improvements brought about by model updates. The sum of improvements might result in overestimation of contribution. Thus, the proposed approach also includes a model for correcting the overestimation issue. This scheme ensures that payment is proportional to model quality improvement, which means the budget for achieving a target model quality level is predictable. It also ensures that data owners who submit model updates early receive a higher reward. This in turn motivates them to participate even in early stages of the federated model training process. 
  
  Yu  <cit.> proposed a joint objective optimization-based approach that in addition to the contributions of the participants, takes costs and waiting time into account in order to achieve additional notions of fairness when distributing payoffs to the FL participants. 
  
  
  
  
  § THE CFFL FRAMEWORK
  
  
  
  
   §.§ Collaborative Fairness
  
  
  
  Different from the existing approaches, our proposed framework provides an alternative paradigm, in which participants are allocated with different versions of the FL model with performance commensurate with their contributions.
  Under this context, we define collaborative fairness as follows.
  
  
  Collaborative fairness. In a federated system, a high-contribution participant should be rewarded with a better performing local model than a low-contribution participant. Mathematically, fairness can be 
  quantified by the correlation coefficient between the contributions of participants and their respective final model accuracies. 
  
  
  
  
   §.§ Fairness via Reputation
  
  In our CFFL, we modify FL by allowing participants to download only the allocated aggregated updates according to their reputations. The server manages a reputation list for all participants, and updates it according to the quality of the uploaded gradients of each participant in each communication round. The upload rate – θ_u – denotes the proportion of parameters of which gradients are uploaded, i.e., if θ_u=1, gradients of all parameters are uploaded; if θ_u=0.1, gradients of only 10% the parameters are uploaded. We further denote the selected set of gradients as S, corresponding to θ_u gradients selected according to the “largest values" criterion: sort the gradients in Δw⃗_j (by their 
  magnitude), and upload θ_u of them, starting from the largest. 
  Specifically, the server separately evaluates the validation accuracy of participant j by integrating j's uploaded gradients. In particular, if θ_u=1, Δ (w⃗_j)^S ≜Δw⃗_j, the server can derive participant j's entire model w⃗_j, as all participants are initialized with the same parameters in the beginning. The server then computes the validation accuracy of participant j based on w⃗_j as vacc_j  V(w⃗_j + Δ (w⃗_j)^S), here V denotes the validation dataset. If θ_u ≠ 1, the server simply integrates participant j's uploaded gradients Δ (w⃗_j)^S into an auxiliary model w⃗_g kept by the server to compute participant j's validation accuracy as vacc_j  V(w⃗_g + Δ (w⃗_j)^S). Note w⃗_g is an auxiliary model maintained by the server to 
  aggregate gradients and calculate participants' reputations, and its parameters are not broadcast to individual participants as in the standard FL systems.
  
  Then the server normalizes vacc_j and passes the normalized vacc_j through a sinh(α) function in Eq. (<ref>) to calculate the reputation c_j of participant j in each communication round.
  
      c_j=sinh(α*x)
  
  Here x is the normalized vacc_j, so the higher x, the more informative participant j's uploaded gradients are. sinh(α) is introduced as a punishment function, and α denotes the punishment factor, used to distinguish the reputations among participants based on how informative their uploaded gradients are. The server iteratively updates the reputation of each participant separately based on the calculated reputation in each round and its historical reputation. The high-contribution participant will be highly rated by the server, while the low-contribution participant can be detected and even isolated from the federated system, avoiding the low-contribution participants from dominating the whole system, or free-riding. 
  
  This computed reputation determines the number of aggregated gradients each participant will be allocated in the subsequent communication round. The higher the reputation of participant j, the more aggregated gradients will be allocated to participant j. The aggregated gradients refer to the collection of gradients from all participants, 
  and are used here as a form of reward in each communication round. The detailed realization of CFFL is in Algorithm <ref>. In each communication round, each participant uploads θ_u fraction of clipped gradients to the server, and server updates the reputation based on the performance of these uploaded gradients on a validation set, and determines the number of aggregated updates to allocate to each participant. We adopt gradient clipping to reduce the impact of noise from abnormal examples/outliers.
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
       
  
  
  
  
  
  
  
  
  
      
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
      
  
  
  
  
  
  
  
  
  
  
   §.§ Quantification of Fairness
  
  In this work, we quantify collaborative fairness via the correlation coefficient between participant contributions (X-axis: test accuracies of standalone models which characterize their individual learning capabilities on their own local datasets) and participant rewards (Y-axis: test accuracies of final models received by the participants). 
  
  Participants with higher standalone accuracies empirically contribute more.
  Therefore, the X-axis can be expressed by Equation <ref>, where sacc_j denotes the standalone model accuracy of participant j:
  
      x⃗={sacc_1,⋯,sacc_n}
  
  
  Similarly, Y-axis can be expressed by Equation <ref>, where acc_j represents the final model accuracy of participant j:
  
      y⃗={acc_1,⋯,acc_n}
  
  
  As the Y-axis measures the respective model performance of different participants after collaboration, it is expected to be positively correlated with the X-axis for a good measure of fairness. Hence, we formally quantify collaborative fairness in Equation <ref>:
  
      r_xy=∑_i=1^n (x_i-x̅)(y_i-y̅)/(n-1)s_xs_y
  
  where x̅ and y̅ are the sample means of x⃗ and y⃗, s_x and s_y are the corrected standard deviations. The range of fairness falls within [-1,1], with higher values implying good fairness. Conversely, negative coefficient implies poor fairness. 
  
  
  
  
  § EXPERIMENTAL EVALUATION
  
  
  
  
   §.§ Datasets
  
  We implement experiments on two benchmark datasets. The first is the MNIST dataset[<http://yann.lecun.com/exdb/mnist/>] for handwritten digit recognition, consisting of 60,000 training examples and 10,000 test examples. The second is the Adult Census dataset[<http://archive.ics.uci.edu/ml/datasets/Adult>]. 
  This dataset is commonly used to predict whether an individual makes over 50K dollars in a year (binary). There are total 48,843 records, 
  we manually balance the dataset to have 11687 records over 50K and 11687 records under 50K, resulting in total 23374 records. We then conduct an 80-20 train-test split. For all datasets, we randomly choose 10% of training examples as the validation set. 
  
  
  
   §.§ Baselines
  
  We demonstrate the effectiveness of our proposed CFFL framework through comparison with the following frameworks.
  
  Standalone framework allows participants to train standalone models on local datasets without collaboration. This framework delivers minimum utility, because each participant is susceptible to falling into local optima when training alone. In addition, we remark that there is no concrete concept of collaborative fairness in the Standalone framework, because participants do not collaborate.
  
  Distributed framework enables participants to train independently and concurrently, and share their gradients or model parameters to achieve a better global model. For comparison, we choose two representative Distributed baselines, including FedAvg <cit.> and DSSGD <cit.>.
  
  Furthermore, we investigate different upload rates θ_u=0.1 and θ_u=1 <cit.>, where gradients are uploaded according to the “largest values” criterion when θ_u=0.1. The rationale behind introducing an upload rate less than 1 is to reduce overfitting and to save communication overhead. 
  
  
  
  
   §.§ Experimental Setup
  
  
  Due to the fact that the data are often heterogeneous across participants both in terms of size and distribution, we investigate the following two realistic scenarios:
  
  Imbalanced data size. To simulate data size heterogeneity, we follow a power law to randomly partition total {3000,6000,12000} MNIST examples among {5,10,20} participants respectively. Similarly, for Adult dataset, {4000,8000,12000} examples are randomly partitioned among {5,10,20} participants. In this way, each participant has a distinctly different number of examples, with the first participant has the least and the last participant has the most. We remark that the purpose of allocating on average 600 MNIST examples for each participant is to fairly compare with Shokri  <cit.>, where each participant has a small number of 600 local examples to simulate data scarcity which necessitates collaboration. 
  
  Imbalanced class numbers. 
  To examine data distribution heterogeneity, we vary the class numbers in the data of each participant, increasing from the first participant to the last. For this scenario, we only investigate the MNIST dataset. We distribute classes in a linspace manner, for example, participant-{1,2,3,4,5} own {1,3,5,7,10} classes from MNIST dataset respectively. In more detail, for MNIST with total 10 classes and 5 participants, we simulate the first participant has data from only 1 class, while the last participant has data from 10 classes. We first partition the training dataset according to the labels, and then sample and assign subsets of training data with corresponding labels to the participants. Note that each participant still has the same number of examples, 600 examples. 
  
  Model and Hyper-Parameters. For MNIST Imbalanced data size experiment, we use a two-layer fully connected neural network with 128 and 64 units respectively. The hyperparameters are: local epochs E=2, local batch size B=16, and local learning rate lr=0.15 for P=5 and lr=0.25 for P={10, 20}, with exponential decay of γ = 0.977, gradient clipping between [-0.01, 0.01], with a total of 30 communication rounds. For MNIST Imbalanced class numbers experiment, the same neural network architecture is used. The hyperparameters are: local epochs E=1, local batch size B=16, and local learning rate lr=0.15 for P={5, 10, 20}, with exponential decay of γ = 0.977, gradient clipping between [-0.01, 0.01], with a total of 50 communication rounds. For Adult, we use a single layer fully connected neural network with 32 units. The hyperparameters are: local epochs E=2, local batch size B=16, and local learning rate lr=0.03 with exponential decay of γ = 0.977, gradient clipping between [-0.01, 0.01], with a total of 30 communication rounds. 
  
  Furthermore, to reduce the impact of different initializations and avoid non-convergence, we initialize the same model parameter w⃗_0 for all participants and the server w⃗_g. 
  For all the experiments, we empirically set the reputation threshold via grid search as follows:
  c_th=1/|R|*1/3 for imbalanced data size, and c_th=1/|R|*1/6 for imbalanced class numbers, where |R| is the number of participants with reputations higher than the threshold. For the punishment factor, we empirically choose α=5. Stochastic Gradient Descent(SGD) is used as the optimization technique throughout.
  
  Communication Protocol. In standard FL, one global model is given to all participants, both during and at the end of the training process. Such a setup forbids the calculation of our definition of fairness via the pearson coefficient, when all participants have the same reward. To mitigate this, we follow <cit.> to adopt the round-robin communication protocol for DSSGD and FedAvg. 
  In each communication round, participants upload parameter updates and download parameters in sequence, leading to models with insignificant performance differences, so that their test accuracies can be used for the calculation of fairness. 
  
  
  
  
   §.§ Experimental Results
  
  
  
  
  
  Fairness comparison.
  Table <ref> lists the calculated fairness of 
  DSSGD, FedAvg and CFFL over MNIST and Adult under varying participant number settings from {5,10,20}, different pretraining status from {1,0}, and different upload rates θ_u from {0.1, 1}. From the high values of fairness (some close to the theoretical limit of 1.0), we conclude that CFFL achieves good fairness, confirming the intuition behind our notion of fairness: the participants with higher contributions are rewarded with better-performing models. Moreover, pretrain=1 can lead to slightly higher fairness than pretrain=0. This is attributed to the individual pretraining of 5 epochs before collaborative learning starts, because the participants' models have already moved towards their respective model optimum. Note that pretraining is only conducted for CFFL. We also observe that DSSGD and FedAvg yield significantly lower fairness than our CFFL. This is expected since neither the communication protocol nor the learning algorithm incorporates the concept of fairness.
  
  
  
  Accuracy comparison. 
  Table <ref> reports the corresponding accuracies on MNIST and Adult datasets of {5,10,20} participants when θ_u=0.1. Here we report the best accuracy achieved among the participants, because CFFL enables participants to converge to different final models, so we expect the most contributive participant to receive a model with the highest accuracy comparable to both Distributed frameworks. For the Standalone framework, we show the accuracy of the same participant. It can be observed that CFFL obtains comparable accuracy to DSSGD and FedAvg, and always attains higher accuracy than the Standalone framework. For example, for MNIST with 20 participants, our CFFL (CFFL*) achieves 93.25 (93.34)% test accuracy, higher than the Standalone framework (90.64%), and slightly lower than FedAvg (96.26%). The observation that DSSGD achieves lowest accuracy in this setting can be attributed to its higher instability and fluctuations during training. 
  
  
  
  
  Individual model performance. 
  
  To examine the impact of our CFFL on individual convergence, Figure <ref> plots the test accuracy of each participant for the Standalone framework and CFFL with upload rate of {0.1,1} and with/without pretraining over MNIST across 30 (communication) rounds. It can be observed that our CFFL consistently delivers better accuracy than the standalone model of any participant.  Importantly, it confirms that our CFFL enforces the participants to converge to different local models, which are still better than their standalone models without collaboration, thereby offering fairness and utility as claimed. 
  We also observe slight fluctuations at the beginning of training. This can be attributed to the fact that participants are allocated with different aggregated updates from the server. As we can see from these figures, the convergence curves for CFFL (with pretrain) and CFFL (w/o pretrain) follow the similar trend, confirming that pretraining does not alter the overall convergence behaviour, but provides relatively better fairness in most cases.
  
  
  
  
  
  For imbalanced class numbers, Figure <ref> shows individual model accuracy in the Standalone framework and our CFFL. We see that all participants achieve higher accuracies in CFFL than their standalone counterparts. Similar to the scenario of imbalanced data size, all participants converge to different final models, but with more obvious accuracy gaps, resulting in higher fairness. Moreover, it takes longer for participants to converge when there are more participants in the system. 
  
  
  
  
  
  
  
  
  
  § DISCUSSIONS
  
  
  Robustness to Free-riders.  
  In an FL system, there may exist free-riders who aim to benefit from the global model, without really contributing. Typically, free-riders may pretend to be contributing by 
  uploading random or noisy updates. In standard FL systems, there is no specific safeguard against this, so even free-riders can enjoy the system's global model at virtually no cost. Conversely, CFFL can automatically identify and isolate free-riders. This is because the empirical utility (on the validation set) of the random or noisy gradients is generally low. As collaborative training proceeds, the free-riders will receive gradually lower reputations, and eventually be isolated from the system when their reputations fall below the reputation threshold. Through our additional experiments (including 1 free rider who always uploads random values as gradients), we observe that our CFFL can always identify and isolate the free rider at the early stages of collaboration, without affecting both accuracy and convergence.
  
  Choice of Reputation Threshold. Using a reputation threshold c_th allows the server to enforce a lower bound on the reputation. This can be used to detect and isolate the free-rider in the system. A key challenge lies in the selection of an appropriate threshold, as fairness and accuracy may be inversely affected. For example, too small c_th might allow low-contribution participant to sneak into the federated system without being detected and isolated. On the contrary, too large c_th might isolate too many participants in the system. In our experiments, we empirically find suitable values for different scenarios.
  
  
  
  § CONCLUSION AND FUTURE WORK
  
  
  This work initiates the research 
  on collaborative fairness in federated learning (FL), and modifies FL to enforce participants to converge to different models. A novel collaborative fair federated learning framework named CFFL is proposed. Based on empirical individual model performance on a validation set, a reputation mechanism is introduced to mediate participant rewards across communication rounds. Experimental results demonstrate that CFFL achieves comparable accuracy to two Distributed frameworks, and always achieves better accuracy than the Standalone framework, confirming the effectiveness of CFFL in terms of both fairness and utility. A number of avenues for further work are appealing. In particular, we would like to study how to quantify fairness in more complex settings, 
  and 
  apply our framework to various domains, such as financial, biomedical, speech, NLP, etc. Furthermore, we would like to systematically integrate robustness with fairness. 
  It is expected that our system can find wide applications in real world.
  
  
  
  
  IEEEbib
  
  
  