Abstract
Fully Homomorphic Encryption (FHE) offers a promising path toward privacy-preserving machine learning by allowing computations on encrypted data. However, deploying modern deep Convolutional Neural Networks (CNNs) in FHE environments remains challenging due to the non-polynomial nature of activation functions and the limited capacity of ciphertext slots. This paper introduces Peregrine, a framework that enables high-performance CNNs, including complex architectures like YOLOv5, to perform inference on encrypted data through a novel one-shot fine-tuning strategy. By integrating range-aware polynomial activations (PolyAct-RN) and a Generalized Interleaved Packing (GIP) scheme, Peregrine achieves near-baseline accuracy on major benchmarks while significantly reducing engineering complexity.
Introduction
Fully Homomorphic Encryption (FHE) is often regarded as the "holy grail" of data privacy, enabling a server to process sensitive information—such as medical imagery or financial records—without ever decrypting it. Despite its potential, FHE is notoriously difficult to integrate with modern deep learning for two primary reasons:
- The Activation Gap: FHE natively supports only additions and multiplications. Standard non-linear activations like ReLU are not polynomials. While they can be approximated, high-degree polynomials are computationally expensive, and low-degree approximations often lead to catastrophic accuracy loss.
- The Capacity Barrier: Modern FHE schemes like CKKS store data in a fixed number of "slots" within a ciphertext. High-resolution images often exceed these slot capacities, making standard convolutions inefficient or impossible to implement without complex data management.
Peregrine addresses these hurdles by providing a streamlined path to convert pre-trained plaintext models into FHE-compatible versions with minimal accuracy degradation.
Methodology
1. Single-Stage Fine-Tuning (SFT) with PolyAct-RN
To bridge the activation gap, Peregrine introduces PolyAct-RN, a range-aware polynomial activation operator. Instead of attempting a global approximation of the ReLU function, PolyAct-RN leverages the homogeneity property of ReLU: $ReLU(x) = q \cdot ReLU(x/q)$.
During a brief fine-tuning stage, the operator tracks the dynamic range of input data, similar to Batch Normalization. It then scales the inputs into a "safe" interval (typically $[-3, 3]$) where a simple degree-4 polynomial can accurately mimic ReLU. The model scales the input down, applies the polynomial, and scales the output back up. This approach allows pre-trained models to adapt to polynomial activations in just a few epochs, maintaining functional properties without the need for training from scratch.
2. Generalized Interleaved Packing (GIP)
To overcome the capacity barrier for high-resolution tasks, the authors developed Generalized Interleaved Packing (GIP). This scheme provides a flexible data-management strategy that adapts to varying image sizes:
- High-Resolution Handling: For large images, GIP "interleaves" pixels across multiple ciphertexts, allowing the system to process resolutions that exceed the slot capacity of a single CKKS ciphertext.
- Efficiency for Small Images: For lower resolutions, it packs multiple channels into a single ciphertext to maximize throughput.
Crucially, Peregrine includes a suite of homomorphic operators—such as convolutions, upsampling, and feature fusion—designed to work directly on this GIP format. This eliminates the need for expensive data reshuffling (often requiring Multi-Party Computation or complex rotations) between layers.
Experimental Results
The framework was evaluated across three standard benchmarks to demonstrate its versatility and scalability:
- CIFAR-10: A ResNet-20 model converted via Peregrine maintained exceptional performance, with accuracy moving from a 91.9% baseline to 92.0%.
- ImageNet: On this large-scale dataset, a MobileNetv2 model dropped only slightly, from 71.9% to 70.1% accuracy.
- MS COCO (Object Detection): Marking a significant milestone, Peregrine successfully ran FHE inference for the YOLOv5n architecture. It achieved an [email protected] of 0.427, compared to the plaintext baseline of 0.457. This demonstrates that FHE can handle complex "neck" and "head" structures, including multi-scale feature fusion.
Discussion and Conclusion
Peregrine represents a major step toward practical privacy-preserving AI. By eliminating the need for Multi-Party Computation (MPC) to reshuffle data, it simplifies the security model and reduces communication overhead.
However, challenges remain. While Peregrine achieves high accuracy, the computational latency of FHE is still significant; a single YOLOv5n inference takes approximately 2.5 hours on a single CPU thread. Future work will focus on leveraging hardware acceleration (GPUs/FPGAs) and parallelization, which the authors estimate could improve speeds by up to 1,000x, bringing FHE-based deep learning closer to real-time application.
Summary updated