Paper 2025/1510

Mosformer: Maliciously Secure Three-Party Inference Framework for Large Transformers

Ke Cheng, Xidian University
Yuheng Xia, Xidian University
Anxiao Song, Xidian University
Jiaxuan Fu, Xidian University
Wenjie Qu, National University of Singapore
Yulong Shen, Xidian University
Jiaheng Zhang, National University of Singapore
Abstract

Transformer-based models like BERT and GPT have achieved state-of-the-art performance across a wide range of AI tasks but raise serious privacy concerns when deployed as cloud inference services. To address this, secure multi-party computation (MPC) is commonly employed, encrypting both user inputs and model parameters to enable inference without revealing any private information. However, existing MPC-based secure transformer inference protocols are predominantly designed under the semi-honest security model. Extending these protocols to support malicious security remains a significant challenge, primarily due to the substantial overhead introduced by securely evaluating complex non-linear functions required for adversarial resilience. We introduce Mosformer, the first maliciously secure three-party (3PC) inference framework that efficiently supports large transformers such as BERT and GPT. We first design constant-round comparison and lookup table protocols with malicious security, leveraging verifiable distributed point functions (VDPFs). Building on these, we develop a suite of 3PC protocols for efficient and secure evaluation of complex non-linear functions in transformers. Together with optimized modulus conversion, our approach substantially reduces the overhead of secure transformer inference while preserving model accuracy. Experimental results on the vanilla transformer block show that Mosformer achieves up to a $5.3\times$ speedup and a $4.3\times$ reduction in communication over prior maliciously secure protocols. Despite offering stronger security guarantees, Mosformer achieves comparable or even superior online performance to state-of-the-art semi-honest 2PC and 3PC frameworks, including BOLT (Oakland 2024), BumbleBee (NDSS 2025), SHAFT (NDSS 2025), and Ditto (ICML 2024), on full-scale models such as BERT and GPT-2.

Metadata
Available format(s)
PDF
Category
Cryptographic protocols
Publication info
Published elsewhere. ACM CCS 2025
DOI
10.1145/3719027.3765028
Keywords
Secure Transformer InferenceMalicious SecurityFunction Secret Sharing
Contact author(s)
chengke @ xidian edu cn
yuhengxia @ stu xidian edu cn
songanxiao @ stu xidian edu cn
jiaxuanfu @ stu xidian edu cn
wenjiequ @ u nus edu
ylshen @ mail xidian edu cn
jhzhang @ nus edu sg
History
2025-09-26: revised
2025-08-22: received
See all versions
Short URL
https://ia.cr/2025/1510
License
Creative Commons Attribution
CC BY

BibTeX

@misc{cryptoeprint:2025/1510,
      author = {Ke Cheng and Yuheng Xia and Anxiao Song and Jiaxuan Fu and Wenjie Qu and Yulong Shen and Jiaheng Zhang},
      title = {Mosformer: Maliciously Secure Three-Party Inference Framework for Large Transformers},
      howpublished = {Cryptology {ePrint} Archive, Paper 2025/1510},
      year = {2025},
      doi = {10.1145/3719027.3765028},
      url = {https://eprint.iacr.org/2025/1510}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.