Encrypted Large Model Inference: The Equivariant Encryption Paradigm

James Buban, Hongyang Zhang, Claudio Angione, Harry Yang, Ahmad Farhan, Seyfal Sultanov, Michael Du, Xuran Ma, Zihao Wang, Yue Zhao, Arria Owlia, Fielding Johnston, Patrick Colangelo · DOI

TL;DR

The paper introduces Equivariant Encryption (EE), a new paradigm for "blind" AI inference that allows large models like Llama 3.1 to run on encrypted data with virtually zero performance penalty. By transforming internal data representations rather than encrypting the entire computational graph, EE achieves the privacy of Homomorphic Encryption with the speed of standard plaintext processing.

What Problem Does This Paper Address?

As Large Language Models (LLMs) and diffusion models become integrated into healthcare, finance, and regulated industries, the "where" and "how" of inference become critical. Deploying these models on distributed or decentralized "untrusted" nodes risks exposing sensitive user data (like medical records or private queries).

Existing privacy-preserving technologies all have a "catch":

  • Fully Homomorphic Encryption (FHE): Extremely slow and computationally expensive for billion-parameter models.
  • Secure Multi-Party Computation (SMPC): Requires massive communication overhead between parties.
  • Differential Privacy (DP): Adds noise, which often degrades the model's accuracy.
  • Trusted Execution Environments (TEEs): Rely on hardware-level trust that can be bypassed by system admins.

The authors seek a "Middle Ground": a way to keep data confidential throughout the entire neural network pipeline without sacrificing the real-time throughput required by modern applications.

Methods

The core innovation is Equivariant Encryption (EE). The term "equivariant" comes from a mathematical property where a transformation (encryption) commutes with a function (the neural network layer).

Formally, the authors define it such that: $$decrypt(F(encrypt(p))) = F(p)$$

Instead of using polynomial-based encryption for every single math operation (the FHE approach), EE selectively obfuscates internal representations. It transforms the data into a specialized "encrypted domain" where the model can perform linear and specific non-linear operations (like ReLU, GeLU, or LayerNorm) as if it were working on plaintext.

The Workflow: 1. One-Time Setup: The model is "translated" into an EE-compatible version offline on a secure server. 2. Encrypted Inference: At runtime, the user sends encrypted inputs. The inference server processes these "scrambled" tokens/activations. 3. Decryption: The final output is sent back to the user, who is the only one with the key to map the results back to readable text.

Datasets

The authors evaluated their approach using several standard benchmarks to ensure both speed and "fidelity" (accuracy):

  • IMDb Dataset: Used for benchmarking BERT-based sentiment analysis models.
  • MT-Bench & ShareGPT: Used for evaluating Large Language Models (specifically Llama 3.1-8B). They sampled 2,000 entries from ShareGPT to test output consistency.

Key Insights and Ideas

  • Exactness over Approximation: Most encrypted computation methods struggle with non-linear functions (like the "S-curves" in neural networks), often requiring messy polynomial approximations. EE handles functions like ReLU and SiLU exactly, meaning there is zero accuracy loss inherent to the encryption method.
  • Server Blindness: In an EE pipeline, the raw tokens never exist on the server. Even if a hacker breaches the inference node, they only see high-dimensional "scrambled" vectors that are computationally infeasible to invert without the user's specific transformation key.
  • The "Near-Zero" Overhead: Because the "encrypted" model maintains the same number of additions and multiplications as the original, the hardware (GPUs) treats the workload identically to a standard unencrypted model.

Key Results

The benchmarking results show that EE effectively eliminates the "privacy tax" on performance:

  • Latency: For Llama 3.1-8B running on a vLLM setup with a batch size of 256, the latency change was -0.53% (essentially identical to plaintext). In contrast, traditional HE is often orders of magnitude slower.
  • Fidelity: The "Fidelity Score" (how closely the encrypted output matches the plaintext output) was 99.999% for the Llama models.
  • Integration: The authors note that EE requires minimal code changes, typically just replacing specific layer operations with their "encrypted" equivalents.

Limitations and Future Work

While EE is highly efficient, the authors acknowledge it introduces a new surface for heuristic attacks. They provide a comprehensive threat analysis exploring how an adversary might try to "guess" the original tokens using:

  • Linguistic Domain Knowledge: Using word frequency (e.g., "the" appears more often than "quartz") to reverse-engineer the mapping.
  • LLM-as-a-Judge: Using a second, powerful model (like GPT-4) to score how "sensible" a decrypted output looks during a brute-force attempt.

Future Work will likely focus on increasing the combinatorial complexity of the transformations to make these heuristic attacks even more "prohibitively expensive," ensuring that even with large amounts of intercepted data, the encryption remains robust.

Summary updated

Abstract

Large scale deep learning model, such as modern language models and diffusion architectures, have revolutionized applications ranging from natural language processing to computer vision. However, their deployment in distributed or decentralized environments raises significant privacy concerns, as sensitive data may be exposed during inference. Traditional techniques like secure multi-party computation, homomorphic encryption, and differential privacy offer partial remedies but often incur substantial computational overhead, latency penalties, or limited compatibility with non-linear network operations. In this work, we introduce Equivariant Encryption (EE), a novel paradigm designed to enable secure, "blind" inference on encrypted data with near zero performance overhead. Unlike fully homomorphic approaches that encrypt the entire computational graph, EE selectively obfuscates critical internal representations within neural network layers while preserving the exact functionality of both linear and a prescribed set of non-linear operations. This targeted encryption ensures that raw inputs, intermediate activations, and outputs remain confidential, even when processed on untrusted infrastructure. We detail the theoretical foundations of EE, compare its performance and integration complexity against conventional privacy preserving techniques, and demonstrate its applicability across a range of architectures, from convolutional networks to large language models. Furthermore, our work provides a comprehensive threat analysis, outlining potential attack vectors and baseline strategies, and benchmarks EE against standard inference pipelines in decentralized settings. The results confirm that EE maintains high fidelity and throughput, effectively bridging the gap between robust data confidentiality and the stringent efficiency requirements of modern, large scale model inference.
BibTeX
@misc{buban2025encrypted,
  author = {James Buban and Hongyang Zhang and Claudio Angione and Harry Yang and Ahmad Farhan and Seyfal Sultanov and Michael Du and Xuran Ma and Zihao Wang and Yue Zhao and Arria Owlia and Fielding Johnston and Patrick Colangelo},
  title = {{Encrypted Large Model Inference: The Equivariant Encryption Paradigm}},
  year = {2025},
  eprint = {2502.01013},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.01013},
}
Figure