C-4.1 LWE Modulus Switching

- Reference: Modulus Switching in LWE

Recall that the LWE cryptosystem (§B-2.2) comprises the following components:

In the LWE cryptosystem, modulus switching is a process of converting an original LWE ciphertext’s modulo domain to a smaller modulo domain. This can be seen as scaling down all components, except for the plaintext m and the secret key S, in the original LWE ciphertext to a smaller domain. This operation preserves the size and integrity of the original plaintext m, while the scaling factor Δ gets reduced to a smaller value Δ^ and the noise e to a smaller (reduced) noise e^ (note that noise alteration does not affect the original plaintext m, because the noise gets rounded away after decryption, anyway), and A also gets scaled down to a smaller A^. Modulus switching is used for computational efficiency during TFHE’s bootstrapping (which will be discussed in §D-1.8). Modulus switching is also used for implementing the ciphertext-to-ciphertext multiplication algorithm in BGV (§D-2.7) and CKKS (§D-3.5).

The high-level idea of LWE modulus switch is to rescale the congruence relationship of the LWE scheme. LWE’s homomorphic computation algorithms include the following: ciphertext-to-ciphertext addition, ciphertext-to-plaintext addition, ciphertext-to-plaintext multiplication, ciphertext-to-ciphertext multiplication. However, all congruence relationships used in these algorithms are essentially rewritten versions of the following single fundamental congruence relationship: b = A S + Δm + e mod q. Thus, modulus switch of an LWE ciphertext from q q is equivalent to rescaling the modulo of the above congruence relationship from q q.

Based on this insight, the LWE cryptosystem’s modulus switching from q q^ (where q > q^) is a process of converting the original LWE ciphertext 𝖫𝖶𝖤S,σ(Δm) as follows:

Summary C-4.1 LWE Modulus Switching

Given an LWE ciphertext (A,b) where b = A S + Δm + e mod q and m t, modulus switch of the ciphertext from q to q^ is equivalent to updating (A,b) to (A^,b^) as follows:

A^ = (a^0,a^1,  a^k1), where each a^i = aq^ q q^ # ⌈⌋ means rounding to the nearest integer

b^ = bq^ q q^

𝖫𝖶𝖤S,σ(Δ^m) = (a^0,a^1,  ,b^) q^k+1

The above update effectively changes e^ and Δ^ as follows:

e^ = eq^ q q^,

Δ^ = Δq^ q # which should be an integer

Meanwhile, S and m stay the same as before.

Note that in order for (a^0,a^1,  ,b^) q^k+1 to be a valid LWE ciphertext of Δ^m, we need to prove that the following relationship holds:

b^ = i=0k1a^i si + Δ^m + e^ q^

Proof.

1.
Note the following:

b^ = bq^ q = bq^ q + 𝜖b (where 0.5 < 𝜖b < 0.5, a rounding drift error)

ai^ = aiq^ q = aiq^ q + 𝜖ai (where 0.5 < 𝜖ai < 0.5)

e^ = eq^ q = eq^ q + 𝜖e (where 0.5 < 𝜖e < 0.5)

2.
Note the following:

b = a s + Δm + e = i=0k1(aisi) + Δm + e q

b = i=0k1(aisi) + Δm + e + H q (where modulo q is replaced by adding H q, some multiple of q)

3.
According to step 1 and 2:

b^ = bq^ q + 𝜖b q^

= ( i=0k1(aisi) + Δm + e + H q) q^ q + 𝜖b

= q^ q i=0k1(aisi) + q^ q Δm + q^ q e + q^ q H q + 𝜖b

= i=0k1 (q^ q aisi) + Δ^m + (e^ 𝜖e) + q^ H + 𝜖b

= i=0k1 ((a^i 𝜖ai) si) + Δ^m + e^ 𝜖e + q^ H + 𝜖b

= i=0k1(a^isi 𝜖aisi) + Δ^m + e^ 𝜖e + 𝜖b q^

= i=0k1a^isi + Δ^m + (e^ 𝜖e + 𝜖b i=0k1𝜖aisi) q^

= i=0k1a^isi + Δ^m + e^ + 𝜖𝑎𝑙𝑙 q^ # where 𝜖𝑎𝑙𝑙 = (𝜖e + 𝜖b i=0k1𝜖aisi)

The biggest possible value for 𝜖𝑎𝑙𝑙 is,

𝜖𝑎𝑙𝑙 = |0.5|+ |0.5|+ |0.5 k|= 1 + 0.5k

So, LWE modulus switching results in an approximate congruence relationship (§A-12). However, if Δ^ is large enough, 𝜖𝑎𝑙𝑙 = 1 + 0.5k will be shifted to the right upon LWE decryption and get eliminated, and finally we can recover the original m. Also, in practice, the term i=0k1𝜖aisi would converge to 0 for a sufficiently large k, because each ai is uniformly sampled and si is also uniformly sampled.

Caution: If Δ^ is not large enough, then 𝜖𝑎𝑙𝑙 may not get eliminated during decryption and corrupt the plaintext m. Also, if Δ Δ^ shrinks too much, then the distance between Δ^m and e^ would become too narrow and the rounding process of e^ = eq^ q may end up overlapping the least significant bit of Δ^m, corrupting the plaintext.

4.
To summarize, b^ is approximately as follows:

b^ = i=0k1a^isi + Δ^m + e^ + 𝜖𝑎𝑙𝑙 i=0k1a^isi + Δ^m + e^ q^

Thus, (a^0,a^1,  ,b^) = 𝖫𝖶𝖤S,σ(Δ^m), decrypting which will give us m.