PUMA:五分钟内安全推理 LLaMA-7B
PUMA: Secure Inference of LLaMA-7B in Five Minutes
AI总结:
提出PUMA框架,通过高质量近似和安全Embedding/LayerNorm设计,实现快速安全的Transformer推理,较MPCFORMER快约2倍,首次在MPC下评估LLaMA-7B,5分钟内生成1个token。
摘要:
以 ChatGPT 为代表的众多公司已开始提供基于大型 Transformer 模型的服务。然而,使用此类服务不可避免地会将用户的提示词泄露给模型提供商。以往的研究已利用安全多方计算(MPC)对 Transformer 模型进行安全推理,其中模型参数和客户端的提示词均保持机密。尽管如此,这些框架在模型性能、效率和部署方面仍存在局限。为解决这些局限,我们提出了 PUMA 框架,以实现快速且安全的 Transformer 模型推理。我们的框架为 GeLU 和 softmax 等昂贵函数设计了高质量的近似,在保持模型性能的同时显著降低了安全推理的成本。此外,我们设计了安全的 Embedding 和 LayerNorm 流程,在不破坏 Transformer 架构的前提下忠实实现了所需功能。PUMA 比最先进的框架 MPCFORMER(ICLR 2023)快约 2 倍,并且在不进行微调的情况下,其准确率与明文模型相当(这是以往工作未能实现的)。PUMA 甚至可以在约 5 分钟内评估 LLaMA-7B 以生成 1 个 token。据我们所知,这是首次能够在 MPC 下评估如此参数规模的模型。PUMA 已在 SecretFlow-SPU 的 Github 仓库中开源。
英文摘要:
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\times$ 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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。