D-1.8 Noise Bootstrapping

- Reference: TFHE Deep Dive - Part IV - Programmable Bootstrapping [10]

Continuing homomorphic additions of TFHE ciphertexts does not necessarily increase the noise e, because e is randomly generated over the Gaussian distribution, thus adding up many noises would give the mean value of 0. On the other hand, continuing homomorphic multiplications increases the noise, because the noise terms get multiplied, growing its magnitude. Thus, we need to somehow reset the noise before it trespasses on the higher bits where plaintext m resides (i.e., preventing the red noise bits from overflowing to the blue plaintext bits as shown in Figure 8). The process of re-initializing the noise to a smaller value is called noise bootstrapping.

As explained in the beginning of this section, TFHE uses LWE (which is GLWE with n = 1) to encrypt & decrypt a plaintext. That is, each plaintext is m (a single number), encoded as a zero-degree polynomial. Further, the secret key S that encrypts each m is a vector {s0,s1,  ,sk1} instead of a polynomial. On the other hand, TFHE’s noise bootstrapping uses homomorphic addition between GLWE ciphertexts and homomorphic multiplication between GLWE and GGSW ciphertexts.

Suppose we have a TFHE ciphertext as follows:

𝖫𝖶𝖤s,σ(Δm) = (a0,a1,  ak1,b)

b = i=0k1aisi + Δm + eb

s = (s0,s1,  sk1)

, where eb is a big noise accumulated over a series of many ciphertext (or plaintext) multiplications. The goal of noise bootstrapping is to convert (a0,a1,  ak1,b) into (a0,a1,  ak1,b) such that:

b = i=0k1aisi + Δm + es

, where es is a re-initialized noise.

D-1.8.1 Overview

To implement noise bootstrapping, we create a specially designed (n 1)-degree polynomial V (X) called a Lookup Table (LUT). Before explaining V (X), we will first motivate the idea based on a preliminary LUT polynomial V q(X). Imagine that the polynomial V q(X)’s each degree term Xj has its exponent j = Δmi + e, a plaintext mi with some noise e Δ, and its corresponding coefficient vj = mi, which is a noise-free plaintext. Therefore, the (q 1)-degree polynomial V q(X) is defined as follows:

V q(X) = v0 + v1X1 + v2X2 +    + vq1Xq1

= m0XΔm0+e0 + m0XΔm0+e1 + m0XΔm0+e2 +    + m0XΔm0+eΔ1 # total Δ terms

+  m1XΔm1+e0 + m1XΔm1+e1 + m1XΔm1+e2 +    + m1XΔm1+eΔ1 # total Δ terms

+   

+  mt1XΔmt1+e0 + mt1XΔmt1+e1 + mt1XΔmt1+e2 +    + mt1XΔmt1+eΔ1 # total Δ terms

In the above formula, each mi and ek represent every possible plaintext message and error values (where mi t and ek Δ).

We design V q(X) to have the special property that each vjXj term represents the special mapping (exponent, coefficient) = (Δmi + e,mi), where e can be any value in Δ. During the TFHE setup stage, we GLWE-encrypt V q(X) by using our newly defined GLWE key S𝑏𝑘, a bootstrapping key, which is different from the LWE secret key s. S𝑏𝑘 is a list of (n 1)-degree polynomials with binary coefficients. Later, during the noise bootstrapping stage, we will rotate the coefficients of V by Δm + e positions to the left by computing V X(Δm+e) = V , by using the polynomial coefficient rotation method 1 technique (Summary A-5.2.1 in §A-5.2). Then, we will extract the polynomial’s constant term’s coefficient (i.e., the left-most 0-degree term’s coefficient in the rotated polynomial V ) by using the coefficient extraction technique (§D-1.7). Further, we will encrypt V q(X) as a GLWE ciphertext at the TFHE setup stage, and thus the rotated V q(X)’s extracted constant term’s coefficient is an LWE encryption of m (i.e., 𝖫𝖶𝖤s,σ(Δm)) with a re-initialized (i.e., completely reduced) noise.

To summarize, the noise bootstrapping procedure can be conceptually understood (at least for now) as follows:

1.
Input: 𝖫𝖶𝖤s,σ(Δm + e) as a noisy ciphertext encrypting m
2.
Convert the input into the form of X(Δm+e) as a rotator of V q(X) (Lookup Table).
3.
Rotate V q to the left by Δm + e positions by computing V q X(Δm+e) = V q.
4.
Extract the rotated V q(X)’s constant term’s coefficient m as an LWE encryption, which is 𝖫𝖶𝖤s,σ(Δm).
5.
Output: 𝖫𝖶𝖤s,σ(Δm) as an LWE encryption of the plaintext m with a re-initialized noise

