通过加密剪枝与多项式降阶,显著提升私有Transformer推理效率。
CipherPrune: Efficient and Scalable Private Transformer Inference
- 加密层间渐进剪枝,动态移除低重要性输入 token。
- 对低重要性 token 使用低阶多项式,降低计算开销。
- 适用于长序列私有推理,适合需要高效隐私保护的场景。
使用密码协议进行私有 Transformer 推理为隐私保护机器学习提供了前景,但仍面临显著的运行时开销(效率问题)和处理长输入序列的挑战(可扩展性问题)。我们观察到,Transformer 的运算复杂度随输入 token 数量呈二次增长,因此减少输入长度至关重要。值得注意的是,每个 token 重要性不同,许多输入包含冗余信息。此外,以往依赖高次多项式近似非线性激活的方法计算成本高。因此,对不重要的 token 降低多项式阶数可显著加速私有推理。基于此,我们提出 CipherPrune:一种高效且可扩展的私有推理框架,包含安全加密的 token 剪枝协议、多项式降阶协议及相应的 Transformer 网络优化。在协议层面,加密剪枝以逐层方式自适应地从加密输入中移除不重要 token;加密多项式降阶在剪枝后为低重要性 token 分配更低阶多项式,实现加速而无需解密。在网络层面,通过基于梯度的搜索实现协议感知的网络优化,以最大化剪枝阈值和多项式降阶条件,同时保持所需精度。实验表明,与之前方法相比,CipherPrune 在 128 个 token 输入下将执行开销降低约 6.1 倍,在 512 个 token 输入下降低约 10.6 倍,仅带来轻微精度损失。代码已公开于 https://github.com/UCF-Lou-Lab-PET/cipher-prune-inference。
原文摘要 · Abstract (English)
Private Transformer inference using cryptographic protocols offers promising solutions for privacy-preserving machine learning; however, it still faces significant runtime overhead (efficiency issues) and challenges in handling long-token inputs (scalability issues). We observe that the Transformer's operational complexity scales quadratically with the number of input tokens, making it essential to reduce the input token length. Notably, each token varies in importance, and many inputs contain redundant tokens. Additionally, prior private inference methods that rely on high-degree polynomial approximations for non-linear activations are computationally expensive. Therefore, reducing the polynomial degree for less important tokens can significantly accelerate private inference. Building on these observations, we propose \textit{CipherPrune}, an efficient and scalable private inference framework that includes a secure encrypted token pruning protocol, a polynomial reduction protocol, and corresponding Transformer network optimizations. At the protocol level, encrypted token pruning adaptively removes unimportant tokens from encrypted inputs in a progressive, layer-wise manner. Additionally, encrypted polynomial reduction assigns lower-degree polynomials to less important tokens after pruning, enhancing efficiency without decryption. At the network level, we introduce protocol-aware network optimization via a gradient-based search to maximize pruning thresholds and polynomial reduction conditions while maintaining the desired accuracy. Our experiments demonstrate that CipherPrune reduces the execution overhead of private Transformer inference by approximately $6.1\times$ for 128-token inputs and $10.6\times$ for 512-token inputs, compared to previous methods, with only a marginal drop in accuracy. The code is publicly available at https://github.com/UCF-Lou-Lab-PET/cipher-prune-inference.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。