FederatedAI / FATE

An Industrial Grade Federated Learning Framework
Apache License 2.0
5.71k stars 1.55k forks source link

How to improve the efficiency of paillier or other homomorphic encryption algorithm? #56

Closed fourseven471 closed 5 years ago

fourseven471 commented 5 years ago

I evaluated the computational efficiency of paillier in Fate(denoted as paillier_fate) and paillier implemented in python(https://github.com/n1analytics/python-paillier , denoted as paillier_python), the calculation efficiency of paillier_fate is more than six times higher than paillier_python.

The implementations of the two algorithms are similar. So, i want to know how to improve the efficiency of paillier. Are there any other homomorphic encryption libraries or implementation tips that can improve efficiency.

dylan-fan commented 5 years ago

we test our fate-paillier is same as paillier_python.
paillier_python: generate_paillier_keypair(n_length=1024) fate-paillier: PaillierKeypair.generate_keypair(n_length=1024)

Maybe n_length is not same in your testcase

fourseven471 commented 5 years ago

Thanks for your reply! @dylan-fan

  1. It is indeed due to the n_length. Moreover, if n_length is set too samll, the decoding will fail. So, what is the smallest value of n_length in safe condition.

  2. How much is the efficiency difference between an encrypted LR and an unencrypted LR?

  3. Have you tried other homomorphic encryption librarys? such as HELib、SEAL、Pyfhel、FV-NFLib...?

we test our fate-paillier is same as paillier_python. paillier_python: generate_paillier_keypair(n_length=1024) fate-paillier: PaillierKeypair.generate_keypair(n_length=1024)

Maybe n_length is not same in your testcase

Thanks for your reply! @dylan-fan

  1. It is indeed due to the n_length. Moreover, if n_length is set too samll, the decoding will fail. So, what is the smallest value of n_length in safe condition.

  2. How much is the efficiency difference between an encrypted LR and an unencrypted LR?

  3. Have you tried other homomorphic encryption librarys? such as HELib、SEAL、Pyfhel、FV-NFLib...?

dylan-fan commented 5 years ago
  1. n_length>=1024 maybe better
  2. encrypted LR is slower than unencrypted LR,but accuracy is similar. Efficiency problem in encrypted LR can be resolved in distributed computing. You can run our lr example and see the result.
  3. phe , google homomorphic encryption lib.
fourseven471 commented 5 years ago

Deep learning is very computationally intensive, and the use of homomorphic encryption will make the efficiency of training very low. Could you tell me what homomorphic encryption libraries you used to implement the deep learning model, or what optimization techniques did you use on the paillier library ?