TFHE-rs v0.5: Detecting Overflows, Running on GPU and More
This new version of TFHE-rs introduces two key enhancements: GPU acceleration for improved performance and overflow detection for increased reliability in projects. Additionally, this version marks the start of ongoing backward compatibility in TFHE-rs, aimed at providing a more seamless and consistent experience for developers.
Overflow detection
Rust offers a feature where the program can panic and abort if there's an overflow, meaning an operation's result doesn't fit its output type. However, in homomorphic computations, this gets trickier. Since the server can't see the results due to the nature of Fully Homomorphic Encryption (FHE), detecting overflows is more complex. The newest version of TFHE-rs tackles this by introducing homomorphic operators that can detect overflow. It's important to note that using these overflow-detecting operators might slow things down a bit compared to standard operations. The table below shows some timing based on the type and precision involved.
Overflow detection in TFHE-rs is designed to be efficient. It's not enabled by default to prevent slowing down operations. Instead, it's available through specific functions. The approach involves storing overflow information in a unique ciphertext. This ciphertext must be decrypted by the client for verification. Below is an example demonstrating how to use these new operations.
GPU Powered Homomorphic Computation
TFHE-rs now harnesses GPU power through a CUDA implementation, enhancing its cryptographic capabilities. This update includes almost all operations for homomorphic unsigned integers. The table below summarizes how the timings vary depending on the precision.
Integrating the GPU backend into existing programs is straightforward, requiring minimal changes. Example 2 illustrates this process. The primary adjustment is in the key settings: the client needs to create a compressed server key, which is then sent to the server operating the GPU backend. The server's role is simple – decompress the key and then proceed with the standard homomorphic instructions.
For detailed guidance on configuring the GPU, please refer to the TFHE-rs documentation.
Miscellaneous features
TFHE-rs has been updated with several new features and enhancements, including:
- Data Backward Compatibility: Despite TFHE-rs not being in a stable version, which leads to occasional breaking changes between releases, the library provides tools to help FHE application developers seamlessly update their data from TFHE-rs 0.4 to 0.5. For migration scenarios and examples, see documentation.
- Enhanced KS-PBS Timings: The keyswitch operation in TFHE-rs has been optimized to be 20% to 35% faster. This improvement means that the KS-PBS atomic pattern, a crucial operation in TFHE, now executes in approximately 12 ms on the CPU, using the same benchmark configuration as before.
- Accelerated Addition for Vector of ciphertexts: The process for adding vectors of ciphertexts in TFHE-rs has been significantly optimized, achieving up to a 5x speedup compared to the previous version.
- In the lower levels, there's an update to how large integers are handled. Now, integers based on the Residue Number System (RNS) are easier to use in homomorphic circuits, especially for operations like additions and multiplications.
- Now, there's a homomorphic circuits simulator for debugging. It uses simple ciphertexts, speeding up execution times significantly. This means all operations mimic their encrypted counterparts, making the debugging process quicker and easier.
Additional links
- Star the TFHE-rs Github repository to endorse our work.
- Review the TFHE-rs documentation.
- Get support on our community channels.