# "Symmetric" levels in bootstrapping

Hello everyone, nice to meet you!

I am exploring the OpenFHE world, and I am trying to re-implement an algorithm that I wrote in SEAL one year ago (CKKS).

In particular, I had to perform n iterations on a set of data, but at the end of each iteration I had to send the result back to the client, since I used all the mult levels.

Now I’d like to take advantage of bootstrapping so that I can run the whole algorithm without a continuous exchange of data between server-client.

The thing that I noted running the examples it that, after the bootstrap, the available levels are lower. How can I setup the parameters so that “before” and “after” the bootstrap a ciphertext has the same available levels (like 15 before, 15 after) ?

So that I can write one procedure, instead of two.

Also, I find not so easy to choose parameters, is there any reference/guide?

Thank you for the amazing effort to write this library, I found it really fast and easy to write !

Increase the multiplicative depth to a higher value as shown in this example. Set it to ~30 or something close to that, try with more values until you get what you want.

For the parameter selection, you can refer to the examples to learn how to set them properly.
Also, refer to the parameters guide here.

What I want to understand is how parameters affect security and performance…
I mean, what happens if I set the multiplicative depth to 20, instead of 30? Will I gain precision? Performance? Why should I be able to set a lower depth with respect to the space (for the noise) that I have available in the ciphertext?

I come from SEAL where the depth was computed as a function of all the other parameters.

Anyway, I’d need more or less 19 levels per iteration, with a total of 10 iterations; so I need to perform bootstrap

Sorry for the silly questions, I am pretty new as you can see

Bootstrapping by itself is a homomorphic operation that consumes a significant number of levels (typically 15-20). So one needs to set the multiplicative depth to the number of levels needed for bootstrapping + the number of levels needed for the computation before the next bootstrapping (which seems to be 19 in your case). SEAL only supports leveled FHE (w/o bootstrapping). This is why there this issue does not come up.

You can look at openfhe-development/simple-ckks-bootstrapping.cpp at v1.0.3 · openfheorg/openfhe-development · GitHub and set this variable to something like 19. Then the next line will add the number of levels needed for bootstrapping.

Here is an example with many bootstrapping calls (logreg training where bootstrapping is called after each iteration): GitHub - openfheorg/openfhe-logreg-training-examples: Examples of Logistic Regression Training using Nesterov Accelerated Gradient Descent By default, it runs 200 iterations.

As the multiplicative depth increases, so does the computational overhead, which can lead to a decrease in performance. Therefore, it is important to optimize multiplicative depth for your application to achieve the best possible performance.

If you have issues regarding precision, there are several ways to improve it. Let us know.

Ok, thank you guys! I got it now.