TL;DR
FEnc² is a hardware-agnostic data packing framework that drastically accelerates private convolutional neural network (CNN) inference under Fully Homomorphic Encryption (FHE). By analytically balancing spatial and channel data dependencies, it optimizes ciphertext slot utilization and minimizes expensive rotation operations, delivering up to a 228× end-to-end speedup over state-of-the-art methods.
What Problem Does This Paper Address?
Fully Homomorphic Encryption (FHE)—specifically the CKKS scheme—allows clouds to perform computations directly on encrypted data, making it a holy grail for privacy-preserving Machine Learning as a Service (MLaaS). However, FHE is notoriously slow. To amortize the high cost of encrypted primitives, frameworks pack multiple plaintext values into the vector slots of a single ciphertext to enable SIMD-style parallel processing.
The bottleneck in private CNN inference stems from two main issues:
- Excessive Rotations: Convolutions require shifting data to align pixels across spatial and channel dimensions. These "ciphertext rotations" are incredibly expensive, often accounting for over 70% of total runtime.
- Cross-Layer Fragmentation: As data moves through a CNN, channel-reduction layers (like $1\times1$ convolutions) leave many ciphertext slots empty. This poor slot utilization causes a explosion in ciphertext count and memory overhead downstream.
Existing packing strategies use static, handcrafted layouts that optimize either spatial or channel dimensions in isolation, leading to massive inefficiencies as the tensor geometry changes across layers.
Methods
The authors introduce FEnc², a unified framework that treats ciphertext packing as an algorithmic optimization problem based on convolutional structure and layer geometry. It consists of two primary components:
- Conv-aware Encoding: Instead of traditional row-major or pixel-wise packing,
FEnc²partitions 4D feature tensors into parameterized $S \times S$ blocks. It uses a rigorous convex optimization model to analytically select an optimal block size ($S^*$) that mathematically balances "inner rotations" (spatial aggregation) and "outer rotations" (channel aggregation). - Arch-aware Ct Compression (AAC): To combat fragmentation, AAC dynamically consolidates sparsely filled ciphertexts after channel-reduction layers using a lightweight masked rotate-and-add sequence. Crucially, by cleverly scheduling plaintext scales, AAC avoids adding any multiplicative depth to the FHE circuit.
Datasets
The framework was evaluated using standard computer vision datasets across various model scales:
- MNIST (with LeNet)
- CIFAR-10 (with VGG5 and SqueezeNet)
- ImageNet (with ResNet18 and MobileNet)
No new datasets were introduced.
Key Insights and Ideas
- Packing as a Global Optimization Space: Rather than treating data layout as a static pre-processing step,
FEnc²proves that data packing is a dynamic, layer-aware degree of freedom that can be mathematically optimized. - The Rotation Trade-off Sweet Spot: Maximizing block size eliminates inner rotations but explodes outer rotations. Minimizing it does the opposite.
FEnc²derives the exact theoretical optimum ($S^*$) to minimize the sum of both costs. - Multiplicative Depth-Free Compression: Plaintext masking usually consumes an encryption level (multiplicative depth), which triggers expensive bootstrapping.
FEnc²bypasses this by sharing the uniform scale factor ($\Delta$) between the convolution weights and the compression masks.
Key Results
FEnc² was prototyped on both CPU and GPU backends and compared against leading baselines like CHET, HElayers, and Orion:
- End-to-End Speedups: On a GPU backend,
FEnc²achieved a 228.83× speedup over Orion for LeNet (MNIST) and a 4.55× speedup for MobileNet (ImageNet). On CPUs, the speedups reached 226.06× and 9.43×, respectively. - Memory Efficiency: It reduced memory consumption by up to 98.49% for LeNet and 85.08% for MobileNet on CPU.
- OOM Boundary Extension: By keeping ciphertext slots nearly 100% utilized,
FEnc²dramatically lowered the memory footprint, allowing the system to scale to much larger batch sizes (e.g., sustaining batches of 512 for LeNet where baselines crashed at 64–128).
Limitations and Future Work
While FEnc² focuses heavily on CNNs, the authors briefly demonstrate its extensibility to Transformer architectures, achieving a 6.74× speedup on a BERT encoder block. However, a full end-to-end evaluation of Transformers remains an open challenge due to the complexities of integrating non-linear components like Softmax and LayerNorm under FHE, which the authors flag as an active direction for future research.
Summary updated