Closed vurdeljica closed 3 years ago
Hi @vurdeljica , I'm afraid you might be trying to perform too many multiplications without decrypting. Unfortunately, other than playing with the context parameters, your best chance is to send some intermediate results back to the owner, decrypt them, encrypt them again, and continue the computation. Note that this limitation is inherent to Homomorphic Encryption schemes like the ones implemented in SEAL (our preferred backend).
Additionally, if you want to know the multiplication depth of a given Pyfhel instance, you can use the following function (introduced in 3ce85c1):
You can see an example of its usage in the Demo_MultDepth_n_relin.py example. Try running it!:
Unfortunately, you can only do so many multiplications before the noise inside grows too much for the ciphertext to be decipherable at all. There is no "safe" way to detect if an operation can be executed or not without the decryption key (otherwise this information could be use to attack the entire protocol). If you have the decryption key, it suffices to check the noiseLevel
of the PyCtxt: if it reached 0, then it cannot be decrypted correctly anymore.
I confirm that noise impacts the result. I have also tried to use lattigo library for go. I have used BFV scheme and I managed to multiply 10000 (I stopped here, maybe more multiplications can be done) encrypted numbers without the issue. Also the computation was super fast. Do you have any idea why is lattigo heavily outperforming SEAL? Does Pyfhel have the option to choose which scheme (BFV or CKKS) we want to use? I see that SEAL supports both schemes.
We never got enough time to implement the latest version of SEAL (the one implementing CKKS). If you're truly interested, you could tackle this implementation with guidance.
Description I am trying to do multiple multiplications on encrypted numbers. I have managed to perform 20-25 operations and than multiplication starts to output invalid results. I am not sure whether I have configured context parameters in the wrong way or it is the bug in the Pyfhel. It really looks like some overflow is going on in Pyfhel. Please see the code below which you could use to reproduce the issue.
Code To Reproduce Error
And output is:
Expected behavior Expected behavior is to perform all multiplications correctly or to have some warning/error that operation can't be executed correctly in the encrypted domain due to limitations in homomorphic encryption.
Setup: