Nimbus: Secure and Efficient Two-Party Inference for Transformers

Zhengyi Li, Kang Yang, Jin Tan, Wen-jie Lu, Haoqi Wu +6 more
2/3/2026

No official code found. Best implementation: secretflow/spu (325 stars, Apache-2.0, last commit 2026-05-03).

Abstract

Transformer models have gained significant attention due to their power in machine learning tasks. Their extensive deployment has raised concerns about the potential leakage of sensitive information during inference. However, when being applied to Transformers, existing approaches based on secure two-party computation (2PC) bring about efficiency limitations in two folds: (1) resource-intensive matrix multiplications in linear layers, and (2) complex non-linear activation functions like $\mathsf{GELU}$ and $\mathsf{Softmax}$. This work presents a new two-party inference framework $\mathsf{Nimbus}$ for Transformer models. For the linear layer, we propose a new 2PC paradigm along with an encoding approach to securely compute matrix multiplications based on an outer-product insight, which achieves $2.9\times \sim 12.5\times$ performance improvements compared to the state-of-the-art (SOTA) protocol. For the non-linear layer, through a new observation of utilizing the input distribution, we propose an approach of low-degree polynomial approximation for $\mathsf{GELU}$ and $\mathsf{Softmax}$, which improves the performance of the SOTA polynomial approximation by $2.9\times \sim 4.0\times$, where the average accuracy loss of our approach is 0.08\% compared to the non-2PC inference without privacy. Compared with the SOTA two-party inference, $\mathsf{Nimbus}$ improves the end-to-end performance of \bert{} inference by $2.7\times \sim 4.7\times$ across different network settings.

View on arXivView PDF

Code Implementations(1)

secretflow/spuCommunity100%
Apache-2.0

SPU (Secure Processing Unit) aims to be a provable, measurable secure computation device, which provides computation ability while keeping your private data protected.

325146C, C++Jul 2, 20225 months agoApache-2.0
privacy-preservingprivate-set-intersectionsecure-multiparty-computation

Similar Papers

Cite this paper

@article{li2026nimbus,
  title  = {Nimbus: Secure and Efficient Two-Party Inference for Transformers},
  author = {Zhengyi Li and Kang Yang and Jin Tan and Wen-jie Lu and Haoqi Wu and Xiao Wang and Yu Yu and Derun Zhao and Yancheng Zheng and Minyi Guo and Jingwen Leng},
  year   = {2026},
  eprint = {2411.15707},
  archivePrefix = {arXiv},
  doi    = {10.48550/arXiv.2411.15707},
  url    = {https://arxiv.org/abs/2411.15707},
  journal = {NEURIPS 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2411.15707.svg)](https://codeofpaper.com/paper/2411.15707)

Discussion