plaintextseal

The form of Plaintext in real number CKKS Encoding Microsoft SEAL


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

Form of Plaintext:

Thank you for your help!


Solution

  • 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.