Abstract
This paper presents a method for performing Convolutional Neural Network (CNN) inference while maintaining the privacy of both user input data and provider model parameters through Fully Homomorphic Encryption (FHE). By optimizing CNN architectures to minimize multiplicative depth—replacing ReLU with polynomial activations and Max Pooling with Mean Pooling—and employing nested multi-threading, the authors achieve practical throughput for secure Machine Learning as a Service (MLaaS). Experimental results on the MNIST dataset demonstrate a high accuracy of 97.86% with an amortized inference time of 34 milliseconds per image.
Introduction
In traditional Machine Learning as a Service (MLaaS), users must trust cloud providers with sensitive data, while model owners must expose proprietary weights. Fully Homomorphic Encryption (FHE) offers a solution by allowing computation on encrypted data. However, standard CNNs are computationally prohibitive in FHE due to non-linear operations like ReLU and Max Pooling, which increase "noise" in ciphertexts and require expensive "bootstrapping" operations. Most existing secure inference solutions only encrypt user inputs, leaving model weights vulnerable.
Methods
The proposed pipeline utilizes the CKKS FHE scheme via IBM's HElib, supporting approximate floating-point arithmetic. To bypass the need for bootstrapping, the authors introduce several architectural constraints:
- Depth-Constrained Architecture: Mean Pooling replaces Max Pooling to avoid multiplicative depth consumption.
- Polynomial Activation: A degree-2 polynomial ($g(u) = 0.47 + 0.50u + 0.09u^2$) replaces ReLU, consuming only a depth of 1.
- SIMD Ciphertext Packing: Thousands of images are packed into single ciphertext slots, enabling massive parallel processing.
- Nested Multi-Threading: A custom strategy distributes workloads across 112 CPUs to manage the significant memory overhead of FHE ciphertexts.
The system was evaluated using the MNIST dataset, consisting of 70,000 handwritten digit images.
Key Insights and Trade-offs
A critical finding is the impact of the FHE depth parameter ($L$). Increasing $L$ allows for deeper networks but results in a linear increase in compute time and memory usage, alongside a non-linear decrease in the security level ($\lambda$). This necessitates custom-designed models that adhere to strict depth constraints.
Furthermore, while convolutions are compute-intensive, Fully Connected (FC) layers present the primary memory bottleneck. The inflation of ciphertexts in FC layers makes naive parallelization impractical, requiring the specialized nested multi-threading approach developed by the authors.
Results
The fully encrypted CNN achieved an accuracy of 97.86% on MNIST, a minimal decrease from the 98.39% baseline. The nested multi-threading strategy provided a ~40x speedup, reducing total execution time from over 6 hours to 561 seconds. Due to the packing of 16,384 images per ciphertext, the amortized throughput reached 34 milliseconds per image.
Conclusion and Future Work
While the amortized throughput is impressive, the high latency for single-image inference (nearly 10 minutes) remains a limitation for real-time applications. Future research will focus on packing strategies that prioritize lower latency and extending these FHE building blocks to support secure model training.
Summary updated