Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I enable pyfhel on a vector of size greater than 2**15? Does BatchEnabled helps? #199

Closed
Deepthiappasani opened this issue Jun 6, 2023 · 1 comment
Labels
Functionality Wether this library supports a certain operation or not

Comments

@Deepthiappasani
Copy link

Deepthiappasani commented Jun 6, 2023

I was trying to encrypt a vector of size 256134568 which is way larger than the Poly_modulus_degree (N) that Pyfhel accepts.
However, I tried to do it by dividing the vector into different chunks. But it isn't time efficient. Can you suggest any workaround or more efficient way to do it? In some papers, I've seen the brief mentions of Batch Enabling, does this relate to my concern? Can you provide me more context or how to enable batching or its usecase?

@Deepthiappasani Deepthiappasani added the Functionality Wether this library supports a certain operation or not label Jun 6, 2023
@Deepthiappasani Deepthiappasani changed the title How can I enable pyfhel on a vector of size greater than then 2**15? Does batch_enable helps? How can I enable pyfhel on a vector of size greater than then 2**15? Does BatchEnabled helps? Jun 6, 2023
@Deepthiappasani Deepthiappasani changed the title How can I enable pyfhel on a vector of size greater than then 2**15? Does BatchEnabled helps? How can I enable pyfhel on a vector of size greater than 2**15? Does BatchEnabled helps? Jun 6, 2023
@AlexanderViand
Copy link
Collaborator

Pyfhel already uses "batch encoding" by default, that's why there's the ability to encrypt vectors in the first place.

Your vector size is not actually that large (roughly $2^{28}$). FHE can still be instantiated somewhat efficiently with $N = 2^{32}$. However, I'm not sure if the underlying libraries natively support that size (e.g., older versions of SEAL did not have pre-set parameters for this size).

Note, that the poly_modulus_degree needs to be a power of two, so maybe try it again with poly_modulus_degree = 2**31 ($N = 2^{32}$) and see if that's supported. Otherwise, I recommend you use two ciphertexts, each with poly_modulus_degree = 2**15 ($N = 2^{16}$). In fact, there's a good chance that the latter will be more efficient if you're computation doesn't need a lot of interaction between the two parts of the vector, as the overhead for larger $N$ grows faster than $N$ itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Functionality Wether this library supports a certain operation or not
Projects
None yet
Development

No branches or pull requests

2 participants