The output 𝖫𝖶𝖤s,σ(Δm) encrypts the same plaintext message as the input ciphertext, but with completely reduced noise. Therefore, the output 𝖫𝖶𝖤s,σ(Δm) can be used for subsequent TFHE homomorphic operations (e.g., addition or multiplication). During this noise bootstrapping process, the polynomial V q is used as a dictionary that contains the mappings from the noisy plaintext Δm + e (i.e., as Δm + e = j where vjXj) to the noise-free plaintext m (i.e., as m = vj where vjXj). Therefore, V q is called the Lookup Table (LUT).

Then, what should be the degree of V q(X)? In order for V q(X) to encode all possible mappings from Δm + e q to m t, V q(X) should be a (q 1)-degree polynomial. However, q is a very big number, and it is computationally infeasible to manage a (q 1)-degree polynomial. Thus, in practice, we instead use a much smaller polynomial V (X) whose degree is only n 1. Remember that according to our TFHE setup, n q. Therefore, we need a way to compress the big ciphertext space Δm + e q into a much smaller space n and encode the compressed values as the exponents of Xj in a proportionally correct way. For this proportional compression of q n, we will use the LWE modulus switching technique learned from §C-4.1.

D-1.8.2 Modulus Switch for Noise Boootstrapping

To avoid using the giant (q 1)-degree polynomial V q, we will compress q possible ciphertext elements Δm + e q into n distinct exponents of the (n 1)-degree polynomial V , where each vjXj term in V represents a mapping from j vj (i.e., noisy plaintext to noise-free plaintext). However, notice that when we rotate the coefficients of the (n 1)-degree polynomial V to the left, as vjXj rotates across the boundary between X0 and Xn1 degree terms, vj’s sign flips to vj (as shown in the example of §A-5.2.1). Due to this coefficient sign flip, the (n 1)-degree polynomial V can theoretically encode total 2n distinct coefficient states as follows: (v0,v1,v2,  ,vn1,v0,v1,  ,vn1). To move each of these 2n distinct coefficients to the constant term’s coefficient position in V (i.e., shifting the coefficient vj to the leftmost term in V ), the rotating computation of V Xj can use 2n distinct j values, which are {0,1,2,  ,n 1,n,  ,2n 1}, to move each of (v0,v1,v2,  ,vn1,v0,v1,  ,vn1) coefficients to the constant term’s position. This implies that the exponent j in V Xj can use any of the 2n distinct values to cover all possible 2n (sign-flipped) coefficient states of V . Also, remember that j = Δm + e. Therefore, we will switch the modulo of Δm + e from q 2n. Using the LWE modulus switching technique (§C-4.1), our original LWE ciphertext 𝖫𝖶𝖤s,σ(Δm + e) = (a0,a1,  ak1,b) qk+1 (i.e., the initial input to the noise bootstrapping procedure) will be converted into the following:

𝖫𝖶𝖤s,σ(Δ^m) = (a^0,a^1,  a^k1,b^) 2nk+1

s = (s0,s1,  sk) 2k # the secret key stays the same, as each si is binary

Δ^ = Δ2n q = 2n t 2n

a^i = ai2n q 2n

e^ = e2n q 2n

b^ = b2n q i=0k1a^isi + Δ^m + e^ 2n

The degree of V (X) and Security: If our goal were to design the minimal-degree polynomial V whose coefficients map all possible values of the plaintext m, then it would be sufficient to design a t-degree polynomial V . Nonetheless, the reason why we choose the degree of V to be 2n instead of t is to guarantee an enough security level– the higher the polynomial degree n is, the safer our scheme is against attacks.

D-1.8.3 Halving the Plaintext Space To be Used

Problematically, the LUT polynomial V (X) rotates negacyclically, that is, V (X) Xn = V (X) (i.e., coefficients flip their signs with the rotation period of n). More generally:

V (X) Xj = V (X) X2nj = V (X) X4nj =

