D-4.11 Modulus Bootstrapping

- Reference: Bootstrapping for BGV and BFV Revisited [14]

BGV’s bootstrapping shares some common aspects with both BFV and CKKS’s bootstrapping. The goal of BGV’s bootstrapping is the same as that of CKKS, but the internal technique is closer to that of BFV. Like CKKS, BGV’s bootstrapping resets the depleted ciphertext modulus from ql →qL (strictly speaking, from ql →ql′ such that l < l′ < L because the bootstrapping operations between step 2 ∼6 have consumed multiplicative levels). This modulus transition effectively not only resets the multiplicative level but also reduces the noise-to-ciphertext modulus ratio. To achieve this goal, one might think that BGV’s bootstrapping can take the same ModRaise approach used by CKKS’s bootstrapping. However, this is not a directly applicable solution because CKKS uses the sine approximation technique to eliminate the q0-multiple overflows after the mod-raise. On the other hand, BGV is an exact encryption scheme that does not allow the approximation of plaintext values. Therefore, BGV uses BFV’s digit extraction approach to eliminate its modulus overflows. To use digit extraction, as in the case of BFV, BGV also has to modify the plaintext modulus to a specially prepared one, p𝜀. To configure both the plaintext modulus and the ciphertext modulus to the desired values (i.e., p𝜀 and qL), BGV employs the homomorphic decryption technique, as BFV does.

The technical details of BGV’s bootstrapping are as follows.

Suppose that we have an RLWE ciphertext (A,B) = 𝖱𝖫𝖶𝖤S,σ(M + ΔE) mod ql, where A ⋅S + B = M + ΔE, Δ = t = p (a prime), and ql is the ciphertext modulus of the current multiplicative level.

1.
Modulus Switch from ql →q^: BFV’s bootstrapping initially switches the ciphertext modulus from q →p𝜀−1 where q ≫p𝜀 > t = p. On the other hand, BGV’s bootstrapping switches the ciphertext modulus to q^ that is a special modulus satisfying the relation: q^ ≡1 mod p𝜀 and q^ > p𝜀 (where p𝜀 will be explained in the next step). In order for a modulus switch from ql →q^ (i.e., the special modulus) to be possible, the prime factor(s) comprising q^ have to be congruent with q0,…,qL mod t, so that we can do a modulus switch from ql ⋅q^ →q^ (based on the technique learned in §D-4.7). Eventually, this step’s modulus switch transforms the ciphertext (A,B) mod ql to (A^,B^) mod q^, during which the plaintext modulus (i.e., noise’s scaling factor) stays the same.

2.
Ciphertext Coefficient Multiplication by p𝜀−1: The constant p𝜀−1 is multiplied to each coefficient of the ciphertext polynomials, updating the ciphertext to p𝜀−1 ⋅(A^,B^) = (A′,B′) mod q^, where A′ = p𝜀−1A^ and B′ = p𝜀−1B^. This operation updates the original decryption relation A^ ⋅S + B^ = M + 𝑝𝐸 + Kq^ to A′⋅S + B′ = p𝜀−1M + p𝜀E + K′q^ (where ||K′||∞ ≤n + 1). Notice that the plaintext modulus (i.e., noise’s scaling factor) has been changed from p →p𝜀. When choosing 𝜀, BGV enforces the following additional constraint: q^ > p𝜀 and q^ ≡1 mod p𝜀.

3.
ModRaise: We mod-raise (A^,B^) mod q^ to (A^,B^) mod qL, where q^ ≪qL. The mod-raised ciphertext’s decryption relation is as follows:

A^ ⋅S + B^ = p𝜀−1M + p𝜀E + K′q^ mod qL

Note that K′q^ is the q^-multiple overflow and does not get reduced modulo qL, because K′q^ ≪qL. We saw the same situation in the CKKS bootstrapping’s ModRaise (§D-3.13.1) which resets the ciphertext modulus from q0 →qL at the cost of incurring a Kq0 overflow, which is to be removed by EvalExp’s homomorphic (approximate) sine graph evaluation (§D-3.13.4). Likewise, BGV’s mod-raised ciphertext (A^,B^) mod qL is 𝖱𝖫𝖶𝖤S,σ(p𝜀−1M + p𝜀E + K′q^) mod qL, an encryption of p𝜀−1M + p𝜀E + K′q^. In the later step, we will use digit extraction to homomorphically eliminate K′q^ like we did in BFV’s bootstrapping. The reason BGV’s bootstrapping uses digit extraction instead of approximated sine evaluation is that BGV is an exact encryption scheme like BFV (not an approximate scheme like CKKS).

4.
CoeffToSlot: This step works the same way as CKKS and BFV’s CoeffToSlot step: move the coefficients of the polynomial p𝜀−1M + p𝜀E + q^K′ to the input vector slots of a new ciphertext. We denote polynomial Z = p𝜀−1M + p𝜀E + q^K′, and each i-th coefficient of Z as zi. For the CoeffToSlot step, we homomorphically compute Z ⋅n−1 ⋅W~ ⋅InR. Then, each input vector slot of the resulting ciphertext ends up storing each zi of the polynomial Z.

