Homomorphic Encryption (HE) is often described as the "holy grail" of cryptography, enabling computation on data while it remains encrypted. This capability is vital for privacy-preserving cloud computing and secure data analysis. However, the massive computational overhead of HE has historically confined it to theoretical research and small-scale prototypes. To address this, researchers from Nanjing University, Fudan University, and Zhejiang Lab have introduced Phantom, a high-performance, unified GPU-accelerated library designed to bridge the gap between HE theory and real-world application.
The Challenge of Practical Homomorphic Encryption
While HE provides unparalleled privacy, it is notoriously slow. Word-wise HE schemes, such as BGV, BFV, and CKKS, are preferred for practical use because they allow for "batching"—packing multiple data points into a single ciphertext to be processed in parallel, similar to SIMD (Single Instruction, Multiple Data) operations.
Despite these theoretical advantages, CPU-based libraries like Microsoft SEAL often remain too slow for complex tasks such as deep learning inference. Previous attempts to leverage GPU acceleration have been fragmented, typically focusing on a single scheme or a specific subset of operations. There was a clear need for a unified framework that optimizes the entire pipeline—from low-level polynomial mathematics to high-level scheme management—across all major HE variants.
The Phantom Architecture
Phantom is built from the ground up using a multi-layered architecture that integrates math/polynomial operations, Residue Number System (RNS) arithmetic, and high-level scheme functions. This modular approach allows for a unified logic where BGV, BFV, and CKKS share highly optimized underlying codebases.
Technical Innovations
The library introduces several key engineering and theoretical optimizations to maximize GPU performance:
- NWT-2D (Number-theoretic Weighted Transform): Instead of a standard 1D transform, Phantom utilizes a hierarchical 2D approach for polynomial multiplication. This reduces register pressure on the GPU, allowing for higher occupancy and fewer slow accesses to global memory.
- Kernel Fusing: By "fusing" multiple operations (such as modulus-switching and error correction) into a single GPU kernel, Phantom keeps data in fast on-chip registers and shared memory. This drastically reduces the I/O latency caused by moving data between the GPU's processing cores and its main VRAM.
- Optimized Hybrid Key-Switching: Key-switching is one of the most expensive operations in HE. The authors refined the "hybrid" technique to eliminate redundant transforms, saving significant computational cycles.
- Karatsuba Multiplication: The library applies the Karatsuba algorithm to homomorphic multiplication, trading expensive 64-bit multiplications for cheaper additions and shifts at the instruction level.
Comparative Analysis and Benchmarking
To evaluate Phantom, the researchers compared it against the industry-standard CPU library, Microsoft SEAL, and previous state-of-the-art GPU implementations, such as the work by Jung et al. (2021). Benchmarks were performed on an NVIDIA Tesla A100 80G GPU using standard cryptographic parameter sets that meet 128-bit security standards.
As shown in the comparison table, Phantom provides the most comprehensive support for scheme functions and operations across all three major word-wise HE schemes. Notably, it provides the first comprehensive performance report for the BGV scheme on a GPU.
Key Results
The optimizations implemented in Phantom yielded significant performance gains:
- Key-Switching Speedup: Phantom achieved a 1.4x speedup in the total time for the key-switching module compared to the previous best GPU implementation.
- NWT/INWT Efficiency: The optimized transforms showed up to a 19.8% improvement in speed and a 24.7% increase in memory throughput.
- Kernel Fusing Impact: Fusing the
ModDownoperation with error correction in BGV resulted in a speedup of 1.73x to 1.90x for that specific task. - Scalability: Phantom supports larger parameter sizes (polynomial degrees up to $2^{17}$) than many previous works, making it suitable for complex, deep-circuit computations.
Conclusion and Future Work
Phantom demonstrates that managing the GPU's memory hierarchy through kernel fusing and hierarchical transforms is just as critical as optimizing the underlying algebra. By providing a unified, high-speed framework, Phantom moves word-wise homomorphic encryption closer to practical deployment in privacy-sensitive fields.
While the library is a major step forward, future work remains. The authors note that while the library supports the operations needed for bootstrapping (refreshing ciphertexts), a fully optimized end-to-end bootstrapping benchmark for all three schemes was not the primary focus of this study. Additionally, scaling these optimizations across multi-GPU clusters represents a promising path for even larger-scale applications.
Summary updated