Manuscript Offprint

arXiv:2611.04488

Perseus: A Full-Stack System for Homomorphic Model Inference

Alessandro Zirilli, Davide Marincione, Evgenios M. Kornaropoulos, Giuseppe Ateniese, Emanuele Rodolà

Alessandro Zirilli*¹

Davide Marincione*¹,³

Evgenios M. Kornaropoulos²

Giuseppe Ateniese²

Emanuele Rodolà¹,³

¹Sapienza University of Rome

²George Mason University

³Paradigma

Large Language Models (LLMs) have made it exceptionally convenient for users to send their private data to model providers, which process them in plaintext. Fully Homomorphic Encryption (FHE) promises to secure remote inference by computing directly on encrypted data, yet it has remained prohibitively slow. The effort to make it practical remains fragmented, with most existing frameworks being closed-source, which keeps progress from compounding. We present Perseus, a free and open¹ Python software library that supports the full stack of encrypted model inference, from the cryptographic backend and data packing, to encrypted nonlinearities and end-to-end model execution. Perseus ships with built-in novel optimizations, one at each level of the stack: in-kernel regeneration of key-switching keys at the (i) backend level, a complex variant of Cachemir packing [1] at the (ii) data level, and a state-of-the-art bootstrap placer that is both packing- and magnitude-aware at the (iii) model level. Perseus achieves state-of-the-art latency across multiple models and modalities, within 3% of the plaintext models' accuracy and perplexity. Remarkably, it is 3.96× faster at single-token decoding than any other implementation on Llama-3-8B (Table 1). We initiate, for the first time, a public speedrun on encrypted GPT-2, so that progress can compound.

Table 1: Encrypted Llama-3-8B decode of one token; †composed from per-block or per-operator timings, not run end to end. Throughout the paper we mark competing frameworks as: ✓ available, ~ temporarily or partially released, and × closed-source.

(i) Llama-3-8Bcontexts/tokGPUavailability
AR-HE (Kanpak and Unat, 2026)321569.0†H100✗
ROSETTA (Yu et al., 2026b)512311.0†A100✗
Cachemir (Yu et al., 2026a)51297.0†A100~
Sylph (Park et al., 2026)12831.0†RTX PRO 6000✗
Perseus (ours)5127.8RTX PRO 6000✓

Code

Speedrun

1 Introduction

Fully Homomorphic Encryption (FHE) promises a future of trustless outsourced computation. One of its most appealing applications is Machine Learning, where successful task execution often depends on disclosing sensitive data. In particular, the recent expansion of capabilities in Large Language Models (LLMs) has made them extremely convenient for many users, who accept to share their private, plaintext data with the models' inference providers. While encrypted models exist, the extreme latency FHE introduces through bootstrapping limits the deployment of these models in practice.

The landscape of encrypted execution is evolving rapidly, with various approaches aiming to reduce the high latency imposed by FHE (and in particular CKKS [5]). New techniques are being released for all the different abstraction levels of the encrypted models' inference stack, from bootstrap speed-ups, GPU implementations [6–9], and 32-bit arithmetic [7] at the cryptographic backend level; to task-specific packing systems [1, 10–16] at the data level; and to new techniques for approximating machine learning layers [4, 17–24], bootstrap placers [25–27], and fine-tuning techniques [23, 28] at the model level. The unfortunate reality of these optimizations is that most

*Equal contribution. Contact: {zirilli, marincione}@di.uniromal.it.

¹Released under the BUSL 1.1: free for research and non-commercial use, commercial use available upon request.

Preprint.

are implemented into different, sometimes closed-source, frameworks, making integration between one another difficult and time-consuming.

We present Perseus, a publicly available Python library for encrypted machine learning model inference that enables practitioners to implement models and optimization techniques in an easy-to-use environment. Perseus' contributions are:

  • a free and open Python library (code) that supports full-stack development of models, built on Perseus-core, a Rust and CUDA cryptographic backend for CKKS 32-bit arithmetic and bootstrapping.

  • Built-in optimizations at all levels of the stack, from in-kernel regeneration of key-switching keys using ChaCha12 (halving key storage), a complex variant of Cachemir packing (roughly halving memory), to packing- and magnitude-aware bootstrap planning with an iterated minimum cut (≈30% fewer bootstraps), which result in state-of-the-art latency on all already-implemented models (GPT-2, Llama-3-8B, ViT, BERT).

  • A public leaderboard to cooperatively optimize encrypted language models' inference, a speedrun (leaderboard) that will condense the community's effort to reduce latency.

Throughout the paper, we report published results for competing methods when their code is unavailable and reproduce their results when the code is publicly available.

References (47)