[論文レビュー] PUMA: Secure Inference of LLaMA-7B in Five Minutes
PumaはGeLU/softmaxの効率的近似とエンドツーエンドの安全な埋め込みとLayerNormを導入することにより、再学習なしで平文の精度に近い精度を達成し、LLaMA-7Bの推論を約5分/トークンで実現する。
With ChatGPT as a representative, tons of companies have began to provide services based on large Transformers models. However, using such a service inevitably leak users' prompts to the model provider. Previous studies have studied secure inference for Transformer models using secure multiparty computation (MPC), where model parameters and clients' prompts are kept secret. Despite this, these frameworks are still limited in terms of model performance, efficiency, and deployment. To address these limitations, we propose framework PUMA to enable fast and secure Transformer model inference. Our framework designs high quality approximations for expensive functions such as GeLU and softmax, and significantly reduce the cost of secure inference while preserving the model performance. Additionally, we design secure Embedding and LayerNorm procedures that faithfully implement the desired functionality without undermining the Transformer architecture. PUMA is about $2 imes$ faster than the state-of-the-art framework MPCFORMER(ICLR 2023) and has similar accuracy as plaintext models without fine-tuning (which the previous works failed to achieve). PUMA can even evaluate LLaMA-7B in around 5 minutes to generate 1 token. To our best knowledge, this is the first time that a model with such a parameter size is able to be evaluated under MPC. PUMA has been open-sourced in the Github repository of SecretFlow-SPU.
研究の動機と目的
- 再学習なしで大規模なTransformerモデルのプライバシー保護推論を促進する。
- Transformerの非線形層に対する高速で正確なMPCベースのプロトコルを開発する。
- 平文のTransformerワークフローと整合するエンドツーエンドの安全な埋め込みとLayerNormを提供する。
- 大規模モデル(LLaMA-7B)へのスケーラビリティと、一般的なソースの事前学習済みモデルとの互換性を示す。
提案手法
- MPC効率に合わせたGeLUとsoftmaxの新しい多項式近似を設計する。
- 平文Transformerアーキテクチャと互換性のあるエンドツーエンドの安全なEmbeddingとLayerNormを実装する。
- 線形・非線形演算のために確立されたMPCプリミティブを用いた2-out-of-3レプリケート秘密分散を使用する。
- 通信・計算を削減するため、負指数のTaylor風展開と除算の削減によってsoftmaxを最適化する。
- 再学習なしで事前学習済みTransformer重みの安全な読み込みと実行を可能にする。
- 大規模モデル向けの大規模秘密分散構造を扱うためのシリアライズ調整済みインフラを提供する。
実験結果
リサーチクエスチョン
- RQ1再学習せずに安全なMPCベース推論は大規模なTransformerモデルでプレーンテキストレベルの精度を達成できるか?
- RQ2GeLU、softmax、LayerNorm、Embeddingなどの非線形Transformer要素に対して、実用的な安全推論のスピードアップをもたらす近似とプロトコル設計は何か?
- RQ3平文モデルのワークフローを変更せずにエンドツーエンドの安全なEmbeddingとLayerNormは実現可能か?
- RQ4MPC下でPumaはMPCFormerなどの以前の研究と比較してLLaMA-7Bのような非常に大規模モデルへどのようにスケールするか?
主な発見
- Pumaはプレーンテキストモデルと一致する精度を小さなマージンで達成する(GLUEタスクでは差が0.011を超えず、GPT-2系では困惑度が0.02以下)。
- Pumaは評価対象のモデルとタスク全体でMPCFormerより約2倍高速で、同等またはそれ以上の精度を提供する。
- 安全なLLaMA-7B推論を、入力/出力の測定コストを含めMPC下で1トークンあたり5分で実証。
- エンドツーエンドの安全なEmbeddingとLayerNormは再学習なしで事前学習済みTransformer重みの読み込みを可能にし、平文モデルとの互換性を維持する。
- Pumaは大規模モデルでスケーラビリティが有利で、報告された実験ではGPT-2ファミリーモデルで相対的な速度向上が大きい。
この論文を読む
Nubintのビューアで原文を開き、読みながら気になる箇所をすぐに質問できます。
Nubintでこの論文を読むこのレビューはAIが論文の原文をもとに作成しました。引用する前に原文をご確認ください。