Abstract
Fully Homomorphic Encryption (FHE) enables computation on encrypted data but suffers from significant performance overheads, particularly in programs containing complex or "oblivious" loops. We present CHLOE, a compiler framework that optimizes loop execution through intelligent segmentation, multi-level vectorization, and control-path reduction. By classifying loops and applying closed-form mathematical analysis, CHLOE achieves speedups ranging from $3.2\times$ to $10^5\times$ over state-of-the-art FHE compilers.
Introduction
Fully Homomorphic Encryption (FHE) is often described as the "holy grail" of cryptography, allowing for secure computation without data decryption. Despite its promise, FHE remains orders of magnitude slower than plaintext computing. A primary bottleneck is the handling of loop structures. Standard loops introduce branching complexity, requiring the execution of all paths via masking, and "oblivious loops"—where termination conditions are encrypted—often necessitate inefficient full unrolling.
Methodology: The CHLOE Framework
CHLOE addresses these challenges through a multi-level compiler architecture built on the MLIR framework. The system categorizes loops into Transparent Loops (with public conditions) and Oblivious Loops (with encrypted conditions).
The core optimization strategy involves several key components:
- Loop Segmentation: Breaking complex loop bodies into independent arithmetic (additions/multiplications) and non-arithmetic (comparisons) segments. This allows the compiler to apply specialized optimizations to each part.
- Multi-Level Vectorization: Utilizing SIMD (Single Instruction, Multiple Data) capabilities of schemes like CKKS and BFV. CHLOE employs SIMD-PBS (Programmable Bootstrapping) to amortize the cost of expensive bootstrapping operations across multiple data points.
- Control-Path Reduction: For oblivious loops following known mathematical recurrences (e.g., the Fibonacci sequence), CHLOE uses Closed-Form Analysis to replace iterative loops with single analytical expressions.
- Cost-Aware Type Alignment: A cost model guides the selection of data representations (e.g., switching between LWE and RLWE ciphertexts) to minimize computational noise and total latency.
Key Insights and Comparative Analysis
CHLOE's performance stems from its ability to avoid unnecessary unrolling and its "cross-scheme" nature. Unlike many compilers restricted to a single FHE scheme, CHLOE acts as a hybrid compiler, dynamically selecting the optimal tool (CKKS, BFV, or TFHE) for different program segments.
As shown in the comparative analysis, CHLOE is the only general-purpose compiler supporting a hybrid of BFV, TFHE, and CKKS with integrated scheme switching and advanced loop optimizations like segmentation and distribution.
Evaluation and Results
The framework was evaluated against real-world benchmarks including database querying, SVM classification, and iterative image segmentation.
- Transparent Loops: CHLOE achieved speedups of $3.2\times$ to $54\times$ over HEIR and Google's Transpiler. Its vectorization strategy allowed execution time to remain nearly flat as data size increased, whereas other compilers saw linear increases in latency.
- Oblivious Loops: In cases where closed-form solutions were applicable, CHLOE outperformed human-assisted unrolling by up to $10^5\times$.
- Efficiency: In image segmentation tasks, CHLOE demonstrated a $172\times$ performance improvement over the nearest competitor.
Conclusion and Limitations
While CHLOE significantly advances FHE compiler technology, it introduces higher memory overhead due to the requirements of SIMD-PBS. Furthermore, performance gains are limited in loops with immediate data dependencies between arithmetic and non-arithmetic operations within the same iteration. Future work will focus on optimizing ciphertext conversion to handle complex data reuse scenarios more efficiently.
Summary updated