Secure Federated Learning using Hybrid Homomorphic Encryption.
⚠️ Caution: Running everything below (especially the HHE protocol) requires a machine with at least 64 GB of RAM
Please make sure that you have these installed:
- The
justcommand runner. Installation guide here - The
uvPython package and project manager. Installation guide here - The Go programming language
just setup-venvThis will create a vertual Set up the Python env and install the Python packages needed. When it's done, please run
source .venv/bin/activateand you are ready.
just prepare-mnist-dataThis will create 3 partitions for training:
- Partition 1: No labels 1, 3, 7
- Partition 2: No labels 2, 5, 8
- Partition 3: No labels 4, 6, 9
And 4 test sets for evaluation:
- Test set that only includes label 1, 3, 7
- Test set that only includes label 2, 5, 8
- Test set that only includes label 4, 6, 9
- Test set that only includes all labels
The datasets will be saved into data/MNIST/processed
just train-mnist-model-save-weightsThis will train 3 models locally on the partitioned MNIST datasets. Weights will be saved into weights/MNIST/plain
just run-mnist-fed-avgThis will do plaintext averaging of the 3 trained model, and then evaluate them on all test sets
just run-heEach client encrypts the plaintext weights in CKKS, and then the server does HE encrypted FedAvg
just run-mnist-fed-avg-he
Evaluate the decrypted average weights from plain HE FedAvg
just run-hhe
This will run the FedAvg protocol using HHE. Each client encrypts the plaintext weights into symmetric ciphertexts and sends to the server. The server transciphers the symmetric ciphertexts into HE ciphertexts, and finally does HE encrypted FedAvg
just test-hheThis decrypts the HE avg ciphertext weights from the HHE protocol, and compare it with the one outputs by plain HE FedAvg
just run-mnist-fed-avg-hheEvaluate the decrypted average weights from FedAvg using HHE
just run-mnist-e2eWill run all the above in one go
