[论文解读] East: Efficient and Accurate Secure Transformer Framework for Inference
East 提出了一种安全、高效且准确的框架,用于隐私保护的 Transformer 推理,采用一种新颖的不经意分段多项式评估(OPPE)算法,以加速 GELU 和 tanh 等非线性函数的计算。与先前工作相比,其运行时间降低 1.5 倍,通信量降低 2.6 倍,且无需模型微调即可保持明文级别的精度。
Transformer has been successfully used in practical applications, such as ChatGPT, due to its powerful advantages. However, users' input is leaked to the model provider during the service. With people's attention to privacy, privacy-preserving Transformer inference is on the demand of such services. Secure protocols for non-linear functions are crucial in privacy-preserving Transformer inference, which are not well studied. Thus, designing practical secure protocols for non-linear functions is hard but significant to model performance. In this work, we propose a framework \emph{East} to enable efficient and accurate secure Transformer inference. Firstly, we propose a new oblivious piecewise polynomial evaluation algorithm and apply it to the activation functions, which reduces the runtime and communication of GELU by over 1.5$ imes$ and 2.5$ imes$, compared to prior arts. Secondly, the secure protocols for softmax and layer normalization are carefully designed to faithfully maintain the desired functionality. Thirdly, several optimizations are conducted in detail to enhance the overall efficiency. We applied \emph{East} to BERT and the results show that the inference accuracy remains consistent with the plaintext inference without fine-tuning. Compared to Iron, we achieve about 1.8$ imes$ lower communication within 1.2$ imes$ lower runtime.
研究动机与目标
- 解决隐私保护的 Transformer 推理中非线性函数缺乏高效且准确的安全协议的问题。
- 实现安全推理,同时保护客户端输入隐私与服务器模型参数隐私。
- 保持原始模型架构不变,无需微调或结构修改。
- 降低安全非线性函数带来的性能开销,此前其通信成本最高可达 87%。
- 设计优化的、适合 MPC 的协议,用于 GELU、tanh、softmax 和层归一化,同时最小化误差泄露。
提出的方法
- 提出一种新的不经意分段多项式评估(OPPE)算法,通过分段多项式逼近,安全地评估 GELU 和 tanh 等非线性函数。
- 设计基于误差受限转换方法和秘密共享的保密协议,以确保 softmax 和层归一化的正确性与隐私性。
- 通过减少 Beaver 三元组的使用并利用高效的预计算,优化离线与在线阶段,提升通信与运行效率。
- 将协议集成到 BERT 的完整推理流水线中,保持原始模型结构,无需微调。
- 采用同态加密(HE)和秘密共享(SS)作为底层密码原语,确保安全性和正确性。
- 针对 GELU(d=3, m=8)和 tanh(d=3, m=7)等函数应用维度特定优化,平衡精度与效率。
实验结果
研究问题
- RQ1在隐私保护的 Transformer 推理场景中,如何以最小的性能开销安全评估 GELU 和 tanh 等非线性函数?
- RQ2与基于查表的方法相比,新颖的不经意评估方法是否能显著降低非线性函数的通信与运行时间成本?
- RQ3在 MPC 基础的推理中,能否设计出既保持精度又具备高效率的保密 softmax 与层归一化协议?
- RQ4在不进行微调的前提下,能否在保持原始模型架构的同时,实现接近明文性能的安全推理?
- RQ5与当前最先进的解决方案 Iron 相比,所提出的框架在运行时间、通信量和推理精度方面表现如何?
主要发现
- 所提出的 OPPE 算法相比 NFGen(先前的 SOTA 方法),将 GELU 的通信成本降低 2.6 倍,运行时间降低 1.5 倍。
- 对于 GELU,East 相比当前安全 Transformer 推理中的 SOTA 方法 Iron,实现 1.5 倍的运行时间降低与 2.9 倍的通信量降低。
- 安全的 softmax 和层归一化协议随输入维度线性扩展,对 1000 维输入,分别需约 5 秒和 2 秒的运行时间。
- East 保持了与明文模型完全一致的推理精度,在所有测试基准上均无 F1 分数、精确率、召回率或准确率的下降。
- 与 Iron 相比,该框架将总通信量减少 1.8 倍,运行时间减少 1.2 倍,BERT-Base 推理中可节省约 256 秒和约 30 GB 通信量。
- 由于 Beaver 三元组使用量减少,离线阶段最多优化 3 倍,显著提升了预计算效率。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。