A Federated-Learning Algorithm Based on Client Sampling and Gradient Projection for the Smart Grid
Abstract
:1. Introduction
- We propose a federated-learning algorithm tailored for smart grids, which is based on client-sampling strategies and gradient-projection techniques. This algorithm divides the model-training process in federated learning into two stages: pre-training and formal training.
- In the pre-training stage, a client-sampling strategy is employed to address external conflicts. In the formal training stage, the gradient-projection algorithm is used to handle internal conflicts.
- By resolving internal and external conflicts during federated-learning training, the proposed algorithm enhances the fairness of federated-learning models while ensuring global model accuracy and reducing communication costs.
2. Related Work
2.1. Based on Client Weight Allocation Strategies
2.2. Based on Client-Sampling Strategies
2.3. Based on Personalized Local Models
3. Proposed Approach
3.1. Related Definitions
3.2. Overview: FedCSGP Algorithm
3.3. Detailed: FedCSGP Algorithm
- Pre-training phase
- Step 1: The central server initializes and sends it to k clients.
- Step 2: Each client i trains the received global model using its local data through gradient descent. After local iterative training, the client obtains a local model update and sends it to the central server, where .
- Step 3: The central server receives the uploaded local model updates from the clients and performs hierarchical clustering on these updates. This process generates C clusters and calculates the total data quantity owned by each cluster.
- Step 4: The C clusters are sorted in descending order based on their total data quantities . Then, the clusters are merged into m clusters according to the rule of having an equal data quantity in each cluster. The probability of selecting each client within a cluster is computed.
- Formal training phase
- Step 1: The central server randomly selects m clients from each cluster with probability .
- Step 2: The central server sends the current global model to the selected clients, where represents the global model in the t-th round.
- Step 3: The selected clients train their local models using their respective local data through gradient descent. After local iterative training, each client obtains its local model and the corresponding loss value in the t-th round.
- Step 4: The clients send their local models and loss values to the central server.
- Step 5: The central server calculates the local model update for each client and stores them in W, i.e., .
- Step 6: The local model updates in W are sorted in ascending order based on their corresponding loss values. The sorted updates are stored in , i.e., , where i represents the client index.
- Step 7: For each update in , check if holds, indicating an internal conflict between and , where is from and . If holds, it implies an internal conflict, and needs to undergo orthogonal projection to mitigate the conflict. Compute .
- Step 8: Calculate the sum of the local model updates .
- Step 9: Scale the sum of the projected local model updates by .
- Step 10: The central server updates the global model as .
Repeat Steps 1 to 10 until the predetermined training rounds are reached.
Algorithm 1 FedCSGP Algorithm. |
Input: , m, k, T Output:
|
Algorithm 2 Gradient project algorithm. |
Input: , m, k, T Output:
|
4. Experiments
4.1. Datasets
4.2. Experimental Setup
4.3. Experimental Results
4.3.1. MNIST
4.3.2. CIFAR-10
5. Conclusions and Future Work
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
Abbreviations
Notation | Meaning |
Initialized global model | |
k | Total number of clients |
T | Communication rounds |
Local model update of client i in the pre-training phase | |
Local model trained by client i in the pre-training phase | |
C | Number of classes obtained in the pre-training phase |
Total data quantity of all clients in class j | |
m | Number of clients sampled per training round |
Probability of client k being selected | |
Global model in the t-th round | |
Local model and loss value of client i in the t-th round | |
Local model update of client i in the t-th round | |
W | List of local model updates of clients before sorting |
List of local model updates of clients after sorting | |
Projected size of local model update of client i | |
Sum of projected local model updates |
References
- Taghia, J.; Moradi, F.; Larsson, H.; Lan, X.; Orucu, A.; Ebrahimi, M.; Johnsson, A. Congruent learning for self-regulated federated learning in 6g. IEEE Trans. Mach. Learn. Commun. Netw. 2024, 2, 129–149. [Google Scholar] [CrossRef]
- Voigt, P.; Von dem Bussche, A. The eu general data protection regulation (gdpr). In A Practical Guide, 1st ed.; Springer International Publishing: Cham, Switzerland, 2017; Volume 10, pp. 10–5555. [Google Scholar]
- de la Torre, L. A Guide to the California Consumer Privacy Act of 2018. SSRN Electron. J. 2018; 1–8, SSRN 3275571. [Google Scholar]
- Han, S.W.; Munir, A.B. Information security technology-personal information security specification: China’s version of the gdpr. Eur. Data Prot. Law Rev. 2018, 4, 535. [Google Scholar]
- Liu, X.; Deng, Y.; Nallanathan, A.; Bennis, M. Federated learning and meta learning: Approaches, applications, and directions. IEEE Commun. Surv. Tutor. 2024, 26, 571–618. [Google Scholar] [CrossRef]
- Kalapaaking, A.P.; Khalil, I.; Rahman, M.S.; Atiquzzaman, M.; Yi, X.; Almashor, M. Blockchain-based federated learning with secure aggregation in trusted execution environment for internet-of-things. IEEE Trans. Ind. Inform. 2023, 19, 1703–1714. [Google Scholar] [CrossRef]
- He, S.; Shi, K.; Liu, C.; Guo, B.; Chen, J.; Shi, Z. Collaborative sensing in internet of things: A comprehensive survey. IEEE Commun. Surv. Tutor. 2022, 24, 1435–1474. [Google Scholar] [CrossRef]
- Dressel, J.; Farid, H. The accuracy, fairness, and limits of predicting recidivism. Sci. Adv. 2018, 4, eaao5580. [Google Scholar] [CrossRef] [PubMed]
- Du, W.; Xu, D.; Wu, X.; Tong, H. Fairness-aware agnostic federated learning. In Proceedings of the 2021 SIAM International Conference on Data Mining (SDM), Virtual Event, 29 April–1 May 2021; SIAM: Philadelphia, PA, USA, 2021; pp. 181–189. [Google Scholar]
- Briggs, C.; Fan, Z.; Andras, P. Federated learning with hierarchical clustering of local updates to improve training on non-iid data. In Proceedings of the 2020 International Joint Conference on Neural Networks (IJCNN), Glasgow, UK, 19–24 July 2020; pp. 1–9. [Google Scholar]
- Ghosh, A.; Hong, J.; Yin, D.; Ramchandran, K. Robust federated learning in a heterogeneous environment. arXiv 2019, arXiv:1906.06629. [Google Scholar]
- Smith, V.; Chiang, C.-K.; Sanjabi, M.; Talwalkar, A.S. Federated multi-task learning. Adv. Neural Inf. Process. Syst. 2017, 30, 4427–4437. [Google Scholar]
- Kairouz, P.; McMahan, H.B.; Avent, B.; Bellet, A.; Bennis, M.; Bhagoji, A.N.; Bonawitz, K.; Charles, Z.; Cormode, G.; Cummings, R.; et al. Advances and open problems in federated learning. Found. Trends® Mach. Learn. 2021, 14, 1–210. [Google Scholar] [CrossRef]
- Mohri, M.; Sivek, G.; Suresh, A.T. Agnostic federated learning. In International Conference on Machine Learning; PMLR: New York, NY, USA, 2019; pp. 4615–4625. [Google Scholar]
- Wang, J.; Liu, Q.; Liang, H.; Joshi, G.; Poor, H.V. Tackling the objective inconsistency problem in heterogeneous federated optimization. arXiv 2020, arXiv:2007.07481. [Google Scholar]
- Hu, Z.; Shaloudegi, K.; Zhang, G.; Yu, Y. Federated learning meets multi-objective optimization. IEEE Trans. Netw. Sci. Eng. 2022, 9, 2039–2051. [Google Scholar] [CrossRef]
- Cui, S.; Pan, W.; Liang, J.; Zhang, C.; Wang, F. Addressing algorithmic disparity and performance inconsistency in federated learning. Adv. Neural Inf. Process. Syst. 2021, 34, 26091–26102. [Google Scholar]
- Hamer, J.; Mohri, M.; Suresh, A. Fedboost: A communication-efficient algorithm for federated learning. PMLR 2020, 119, 3973–3983. [Google Scholar]
- Li, T.; Sanjabi, M.; Beirami, A.; Smith, V. Fair resource allocation in federated learning. arXiv 2019, arXiv:1905.10497. [Google Scholar]
- Zhao, Z.; Joshi, G. A dynamic reweighting strategy for fair federated learning. In Proceedings of the ICASSP 2022—2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Virtual, 7–13 May 2022; pp. 8772–8776. [Google Scholar]
- Sun, Y.; Si, S.; Wang, J.; Dong, Y.; Zhu, Z.; Xiao, J. A fair federated learning framework with reinforcement learning. In Proceedings of the 2022 International Joint Conference on Neural Networks (IJCNN), Padua, Italy, 18–23 July 2022; pp. 1–8. [Google Scholar]
- Li, T.; Beirami, A.; Sanjabi, M.; Smith, V. Tilted empirical risk minimization. arXiv 2020, arXiv:2007.01162. [Google Scholar]
- Yang, M.; Wang, X.; Zhu, H.; Wang, H.; Qian, H. Federated learning with class imbalance reduction. In Proceedings of the 2021 29th European Signal Processing Conference (EUSIPCO), Dublin, Ireland, 23–27 August 2021; pp. 2174–2178. [Google Scholar]
- Huang, T.; Lin, W.; Wu, W.; He, L.; Li, K.; Zomaya, A.Y. An efficiency-boosting client selection scheme for federated learning with fairness guarantee. IEEE Trans. Parallel Distrib. Syst. 2020, 32, 1552–1564. [Google Scholar] [CrossRef]
- Zhou, P.; Fang, P.; Hui, P. Loss tolerant federated learning. arXiv 2021, arXiv:2105.03591. [Google Scholar]
- YiLin, W.; Zhao, N.; Yan, Z. Client selection method based on local model quality. Comput. Eng. 2023, 49, 131–143. [Google Scholar]
- Hao, W.; El-Khamy, M.; Lee, J.; Zhang, J.; Liang, K.J.; Chen, C.; Duke, L.C. Towards fair federated learning with zero-shot data augmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 3310–3319. [Google Scholar]
- Fraboni, Y.; Vidal, R.; Kameni, L.; Lorenzi, M. Clustered sampling: Low-variance and improved representativity for clients selection in federated learning. In Proceedings of the International Conference on Machine Learning, Virtual, 18–24 July 2021; pp. 3407–3416. [Google Scholar]
- Ghosh, A.; Chung, J.; Yin, D.; Ramchandran, K. An efficient framework for clustered federated learning. Adv. Neural Inf. Process. Syst. 2020, 33, 19 586–19 597. [Google Scholar] [CrossRef]
- Li, T.; Sahu, A.K.; Zaheer, M.; Sanjabi, M.; Talwalkar, A.; Smith, V. Federated optimization in heterogeneous networks. Proc. Mach. Learn. Syst. 2020, 2, 429–450. [Google Scholar]
- Jiahui, T.; Lv, T.; Zhou, R. A fair resource allocation scheme in federated learning. J. Comput. Res. Dev. 2022, 59, 1240–1254. [Google Scholar]
- Li, T.; Hu, S.; Beirami, A.; Smith, V. Ditto: Fair and robust federated learning through personalization. In Proceedings of the International Conference on Machine Learning, Virtual, 18–24 July 2021; pp. 6357–6368. [Google Scholar]
- Yu, T.; Kumar, S.; Gupta, A.; Levine, S.; Hausman, K.; Finn, C. Gradient surgery for multi-task learning. Adv. Neural Inf. Process. Syst. 2020, 33, 5824–5836. [Google Scholar]
- Wang, Z.; Fan, X.; Qi, J.; Wen, C.; Wang, C.; Yu, R. Federated learning with fair averaging. arXiv 2021, arXiv:2104.14937. [Google Scholar]
- McMahan, B.; Moore, E.; Ramage, D.; Hampson, S.; y Arcas, B.A. Communication-efficient learning of deep networks from decentralized data. In Proceedings of the Artificial Intelligence and Statistics, Fort Lauderdale, FL, USA, 20–22 April 2017; pp. 1273–1282. [Google Scholar]
- LeCun, Y.; Cortes, C.; Burges, C. Mnist Handwritten Digit Database. 2010. Available online: http://yann.lecun.com/exdb/mnist/ (accessed on 19 May 2024).
- Krizhevsky, A.; Hinton, G. Learning Multiple Layers of Features from Tiny Images. 2009. Available online: https://www.cs.toronto.edu/~kriz/cifar.html (accessed on 19 May 2024).
- Hsu, T.-M.H.; Qi, H.; Brown, M. Measuring the effects of non-identical data distribution for federated visual classification. arXiv 2019, arXiv:1909.06335. [Google Scholar]
Parameter | Value |
---|---|
Operating System | Ubuntu 20.04 |
Memory | 40 GB |
CPU and GPU | Intel(R) Xeon(R) 8255C CPU, RTX 3080 (10 GB) |
Development Framework | PyTorch 1.11.0 |
Programming Language | Python 3.8 |
Performance Metric | FedCSGP | FedAvg | FedFV | Clustered_Sampling |
---|---|---|---|---|
Var() | 0.00106 | 0.00148 | 0.00118 | 0.00132 |
Lowest Accuracy | 0.83266 | 0.81094 | 0.81446 | 0.83132 |
Highest Accuracy | 1 | 1 | 1 | 1 |
Average Accuracy | 0.96062 | 0.95346 | 0.96216 | 0.95458 |
Top 5% | 1 | 1 | 1 | 1 |
Worst 5% | 0.87464 | 0.85104 | 0.8675 | 0.86366 |
Runtime | 843.13628 | 442.20558 | 621.50996 | 1148.10524 |
Performance Metric | FedCSGP | FedAvg | FedFV | Clustered_Sampling |
---|---|---|---|---|
Var() | 0.01532 | 0.01796 | 0.01944 | 0.01518 |
Lowest Accuracy | 0.31622 | 0.23714 | 0.24056 | 0.29294 |
Highest Accuracy | 0.92018 | 0.90702 | 0.93846 | 0.91292 |
Average Accuracy | 0.59628 | 0.5628 | 0.58618 | 0.58192 |
Best 5% Accuracy | 0.85388 | 0.85126 | 0.875 | 0.8411 |
Worst 5% Accuracy | 0.35244 | 0.30652 | 0.33504 | 0.33226 |
Runtime (seconds) | 3474.92874 | 1963.22436 | 2511.23318 | 3874.9994 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Zhao, R.; Lu, J.; Liu, Z.; Wang, T.; Guo, W.; Lan, T.; Hu, C. A Federated-Learning Algorithm Based on Client Sampling and Gradient Projection for the Smart Grid. Electronics 2024, 13, 2023. https://doi.org/10.3390/electronics13112023
Zhao R, Lu J, Liu Z, Wang T, Guo W, Lan T, Hu C. A Federated-Learning Algorithm Based on Client Sampling and Gradient Projection for the Smart Grid. Electronics. 2024; 13(11):2023. https://doi.org/10.3390/electronics13112023
Chicago/Turabian StyleZhao, Ruifeng, Jiangang Lu, Zewei Liu, Tianqi Wang, Wenxin Guo, Tian Lan, and Chunqiang Hu. 2024. "A Federated-Learning Algorithm Based on Client Sampling and Gradient Projection for the Smart Grid" Electronics 13, no. 11: 2023. https://doi.org/10.3390/electronics13112023
APA StyleZhao, R., Lu, J., Liu, Z., Wang, T., Guo, W., Lan, T., & Hu, C. (2024). A Federated-Learning Algorithm Based on Client Sampling and Gradient Projection for the Smart Grid. Electronics, 13(11), 2023. https://doi.org/10.3390/electronics13112023