Large plaintext modulus

I’m new to working with OpenFHE. I am trying to work with a simple example using a large plaintext module. But parameters.SetPlaintextModulus() is giving errors for primes more than 64 bits. I have looked in the CCParams but didn’t see anything. Is there anything I am missing?

Integer schemes in OpenFHE do not support such large primes. You may use the Chinese Remainder Theorem (CRT) trick to decompose your problem modulo multiple primes.

Say your desired plaintext modulus is t, this means your original plaintext space is \mathbb{Z}_t.

Try to find a chain of suitable ~ 64-bit primes p_1, p_2, \ldots, p_k, such that \Pi_{i=1}^{k}p_i \geq t. Then:

  1. instantiate k instances of your problem each in plaintext space \mathbb{Z}_{p_i},
  2. solve your problem modulo each p_i to get k partial results,
  3. reconstruct the partial results in \{\mathbb{Z}_{p_i}\}_{i=1}^{k} to get the solution back in \mathbb{Z}_t.

An example of this technique can be found in the paper below, (see Figure 2):
Towards the AlexNet Moment for Homomorphic Encryption: HCNN, the First Homomorphic CNN on Encrypted Data with GPUs

1 Like