NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Encryption-Friendly LLM Architecture

Donghwan Rho, Taeseong Kim, Minje Park, Jung Woo Kim, Hyunsik Chae, Ernest K. Ryu, Jung Hee Cheon

TL;DR Large Language Models (LLMs) struggle to offer personalized fine-tuning and inference without compromising user privacy. This paper introduces an "encryption-friendly" Transformer architecture that uses LoRA and Gaussian Kernel attention to make Homomorphic Encryption (HE) computationally feasible. The result is a ~7x speedup in secure fine-tuning and a 2.3x speedup in inference without sacrificing model accuracy.

The Privacy Bottleneck in LLMs

Users increasingly want LLMs to provide personalized responses based on their private data, which requires fine-tuning. However, sending sensitive data to a central server raises massive privacy concerns.

Homomorphic Encryption (HE) offers a mathematically rigorous solution: it allows a server to perform computations on encrypted data without ever decrypting it. The catch? HE natively supports only basic polynomial operations (addition and multiplication). Standard Transformers are a nightmare for HE because they rely heavily on non-polynomial operations (like division and max functions) and require massive matrix multiplications.

Specifically, the authors identify two major bottlenecks:

  1. Full fine-tuning requires multiplying two encrypted matrices together (Ciphertext-Ciphertext Matrix Multiplication, or CCMM), which is incredibly slow.
  2. The Softmax function in the attention mechanism requires calculating exponentials, maximums, and divisions, which are notoriously difficult and computationally expensive to approximate using HE.

Proposed Architecture: Encryption-Friendly Design

To bypass these bottlenecks, the authors propose a modified, HE-friendly Transformer architecture.

Client-Server architecture for privacy-preserving LLM fine-tuning and inference using LoRA and Gaussian Kernels.
  • LoRA (Low-Rank Adaptation) for HE: Instead of updating all model weights (full fine-tuning), the authors use LoRA. Because the base model weights remain frozen and unencrypted on the server, the model can rely mostly on Plaintext-Ciphertext Matrix Multiplications (PCMM), which are vastly faster than CCMMs. Only the small LoRA adapters require the slow CCMM operations. In standard machine learning, LoRA is famous for saving GPU memory; under HE, its primary benefit is algorithmic, fundamentally shifting the computational burden.
  • Gaussian Kernel (GK) Attention: The authors completely remove the Softmax function from the attention mechanism. Instead, they use a Gaussian Kernel to compute attention scores. This eliminates the need for division and max functions entirely. It also restricts the exponential function to negative inputs ($x \le 0$), which is much easier to approximate with polynomials.
  • AdamW-HE: In encrypted training, even the optimizer step can take longer than the forward pass. The standard AdamW optimizer requires an inverse square root calculation that is highly unstable near zero under HE. The authors adjust the $\epsilon$ parameter and the calculation structure to ensure stable encrypted training.

Experimental Setup

The model was evaluated on the GLUE benchmark, specifically focusing on downstream tasks like CoLA, MRPC, RTE, STSB, SST-2, and QNLI. Larger datasets were excluded due to the extreme computational constraints of running HE experiments.

Key Results and Insights

The proposed architecture demonstrates that privacy-preserving LLMs are computationally within reach, yielding massive speedups and maintaining competitive accuracy.

Performance comparison showing the speedup of PCMM over CCMM and Gaussian Kernel (GK) over Softmax.
  • Massive Speedups: The proposed architecture (LoRA + GK) is 6.94x faster to fine-tune under HE compared to a standard full fine-tuning approach with Softmax. Inference is 2.3x faster.
  • Component-level Wins: As shown in the performance tables, evaluating the Gaussian Kernel is 6.24x faster than evaluating Softmax under HE. Furthermore, PCMM is roughly 4.58x faster than CCMM.
  • Maintained Accuracy: Despite heavy polynomial approximations and architectural changes, the HE-encrypted model maintains performance comparable to plaintext, unencrypted models. On the GLUE benchmark, the encrypted LoRA+GK model achieved an average score of 0.6621, closely trailing the plaintext full-finetuned model's score of 0.7068.
  • Scaling Advantages: Theoretical projections show that as embedding dimensions and sequence lengths grow (like in modern LLMs), the computational time saved by using LoRA and GK over standard methods actually increases.

Limitations and Future Work

  • Model Scale: Due to the sheer computational weight of HE, the experiments were run on a relatively small 2-layer BERT-style encoder model. Scaling this non-interactive HE approach to massive modern LLMs (like GPT-4 or Llama-3) remains a daunting engineering challenge.
  • Threat Model Limits: While this approach cryptographically protects the user's data from the server, it does not protect the server's model weights from the user. The paper does not address model extraction or stealing attacks.
  • Future Directions: The authors suggest that the future of privacy-preserving ML lies not in porting standard models to HE, but in designing entirely new neural network architectures explicitly tailored for the mathematical constraints of encrypted environments.

Summary updated

BibTeX
@inproceedings{rho2025encryption,
  author = {Donghwan Rho and Taeseong Kim and Minje Park and Jung Woo Kim and Hyunsik Chae and Ernest K. Ryu and Jung Hee Cheon},
  title = {{Encryption-Friendly LLM Architecture}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=pbre0HKsfE},
}
Figure