GetLevel() wrong value?

Hello, I feel like the c->GetLevel() function called on a CKKS ciphertext is not exact, or maybe I am missing something. In particular, I create c, I square it, and the level stays 0. Is that correct? I leave my source code here.

In my source code case the output is:

Level: 0

Process finished with exit code 0

For CKKS, the rescaling logic is a bit tricky for FLEXIBLE* scaling techniques, especially for the first multiplication. The automated logic aims to reduce the degree of error in approximations. This involves intricate management of ciphertexts at various levels, each with its own scaling factor. OpenFHE tries to shield the user from this intricate process.

If you prefer a more straightforward and predictable behavior, you can use the FIXEDMANUAL scaling technique in which you need to manually rescale the ciphertext after every multiplication. Here is an example code:

c = crypto_context->EvalMult(c, c);
crypto_context->RescaleInPlace(c);

More information on the different scaling techniques in OpenFHE can be found in the OpenFHE main paper: OpenFHE: Open-Source Fully Homomorphic Encryption Library, see Section 2.1.1.

3 Likes