You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's say I want to use a 60-bit ciphertext modulus in BFV. After I finish all the homomorphic operations, I want to switch to a smaller modulus (30-bit). Now, let's say I created the context and seal::EncryptionParameters using the bit_sizes = {60, 60}. I noticed that SEAL only has mod_switch_scale_to_next in evaluator, which always tries to throw away one modulus on the chain.
Related issue:
#444 is related, but calculating round(ct/q) is only one useful special case for modulus switching, but not general enough. (q is the last small prime in the prime chain)
Question:
After the modulus switching, I only need decryption. Suppose I have added a function that calculates the general modulus switching round(ct*Q'/Q) for a Q' that has half the bit size. Then bit_sizes = {60, 60} should become {30, 60}. The problem is that I don't know how to modify the context accordingly. Is implementing a customized decryption function using the new smaller modulus the best choice for me?
Another approach is to use bit_sizes = {30, 30, 60} in the beginning. However, since RNS is using uint64_t to store all modulus, using two 30-bit modulus brings at least 2 times slow down for all calculations. One solution I can think of is to change the word size to 32 bit. This is mentioned before in #105 . It was considered not worth the big changes at that time. However, we now have Intel HEXL, additions and multiplications can be way faster than before. Example: _mm512_mul_epu32. But this approach is too heavy for me.
I would be grateful for any suggestions!
The text was updated successfully, but these errors were encountered:
Context:
Let's say I want to use a 60-bit ciphertext modulus in BFV. After I finish all the homomorphic operations, I want to switch to a smaller modulus (30-bit). Now, let's say I created the
context
andseal::EncryptionParameters
using thebit_sizes = {60, 60}
. I noticed that SEAL only hasmod_switch_scale_to_next
in evaluator, which always tries to throw away one modulus on the chain.Related issue:
#444 is related, but calculating
round(ct/q)
is only one useful special case for modulus switching, but not general enough. (q is the last small prime in the prime chain)Question:
After the modulus switching, I only need decryption. Suppose I have added a function that calculates the general modulus switching
round(ct*Q'/Q)
for aQ' that has half the bit size
. Thenbit_sizes = {60, 60}
should become{30, 60}
. The problem is that I don't know how to modify the context accordingly. Is implementing a customized decryption function using the new smaller modulus the best choice for me?Another approach is to use
bit_sizes = {30, 30, 60}
in the beginning. However, since RNS is usinguint64_t
to store all modulus, using two 30-bit modulus brings at least 2 times slow down for all calculations. One solution I can think of is to change the word size to 32 bit. This is mentioned before in #105 . It was considered not worth the big changes at that time. However, we now have Intel HEXL, additions and multiplications can be way faster than before. Example: _mm512_mul_epu32. But this approach is too heavy for me.I would be grateful for any suggestions!
The text was updated successfully, but these errors were encountered: