D-5 RNS-variant FHE Schemes

FHE parameters of BFV, BGV, or CKKS schemes which are secure enough sometimes require the ring size of polynomial coefficients to be 1000 bits or more, which consumes much computational resources for 64-bit CPU architectures. To make the computation efficient, we can alternatively represent the coefficients of ciphertext polynomials by the number residue system (RNS) §A-13.1, which allows modulo addition and multiplication of elements from a large ring (e.g., 1000 bits) by the combination of values computed in small rings (e.g., 32 64 bits), each of which compactly fits in 64-bit CPU registers. Modern BFV, BGV, and CKKS schemes adopt this RNS approach by default for efficient computation of large values. These are called RNS-variant FHE schemes.

While RNS can directly compute modulo addition and multiplication, it does not directly support other operations such as ModRaise or modulus switch, which are essential operations for all FHE schemes. This section explains how we can design such corner-case operations based on RNS to accomplish a complete design of RNS-based FHE schemes. Besides BFV, BGV, and CKKS, TFHE can also theoretically use RNS for representing its ciphertext coefficients. However, TFHE’s practically used coefficient size is less than 232 (or 264), which compactly fits in 32-bit (or 64-bit) modern CPU registers. Therefore, TFHE does not need RNS. Thus, this section will focus on RNS-based operations for BFV, BGV, and CKKS.

Particularly in this section, we assume the modulo reduction a mod q = |a|q implicitly uses a centered (i.e., signed) residue representation (§A-1.2.3) whose modulo overflow & underflow boundaries are q 2 1 and q 2, respectively. This assumption is necessary to eliminate a certain modulo reduction operation when designing FastBconvEx (§D-5.8)– by using the assumption of limiting the possible range of certain residue arithmetic as discussed in §A-1.2.3.

Required Background


D-5.1 Fast Base Conversion: FastBConv
D-5.2 RNS-based ModRaise: ModRaiseRNS
D-5.3 RNS-based ModDrop: ModDropRNS
D-5.4 RNS-based Modulus Switch: ModSwitchRNS
D-5.4.1 Comparing ModSwitchRNS, ModRaiseRNS, and ModDropRNS
D-5.5 RNS-based Decryption
D-5.5.1 BFV Decryption: 𝖣𝖾𝖼 𝖱𝖭𝖲𝖡𝖥𝖵
D-5.5.2 CKKS and BGV Decryption
D-5.6 BGV’s RNS-based Modulus Switch: 𝖬𝗈𝖽𝖲𝗐𝗂𝗍𝖼𝗁 𝖱𝖭𝖲𝖡𝖦𝖵
D-5.7 Small Montgomery Reduction Algorithm: SmallMont
D-5.7.1 Improving FastBConv by Using SmallMont
D-5.8 Exact Fast Base Conversion: FastBConvEx
D-5.9 Decomposing Multiplication: DecompMultRNS
D-5.10 Applying RNS Techniques to FHE Operations
D-5.10.1 Addition and Multiplication of Polynomials
D-5.10.2 Key Switching
D-5.10.3 Input Slot Rotation
D-5.10.4 BFV’s Ciphertext-to-Ciphertext Multiplication
D-5.10.5 CKKS’s Ciphertext-to-Ciphertext Multiplication
D-5.10.6 BGV’s Ciphertext-to-Ciphertext Multiplication
D-5.10.7 BFV’s Bootstrapping
D-5.10.8 CKKS’s Bootstrapping
D-5.10.9 BGV’s Bootstrapping
D-5.10.10 Noise Impact of RNS Operations
D-5.10.11 Python Source Code of RNS Primitives