5.
Digit Extraction: At this point, each input vector slot contains each coefficient of p𝜀−1M + p𝜀E + q^K′, which is p𝜀−1mi + p𝜀ei + q^ki′. Recall that we designed the lowest multiplicative level’s ciphertext modulus q^ and the homomorphic multiplication factor p𝜀 such that q^ ≡1 mod p𝜀, or q^ = k⟨q^⟩⋅p𝜀 + 1 for some positive integer k⟨q^⟩. Therefore, the following holds:

p𝜀−1mi + p𝜀ei + q^ki′

= p𝜀−1mi + p𝜀ei + ki′⋅(k⟨q^⟩⋅p𝜀 + 1) ▹ applying q^ = k⟨q^⟩⋅p𝜀 + 1

= p𝜀−1mi + ki′+ p𝜀 ⋅(ei + ki′⋅k⟨q^⟩) ▹ rearranging the terms

= p𝜀−1mi + ki′+ p𝜀 ⋅ki⟨q^+𝜀⟩ ▹ where ki⟨q^+𝜀⟩ = ei + ki′⋅k⟨q^⟩

≡p𝜀−1mi + ki′(𝑚𝑜𝑑p𝜀)

To eliminate ki′ from the above (where |ki′|≤n + 1), we use the same digit extraction polynomial G𝜀,v as in the BFV bootstrapping (§D-2.11.5) :

zi = d0 + (∑ ⁡ j=𝜀′𝜀−1d∗pj) ▹ where d0 ∈ ℤp, and d∗ can be any integer, and 1 ≤𝜀′ ≤𝜀

F𝜀′(zi) ≡d0 mod p𝜀′+1

G𝜀(zi) ≡(zi −F𝜀−1 ∘F𝜀−2 ∘⋯ ∘F1⏟ 𝜀−1 times(zi)) ⋅|p−1|q

We evaluate the digit extraction polynomial G𝜀 for {𝜀,𝜀 −1,𝜀 −2,⋯,2} recursively a total of 𝜀 −1 times. This operation finally zeros out and right-shifts the least significant (base-p) 𝜀 −1 digits of zi as follows:

G2 ∘G3 ∘⋯ ∘G𝜀−1 ∘G𝜀(zi)

= mi + ki″p mod ql′

, where ki″p𝜀 is some multiple of p𝜀 to account for the original p𝜀-multiple overflow term plus additional p𝜀-multiple overflows generated during the digit extraction. Note that the digit extraction step reduces the ciphertext modulus from qL →ql′ (where l′ is an integer smaller than L), because the homomorphic evaluation of the polynomial G𝜀 requires some ciphertext-to-ciphertext multiplications, which consume some multiplicative levels. The output of the digit extraction step is mi + ki″p mod ql′ stored in each input vector slot.

Handling the Divisions by p: Unlike in BFV (§D-2.11.5), we cannot use scaling factor re-interpretation because the scaling factor setup of BGV is different from that of BFV. In BGV’s digit extraction, each round should explicitly homomorphically multiply the slot values by |p−1|q⟨i⟩, where q⟨i⟩ is the ciphertext modulus at the i-th round of digit extraction. Given (A⟨g1⟩,B⟨g1⟩) mod q⟨1⟩ is the ciphertext at the 1st round of digit extraction just before inverse-p division, the actual division-by-p is equivalent to performing the ciphertext-to-plaintext multiplication (§D-2.6) as follows:

(A⟨g1⟩,B⟨g1⟩) ⋅𝖤𝗇𝖼𝗈𝖽𝖾(p−1) mod q⟨1⟩

= (A⟨g1⟩,B⟨g1⟩) ⋅p−1 mod q⟨1⟩ ▹ since 𝖤𝗇𝖼𝗈𝖽𝖾(p−1) = p−1 + 0X + 0X2 + ⋯ + 0Xn−1

= (p−1A⟨g1⟩,p−1B⟨g1⟩) mod q⟨1⟩

Therefore, by multiplying the coefficients of two BGV ciphertext polynomials A⟨g1⟩ and B⟨g1⟩ by |p−1|q⟨1⟩, we obtain the following effect:

(|p−1|q⟨1⟩ ⋅A⟨g1⟩) ⋅S + (|p−1| q⟨1⟩ ⋅B⟨g1⟩) mod q⟨1⟩

= |p−1|q⟨1⟩ ⋅(p𝜀−1M + ⌊K′⌋p + K″p𝜀) mod q⟨1⟩

= p𝜀−2M + ⌊K′ p ⌋ + K″p𝜀−1 mod q⟨1⟩

