Paper 2025/991

MOAI: Module-Optimizing Architecture for Non-Interactive Secure Transformer Inference

Linru Zhang, Nanyang Technological University
Xiangning Wang, Nanyang Technological University
Jun Jie Sim, Ant International
Zhicong Huang, Ant Group
Jiahao Zhong, Nanyang Technological University
Huaxiong Wang, Nanyang Technological University
Pu Duan, Ant International
Kwok Yan Lam, Nanyang Technological University
Abstract

Privacy concerns have been raised in Large Language Models (LLM) inference when models are deployed in Cloud Service Providers (CSP). Homomorphic encryption (HE) offers a promising solution by enabling secure inference directly over encrypted inputs. However, the high computational overhead of HE remains a major bottleneck. To address this challenge, we propose MOAI, an efficient HE-based, non-interactive framework for secure transformer inference. MOAI gains significant efficiency improvement from: (1) a novel evaluation flow that combines column and diagonal packing with consistent strategies across all layers, eliminating expensive format conversions. (2) rotation-free algorithms for Softmax and LayerNorm that significantly reduce the number of costly HE rotations, removing 2448 HE rotations in BERT-base inference. (3) Column packing removes rotations in plaintext–ciphertext matrix multiplications and interleaved batching further reduces the rotations in ciphertext–ciphertext matrix multiplications. MOAI uses at least 1.7x fewer HE rotations compared to the state-of-the-art works across all matrix multiplications of BERT-base. As a result, We achieve a 52.8% reduction in evaluation time compared to the state-of-the-art HE-based non-interactive secure transformer inference, THOR (Moon et al., CCS’25). We then apply MOAI on the Powerformer’s framework and achieve a 55.7% reduction in evaluation time compared to Powerformer (Park et al., ACL’25), which approximates Softmax and LayerNorm with simpler functions in transformer and proposes HE-based non-interactive transformer inference. We report an amortized time of 2.36 minutes per input on a single GPU environment. We show the extendibility by applying MOAI in LLaMA-3-8B. Our implementation is publicly available as open source.

Metadata
Available format(s)
PDF
Category
Applications
Publication info
Published elsewhere. Minor revision. ICLR 2026
Keywords
Privacy inferenceFully homomorphic encryptionTransformer
Contact author(s)
linru zhang @ ntu edu sg
xiangning wang @ ntu edu sg
junjie sim @ antgroup com
zhicong hzc @ antgroup com
jiahao zhong @ ntu edu sg
hxwang @ ntu edu sg
p duan @ antgroup com
kwokyan lam @ ntu edu sg
History
2026-02-09: last of 3 revisions
2025-05-29: received
See all versions
Short URL
https://ia.cr/2025/991
License
Creative Commons Attribution
CC BY

BibTeX

@misc{cryptoeprint:2025/991,
      author = {Linru Zhang and Xiangning Wang and Jun Jie Sim and Zhicong Huang and Jiahao Zhong and Huaxiong Wang and Pu Duan and Kwok Yan Lam},
      title = {{MOAI}: Module-Optimizing Architecture for Non-Interactive Secure Transformer Inference},
      howpublished = {Cryptology {ePrint} Archive, Paper 2025/991},
      year = {2025},
      url = {https://eprint.iacr.org/2025/991}
}
Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.