通过优化加密数据布局,大幅降低私有推理的计算开销。
FEnc$^2$: Unifying Data Packing for Efficient Private Inference via Convolution and Architecture-Aware Fragment Encoding

- 提出分片编码框架,同时处理空间与特征依赖关系
- 在MNIST和ImageNet上实现最高228倍的推理加速
- 适合需要高效隐私保护推理的系统设计者
全同态加密(FHE)可实现隐私保护机器学习,但带来极高的计算与内存开销。这些开销不仅来自数论变换(NTT)、旋转和密钥切换等底层操作,也源于应用层密文打包效率低下。现有打包策略通常仅保留邻近数据或特征分组之一,导致密文槽浪费、旋转次数过多及密文数量增加。本文提出FEnc2,一种基于CKKS的统一分片编码框架,用于私有卷积神经网络推理。FEnc2通过两个组件优化:1)卷积感知编码,分析选择最优分片大小,解耦空间依赖并最小化跨层内外旋转;2)架构感知密文压缩,在特征或通道缩减层后恢复密文密度。两者协同重塑加密工作负载结构,使同态操作减少一到两个数量级。在最大批次下,利用全部内存容量,FEnc2在GPU上对LeNet/MNIST实现最高228.83倍加速,在CPU上达226.06倍;对MobileNet/ImageNet,GPU上提速4.55倍,CPU上9.43倍。FEnc2与硬件无关,但能重构加密张量布局,降低密文数量与硬件压力,补充如NTT、密钥切换加速器等底层优化。结果表明,应用层数据布局是加密推理的首要架构维度,也是下一代FHE系统的关键使能技术。
原文摘要 · Abstract (English)
Fully Homomorphic Encryption (FHE) enables privacy-preserving machine learning but incurs extreme computational and memory overhead. These costs come not only from expensive low-level primitives, including Number Theoretic Transform (NTT), rotation, and key-switching, but also from inefficient ciphertext packing at the application level. Existing packing strategies typically preserve either neighboring data elements or feature grouping, but not both, leading to wasted ciphertext slots, excessive rotations, and inflated ciphertext counts. We propose FEnc2, a unified and principled fragment-based encoding framework for CKKS-based private convolutional neural network inference. FEnc2 optimizes slot utilization, rotation complexity, and ciphertext density through two components: 1)Conv-aware Encoding, which analytically selects an optimal fragment size to decouple spatial dependencies and jointly minimize inner-outer rotations across layers, and 2)Arch-aware Ct Compression, which restores ciphertext density after feature- or channel-reduction layers. Together, these transformations reshape encrypted workload structure and reduce homomorphic operations by one to two orders of magnitude. With full memory capacity utilized, i.e., at maximum batch size, FEnc2 achieves end-to-end latency speedups over the state-of-the-art Orion of up to 228.83x on GPU and 226.06x on CPU for LeNet on MNIST, and up to 4.55x on GPU and 9.43x on CPU for MobileNet on ImageNet. FEnc2 is hardware-agnostic yet architecturally transformative: by optimizing encrypted tensor layout before execution, it reduces ciphertext count and workload pressure on hardware, complementing primitive-level optimizations such as NTT and keyswitch accelerators. These results show that application-level data layout is a first-order architectural design dimension for encrypted inference and an important enabler for next-generation FHE systems.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。