1

I wonder about the size and form of Plaintext in CKKS Encoding for real number, taking small N for example:

  • Input vector array = [1.1, 2.2]
  • N = 8, scale Delta = 2^2 = 4
  • Number of slot = N/2 = 4

Form of Plaintext:

  • ptx = [4.4 8.8 0.0 0.0] with size of N/2 or:
  • ptx = [4.4 8.8 0.0 0.0 | 0.0 0.0 0.0 0.0] with size of N or:
  • ptx = [4.4 8.8 0.0 0.0 | 4.4 8.8 0.0 0.0] with size of N

Thank you for your help!

France
  • 29
  • 4

2 Answers2

1

First, in CKKS the number of slots is always N/2 where N is poly_modulus_degree. When you encode a vector shorter than that, the rest of the slots are simply set to zero. Therefore, in your case the plaintext slot values would be [1.1, 2.2, 0.0, 0.0], with a scale of 4. There is an important special case, however: when you encode a single value, then all the slots will hold that value.

However, this is not at all what the actual plaintext data looks like. There isn't an easy way to read the slot values from the plaintext coefficient data: none of the options you suggest match with what is happening in CKKS encoding:

  1. the input vector is doubled in length with its complex conjugates;
  2. an FFT-like transform is computed to convert the input vector into a complex-coefficient polynomial;
  3. the complex coefficients are scaled the designated scale;
  4. the real part of the coefficients is extracted as an integer modulo coeff_modulus (really this is in the RNS representation, i.e., modulo each coeff_modulus prime);
  5. The resulting RNS polynomial is converted to NTT form, which is the default state for Plaintexts when using CKKS.

Without scaling, step 4. would introduce so much error that the process would become totally irreversible.

Kim Laine
  • 856
  • 5
  • 10
0

I really appreciate your help. I was vague how to encode and encrypt a message vector into a ciphertext using CKKS scheme, which I cannot print out in SEAL code. Anyway, I wonder that:

  1. Steps from 2 to 5 transform a N-size vector into a N-size NTT-form ciphertext.
  2. What is different between doubling a vector of real numbers and a vector of complex numbers in step 1,
  3. How can we map real & image parts of complex numbers into N/2 slots in step 2?

Please don't laugh at me if the question is stupid :). Thanks for your help.

France
  • 29
  • 4