seal

Decoding and Decryption Error Indicators in SEAL


I know that in SEAL 2.3.1 the decoding and decryption errors will fail silently. I.e. there are no indicators for insufficient noise error or find violations of the plain_modulus, poly_modulus setting, when attempting to decode / decrypt some calculation result. Are those indicators exist in any of the later versions e.g. in 3.0, 3.1, 3.2 or does an incorrect decoding or decryption still fails silently?


Solution

  • There is no significant change since SEAL 2.3.1, except that since SEAL 3.0 the presence of CKKS scheme makes the answer more complicated.

    Decryption. SEAL 3.2.0 does not give any indication that the noise budget is zero. You'll have to test for that separately for the BFV scheme; the CKKS scheme doesn't have a similar clean concept of noise. Furthermore, it is slightly misleading to say that decryption fails: decryption always succeeds and gives some output Plaintext, but the Ciphertext-Plaintext pair may have maxed out noise (for BFV). A user may want to implement a function that checks the noise level first and then decrypts, but it has some performance cost and probably doesn't make sense to do automatically by SEAL.

    Decoding. When using the CKKS scheme, SEAL 3.2.0 will throw on decoding errors (when using CKKSEncoder), e.g., when the Plaintext given to it has too large scale. Such a Plaintext should not be possible to produce through valid uses of Evaluator/Decryptor though. CKKS decoding will be incorrect if the scale and message are so large that their product wraps arounds coeff_modulus, but Evaluator has no way of detecting this, and neither has CKKSEncoder. For BFV, the IntegerEncoder can detect decoding overflow errors and will throw in these cases (as in SEAL 2.3.1), but for BatchEncoder there are no incorrect decodings so such a thing cannot be detected at all. Note that plain_modulus overflows can never be detected in encrypted form.