SHAFT: Secure, Handy, Accurate, and Fast Transformer Inference¶
Authors: Andes Y. L. Kei; Sherman S. M. Chow
Year: 2025
Venue: IACR ePrint 2025/2324
type: system collection: catalogue status: auto
Links: DOI · ePrint 2025/2324
Summary¶
Auto-extracted summary (unreviewed)
SHAFT is an MPC-based secure transformer inference framework that introduces the first constant-round softmax protocol (via input clipping and an ODE characterization, avoiding max extraction) and a highly accurate GELU protocol based on a Fourier-series approximation. It reduces communication by 62-70% and runs 1.8-2.4x faster than SIGMA, and is 2.6-3.7x faster than BumbleBee in LAN, while keeping accuracy comparable to plaintext models; the open-source code integrates with Hugging Face for easy deployment of custom models.
Abstract¶
A growing adoption of transformer-based machine learning models is raising concerns about sensitive data exposure. Nonetheless, current secure inference solutions incur substantial overhead due to their extensive reliance on non-linear protocols, such as softmax and Gaussian error linear unit (GELU). Driven by numerical stability needs, softmax approximations (e.g., NeurIPS 2021) typically extract the maximum element of an input vector, incurring logarithmic rounds (in the input length). Existing GELU protocols (e.g., S&P 2024) use piecewise approximations with high-degree polynomials that rely heavily on secure multiplications and comparisons, which are expensive. Such complexities also hinder model owners unfamiliar with cryptography from deploying custom models. SHAFT, our proposed system, provides a secure, handy, accurate, and fast transformer inference framework for deployment. Highlights of our contributions include 1) the first constant-round (independent of sequence length) softmax protocol for transformers, using input clipping and an ordinary differential equation characterization, and 2) a highly accurate GELU protocol on a novel characterization designed for Fourier series approximation. Extending to broader contexts, our new protocols also apply to general neural networks that use softmax as the final layer and to transformer architectures with different activation functions. Remarkably, SHAFT outperforms state-of-the-art SIGMA (PETS 2024), which uses secret sharing, and BumbleBee (NDSS 2025), which additionally uses RLWE-based homomorphic encryption. More specifically, SHAFT reduces communication by 62–70% and is 1.8–2.4× faster than SIGMA, while also surpassing BumbleBee in terms of running time by 2.6–3.7× under LAN settings. Alongside these improvements, SHAFT attains accuracy comparable to plaintext models, confirming its numerical stability. Next in this progression, SHAFT provides an accessible opensource framework for secure and handy deployment by smoothly integrating with the Hugging Face library (EMNLP Demos 2020).
Source: pdf
Extracted details¶
| Field | Value | Source | Confidence |
|---|---|---|---|
| contribution | First constant-round (sequence-length independent) softmax protocol for transformers using input clipping and an ODE characterization | llm | 0.75 |
| contribution | Accurate GELU protocol based on a novel characterization suited to Fourier series approximation | llm | 0.75 |
| contribution | Protocols also apply to general NNs with softmax output layers and to transformers with other activations | llm | 0.75 |
| contribution | Open-source framework with PyTorch-to-PPML conversion of transformer layers and Hugging Face integration | llm | 0.75 |
| contribution | Outperforms SIGMA (PETS 2024) and BumbleBee (NDSS 2025) in communication and running time | llm | 0.75 |
| schemes | secret sharing | llm | 0.75 |
| libraries | Hugging Face Transformers | llm | 0.75 |
| libraries | PyTorch | llm | 0.75 |
| tasks | private transformer inference | llm | 0.75 |
| tasks | NLP | llm | 0.75 |
| interaction | pure MPC | llm | 0.75 |
| code url | https://github.com/andeskyl/SHAFT.18https (URL found in the full text) | regex | 0.50 |
| code url | https://github.com/andeskyl/SHAFT (URL found in the full text) | regex | 0.50 |
| llm relevance | high | llm | 0.75 |
| key result | communication reduction vs SIGMA: 62-70% (secure transformer inference) | llm | 0.75 |
| key result | speed-up vs SIGMA: 1.8-2.4x (secure transformer inference) | llm | 0.75 |
| key result | speed-up vs BumbleBee (running time): 2.6-3.7x (LAN) | llm | 0.75 |
| key result | accuracy: comparable to plaintext models (secure transformer inference) | llm | 0.75 |
System card: SHAFT¶
| Group | 5. Interactive MPC and HE+MPC hybrids |
| Family | 2PC secret sharing |
| Arithmetic | Fixed point |
| Interaction | Interactive 2PC |
| Model scale | BERT, GPT-2 |
| Status | Active SOTA |
| Relation to the SoK | Constant-round Softmax and cheaper GELU protocols. |
| Note | Avoids the max extraction that costs logarithmic rounds. |
| Systems page | SHAFT |
Keyword mentions¶
Counts of vocabulary terms in the full text (first page of occurrence in brackets).
- scheme: MPC 23 [p.1], Secret sharing 10 [p.1], Garbled circuits 4 [p.2], Function secret sharing 4 [p.2], Oblivious transfer 2 [p.3], Differential privacy 2 [p.5], Zero-knowledge proofs 2 [p.12]
- library: CrypTen 24 [p.2], PyTorch 13 [p.2], HuggingFace 13 [p.1], ONNX 6 [p.2], MP-SPDZ 3 [p.2], EzPC / CrypTFlow 1 [p.13]
- model: BERT 27 [p.1], GPT 18 [p.1], ViT 13 [p.1], Transformer 9 [p.1], CNN 6 [p.1], LLaMA 3 [p.2], VGG 1 [p.1], RNN / LSTM 1 [p.13], Decision tree 1 [p.13]
- dataset: GLUE tasks (QNLI/RTE/MRPC/CoLA/QQP/MNLI/STS-B) 14 [p.2], SST-2 8 [p.2], GLUE 5 [p.2], CIFAR-10 1 [p.1]
- hardware: GPU 9 [p.6], Intel Xeon 2 [p.8]
- technique: Softmax 72 [p.1], GELU 72 [p.1], ReLU 25 [p.2], Lookup table 17 [p.3], Matrix multiplication 9 [p.4], Fine-tuning 9 [p.9], Semi-honest model 9 [p.1], LayerNorm 7 [p.5], Two-party computation 7 [p.2], Attention 5 [p.1], Non-interactive 4 [p.5], Malicious model 4 [p.12], Rotations 3 [p.4], Sigmoid 2 [p.2], Convolution 2 [p.1]
- topic: Private / secure inference 26 [p.1], Privacy-preserving machine learning 11 [p.1], Homomorphic encryption 9 [p.1], Benchmark 7 [p.2], Open source 5 [p.2]
Files¶
| Path (under papers/) | Collection | Pages | Size | SHA-256 | Note |
|---|---|---|---|---|---|
references/catalogue/5-135_shaft-secure-handy-accurate-and-fast-transformer-inference.pdf |
catalogue | 14 | 1.0 MB | c2b9e5ccd463 |
Database key: shaft-secure-handy-accurate-and-fast-transformer-inference · created 2026-11-05 · updated 2026-11-05 · edit with python3 tools/paperdb.py set shaft-secure-handy-accurate-and-fast-transformer-inference COLUMN VALUE