arXiv(opens in a new tab)cs.CRSep 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2609.01730

HEAT: Faster Fully Homomorphic Inference via Approximations-Weights Co-Adaptation

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

Abstract

Fully homomorphic encryption (FHE) allows a server to run a language model directly on encrypted user prompts, but current approaches remain prohibitively slow. Ciphertexts natively support only addition, multiplication, and rotation, and multiplications may be composed only to a bounded depth before a costly bootstrapping operation is needed to continue. Every nonlinearity must therefore be approximated by an iterative method, and each iteration uses multiplications. A higher iteration count buys precision but exhausts the available depth faster and triggers more bootstraps, which dominate latency. Existing approaches fix the iteration counts uniformly across the model rather than tailoring them to each site's error tolerance. We introduce Homomorphic Encryption-Aware Training (HEAT), a fine-tuning method that makes the per-nonlinearity iteration counts learnable, enabling them and the model weights to co-adapt during training. HEAT optimizes iterations with respect to the task objective, allowing the model to adapt to approximation errors encountered during inference without architectural changes or retraining from scratch. On encrypted GPT-2 decoding, HEAT reduces iterations by 3.1×, bootstraps by 1.6×, and end-to-end latency by 1.4×, while improving decode agreement over the calibrated baseline.

https://github.com/gladia-research-group/heat

1 Introduction

As language models grow in scale, running them locally becomes impractical for most users. Access therefore increasingly takes the form of inference-as-a-service, with models hosted on provider-controlled servers and queried remotely. This convenience comes at a privacy cost: prompts and outputs are processed in plaintext and are visible to the provider. Fully homomorphic encryption (FHE) [10] protects the inference of outsourced language models through cryptography. A client encrypts the prompt, the server evaluates the model on it without decrypting, and only the client can recover the output.

Running a model under FHE, however, suffers extreme latency. Ciphertexts natively support only additions, rotations, and multiplications,

Figure

Figure 1: Per module decode-latency composition, calibrated GPT-2 vs. HEAT: paired bars in absolute seconds per token, the hatched cap of each bar being the bootstrap time per module. The two iterative nonlinearities own ≈59% of the token wall and 71% of all bootstrap time; HEAT's saving concentrates in exactly those bars.

Preprint.

and multiplications can be nested up to a finite maximum multiplicative depth, after which slow bootstrapping is required to restore the multiplicative budget. The limited operation set forces nonlinearities to be approximated with iterative methods, whose multiplications consume the budget and consequently lead to frequent bootstrapping. This creates a trade-off between approximation precision and inference latency. Iterations are usually fixed across the model, regardless of the precision required at each site, and this overprovisioning in the iterative methods is the main source of latency during inference (Figure 1). Prior work buys this depth back before deployment mostly by redesigning the network around FHE with polynomial activations or encryption-friendly layers [16, 20, 22], which changes the network's architecture and requires distillation or full retraining.

We introduce Homomorphic Encryption-Aware Training (HEAT), a pre-deployment fine-tuning that, inspired by Banino et al. [4], learns the iteration count at each approximation site jointly with the model weights. A depth regularization term pushes every site toward few iterations, while the task loss retains precision where the model needs it. Because the weights train under the same approximations, they absorb part of the error that shallower solvers introduce, so each site can be cut further than a fixed model would tolerate. The resulting model is architecturally identical to its plaintext parent but demands substantially less multiplicative depth under FHE: on encrypted GPT-2 it cuts total iterations 3.1×3.1 \times, end-to-end decoding latency from ≈54\approx 54 s/tok to ≈38\approx 38 s/tok, and raises top-1 agreement with its own plaintext parent from 74% to 83% (Section 4). We publish our HEAT trained checkpoints on HuggingFace.

References (27)