= V (X)X(jmod2n) = { vj + vj+1X + ,for 0 i < n vj vj1X ,for n j < 2n

, where vj denotes the constant term’s coefficient after rotating the polynomial V (X) by j positions to the left. Problematically, vj flips its sign whenever its rotation crosses the boundary between X0 and Xn1. Given the modulus-switched values a^j, e^, and b^, we design the following LUT polynomial V (X):

V (X) = v0 + v1X1 + v2X2 +    + vn1Xn1

= m0XΔ^m0+e^0 + m0XΔ^m0+e^1 + m0XΔ^m0+e^2 +    + m0XΔ^m0+e^Δ^1 # total Δ^ terms

+  m1XΔ^m1+e^0 + m1XΔ^m1+e^1 + m1XΔ^m1+e^2 +    + m1XΔ^m1+e^Δ^1 # total Δ^ terms

+   

+  mt21XΔ^mt21+e^0 + mt21XΔ^mt21+e^1 + mt21XΔ^mt21+e^2 +   + mt21XΔ^mt21+e^Δ^1 # total Δ^ terms

Remember that by computing V (X) Xj for j = {0,1,,n 1}, we can rotate V (X)’s coefficients to the left by {0,1,n 1} positions. For each j-slot rotation of V (X) where j = {0,1,,n 1}, the rotated polynomial V (X) gets the following values as the constant-term’s coefficient:

Δm0,Δm0,  coeff. of XΔ^m0+e^Δ^ repetitionsΔm 1,Δm1,  coeff. of XΔ^m1+e^Δ^ repetitions  Δm t21,Δmt21,  coeff. of XΔ^mt21+e^Δ^ repetitionsV (X)’s constant term’s coefficient for j = {0,1,n 1} rotations

In the above expression, e^ is a noise that can range from [0,Δ^). Note that all of Δ^mi + e^0,Δ^mi + e^1,,Δ^mi + e^Δ^1 exponents are designed to be mapped to the same coefficient value, mi, which aligns with the fact that their underlying plaintext mi is the same when decrypted (once their associated noise e^ gets eliminated). This is why each mi is redundantly used Δ^ times in a row as coefficients in V (X). We can view this sequential repetition of coefficients as having a robustness of mapping each Δ^mi + e^ to mi against any noise e^ Δ^.

So far, the above sequence of m0,m1,,mt21 coefficients is what we expect V (X) (i.e., the rotated polynomial) to return as its constant term’s coefficient for each of 0,1,,n 1 rotations (where each mi + 1 = mi+1). However, the correctness of the coefficient mappings breaks when the rotation count is between [n,2n 1), because their coefficients flip their signs when they cross the term’s boundary from X0 to Xn1, due to the polynomial ring’s negacyclic nature. Specifically, the constant term’s coefficient values of the rotated polynomial V (X) are as follows for each rotation of n,n + 1,,2n 1 positions:

m0,m0,  coeff. of XΔ^m0+e^Δ^ repetitionsm 1,m1,  coeff. of XΔ^m1+e^Δ^ repetitions  m t21,mt21,  coeff. of XΔ^mt21+e^Δ^ repetitionsV (X)’s constant term’s coefficient after each of n,n + 1,2n 1 rotations

As we can see above, the rotated V (X)’s constant term’s coefficient shows a negacyclic pattern with the rotation period of n, where the second n-rotation group’s coefficients are exactly the negated values of the first n-rotation group’s values. Let’s understand why this negacyclic behavior breaks the (exponent, coefficient) = (Δ^m + e^,m) mappings. Since TFHE’s plaintext and ciphertext values are defined in rings, as we rotate the LUT polynomial V (X), we ideally want the rotated polynomial V (X)’s constant term’s value (i.e., mapped plaintext value) to wrap around in a circular manner, representing a ring pattern (with sequential Δ^ repetitions of each value to be resistant against up to a e^ ZΔ^ noise). However, the negacyclic nature of a polynomial ring makes the constant term’s value of the second-half rotation group problematic, because they are exact negations of those of the first-half rotation group, breaking the circular wrapping-around ring pattern between the first-group values and the second-group values.

To summarize the problem, V (X) has a limitation in becoming a perfect LUT, because it preserves the correct mappings of (exponent, coefficient) = (Δ^m + e^,m) only for one half of i t, not for the other half.

Solution: Good news is that we have observed that V (X)’s mappings of (exponent, coefficient) = (Δ^m + e^,Δm) preserve their ring-pattern consistency if V (X) is rotated no more than n 1 positions (i.e., the first-half rotation group). Therefore, the easiest solution to avoid the negacyclic problem of the LUT polynomial rotation is that the application of TFHE restricts V (X) to be rotated no more than n 1 positions by design during the noise bootstrapping. To enforce this, when the TFHE application’s computation pipeline processes plaintext values (in its original plaintext computation logic before considering any homomorphic operations), the application should ensure to involve only some pre-defined continuous t 2 modulo values within t as the possible inputs and outputs of each computation step. This constraint effectively ensures the possible values of Δ^m + e^ to be continuous n values within 2n. Since the LUT polynomial V (X) gets rotated by computing V (X) X(Δ^m+e^), as the application restricts Δ^m + e^ to be at most n 1 (out of 2n 1) by its application design, V (X) will be rotated at most n 1 positions during the noise bootstrapping. Thus, we can prevent the occurrences of the problematic {n,n + 1,  ,2n 1} rotations that flip the signs of coefficients.

To summarize, at the cost of halving the application’s usable plaintext values to some continuous t 2 values within t, we can prevent V (X)’s negacyclic rotation problem, and thereby preserve V (X)’s correct mappings of (exponent, coefficient) = (Δ^m + e^,m).

Considering all these, our final LUT polynomial V (X) is as follows:

Summary D-1.8.3 Structure of Lookup Table Polynomial 𝐕 (𝐗)

V (X) = v0 + v1X1 + v2X2 +    + vn1Xn1

= m0XΔ^m0+e^0 + m0XΔ^m0+e^1 + m0XΔ^m0+e^2 +    + m0XΔ^m0+e^Δ^1

+  m1XΔ^m1+e^0 + m1XΔ^m1+e^1 + m1XΔ^m1+e^2 +    + m1XΔ^m1+e^Δ^1

+   

+ mt21XΔ^mt21+e^0 + mt21XΔ^mt21+e^1 + mt21XΔ^mt21+e^2

+    + mt21XΔ^mt21+e^Δ^1

, where Δ^ = Δ 2n q = 2n t . The application should ensure that m0,m1,,mt21 are some continuous modulo- t 2 values in t. This constraint ensures V (X)’s rotation positions Δ^mi + e^ (where e Δ^) to be most n continuous possibilities, preventing V (X) from making more than 1 full-cycle rotation that triggers a negacyclic problem.

D-1.8.4 Blind Rotation

Blind rotation refers to rotating an encrypted polynomial’s coefficients so that it is not possible to know how many positions the polynomial’s coefficients are rotated, and after the rotation, it is not possible to see which coefficient has moved to which degree term. Blind rotation uses the basic polynomial rotation method 1 technique (Summary A-5.2 in §A-5.2), with the difference that the V (X) Xi computation is done homomorphically.

Note that XΔ^m+e^b = Xb^ i=0k1a^isi , so we can rotate V by computing V X(b^ i=0k1a^isi) = V Xb^+ i=0k1a^isi . In fact, we cannot directly compute the LWE decryption formula b^ + i=0k1a^isi (or b^ i=0k1a^isi) without the knowledge of the LWE secret key S. Nevertheless, there is a mathematical work-around to compute V Xb^+ i=0k1a^isi without the knowledge of the secret key S, provided we are given {𝐺𝐺𝑆WS𝑏𝑘,σβ,l(si)}i=0k1 at the TFHE setup stage. Note that {𝐺𝐺𝑆WS𝑏𝑘,σβ,l(si)}i=0k1 is a GGSW encryption of the LWE secret key S, encrypted by the GLWE secret key S𝑏𝑘 (i.e., a bootstrapping key). We use S𝑏𝑘 to homomorphically compute V Xb^+ i=0k1a^isi (i.e., blindly rotate the coefficients of V to the left by b^ + i=0k1a^isi positions), according to the following procedure:

1.
GLWE-encrypt the polynomial V with the bootstrapping key S𝑏𝑘 at the TFHE setup stage, so that each coefficient of V gets encrypted.
2.
Compute V 0 = V Xb^, which is basically rotating V ’s polynomials by b^ positions to the left. Since b^ is a known value visible in the LWE ciphertext, we can directly compute the rotation of V 0 = V Xb^.
3.
Compute V 1 = V 0 Xa^0s0 = s0 (V 0 Xa^0 V 0) + V 0. This formula works for the special case where s0 {0,1}: if s0 = 0, then V 1 = V 0; else if s0 = 1, then V 1 = V 0 Xa^0. Computing s0 (V 0 Xa^0 V 0) + V 0 is done as a TFHE homomorphic addition and multiplication. We call this blind rotation of V 0, where the selection bit s0 (i.e., the 1st element of the secret key vector S) is encrypted as a GGSW ciphertext by using S𝑏𝑘 (i.e. the bootstrapping key) and V 0 is an encrypted polynomial as a GLWE ciphertext. Multiplying GLWE-encrypted V 0 with xa^0 is done by GLWE ciphertext-to-plaintext multiplication (§C-3), and subtracting the result by GLWE-encrypted V 0 is done by GLWE ciphertext-to-ciphertext addition/subtraction (§C-1), and multiplying the result by GGSW-encrypted s0 is done by GLWE-to-GGSW multiplication (§D-1.6.2), and adding the result with GLWE-encrypted V 0 is done by GLWE ciphertext-to-ciphertext addition. If s0 = 1, then the formula’s Xa^0 term gets multiplied to V 0, which effectively rotates V 0’s coefficients by a^0 positions to the right. Else if s0 = 0, then V 0 does not get rotated and stays the same. In both cases, the resulting V 1 is encrypted as a new GLWE ciphertext. During this blind rotation, unless we have the knowledge of s0 and S𝑏𝑘, it is impossible to know whether V 0 has been rotated or not, and also how many positions have been rotated.
4.
By using the same blind rotation method as in the previous step, compute the GLWE encryption of V 2 = V 1 Xa^1s1 = s1 (V 1 X1a^ V 1) + V 1. Note that we have the following publicly known components: a^1, a GLWE encryption of V 1, and a GGSW ciphertext of s1 encrypted by using S𝑏𝑘.
5.
Continue to compute the GLWE encryption of V 3,V 4,  ,V k in the same manner, and we finally get a GLWE encryption of V k, whose computed value is equivalent to:

V = V k

  = V k1 Xa^k1sk1

  = V 0 Xa^0s0Xa^1s1Xa^k1sk1

  = V Xb^+ i=0k1a^isi

  = V X(Δ^m+e^b)

This means that the GLWE encryption of the final polynomial V k will have the coefficient m in its constant term, as V (X) is designed to have the mapping (Δ^m + e^,m).

Note that while we restrict the application’s plaintext space usage to some continuous t 2 modulo values within t (§D-1.8.3), this restriction does not exist in the ciphertext space. That is, it is okay for blind rotations to rotate V (X) more than n positions during the intermediate steps, because their invalid positions can be brought back to valid ones by their subsequent steps. Therefore, what matters for the noise bootstrapping correctness is only the completed state V k(X). The rotation-completed V k(X) must have been rotated Δ^m + e^ positions to the left. Therefore, we only need to ensure that Δ^m + e^ falls within our pre-defined continuous t 2 modulo range within the t domain, which is equivalent to ensuring that the aggregate rotation count is at most n 1 positions to avoid coefficient extraction of any double-signed contradicting coefficients.

PIC

Figure 13: An illustration of the MUX logic gate

Homomorphic MUX Logic Gate: In step 3, the formula s0 (V 0 Xa^0 V 0) + V 0 implements the MUX logic gate as shown in Figure 13, where in our case s0 is the selection bit that chooses between the two inputs: V 0 and V 0 Xa^0. If s0 is 1, then the output is V 0 Xa^0; otherwise, the output is V 0. In our design, the homomorphic computation of s0 (V 0 Xa^0 V 0) + V 0 effectively implements a homomorphic MUX gate, where the two inputs are LWE-encrypted and the selection bit is GGSW-encrypted.

D-1.8.5 Coefficient Extraction

Finally, we use the coefficient extraction technique (§D-1.7) to extract the rotated polynomial V (X)’s constant term’s coefficient as an encryption of m: 𝖫𝖶𝖤s,σ(Δm). At this point, the original 𝖫𝖶𝖤 ciphertext’s old noise e^b has gone, and the bootstrapped new ciphertext 𝖫𝖶𝖤s,σ(Δm) has a newly generated small noise es.

In fact, the homomorphic MUX logic in the blind rotation procedure (§D-1.8.4) involves lots of ciphertext multiplications and additions, which can accumulate additional noise until we reach the point of coefficient extraction. In order to limit the accumulating noise during the series of MUX logic, we can carefully adjust the security parameters. For example, we can design a narrower Gaussian distribution for sampling the noise e, while designing a sufficiently large n to compensate for the reduced noise. Meanwhile, increasing q rather makes the system less secure, because it becomes more vulnerable to lattice reduction attacks.

D-1.8.6 Noise Bootstrapping Summary

TFHE’s noise bootstrapping procedure is summarized as follows:

Summary D-1.8.6 TFHE Noise Bootstrapping Procedure

Lookup Table Encryption: Encrypt the LUT polynomial V (X) as a GLWE ciphertext by using the bootstrapping key S𝑏𝑘.

1.
Modulus Switch: Change the modulus of the TFHE ciphertext 𝖫𝖶𝖤s,σ(Δm + eb) from q 2n to get 𝖫𝖶𝖤s,σ(Δ^m + e^b), where Δ^ = Δ 2n q = 2n t .

2.
Blind Rotation: Rotate the GLWE-encrypted polynomial V by (b^ i=0k1a^isi) = (Δ^m + e^b) positions to the left, by recursively computing:

V 0 = V Xb^

V 1 = V 0 Xa^0s0 = s0 (V 0 Xa^0 V 0) + V 0

V k = V k1 Xa^k1sk1 = sk1 (V k1 Xa^0 V 0) + V k1

= V 0 Xa^0s0Xa^1s1Xa^k1sk1

= V Xb^+ i=0k1a^isi

= V X(Δ^m+e^b)

Each step of the actual blind rotation above is computed as the following TFHE ciphertext-to-ciphertext multiplication and addition:

𝖦𝖫𝖶𝖤S,σ(V i+1) = 𝖦𝖦𝖲𝖶S,σβ,l(si)(𝖦𝖫𝖶𝖤S,σ(V i)Xa0 𝖦𝖫𝖶𝖤S,σ(V i))+𝖦𝖫𝖶𝖤S,σ(V i)

3.
Coefficient Extraction: Homomorphically extract the constant term’s coefficient m from the rotated polynomial V k, which is 𝖫𝖶𝖤s,σ(Δ^m).

Halving the Usable Plaintext Range: Problematically, the LUT polynomial V rotates negacyclically. To avoid this problem, we require the application to ensure that the plaintext m uses only continuous t 2 modulo values within t. This way, we avoid rotating V (X) more than n 1 positions that cause coefficient extraction of double-signed contradicting coefficients.

D-1.8.7 Example: Noise Bootstrapping

Suppose the GLWE security setup: n = 16, t = 8, q = 64, k = 8

t=8 = {4,3,2,1,0,1,2,3}

q=64 = {32,31,30,  ,29,30,31}

Δ = q t = 64 8 = 8

And suppose we have the following LWE ciphertext:

s = (1,0,0,1,1,1,0,1) = 2k=8

m = 1 t=8

Δm = 1 8 = 8 q=64

𝖫𝖶𝖤s,σ(Δm) = (a0,a1,a2,a3,a4,a5,a6,a7,b) = (8,28,4,32,0,31,6,7,24) q=64k+1=9

e = 2 q=64 (should be the case that |e|< Δ 2 = 4 for correct decryption)

b = i=07aisi + Δm + e = (8 32 + 31 + 7) + 8 + 2 = 24 q=64

Now then, the TFHE noise bootstrapping procedure is as follows:

1.
Modulus Switch: Switch the modulus of 𝖫𝖶𝖤s,σ(Δm) From q 2n, which is from 64 32. After the modulus switch, the original LWE ciphertext is converted as follows:

2n=32 = {16,15,14,  ,13,14,15}

s = (1,0,0,1,1,1,0,1) = 2k=8

Δ^ = Δ2n 64 = 832 64 = 4

Δ^m = 4 1 = 4 2n=32

e^ = e2n q = 232 64 = 1 2n=32

𝖫𝖶𝖤s,σ(Δ^m) = (a^0,a^1,a^2,a^3,a^4,a^5,a^6,a^7,b^) 2n=32k+1=9

= (832 64, 2832 64,432 64, 3232 64,032 64,3132 64, 632 64,732 64,2432 64)

= (4,14,2,16,0,16,3,4,12)

Note that i=07(a^isi) + Δ^m + e^ = (4 16 + 16 + 4) + 4 + 1 = 13 2n=32

b^ = 12 13 = i=07(a^isi) + Δ^m + e^

This small difference in b^ comes from the aggregated noises of rounding a^0,a^1,,e^ during the modulus switch.

2.
Blind Rotation: We assume that the application avoids the problem of negacyclic polynomial rotation by ensuring that the usable plaintext values are the following continuous 8 2 modulo values within 8 = {4,3,2,1,0,1,2,3}, which are {2,1,0,1}. This implies that the only possible values of i = Δ^m + e^ in V (X) Xi will be: i = {8,7,,6,7}. Based on these requirements, Table 4 is the Lookup Table polynomial V (X) that maps Δ^m + e^ to Δm.

V (X) = v0 + v1X + v2X2 + v 3X3 + v 4X4 + v 5X5 + v 6X6 + v 7X7
...... + v8X8 + v 9X9 + v 10X10 + v 11X11 + v 12X12 + v 13X13 + v 14X14 + v 15X15
.... = 0 + 0X + 0X2 + 0X3 + 1X4 + 1X5 + 1X6 + 1X7
...... + 2X8 + 2X9 + 2X10 + 2X11 + 1X12 + 1X13 + 1X14 + 1X15
i = Δ^m + e^ 8 7 6 5 4 3 2 1
(in V Xi) (11000 2) (110012) (110102) (110112) (111002) (111012) (111102) (111112)
constant term’s 2 2 2 2 1 1 1 1
coeff. of V Xi 1102 1102 1102 1102 1112 1112 1112 111002
𝐦 (plaintext) 2 2 2 2 1 1 1 1
i = Δ^m + e^ 0 1 2 3 4 5 6 7
(in V Xi) (000 2) (0002) (0002) (0002) (0012) (0012) (0012) (0012)
constant term’s 0 0 0 0 1 1 1 1
coeff. of V Xi 000002 000002 000002 000002 001002 001002 001002 001002
𝐦 (plaintext) 0 0 0 0 1 1 1 1
Table 4: The Lookup Table for n = 16,q = 64,t = 8 LWE setup. Orange is the plaintext m’s bits. Green is the noise e’s bits.

Note that V (X)’s coefficients for the X8 X15 terms are {2,1} instead of {2,1}, so that if V gets rotated by {8,7,6,5,4,5,6,7} slots to the left, the constant term’s coefficient flips its sign to {2,1}due to wrapping around the boundary of the n exponent.

During the actual bootstrapping, we will do a blind rotation of Table 4’s V (X) (which is GLWE-encrypted) by b^ i=07a^isi = 4 positions to the left, which is computed as follows:

Δ^m + e^ = b^ i=07a^isi = 12 (4 16 + 16 + 4) = 4 mod 32 2n=32

In Table 4, if the rotation count i = 4, the corresponding constant term’s coefficient is v4 = 1 = m. As Δ = 4, we finally get 𝖫𝖶𝖤s,σ(Δm) = 1.

The actual blind rotation is computed as follows:

s = (1,0,0,1,1,1,0,1)

𝖫𝖶𝖤s,σ(Δ^m) = (a^0,a^1,a^2,a^3,a^4,a^5,a^6,a^7,b^) = (4,14,2,16,0,16,3,4,12)

V 0 = V Xb^ = V X12 = v12 + v13X + v14X2 +

V 1 = V 0 Xa^0s0 = s0 (V 0 Xa^0 V 0) + V 0 = V 0 X4 = v8 + v9X + v10X2 +

V 2 = V 1 Xa^1s1 = s1 (V 1 Xa^1 V 1) + V 1 = V 1 = v8 + v9X + v10X2 +

V 3 = V 2 Xa^2s2 = s2 (V 2 Xa^2 V 2) + V 2 = V 2 = v8 + v9X + v10X2 +

V 4 = V 3 Xa^3s3 = s3 (V 3 Xa^3 V 3) + V 3 = V 3 X16 = v8 v9X v10X2

V 5 = V 4 Xa^4s4 = s4 (V 4 Xa^4 V 4) + V 4 = V 4 X0 = v8 v9X v10X2

V 6 = V 5 Xa^5s5 = s5 (V 5 Xa^5 V 5) + V 5 = V 5 X16 = v8 + v9X + v10X2 +

V 7 = V 6 Xa^6s6 = s6 (V 6 Xa^6 V 6) + V 6 = V 6 = v8 + v9X + v10X2 +

V 8 = V 7 Xa^7s7 = s7 (V 7 Xa^7 V 7) + V 7 = V 7 X4 = v4 + v5X + v6X2 +

The final output of blind rotation is the GLWE ciphertext of V 8, 𝖦𝖫𝖶𝖤S,σ(V 8), whose constant term’s coefficient is v4 = m = 1.

Each step of the actual blind rotation above is computed as the following TFHE ciphertext-to-ciphertext multiplication:

𝖦𝖫𝖶𝖤S,σ(V i+1) = 𝖦𝖦𝖲𝖶S,σβ,l(si) (𝖦𝖫𝖶𝖤S,σ(V i) Xa0 𝖦𝖫𝖶𝖤S,σ(V i)) + 𝖦𝖫𝖶𝖤S,σ(V i)

We will leave this computation for the reader’s exercise.

3.
Coefficient Extraction: At the end of blind rotation, we finally get the following GLWE ciphertext:

𝖦𝖫𝖶𝖤S,σ(V 8)

= 𝖦𝖫𝖶𝖤S,σ(Δ^(v4+v5X+v6X2+v7X3+v8X4+v9X5+v10X6+v11X7+v12X8+v13X9+v14X10+v15X11v0X12v1X13v2X14v3X15))

= 𝖦𝖫𝖶𝖤S,σ(Δ^(1+1X+1X2+1X3+2X4+2X5+2X6+2X7+1X8+1X9+1X10+1X110X120X130X140X15))

= (A0 = j=015(a0,0 + a0,1X + ),A1 = ,Ak1 = ,B = j=015bjXj)

Now, we extract the constant term’s coefficient of the encrypted polynomial 𝖦𝖫𝖶𝖤S,σ(Δ^ (1 + 1X + 1X2 + )) by using the coefficient extraction formula (Summary D-1.7). Specifically, we will extract the constant term’s coefficient, which corresponds to 𝖫𝖶𝖤s,σ(Δm0). We extract 𝖫𝖶𝖤s,σ(Δm0) by computing the following:

𝖫𝖶𝖤s,σ(Δm0) = (a0,a1,  ,ak,bh)

, where ani+j = { ai,0j (if 0 j 0) ai,n+0j (if 0 + 1 j n 1) ,b0 is obtained from the polynomial B
D-1.8.8 Discussion
D-1.8.9 Application: Gate Bootstrapping

Besides implementing the homomorphic MUX logic gate used during blind rotation (§D-1.8.4), it is possible to leverage the LUT polynomial V (X) to implement other homomorphic logic gates such as AND, NAND, OR, XOR, etc. When implementing these gates, each ciphertext is an encryption of a single-bit plaintext (or several bits can be bundled up in a linear combination formula and be processed simultaneously by using LUT). Suppose q = 32, t = 8, m 8 = {4,3,2,1,0,1,2,3}, Δ = q t = 4, Δ^ = Δ 2n q = 2, and we encode the gate input into LWE plaintext as 0 1, and 1 1, and the maximum (accumulated) noise e = [1,1].

Lookup Table Polynomial V (X) = 1 + 1X + 1X2 + 1X3 + 1X4 + 1X5 + 1X6 + 1X7
Decoded
Encoded
Linear
combination
of encodings
Scaled Encoded
Combination
Bootstrapping
Decoded
result
d1 d2 m1 m2 m1 + m2 1 Δ^ (m1 + m2 1) V (X) XΔ^(m1+m21)+e d1 d2
0 0 1 1 3 6 constant term’s coeff. is 1 0
0 1 1 1 1 2 constant term’s coeff. is 1 0
1 0 1 1 1 2 constant term’s coeff. is 1 0
1 1 1 1 1 2 constant term’s coeff. is 1 1
Table 5: An example truth table for an AND operation with an additional encoding.

Table 5 is a programmable bootstrapping design for an AND logic gate. For this application, we define the LUT polynomial V as V (X) = i=07 Xi. The LUT polynomial V (X) maps one half of the plaintext domain to 1, while the other half to 1 (as the terms wrap around the boundary of n = 7). In this design setup, each bit is separately encrypted as independent TFHE ciphertext. Gate inputs 0 and 1 are encoded as 1 and 1, respectively. The linear combination (i.e., homomorphic computation formula) for an AND gate is 𝖫𝖶𝖤s,σ(Δm1) + 𝖫𝖶𝖤s,σ(Δm2) 1. Its output is positive if both inputs are positive (i.e. 1, in which case the blind rotation will rotate V to the left by Δ^ 1 + e positions and the constant term’s coefficient will be 1. Thus, the output of blind rotation and coefficient extraction will be 𝖫𝖶𝖤s,σ(Δ 1) with a reduced noise, which is an encoding of 1. This design can tolerate the maximum noise of |e|= 1. To endure bigger noises, we should increase q and n.

Note that the AND gate’s LUT layout is negacyclic, which is a special case, thus we could use the entire 2n = 16 coefficient states in V (X) for the AND gate mapping function’s outputs, by leveraging V (X)’s innate property of negacyclic rotation. However, in many use cases, the LUT layout is not necessarily negacyclic like this AND gate example. Even our noise bootstrapping’s LUT layout (§D-1.8.1) was not negacyclic, but a unity function (as it simply removes the noise). Thus, for most use cases, we need to use only t 2 out of t plaintext space to avoid more than n 1 rotations of V (X) (§D-1.8.3).

Besides the AND gate, other logic gates can be built in a similar manner, each of which is based on a different linear combination formula and LUT layout.

Division: TFHE does not support direct division of plaintext numbers of any size. This is because TFHE’s LWE vector elements are in the Zq ring, where each element g does not necessarily have a multiplicative inverse g1, which makes it hard to multiply g1 to the target number to divide. Instead, division can be implemented as binary division based on the gates implemented by gate bootstrapping. To support binary division, each plaintext has to be a single bit and encrypted as an independent ciphertext. Or multiple bits can be bundled up and processed concurrently by designing a linear combination formula, similar to the linear combination that we designed for processing 2 input bits of an AND gate.

D-1.8.10 Application: Neural Networks Bootstrapping

PIC

Figure 14: An illustration of neural networks

PIC

Figure 15: An illustration of neural networks’s programmable bootstrapping

Homomorphic encryption can be applied to the neurons of deep neural networks, in which each neuron is generally comprised of two steps of computation:

1.
Linear Combination of Input Values: An input feature value (or intermediate value) set (x1,x2,  ,xn), a weight set (w1,w2, x ,wn), and a bias b are computed as: y = i=1na0w0 + b.
2.
Activation Function: f(y) is computed, where f is a non-linear activation function such as the sin function, ReLU, sigmoid, hyperbolic tangent, etc.

TFHE can homomorphically compute the 1st step’s linear combination formula: y = i=1na0w0 + b as i=1n𝖫𝖶𝖤s,σ(a0) w0 + b, which can be implemented as ciphertext addition (§C-1) and ciphertext-to-plaintext multiplication (§C-3).

However, the 2nd step’s non-linear functions cannot be expressed as addition and multiplication of ciphertexts. To address this issue, the activation function can be evaluated as a programmable bootstrapping, such that the output of the bootstrapping matches or (or is similar) to the output of the activation function. If we use bootstrapping at the 2nd step, noises can be refreshed at the end of every neuron, thus we can potentially handle neural networks of any depth without worrying about the noise growth.