How to support 55 (q_0) + 40 (q_i), i>0 in OpenFHE

Dear developers

Might I seek guidance on how to implement the following security parameters inside OpenFHE and make it able to pass the 128-bit security checking?

I’m using this example to test the bootstrapping openfhe-development/src/pke/examples/advanced-ckks-bootstrapping.cpp at main · openfheorg/openfhe-development · GitHub

I change following configurations

parameters.SetRingDim(1 << 16);
#else
    // All modes are supported for 64-bit CKKS bootstrapping.
    ScalingTechnique rescaleTech = FLEXIBLEAUTO;
    usint dcrtBits               = 40;
    usint firstMod               = 55;
#endif
    cryptoContext->EvalBootstrapSetup(levelBudget, bsgsDim, numSlots, 16);

To make sure the log2(Degree) is <= correct_factor, which is 16.

But value of decrypted results are super far off than the original input value. (The same setup in lattigo would give better performance).

root@f8525abf3eae:/work/build# ./bin/examples/pke/advanced-ckks-bootstrapping 
CKKS scheme is using ring dimension 65536

Input: (0.28982194, 0.36697159, 0.50791944, 0.086401449, 0.66832224, 0.621857, 0.94061381, 0.60058416, ... ); Estimated precision: 40 bits

Initial number of levels remaining: 1
Number of levels remaining after bootstrapping: 11

terminate called after throwing an instance of 'lbcrypto::OpenFHEException'
  what():  /work/src/pke/lib/encoding/ckkspackedencoding.cpp:l.453:Decode(): The decryption failed because the approximation error is too high. Check the parameters. 
Aborted (core dumped)

Might I seek guidance on how to correctly set the parameters correctly to match lattigo’s setup in orion?

Thank you!

Best
Jianming

The parameter set you are trying to use is not good for single-iteration CKKS bootstrapping in OpenFHE. Typically, the scaling factor has to be at least 50 to get meaningful accuracy after one bootstrapping, or the two-iteration bootstrapping can be used if you want to achieve a better accuracy for a smaller scaling factor. The CKKS implementations in Lattigo and OpenFHE are based on different low-level algorithms. The CKKS implementation in OpenFHE is based on 2020/1118. The Lattigo CKKS implementation is based on 2020/1203. Each of them has different tradeoffs both in terms of both usability and efficiency.

1 Like