TL;DR
This paper introduces HE-PEx, a novel framework for efficiently pruning neural networks (NNs) designed for homomorphic encryption (HE). By combining pruning, permutation, and expansion techniques, HE-PEx significantly reduces the computational and memory overhead of privacy-preserving machine learning (PPML) inference, achieving substantial improvements over existing methods while maintaining high accuracy.
What Problem Does This Paper Address?
Privacy-preserving machine learning (PPML) solutions are increasingly important, especially for sensitive data. Homomorphic encryption (HE) offers strong privacy guarantees by allowing computations on encrypted data, but it comes with a significant cost in terms of latency and memory requirements. While pruning is a standard technique to optimize neural networks in plaintext settings, its direct application to HE-based PPML is ineffective. This is because HE operates on ciphertexts that often contain multiple data points (packed using SIMD), and pruning individual weights doesn't necessarily lead to the elimination of entire ciphertexts. The challenge is to develop pruning strategies that are "HE-aware" and can effectively reduce the number of ciphertexts, thereby improving efficiency without sacrificing accuracy.
Methods
The core of HE-PEx lies in a set of novel pruning methods designed for HE with SIMD packing. The framework combines four key primitives:
- Prune: Standard NN pruning techniques are adapted. This includes L1-norm based pruning and random pruning, applied at different scopes (local or global) and targets (weights, neurons, or channels).
- Permute: This is a crucial novel contribution. Instead of directly pruning, HE-PEx reorders the network's weights (permuting rows and columns) to strategically group zero values into entire tiles (ciphertexts). This is achieved through an efficient co-permutation algorithm that avoids adding extra "permute" layers, thus maintaining efficiency.
- Expand: To recover any accuracy lost during pruning, an expansion technique is employed. This involves selectively "un-pruning" zero elements within tiles that contain non-zeros, effectively utilizing the computational capacity of these tiles to improve model accuracy.
- Pack: The framework leverages the "tile tensor" packing technique from HElayers, which decomposes tensors into tiles that are then packed into ciphertexts. HE-PEx aims to maximize "tile sparsity" – the proportion of tiles containing only zeros.
The paper also adapts a state-of-the-art (SotA) pruning method, Hunter [10], for non-interactive HE scenarios, naming it P2T, to serve as a baseline.
Datasets
The paper evaluates its methods on the following datasets:
- MNIST: A dataset of 60,000 handwritten digit images (28x28 pixels).
- CIFAR-10: A collection of 50,000 small color images.
- SVHN: An image dataset with over 600,000 house number images from Street View.
- COVIDx CT-2A: A dataset containing 194,922 chest CT slices, used for a large NN demonstrator.
Key Insights and Ideas
- Pruning for HE is fundamentally different: Naïve pruning of individual weights doesn't translate to efficient HE usage. The granularity of pruning must align with the ciphertext tile structure.
- Permutation is key to tile sparsity: Reordering network weights is more effective than direct pruning for creating zero tiles. This allows for significant compression without accuracy loss.
- Co-permutation avoids overhead: The proposed co-permutation method integrates seamlessly with existing layers, preventing the introduction of additional computational cost during inference.
- Expansion recovers accuracy: The expansion step is vital for mitigating accuracy degradation, effectively utilizing the remaining computational capacity of non-zero tiles.
- Tile shape matters: Different tile shapes offer trade-offs between latency, throughput, and memory. The framework's integration with HElayers allows for optimization across these dimensions.
Key Results
HE-PEx demonstrates significant improvements in PPML inference:
- Tile Sparsity: Achieves tile sparsities of up to 95% (average 61%) across various networks and datasets, with a degradation limit of 2.5% in inference accuracy/loss.
- Efficiency Gains: Compared to unpruned networks, HE-PEx achieves 10-35% improvement in inference speed and a 17-35% decrease in memory requirement. These gains can reach up to 41% if a 5% degradation is acceptable.
- Ciphertext Reduction: Generates networks with 33-65% fewer ciphertexts compared to unpruned networks.
- Comparison to SotA: HE-PEx generates networks with 70% fewer ciphertexts on average compared to the state-of-the-art pruning technique (P2T, an adaptation of Hunter) for the same degradation limit.
- Large Network Demonstration: Successfully applied to a 21-layer HE-friendly AlexNet trained on the COVIDx CT-2A dataset.
Limitations and Future Work
- Prunepack Threshold: The P4E scheme introduces a "prunepack" threshold (percentage of zeros in a tile to prune it). The paper selects 93.8% based on experiments but suggests that further hyperparameter tuning could improve results.
- Permutation Algorithm Variants: While the proposed k-means based permutation is effective, the paper notes that different variants (e.g., Grouped Hamming distance) show varying degrees of impact depending on tile shape and network architecture.
- Future Research: The authors believe further research into the privacy implications of pruned models is valuable. They also suggest that local search strategies could be explored to navigate the state space more efficiently, reducing the computational cost of training and permutation rounds. The framework's flexibility allows for extension to other pruning strategies and HE schemes.
Summary updated