SpENCNN: Orchestrating Encoding and Sparsity for Fast Homomorphically Encrypted Neural Network Inference

Ran Ran, Xinwei Luo, Wei Wang, Tao Liu, Gang Quan, Xiaolin Xu, Caiwen Ding, Wujie Wen

This paper, presented at ICML 2023, introduces SpENCNN, a framework designed to make Homomorphic Encryption (HE) practical for deep learning by tackling its biggest performance bottleneck: the "rotation" operation.

TL;DR

SpENCNN accelerates homomorphically encrypted neural network inference by co-designing model sparsity and data packing. By introducing group-interleaved encoding and HE-friendly sub-block pruning, the framework reduces costly rotation operations, achieving up to 19x speedups with negligible accuracy loss.

What Problem Does This Paper Address?

Machine Learning as a Service (MLaaS) allows users to send data to the cloud for processing, but this raises massive privacy concerns. Homomorphic Encryption (HE) is a cryptographic solution that allows a server to perform computations on data while it remains encrypted.

However, HE is notoriously slow—often 1,000 to 1,000,000 times slower than plaintext computation. The primary culprit is the HE-rotation operation. In HE schemes like CKKS, multiple data points are packed into "slots" within a single ciphertext (SIMD style). To perform operations across different slots (like in a convolution), the ciphertext must be rotated. A single rotation can be significantly slower than an addition or multiplication.

HE-rotation bottleneck and pruning challenges

Traditional model compression (like pruning) doesn't help much here. In plaintext, pruning a weight saves a multiplication. In HE, unless you prune every weight associated with a specific rotation, the server still has to perform that expensive rotation anyway.

Methods

The authors propose two main techniques to "orchestrate" how data is packed and how the model is pruned:

1. HE-Group Convolution & Group-Interleaved Encoding

Standard HE convolutions require "outer-rotations" to move data between different ciphertexts. SpENCNN uses Group Convolution to partition channels into independent groups. They introduce Group-Interleaved Encoding, a novel way to pack these groups into ciphertexts so that the data needed for a calculation is already aligned. This effectively eliminates the need for outer-rotations.

HE-group Convolution and Group-Interleaved Format

2. Sub-block Weight Pruning

To address "inner-rotations" (rotations within a single ciphertext), the authors developed a pruning strategy that targets sub-blocks of weights. Instead of pruning random individual weights, they identify and zero out entire sets of weights that correspond to a specific rotation. If a sub-block is pruned, the associated HE-rotation can be skipped entirely. They use an iterative "prune-and-retrain" approach to maintain model accuracy.

Datasets and Key Results

The framework was evaluated on standard computer vision benchmarks, including MNIST (LeNet) and CIFAR-10 (VGG-5, HEFNet, and ResNet-20).

SpENCNN achieved significant speedups compared to baseline HE implementations:

  • LeNet (MNIST): 8.37× speedup.
  • VGG-5 (CIFAR-10): 12.11× speedup.
  • HEFNet (CIFAR-10): 19.26× speedup.
  • ResNet-20 (CIFAR-10): 1.87× speedup (lower due to the high overhead of "bootstrapping" in deep networks).

Crucially, these speedups came with negligible accuracy loss (typically <1%). When compared to previous state-of-the-art HE pruning methods, SpENCNN was significantly faster and more efficient at reducing the Homomorphic Operation Count (HOC).

Key Insights

  • Rotation is the Real Bottleneck: HE-rotations can take up over 90% of the total computation time in practical HE-NN implementations.
  • Sparsity Must Be "Operation-Aware": Plaintext sparsity is about reducing FLOPs; HE sparsity must be about reducing rotations. Pruning a single weight is useless if the rotation it belongs to still occurs.
  • The Power of Co-Design: By changing both how the data is encoded (the "packing") and how the model is structured (the "sparsity"), the authors found a synergy that neither technique could achieve alone.

Limitations and Future Work

  • Bootstrapping: In very deep networks like ResNet-20, "bootstrapping" (a process to refresh the noise level in a ciphertext) remains a massive bottleneck. While SpENCNN reduces rotations, it doesn't solve the fundamental cost of bootstrapping.
  • Approximated Activations: HE cannot compute non-linear functions like ReLU directly. The authors use quadratic approximations, which is standard but can impact the training stability of much larger models.
  • Hardware Integration: The software-level optimizations could be even more powerful if paired with specialized HE hardware accelerators (ASICs/FPGAs).

Summary updated

BibTeX
@inproceedings{ran2023spencnn,
  author = {Ran Ran and Xinwei Luo and Wei Wang and Tao Liu and Gang Quan and Xiaolin Xu and Caiwen Ding and Wujie Wen},
  title = {{SpENCNN: Orchestrating Encoding and Sparsity for Fast Homomorphically Encrypted Neural Network Inference}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=vPCKyca1s7},
}
Figure