Paper 2025/2271

ARION: Attention-Optimized Transformer Inference on Encrypted Data

Linhan Yang
Jingwei Chen
Wangchen Dai
Shuai Wang
Wenyuan Wu
Yong Feng
Abstract

Privacy-preserving Transformer inference (PPTI) is essential for deploying large language models (LLMs) such as BERT and LLaMA in sensitive domains. In these models, the attention mechanism is both the main source of expressiveness and the dominant performance bottleneck under fully homomorphic encryption (FHE), due to large ciphertext matrix multiplications and the softmax nonlinearity. This paper presents Arion, a non-interactive FHE-based PPTI protocol that specifically optimizes the computation of encrypted attention. First, for the three consecutive ciphertext matrix multiplications in multi-head attention, we introduce the double Baby-Step Giant-Step algorithm, which significantly reduces the number of ciphertext rotations. On BERT-Base, Arion achieves an 82.5% reduction in rotations over the state-of-the-art PPTI protocol MOAI (2025), corresponding to a 5.7x reduction in rotation cost. Second, we propose a linear–nonlinear fusion technique tailored to the softmax evaluation in attention. By decomposing softmax into shift-by-maximum, exponentiation, and reciprocal sub-steps and fusing them with the surrounding encrypted matrix operations, Arion enables efficient attention evaluation while remaining compatible with diverse ciphertext packing formats. We implement Arion using Lattigo and first evaluate attention kernels on popular LLMs including BERT-Tiny, BERT-Base, and LLaMA, confirming the practicality and scalability of the proposed optimizations for encrypted attention computation. For end-to-end applications, on classification tasks for several benchmark datasets, Arion attains accuracy comparable to plaintext inference and yields up to 2.5x end-to-end speedups over MOAI for BERT-Base.

PDF
BibTeX
ePrint ↗
@misc{cryptoeprint:2025/2271,
      author = {Linhan Yang and Jingwei Chen and Wangchen Dai and Shuai Wang and Wenyuan Wu and Yong Feng},
      title = {ARION: Attention-Optimized Transformer Inference on Encrypted Data},
      howpublished = {Cryptology {ePrint} Archive, Paper 2025/2271},
      year = {2025},
      url = {https://eprint.iacr.org/2025/2271}
}
Category
Applications
License
CC BY
Submitted
Updated
Versions

Report a problem

Comments

Log in or create an account

Privacy