TL;DR
PUMA is an end-to-end framework that enables fast, secure multi-party computation (MPC) inference for off-the-shelf Transformer models without requiring any fine-tuning or model retraining. By introducing tailored polynomial approximations for non-linear operations (GeLU, SiLU, Softmax) and native protocols for LayerNorm and Embeddings, PUMA runs roughly $2\times$ faster than prior art like MPCFORMER while matching plaintext accuracy—scaling all the way to running private inference on LLaMA-7B in roughly 3 to 5 minutes per token.
What Problem Does This Paper Address?
Cloud-hosted Large Language Models (LLMs) present a massive privacy dilemma: users must expose proprietary or sensitive prompts to the service provider, or the provider must hand over proprietary model weights to the client.
Secure Multi-Party Computation (MPC) resolves this tension by splitting data and model weights into cryptographic secret shares distributed across multiple servers (in this case, a 3-party setting with an honest majority). Under MPC, servers collaborate to evaluate the model without any single server ever learning the prompt or the weights.
However, existing MPC solutions for Transformers face three critical roadblocks:
- High Latency/Communication: Non-linear functions like GeLU and Softmax rely on expensive MPC division, exponentiation, or iterative routines.
- Accuracy Loss Requiring Retraining: Prior frameworks replace non-linearities with crude approximations (e.g., quadratic functions or plain ReLUs), which destroys model utility unless fine-tuned on custom data—an impractical requirement for data-constrained users.
- Architectural Incompatibility: Existing frameworks often swap LayerNorm for BatchNorm or alter embedding pipelines, making it impossible to directly deploy pre-trained open-source weights (such as those from Hugging Face).
Methods
PUMA operates under 2-out-of-3 replicated secret sharing (semi-honest adversary model) built on top of the SecretFlow-SPU runtime. Its core innovations target the computational bottlenecks of Transformer architectures:
- Piece-Wise Polynomial GeLU/SiLU: Rather than computing expensive hyperbolic tangents ($\tanh$) or sigmoids, PUMA exploits the observation that GeLU is nearly linear outside $[-4, 3]$ (approaching $0$ for $x < -4$ and $x$ for $x > 3$). For the region in between, it uses low-degree piece-wise polynomials (3rd- and 6th-order fits) evaluated using simple secret-shared squares and multiplications.
- Negative-Domain Softmax: In the attention mechanism, PUMA shifts logits by their maximum and a small $\epsilon$ so that all exponentiation inputs are strictly negative. It then evaluates $\exp(x)$ using a clipped Taylor series $(1 + x/2^t)^{2^t}$ through simple bit-truncations and repeated squarings. Crucially, it replaces $n$ separate secure vector divisions with a single reciprocal ($\Pi_{\text{Recip}}$) followed by element-wise multiplications.
- Native LayerNorm & Embeddings:
- PUMA evaluates LayerNorm by computing the inverse square root $\sigma^{-1/2}$ directly via $\Pi_{\text{rSqrt}}$ and broadcasting it, eliminating multi-step round trips.
- For embeddings, it obliviously constructs the one-hot lookup vector inside MPC using secure equality tests ($\Pi_{\text{Eq}}$) and Boolean-Arithmetic multiplications ($\Pi_{\text{MulBA}}$), preserving standard model APIs.
- Large-Model Tensor Chunking: To evaluate models exceeding standard serialization limits (e.g., 2 GB buffers in Protobuf/FlatBuffers), PUMA partitions large secret-shared tensors into smaller chunks during communication and I/O.
Datasets
The authors evaluated PUMA across established benchmarks without retraining:
- GLUE Benchmark Tasks: Evaluated on 500 validation samples each for CoLA (Corpus of Linguistic Acceptability), RTE (Recognizing Textual Entailment), and QNLI (Stanford Question Answering Dataset).
- Wikitext-103 V1: 100 validation samples evaluated for language modeling perplexity.
- Models tested: BERT-Base, RoBERTa-Base, BERT-Large, GPT2-Base, GPT2-Medium, GPT2-Large, and LLaMA-7B.
No new datasets were introduced.
Key Insights and Ideas
- Don't break the architecture: Prior frameworks replaced LayerNorm with BatchNorm to reduce MPC complexity; the authors show this causes catastrophic failure in zero-shot transfer (e.g., BERT CoLA performance collapsed from an MCC of $0.616$ down to $-0.020$, whereas PUMA achieved $0.613$). Faithful layer implementations eliminate the need for costly fine-tuning.
- Exploit natural function bounds: Generic MPC libraries treat non-linear math functions as arbitrary black boxes. By bounding the evaluation domain (e.g., knowing attention logits are negative after max-subtraction or that activations saturate), low-degree polynomials yield sub-percent error rates with minimal secure communication rounds.
- One inversion is better than $n$ divisions: Computing reciprocal sums and multiplying across a vector removes round-trip communication bottlenecks in Softmax and LayerNorm normalization steps.
Key Results
- Accuracy Preservation: Across all GLUE tasks, PUMA’s accuracy stayed within $0.011$ of plaintext floating-point baselines. For GPT-2 models on Wikitext-103, perplexity degradation did not exceed $0.02$.
- Speed & Communication Gains:
- On BERT models, PUMA is $1.38\times$ to $1.92\times$ faster and reduces communication by up to $1.19\times$ compared to MPCFORMER.
- On GPT-2 models, PUMA is $2.25\times$ to $2.41\times$ faster and uses $1.33\times$ to $1.88\times$ less bandwidth.
- Scaling to LLaMA-7B: PUMA achieved the first reported MPC evaluation of a 7-billion-parameter LLM. Running on three cloud servers (128 vCPUs, 1 TB RAM each, 20 Gbps network), PUMA generated one token from an 8-token prompt in $200.5$ seconds (~3.3 minutes) using $1.794\text{ GB}$ of communication, outputting text identical to plaintext LLaMA-7B.
Limitations and Future Work
- Absolute Latency Remains High: While 3 to 5 minutes per token for LLaMA-7B represents a milestone for MPC, it remains far too slow for interactive, real-time user applications.
- Embedding Overhead: Generating the one-hot embedding matrix purely within MPC preserves model integrity but introduces latency penalties that scale as input sequences grow.
- Output-Based Attacks Out of Scope: MPC guarantees that inputs and weights remain secret during computation, but it cannot prevent inference-result attacks (such as model extraction or data reconstruction from returned text).
- Future Work: The authors propose integrating PUMA with post-training quantization (e.g., INT8/INT4) and specialized hardware accelerators (GPUs/TPUs) to push multi-party private inference toward second-level latency.
Summary updated