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 AS + B = p𝜀1M + p𝜀E + Kq^ (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 + Kq^ mod qL

Note that Kq^ is the q^-multiple overflow and does not get reduced modulo qL, because Kq^ 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 + Kq^) mod qL, an encryption of p𝜀1M + p𝜀E + Kq^. In the later step, we will use digit extraction to homomorphically eliminate Kq^ 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 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 n1 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^ = kq^p𝜀 + 1 for some positive integer kq^. Therefore, the following holds:

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

= p𝜀1mi + p𝜀ei + ki(kq^p𝜀 + 1) applying q^ = kq^p𝜀 + 1

= p𝜀1mi + ki+ p𝜀 (ei + kikq^) rearranging the terms

= p𝜀1mi + ki+ p𝜀 kq^+𝜀 where kq^+𝜀 = ei + kikq^

= p𝜀1mi + kimod 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=𝜀𝜀1dpj) 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)) |p1|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 + kip mod ql

, where kip𝜀 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 + kip 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 |p1|qi, where qi is the ciphertext modulus at the i-th round of digit extraction. Given (Ag1,Bg1) mod q1 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:

(Ag1,Bg1) 𝖤𝗇𝖼𝗈𝖽𝖾(p1) mod q1

= (Ag1,Bg1) p1 mod q1 since 𝖤𝗇𝖼𝗈𝖽𝖾(p1) = p1 + 0X + 0X2 + + 0Xn1

= (p1Ag1,p1Bg1) mod q1

Therefore, by multiplying the coefficients of two BGV ciphertext polynomials Ag1 and Bg1 by |p1|q1, we obtain the following effect:

(|p1|q1 Ag1) S + (|p1| q1 Bg1) mod q1

= |p1|q1 (p𝜀1M + Kp + Kp𝜀) mod q1

= p𝜀2M + K p + Kp𝜀1 mod q1

Verbally speaking, the above inverse-p multiplication to all polynomial coefficients of (Ag1,Bg2) has the following two effects: (2) 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+ Kp𝜀 mod q^

1st Round: G𝜀(zi)==⇒effectp𝜀2M + K p + K1p𝜀1 mod q1

2nd Round: G𝜀1 G𝜀(zi)==⇒effectp𝜀3M + K p2 + K2p𝜀2 mod q2

3rd Round: G𝜀2 G𝜀1 G𝜀(zi)==⇒effectp𝜀4M + K p3 + K3p𝜀3 mod q3

𝜀 1-th Round: G2 G𝜀(zi)==⇒effectM + K𝜀1p 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); and. The reason why K gets updated to K1,K2,,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 kp𝜀 kp, 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 + kip 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 + kip, 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 + Kp) 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 Kq^ 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 |p1|qi. 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.