Skip to main content
QUICK REVIEW

[논문 리뷰] PUMA: Secure Inference of LLaMA-7B in Five Minutes

Ye Dong, Wenjie Lu|arXiv (Cornell University)|2023. 07. 24.
Cryptography and Data SecurityComputer Science인용 수 11
한 줄 요약

Puma은 LLaMA-7B의 보안 MPC 기반 추론을 가능하게 하며, 재훈련 없이도 대략 토큰당 5분에 도달하고 평문 정확도와 일치하도록, 효율적인 GeLU/softmax 근사와 엔드투엔드 보안 임베딩 및 LayerNorm을 도입한다.

ABSTRACT

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 아키텍처와 호환되는 엔드투엔드 보안 임베딩과 LayerNorm을 구현한다.
  • 선형 및 비선형 연산에 대해 확립된 MPC 프리미티브를 활용하는 2-out-of-3 재현 비밀 공유를 사용한다.
  • 통신/계산을 줄이기 위해 음의 지수 Taylor-style 전개와 감소된 나눗셈을 통해 softmax를 최적화한다.
  • 재훈련 없이 프리트레인된 Transformer 가중치를 안전하게 로딩하고 실행할 수 있도록 한다.
  • 대형 모델용 대형 비밀공유 구조를 처리하기 위한 직렬화에 맞춘 인프라를 제공한다.

실험 결과

연구 질문

  • RQ1재훈련 없이 보안 MPC 기반 추론이 대형 Transformer 모델에서 평문 수준의 정확도를 달성할 수 있는가?
  • RQ2GeLU, softmax, LayerNorm, Embedding과 같은 비선형 Transformer 구성요소에 대해 어떤 근사와 프로토콜 설계가 실질적인 보안 추론 속도 향상을 제공하는가?
  • RQ3평문 모델 워크플로우를 변경하지 않고 엔드투엔드 보안 임베딩과 LayerNorm이 가능할까?
  • RQ4MPC 하에서 Puma가 MPCFormer 같은 선행 연구와 비교해 LLaMA-7B와 같은 매우 큰 모델로 확장되는 방식은 어떠한가?

주요 결과

  • Puma은 GLUE 과제에서의 차이가 최대 0.011, GPT-2 계열에서의 perplexity 차이가 최대 0.02로 평문 모델과 일치하는 정확도를 달성한다.
  • Puma은 평가된 모델과 작업 전반에서 유사하거나 더 나은 정확도를 제공하면서 MPCFormer보다 약 2배 빠르다.
  • 보안 MPC 하에서 입력/출력 비용을 측정한 결과, LLaMA-7B의 추론이 토큰당 5분에 달하는 것이 시연된다.
  • 엔드투엔드 보안 임베딩과 LayerNorm은 재훈련 없이 프리트레인된 Transformer 가중치를 로딩할 수 있게 하여 평문 모델과의 호환성을 유지한다.
  • Puma은 더 큰 모델에 대해 우수한 확장성을 보이며, 보고된 실험에서 GPT-2 계열 모델에 대해 더 큰 상대 속도 향상을 보인다.

이 논문 읽기

누빈트 뷰어에서 원문을 열고, 읽으면서 궁금한 곳을 바로 물어보세요.

누빈트에서 이 논문 읽기

이 리뷰는 AI가 논문 원문을 바탕으로 만들었습니다. 인용하기 전에 원문을 확인해 주세요.