0

I'm using this parameter setting:

parms.set_poly_modulus("1x^2048 + 1"); // n = 2048
parms.set_coeff_modulus(coeff_modulus_128(2048)); // q = 54-bit prime
parms.set_plain_modulus(1 << 8); // t = 256

With this encoder FractionalEncoder encoder(context.plain_modulus(), context.poly_modulus(), A, B, C); using A=512, B=128 and C=2

If I understood correctly then the setting of A and B depend on the size of n which means that A + B <= 2048 must hold, correct?

What is the general rule when deciding the size of A and B using the poly_modulus, coeff_modulis and plain_modulus setting above? Since choosing to small values don't use the full potential of the Plaintext size. My guess is that A should be increased because B is only for the precision of the fractional part.

TalG
  • 677
  • 1
  • 9
  • 26

1 Answers1

0

A and B depends on how much precision you need and how complicated is the computation: larger A and B would make the encryption more precise, and they will also make the allowed multiplicative depth smaller. The latter is one of the reasons why the fractional encoder does not perform very well. Depending on your task, you might want to stay tuned and use the next release (SEAL 3.0) which contains a new encoding method.

hao chen
  • 165
  • 1
  • 7
  • Thank you for the answer. Could you please explain what do you mean by "larger A and B would make the encryption more precise, and they will also make the allowed multiplicative depth smaller. “. Is it possible to provide some small example for the number 5.5 and this Setting `FractionalEncoder encoder(context.plain_modulus(), context.poly_modulus(), 12, 10, 2);` for explanation purposes. – TalG Oct 07 '18 at 20:28
  • I checked at the provided examples in SEAL and above this setting `FractionalEncoder encoder(context.plain_modulus(), context.poly_modulus(), 64, 32, 3);` there is this description “In this case we decide to reserve 64 coefficients of the polynomial for the integral part (low-degree terms) and expand the fractional part to 32 digits of precision (in base 3) (high-degree terms). These numbers can be changed according to the precision that is needed; note that these choices leave a lot of unused space in the 2048-coefficient polynomials.”. So am I reserving some coefficient space with A and B? – TalG Oct 07 '18 at 20:30
  • I thought the setting was for the Plaintext space so If I set n = 2048, then by setting A = 64 I reserve x^64 + … + x^0 from the Plaintext representations for the integral part of a number. By setting B = 32 I reserve -1x^2047 - … - x^2015 for the fractional part of a number. Doing so I can encode end decode any fractional number as long as I don’t exceed the reserved Plaintext space by A and B. – TalG Oct 07 '18 at 20:56
  • Yeah that's right. and if A = 64, B = 32 and base = 2 then you get 96 bits of precision, so if your number has more than 96 bits, there is approximation error. Larger A and B are more precise in this sense. – hao chen Oct 08 '18 at 21:09
  • Ok and could you please explain the "Multiplicative Depth" and how does it relate to choosing A and B sizes. Lets say I use A = 64, B = 32 and C = 2 together with n = 2048, q = 2048 and t = 256 to encode the number 5.5 as -1x^2047 + 1x^2 + 1. Further more my initial noise for the Chipertext_5-5 with the settings above is 36 bits. How can I calculate the "Multiplicative Depth" in this situation? Is this just (initial noise budget / cost of multiplication)? – TalG Oct 08 '18 at 21:48
  • In SEAL you can think of the encrypted computations as arithmetic circuits. Multiplicative depth refers to the depth of the arithmetic circuit. Since noise growth depends on the depth of the circuit, it is important to lay out your computation in a way that achieves a depth as small as possible. For example, to evaluate x^4 on encrypted data, you would want to compute (x^2) * (x^2). For more details on circuit depth, see any introduction to circuits and circuit complexity. – Kim Laine Oct 09 '18 at 06:32
  • But how does that fact of choosing A = 64, B = 32 for the FractionalEncoder and n = 2048 influence the multiplicative depth compared to using A = 512, B = 128? And way is the multiplicative depth gets smaller fur bigger A and B? – TalG Oct 09 '18 at 07:25