Verbally speaking, the above inverse-p multiplication to all polynomial coefficients of (A⟨g1⟩,B⟨g2⟩) has the following two effects: (1) scales down the plaintext and the noise by p; and (2) reduces the modulus garbage term K′ to ⌊K′ p ⌋ (i.e., right-shift by 1 base-p digit).

BGV’s digit extraction procedure is equivalent to recursively evaluating G𝜀 with the input zi by decreasing 𝜀 by 1 at each round (total 𝜀 −1 rounds) as follows:

Input: p𝜀−1M + K′+ K″p𝜀 mod q^

1st Round: G𝜀(zi)==⇒effectp𝜀−2M + ⌊K′ p ⌋ + K″⟨1⟩p𝜀−1 mod q⟨1⟩

2nd Round: G𝜀−1 ∘G𝜀(zi)==⇒effectp𝜀−3M + ⌊K′ p2 ⌋ + K″⟨2⟩p𝜀−2 mod q⟨2⟩

3rd Round: G𝜀−2 ∘G𝜀−1 ∘G𝜀(zi)==⇒effectp𝜀−4M + ⌊K′ p3 ⌋ + K″⟨3⟩p𝜀−3 mod q⟨3⟩

⋮

𝜀 −1-th Round: G2 ∘⋯ ∘G𝜀(zi)==⇒effectM + K″⟨𝜀−1⟩p mod q⟨𝜀−1⟩

As shown above, the entire digit extraction procedure results in two effects on the values stored in the plaintext slots: (1) scales down the message p𝜀−1M to M; and (2) zeros out the modulus garbage K′ (i.e., ⌊ K′ p𝜀−1⌋ = 0). The reason why K″ gets updated to K″⟨1⟩,K″⟨2⟩,⋯,K″⟨𝜀−1⟩ across rounds is that each i-th round’s evaluation of function F𝜖′ and G𝜖 is done modulo p𝜀−i, which produces new p𝜀−i-multiple overflow garbage values each time.

Beneficially, the 𝜀 −1 rounds of inverse-p multiplications yields the effect of scaling down the plaintext p𝜀−1mi →mi and the noise k″p𝜀 →k″p, which has the desired noise scaling factor p for standard BGV ciphertexts.

6.
SlotToCoeff: This step works the same way as BFV’s SlotToCoeff step: move mi + ki″p stored in the input vector slots back to the polynomial coefficient positions by homomorphically multiplying with W~∗. Upon completing this step, the ciphertext modulus is some value ql′ smaller than qL, because the homomorphic operation of step 4 ∼6 has consumed a few multiplicative levels. The resulting plaintext coefficients are mi + ki‴p, where k‴ > k″ due to the additional noise generated by homomorphically running the SlotToCoeff step. The plaintext modulus (i.e., the noise scaling factor) and the noise scaling factor are p at this point, the standard one for BGV ciphertexts. We let these polynomials be M and K‴ each, and the output ciphertext is 𝖱𝖫𝖶𝖤S,σ(M + K‴p) mod ql′.
D-4.11.1 Discussion

The Reason for Modulus Switch from ql →q^: BGV switches the modulus from ql →q^ to eliminate the ql-multiple overflows during bootstrapping. After switching the modulus ql →q^ and then ModRaise, the encrypted plaintext gets the K′q^ overflow term, which can be reduced to K′ from the plaintext modulus’s perspective due to the special property q^ ≡1 mod p𝜀 (where p𝜀 is the plaintext modulus).

The Choice of 𝜀: The larger 𝜀 is, the greater the (base-p) digit-wise gap between p𝜀−1M and K′ becomes; thus, the less likely it is that the decryption would fail (i.e., fail to zero out K′). However, a larger 𝜀 means the digit extraction operation would be more expensive.

Generalization to Δ = pr: Like the case of BFV’s bootstrapping (Summary D-2.11.6 in §D-2.11.6), we can generalize the plaintext modulus (i.e., noise scaling factor) to pr where p is a prime and r can be any positive integer.

D-4.11.2 Comparing the Bootstrapping in BFV, BGV, and CKKS

Both BFV and BGV’s bootstrapping use digit extraction, but for different purposes. In BFV, digit extraction is used to eliminate the noise in the lower-bit area. In BGV, digit extraction is used to eliminate the modulus garbage values in the lower-bit area generated by ModRaise from q^ →qL. In addition, at each round of BGV’s digit extraction, we explicitly multiply the coefficients of the ciphertext polynomials by |p−1|q⟨i⟩. In BFV, this explicit inverse-p multiplication is skipped and we only conceptually re-interpret the scaling factor.

CKKS’s bootstrapping does not involve digit extraction because it has no values to eliminate in the lower-bit area. Instead, regarding the modulus garbage value ModRaise from q0 →qL, this is eliminated by EvalExp’s homomorphic evaluation of an approximate sine function. Although CKKS’s bootstrapping resets its modulus to a large value, this operation does not decrease the noise-to-message ratio, and this ratio continuously increases over homomorphic operations.