Skip to main content
QUICK REVIEW

[论文解读] LLMs Can Understand Encrypted Prompt: Towards Privacy-Computing Friendly Transformers

X. Liu, Zhuotao Liu|arXiv (Cornell University)|May 28, 2023
Privacy-Preserving Technologies in Data被引用 7
一句话总结

本文提出一种面向隐私计算的Transformer架构,用高效且兼容同态加密(HE)与安全多方计算(MPC)的替代方案,取代原本不友好的非线性操作(如GELU、softmax和层归一化)。通过替换这些计算开销大的组件,该框架在LMM推理中实现5倍速度提升,并将通信开销降低80%,相较最先进的方法如Iron,同时保持几乎相同的模型精度。

ABSTRACT

The community explored to build private inference frameworks for transformer-based large language models (LLMs) in a server-client setting, where the server holds the model parameters and the client inputs its private data (or prompt) for inference. However, these frameworks impose significant overhead when the private inputs are forward propagated through the original LLMs. In this paper, we show that substituting the computation- and communication-heavy operators in the transformer architecture with privacy-computing friendly approximations can greatly reduce the private inference costs while incurring very minor impact on model performance. Compared to state-of-the-art Iron (NeurIPS 2022), our privacy-computing friendly model inference pipeline achieves a $5 imes$ acceleration in computation and an 80% reduction in communication overhead, while retaining nearly identical accuracy.

研究动机与目标

  • 解决基于Transformer的LLM在使用同态加密(HE)与安全多方计算(MPC)进行私有推理时的高计算与通信开销问题。
  • 识别出对隐私计算不友好的操作(如GELU、softmax和层归一化)是私有LLM推理中的主要性能瓶颈。
  • 设计这些非线性操作的隐私计算友好型近似方法,在保持模型精度的同时大幅降低密码学开销。
  • 从端到端角度评估改进后模型在私有计算下的推理时间、通信成本与精度表现。

提出的方法

  • 作者实现了一个完全支持HE与MPC的私有推理系统,用于基于Transformer的LLM,实现对加密输入的安全计算。
  • 他们识别出GELU、softmax和层归一化是私有推理中主要的成本贡献者,占总成本的70%以上。
  • 他们用隐私计算友好型替代方案替换这些操作:用ReLU替代GELU,用多项式近似替代softmax,用简化的归一化层替代原层归一化。
  • 对改进后的模型进行微调,以保持性能,确保在私有推理下精度与原始模型几乎完全一致。
  • 系统采用HE处理线性操作,MPC处理非线性操作,并结合优化的数据编码与批处理策略。
  • 在多个LLM(BERT-Tiny、BERT-Medium、RoBERTa-Base)上端到端测量通信与计算开销,对比原始模型与改进模型的性能。
Figure 1: Ratio of various operators’ cost
Figure 1: Ratio of various operators’ cost

实验结果

研究问题

  • RQ1在使用HE与MPC进行基于Transformer的LLM私有推理时,主要的计算与通信瓶颈是什么?
  • RQ2能否通过使用隐私计算友好型近似方法(如GELU、softmax、层归一化)显著降低推理开销,同时不牺牲模型精度?
  • RQ3与最先进的私有推理系统(如Iron)相比,所提框架在速度与通信效率方面表现如何?
  • RQ4将非线性操作替换为HE/MPC友好型替代方案,对私有LLM推理的端到端精度影响有多大?
  • RQ5所提方法能否在不同LLM架构(如BERT-Tiny、RoBERTa-Base)上实现可扩展性,同时保持高效率与隐私保障?

主要发现

  • 所提出的隐私计算友好型模型在RoBERTa-Base上将私有推理时间缩短至原始模型的1/5.7,分别达到168.43秒与84.50秒。
  • 通信开销降低至原始模型的1/5.6,从原始模型的6.38GB降至优化版本的1.14GB(RoBERTa-Base)。
  • 该框架实现了整体私有推理成本80%的降低,其中最大节省来自替换GELU、softmax与归一化层。
  • 在优化后的BERT-Tiny模型上进行端到端私有推理,其精度略高于原始模型在明文推理下的表现,表明性能稳定或有所提升。
  • 优化后模型的通信开销仅为原始模型的13%,在数据传输效率方面实现显著提升。
  • 在所有评估的数据集中,该模型与原始模型的精度几乎完全一致,证实了在架构修改后性能退化极小。
Figure 2: Accuracies of the model before and after each substitution. We use $-$ mark to denote which operators have been replaced. The changes are done incrementally. For example, “ $-$ Softmax” means both GELU and Softmax are replaced with privacy-computing friendly alternatives.
Figure 2: Accuracies of the model before and after each substitution. We use $-$ mark to denote which operators have been replaced. The changes are done incrementally. For example, “ $-$ Softmax” means both GELU and Softmax are replaced with privacy-computing friendly alternatives.

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。