Paper 2024/1881
THOR: Secure Transformer Inference with Homomorphic Encryption
Abstract
As large language models are increasingly deployed in cloud environments, privacy concerns have become a significant issue. To address this challenge, we present THOR, a non-interactive framework for secure transformer inference using homomorphic encryption. We first propose efficient matrix multiplication algorithms based on diagonal-major encoding and compact ciphertext packing. We extend these basic algorithms to support plaintext-ciphertext matrix multiplication (PC-MM) using parallel submatrix computation and ciphertext-ciphertext multiplication (CC-MM) with a baby-step giant-step strategy. We also design efficient evaluation strategies for non-linear functions such as softmax, LayerNorm, GELU, and Tanh, by integrating advanced approximation techniques with adaptive iterative methods. Our matrix multiplication algorithms outperform state-of-the-art methods, achieving up to 5.3$\times$ speedup in PC-MM for $\mathbb{R}^{768\times 768}\times \mathbb{R}^{768\times 128}$ over BOLT (Pang et al., IEEE S&P 2024) and 9.7$\times$ in CC-MM for $12\times (\mathbb{R}^{64\times 128}\times \mathbb{R}^{128\times 128})$ over Powerformer (Park et al., Preprint). THOR enables secure inference on the BERT-base model with 128 tokens in 10 minutes on a single GPU, while maintaining comparable accuracy on GLUE tasks.
Metadata
- Available format(s)
-
PDF
- Category
- Cryptographic protocols
- Publication info
- Published elsewhere. Minor revision. ACM CCS 2025
- DOI
- 10.1145/3719027.3765150
- Keywords
- Homomorphic encryptionmatrix computationtransformer
- Contact author(s)
-
jungho moon @ desilo ai
aydw0507 @ yonsei ac kr
Xiaoqian Jiang @ uth tmc edu
miran @ hanyang ac kr - History
- 2025-09-12: last of 2 revisions
- 2024-11-19: received
- See all versions
- Short URL
- https://ia.cr/2024/1881
- License
-
CC BY
BibTeX
@misc{cryptoeprint:2024/1881,
author = {Jungho Moon and Dongwoo Yoo and Xiaoqian Jiang and Miran Kim},
title = {{THOR}: Secure Transformer Inference with Homomorphic Encryption},
howpublished = {Cryptology {ePrint} Archive, Paper 2024/1881},
year = {2024},
doi = {10.1145/3719027.3765150},
url = {https://eprint.iacr.org/2024/1881}
}