adap / flower

Flower: A Friendly Federated AI Framework
https://flower.ai
Apache License 2.0
5.09k stars 875 forks source link

Support for Homomorphic Encryption #907

Open kinshukdua opened 2 years ago

kinshukdua commented 2 years ago

Homomorphic Encryption is one of the most popular way to guarantee privacy-preservation when using FL. I looked through the examples, the documentation and this repo but I could not find any mention of Flower being used along side with homomorphic encryption. Does Flower support homomorphic encryption?

sisco0 commented 2 years ago

Is this proposal somehow related to https://github.com/tf-encrypted/tf-encrypted project? It that is the case we could clone our examples/quickstart_tensorflow into examples/quickstart_tensorflow_encrypted to use the syntax shown in the https://github.com/tf-encrypted/tf-encrypted/tree/master/examples/mnist example project.

hei411 commented 2 years ago

Hi @kinshukdua Homomorphic encryption is a general cryptography technique, and there are multiple ways of how it can be used for federated learning.

In the MNIST example provided by @sisco0, the homomorphic encryption is performed by three compute servers, and there is a distinction between model owners and prediction clients.

Alternatively, in https://developer.nvidia.com/blog/federated-learning-with-homomorphic-encryption/, the homomorphic encryption described is performed by a single server, and there is no distinction between all clients.

It would be ideal if you could provide us with more context of how you would want to use Homomorphic encryption for your experiments. Is there any particular protocol you would want to deploy?

Also in general, homomorphic encryption is computationally expensive. Perhaps there are other alternative cryptographic primitives that could achieve the security goals you are aiming for with a lower computation cost?

raywang1021 commented 7 months ago

Is the Semi-Homomorphic Encryption already support in Flower?

danieljanes commented 7 months ago

TL;DR: Yes, Flower supports arbitrary Homomorphic Encryption and Semi Homomorphic Encryption protocols.

Long answer: Flower Next introduces a new low-level messaging API that can be used to implement arbitrary (S)HE protocols. In addition to this, two new abstractions (Workflows on the server-side and Mods on the client-side) allow building those protocols in a modular ways. This enables users to (a) use built-in methods and (b) implement/customize their own approaches.

We introduced those capabilities at Flower AI Summit 2024 in London (https://flower.ai/conf/flower-ai-summit-2024/, video recordings available on YouTube) and will add documentation over the coming weeks.