AdaptiveBatchHE
An adaptive batch homomorphic encryption framework for cross-device Federated Learning, which determines cost-efficient and sufficiently secure encryption strategies for clients with heterogeneous data and system capabilities.
Install / Use
/learn @liyan2015/AdaptiveBatchHEREADME
AdaptiveBatchHE
<!-- start intro -->This repository provides the implementation of the paper "Adaptive Batch Homomorphic Encryption for Joint Federated Learning in Cross-Device Scenarios", which is published in IEEE INTERNET OF THINGS JOURNAL. In this paper, we propose an adaptive batch HE framework for cross-device FL, which determines cost-efficient and sufficiently secure encryption strategies for clients with heterogeneous data and system capabilities. Our framework can achieve comparable accuracy to plain HE (i.e., encryption applied per gradient), while reducing training time by 3×-31×, and communication cost by 45×-66×.
<table> <tr> <td width="25%"><img src="fig/non_iid_three_trainingtime.jpg" width="300"></td> <td width="25%"><img src="fig/non_iid_epochs_accuracy.jpg" width="300"></td> <td width="25%"><img src="fig/non_iid_communication_cost.jpg" width="300" ></td> <td width="25%"><img src="fig/batchencryption_epochs_accuracy.jpg" width="300"></td> </tr> <tr> <td width="25%">Training time over 100 epochs</td> <td width="25%">Testing accuracy over epochs</td> <td width="25%">Communication cost in one epoch</td> <td width="25%">Cost efficiency under various HE key sizes</td> </tr> </table>Our framework consists of the following three key components:
<p align="center"> <img src="fig/framework.jpg" align="center" width="85%"/> </p> <!-- end intro -->1. Clustering of Clients based on Sparsity of CNNs
<!-- start sparsity --> <p align="center"> <img src="fig/sparsity.jpg" align="center" width="40%"/> </p>The codes in CNN Sparisty are for determining the sparsity vectors of clients.
federated_main.py is the main function.
The input is the path of the dataset.
<!-- end sparsity -->2. Selection of HE Key Size for Each Client based on Fuzzy Logic
<!-- start fuzzy --> <p align="center"> <img src="fig/fuzzyworkflow.jpg" align="center" width="100%"/> </p>The codes in fuzzy logic are for determining the HE key size of clients.
fuzzy_logic_main.py is the main function.
There are three inputs: input_NS, input_TR, and input_CC.
Their values are between 0 and 1.
<!-- end fuzzy -->3. Accuracy-lossless Batch Encryption and Aggregation
<!-- start batch --> <p align="center"> <img src="fig/batchencry_server_client.jpg" align="center" width="100%"/> </p>The codes in batch encryption are for accuracy-lossless batch encryption and aggregation of model parameters during FL training.
federated_experiment_main.py is the main function.
The main function needs a proper hyperparameter K to run correctly, of which reason has been explained with detail in the paper. The default K value is 4. For specific settings, please refer to the comments in the codes.
<!-- end batch -->Prerequisites
To run the code, the following libraies are needed:
- Python >= 3.8
- Pytorch >= 1.10
- torchvision >= 0.11
- phe >= 1.5
- skfuzzy >= 0.4
Check environment.yaml for details.
Citing
<!-- start citation -->If you use this repository, please cite:
@article{han2023adaptiveBatchHE,
title={Adaptive Batch Homomorphic Encryption for Joint Federated Learning in Cross-Device Scenarios},
author={Han, Junhao and Yan, Li},
journal={IEEE Internet of Things Journal},
volume={11},
number={6},
pages={9338--9354},
year={2023},
}
List of publications that cite this work: Google Scholar
<!-- end citation -->Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
sec-edgar-agentkit
10AI agent toolkit for accessing and analyzing SEC EDGAR filing data. Build intelligent agents with LangChain, MCP-use, Gradio, Dify, and smolagents to analyze financial statements, insider trading, and company filings.
Kiln
4.7kBuild, Evaluate, and Optimize AI Systems. Includes evals, RAG, agents, fine-tuning, synthetic data generation, dataset management, MCP, and more.
