AutoFHE: Automated Adaption of CNNs for Efficient Evaluation over FHE

Wei Ao, Vishnu Boddeti

TL;DR

This paper introduces AutoFHE, an automated system that adapts Convolutional Neural Networks (CNNs) for secure inference using Fully Homomorphic Encryption (FHE). By intelligently designing polynomial approximations for non-linear activation functions and optimizing bootstrapping operations, AutoFHE achieves a superior trade-off between accuracy and latency compared to existing methods, making secure deep learning inference more practical.

What Problem Does This Paper Address?

The increasing adoption of Machine Learning as a Service (MLaaS) raises significant security and privacy concerns. Customers want to use powerful deep learning models hosted on cloud servers without revealing their sensitive private data. Fully Homomorphic Encryption (FHE) offers a solution by allowing computations on encrypted data, but evaluating complex deep learning models like CNNs under FHE is computationally expensive and challenging. A key hurdle is approximating non-linear activation functions (like ReLU) with polynomials, which FHE schemes can handle. However, current approaches to this approximation are inflexible, often suboptimal, and lead to either low accuracy or high latency due to the need for frequent "bootstrapping" operations to refresh ciphertexts. This paper addresses the need for a more automated and efficient way to adapt CNNs for FHE.

Methods

AutoFHE tackles the problem by framing it as a multi-objective optimization task. Its core innovation lies in:

  • Layerwise Mixed-Degree Polynomials: Instead of using a single type of polynomial approximation for all activation functions, AutoFHE allows different layers to use polynomials of varying degrees. This leverages the observation that different layers have varying sensitivities to approximation errors.
  • Automated Architecture Search: AutoFHE automatically searches for the optimal combination of:
  • Polynomial Approximations: It defines a flexible search space for polynomial approximations (EvoReLU) that can represent pruning, low-degree polynomials, and high-degree polynomials.
  • Homomorphic Evaluation Architecture: It jointly optimizes the placement of bootstrapping operations, which are crucial for FHE but computationally intensive.
  • Hybrid Approximation and Training: AutoFHE combines inheriting weights from pre-trained ReLU networks with fine-tuning the network to adapt to the chosen polynomial approximations. This helps maintain high accuracy while reducing latency.
  • Multi-Objective Optimization Framework: The search is guided by two objectives: maximizing validation accuracy and minimizing the number of bootstrapping operations. This allows AutoFHE to generate a diverse set of solutions that span the accuracy-latency trade-off.
  • Specialized Search Algorithms: The paper introduces MOS (Multi-Objective Search) for navigating the large search space, R-CCDE (Regularized Cooperative Coevolution Differentiable Evolution) for optimizing polynomial coefficients, and PAT (Polynomial-Aware Training) for fine-tuning the network weights.

Datasets

The paper uses the following standard datasets for training and evaluation:

  • CIFAR10: A dataset of 60,000 32x32 color images in 10 classes.
  • CIFAR100: A dataset of 60,000 32x32 color images in 100 classes.

A portion of the CIFAR10 training data is used as a "minival" dataset to guide the search process.

Key Insights and Ideas

  • Layerwise heterogeneity is key: The sensitivity of different layers to approximation errors is not uniform. Exploiting this by using mixed-degree polynomials is crucial for balancing accuracy and efficiency.
  • Joint optimization is necessary: Optimizing polynomial approximations and bootstrapping placement together, rather than independently, leads to significantly better results.
  • Automated search outperforms manual design: The vast design space of polynomial approximations and FHE architectures is too complex for manual design, necessitating automated search techniques.
  • Hybrid training is effective: Combining pre-trained weights with fine-tuning for polynomial approximations allows AutoFHE to achieve high accuracy comparable to original ReLU networks while benefiting from the efficiency of polynomial approximations.
  • RNS-CKKS offers a better trade-off than TFHE for CNNs: The experimental results suggest that RNS-CKKS, when optimized with AutoFHE, provides a better balance of accuracy and latency for CNN inference compared to TFHE.

Key Results

AutoFHE demonstrates significant improvements over existing methods:

  • Speedup: AutoFHE accelerates secure inference by 1.32× to 1.8× compared to high-degree polynomial methods (MPCNN) under RNS-CKKS.
  • Accuracy Improvement: It improves accuracy by up to 2.56% compared to low-degree polynomial methods (AESPA) under RNS-CKKS.
  • Comparison with TFHE: AutoFHE models under RNS-CKKS achieve 103× faster inference and 3.46% higher accuracy compared to TFHE-based REDsec.
  • Trade-off: AutoFHE consistently offers a superior accuracy-latency trade-off across various ResNet and VGG backbones on CIFAR datasets.
  • Automated Design: The paper shows that AutoFHE can discover optimal layerwise mixed-degree polynomial distributions that are challenging to design manually.

Limitations and Future Work

  • Search Space Size: While AutoFHE significantly reduces the search space compared to brute-force, it can still be computationally intensive for very large CNN architectures.
  • Generalization to Other FHE Schemes: The current work focuses on RNS-CKKS. Extending AutoFHE to other FHE schemes could be a future direction.
  • Other Activation Functions: The paper primarily addresses ReLU. Adapting AutoFHE for other non-linear activation functions (e.g., Sigmoid, Tanh) could broaden its applicability.
  • Beyond CNNs: Exploring the application of AutoFHE to other deep learning architectures like Transformers would be a valuable extension.

Summary updated

BibTeX
@article{ao2023autofhe,
  author = {Wei Ao and Vishnu Boddeti},
  title = {{AutoFHE: Automated Adaption of CNNs for Efficient Evaluation over FHE}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2023},
  url = {https://openreview.net/forum?id=JUa6o3f1cm},
}
Figure