arXiv:2411.15707cs.CRcs.AI2024-11NeurIPS被引 31

Nimbus让Transformer模型在保护隐私的前提下,推理速度提升近5倍。

Nimbus: Secure and Efficient Two-Party Inference for Transformers

  • 用外积思路设计新协议,安全计算矩阵乘法
  • 通过输入分布近似非线性函数,效率提升2.9至4倍
  • 适合需要高隐私保障的AI推理场景

Transformer模型因强大的机器学习能力备受关注,但其部署中存在敏感信息泄露风险。现有基于安全两方计算(2PC)的方法在处理Transformer时面临双重效率瓶颈:线性层的资源密集型矩阵乘法,以及GELU、Softmax等复杂非线性激活函数。本文提出新型两方推理框架Nimbus。针对线性层,提出基于外积洞察的新2PC范式与编码方法,相比最先进协议性能提升2.9×~12.5×;针对非线性层,利用输入分布特性,提出低阶多项式近似GELU和Softmax,较最先进多项式逼近方法提速2.9×~4.0×,平均精度损失仅0.08%。与最先进两方推理方案相比,Nimbus在不同网络设置下使BERT推理端到端性能提升2.7×~4.7×。

原文摘要 · Abstract (English)

Transformer models have gained significant attention due to their power in machine learning tasks. Their extensive deployment has raised concerns about the potential leakage of sensitive information during inference. However, when being applied to Transformers, existing approaches based on secure two-party computation (2PC) bring about efficiency limitations in two folds: (1) resource-intensive matrix multiplications in linear layers, and (2) complex non-linear activation functions like $\mathsf{GELU}$ and $\mathsf{Softmax}$. This work presents a new two-party inference framework $\mathsf{Nimbus}$ for Transformer models. For the linear layer, we propose a new 2PC paradigm along with an encoding approach to securely compute matrix multiplications based on an outer-product insight, which achieves $2.9\times \sim 12.5\times$ performance improvements compared to the state-of-the-art (SOTA) protocol. For the non-linear layer, through a new observation of utilizing the input distribution, we propose an approach of low-degree polynomial approximation for $\mathsf{GELU}$ and $\mathsf{Softmax}$, which improves the performance of the SOTA polynomial approximation by $2.9\times \sim 4.0\times$, where the average accuracy loss of our approach is 0.08\% compared to the non-2PC inference without privacy. Compared with the SOTA two-party inference, $\mathsf{Nimbus}$ improves the end-to-end performance of \bert{} inference by $2.7\times \sim 4.7\times$ across different network settings.

隐私计算Transformer两方计算模型推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。