Fully Homomorphic Encryption (FHE) enables non-interactive, privacy-preserving transformer fine-tuning, protecting highly sensitive data as inputs to large language models. Prior work has predominantly pursued efficiency gains through architectural refinements, yet overall performance remains bounded by the substantial cost inherent in encrypted computation. To address these issues, we target the bottleneck at the ciphertext operation level. Concretely, we propose a novel packing strategy that supports batching over a flexible number of inputs, making it well-suited for fine-tuning workloads. In addition, we design operation-specific matrix evaluation algorithms that significantly reduce (i) the number of ciphertext rotations and relinearizations, and (ii) the number of bootstrapping invocations. Additionally, we exploit functional bootstrapping to fold the evaluation of element-wise activation functions directly into the bootstrapping step, thereby reducing overall computational complexity. As a result, our framework achieves a 30× reduction in ciphertext rotations and relinearizations across all matrix operations, as well as a 2.5× reduction in FHE bootstrapping invocations over the entire computation flow, compared to the latest state-of-the-art work. It is worth noting that our system completes fine-tuning of a 2-layer BERT-style model with a batch size of 16 in 650 seconds, achieving a 8× speedup over the state-of-the-art work.
Figures & tables
Scheme
NEXUS Zhang et al. (2025a)
THOR Moon et al. (2025)
Powerformer Park et al. (2025)
MOAI Zhang et al. (2026)
Tricycle Lim et al. (2025)
ARION Yang et al. (2025a)
Rho et al. Rho et al. (2025)
Our work
Task
Inference
Inference
Inference
Inference
Inference
Inference
Fine-tuning
Fine-tuning
Batch inputs
✓
✗
✗
✓
✗
✓
✗
✓
Flexible size
✗
-
-
✗
-
✗
-
✓
Table 1: Comparison of packing methods in FHE-based non-interactive privacy-preserving transformer inference/fine-tuning schemes.
Figure 1: Toy example of comparison between row packing in Rho et al. Rho et al. (2025) and our flexible interleaved column packing. Here n1=2,n2=3,b=3 . If N=6 , then the 3 -flexible interleaved column packing divides {X1,X2,X3} into 3 ciphertexts encrypting: (x001,x002,x003,x101,x102,x103),(x011,x012,x013,x111,x112,x113),(x021,x022,x023,x121,x122,x123) .
Transformer operations
Matrix operations
Schemes
#(RotHE)
#(RelinearizationHE)
Total #(KeySwitchHE)
Multiplicative level used
XiW∗ , i∈[b],∗=Q,K, and V
CPMM
Ours
480
0
480 ( 213× fewer)
1 (2 levels fewer)
Rho et al. (2025)
102480
0
102480
3
XiA∗B∗ , i∈[b],∗=Q,K, and V
CCMM-LoRA
Ours
24
78
102 ( 21× fewer)
2 (1 level fewer)
Rho et al. (2025)
2016
192
2208
3
Sh , i∈[b],h∈[H]
CCMM-kernel
Ours
21912
1536
23448
3 (4 levels fewer)
Rho et al. (2025)
19776
384
20160
7
Table 2: Comparisons with Rho et al. (2025) . Numbers in the table are based on evaluating all kinds of matrix operations (CPMM, CCMM for LoRA, CCMM for kernel, CCMM for ×V , and CCMM in classification head) in the forward pass of a single BERT layer with kernel attention on a batch of inputs (batch size b). The concrete parameters are as follows: Xi∈R128×768,i∈[16] , WQ,WK,WV∈R768×768 , A∈R768×nLoRA , B∈RnLoRA×768 , Wc2∈R768×2 . We have: number of heads H=12 , batch size b=16 , and nLoRA=2 , which are consistently used in both our experiments and those of Rho et al. (2025) .
Figure 2: Runtime results of homomorphic matrix operations across different output ciphertext levels.
# (input ct)
Input lv.
# (BTS)
# (FuncBTS)
# (Output ct)
Output lv.
(Worst prec., Avg prec.)
Time(s)
Felid (ours)
6
4
0
6
6
12
(2−13.54,2−13.97) Yang et al. (2025b)
4.02 (4.33×faster)
Rho et al. Rho et al. (2025) *
6
4
18
0
6
12
(2−10,2−16.4) Rho et al. (2025)
17.4
Table 3: The comparison between CKKS functional bootstrapping and the traditional “evaluation + bootstrapping” flow in Rho et al. (2025) . The comparison is set to the activation in feedforward block. The input level and the output level are set to the same in the two settings.
Scheme
Forward pass
Backward pass + Optimizer
Total
Number
Time (s)
Number
Time (s)
Number
Time (s)
Felid (ours)
683 (2.18×fewer)
295.05
236 (3.44×fewer)
111.95
919 (2.5×fewer)
407 (2.69×faster)
Rho et al. Rho et al. (2025) *
1488
708
812
386
2300
1094
Table 4: Runtime (seconds) and total number of bootstrapping and functional bootstrapping operations in our scheme and in Rho et al. (2025) in LoRA fine-tuning, over a batch of input with batch size = 16.
Scheme
Forward pass
Backward pass
Optimizer
Total
Amortized
Matrix
Non-linear
(Func)Boot
Matrix
Non-linear
(Func)Boot
Felid (ours)
67.79
9.56
295.05
164.04
1.91
92.45
19.9
650.6
40.66 (8×faster)
Rho et al. Rho et al. (2025) *
1429
291
708
2377
47
355
31
5238
327.38
Table 5: Fine-tuning time (seconds) over a batch of input with batch size = 16.
Plaintext Full fine-tuning
Plaintext LoRA fine-tuning
Ciphertext LoRA fine-tuning
Task (Metric)
SM Rho et al. (2025)
GK Rho et al. (2025)
GK (ours)
EK (ours)
GK Rho et al. (2025)
GK (ours)
EK (ours)
GK Rho et al. (2025)
GK (ours)
EK (ours)
MRPC (F1 ↑ )
0.8328
0.8431
0.8349
0.8381
0.8258
0.8298
0.8315
0.8147
0.8255
0.8323
RTE (Accuracy ↑ )
0.5884
0.6101
0.5957
0.6173
0.5776
0.6029
0.6065
0.5993
0.5957
0.5921
STS-B (Pearson ↑ )
0.8415
0.8215
0.8311
0.8230
0.8107
0.8184
0.8274
0.7997
0.8155
0.7824
Average
0.7542
0.7582
0.7539
0.7595
0.7380
0.7504
0.7551
0.7379
0.7456
0.7356
Table 6: Plaintext and ciphertext GLUE results. Results marked with Rho et al. (2025) are taken from the published Gaussian-kernel transformer; “ours” denotes models trained using our continued-pretraining and distillation pipeline. To ensure a fair comparison, we fine-tune the models for 5 epochs as per Rho et al. (2025) .
Appendix figures & tables20 assets
Supplementary material from the paper’s appendix.
Appendix
Operations
Rot
ct-ct Mult
(Relinearization)
ct-pt Mult
Level
CPMM-basic
(n2+n2′)Nbn1
0
0
Nbn1n2n2′
1
CPMM-optimized
(n2+2n2′)Nbn1
0
0
2Nbn1n2n2′
1
Appendix
Table 7: The number of each HE operation for {\enc(Xi)W}i∈[b] in our scheme
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
LoRA-CCMM-basic
nLoRA⋅log(N/(bn1))
Nbn1nLoRA(n2+n2′)
nLoRA+Nbn1n2′
0
2
LoRA-CCMM-optimized
nLoRA⋅log(N/(bn1))
2Nbn1nLoRA(2n2+n2′)
nLoRA+2Nbn1n2′
0
2
Appendix
Table 8: The number of each HE operation for {\enc(Xi)\enc(A)\enc(B)}i∈[b] in our scheme
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
Sh -basic
N2bn12n3+n1log(N/(bn1))
Nbn12n3
n1
Nbn12n3+n1
3
Sh -optimized
Nbn1n3(N2bn12+bn12N)+n1log(bn1N)
Nbn12n3
n1
N2b2n13n3
3
Appendix
Table 9: The number of each HE operation for {Shi}i∈[b] in one head in our scheme
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
×Vh -CCMM-basic
N2bn12n3+n1log(N/(bn1))
Nbn12n3
Nbn1n3
Nbn12n3+n1
2
×Vh -CCMM-optimized
2Nbn1n3(bn12N+N2bn12+1)+n1log(bn1N)
2Nbn12n3
2N2b2n13n3
2Nbn1n3(Nbn12+bn1N)+n1
3
Appendix
Table 10: The number of each HE operation for {σ(Shi)Vhi},i∈[b] in our scheme
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
Extraction
Nbn1n2log(n1)
0
0
Nbn1n2
1
CCMM for Wc1
n1n2⋅log(N/(bn1))+1
Nbn22
n1n2
n1n2
1
CCMM for Wc2
2c⋅log(N/(2b))
2c
2c
0
1
Appendix
Table 11: The number of each HE operation for matrix computations in classification head in our scheme
Operations
Rot
ct-ct Mult
ct-pt Mult
Level
CPMM in [ 16 ]
2d+3d
0
4d
3
CCMM in [ 16 ]
3d+5d
d
4d
3
Appendix
Table 12: The number of each HE operation for one d×d homomorphic matrix multiplication required by JKLS algorithm [ 16 ]
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
CPMM in [ 28 ]
21(2l+3d+log2(d/l))
0
0
21(3d+2l)
3
Appendix
Table 13: The number of each HE operation for CPMM ( \enc(X)W ) for a single input in [ 28 ] .
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
Value CCMM in [ 28 ]
g(23m+4⌈m⌉+2)
2mg
2g
g(3m+1)
3
Appendix
Table 14: The number of each HE operation for value CCMM ( {\enc(σ(Sh))\enc(Vh)}h∈[H] ) for a single input in [ 28 ] , following the GitHub implementation.
Operations
Rot
ct-ct Mult
Relinearization
ct-pt Mult
Level
LoRA-style CCMMs
40nLoRA−1
6nLoRA
6nLoRA
4nLoRA
3
Appendix
Table 15: The number of each HE operation for LoRA-style CCMMs for a single input in [ 28 ] .
Table 16: The number of each HE operation for Kernel CCMM for a single input in [ 28 ] .
Figure 3: Toy example of summing elements within each row under row packing and column packing
Figure 4: Full flow of our framework.
Library
GPU
\add
\plainmult
\mult
RotHE
BTS / ExtBTS
FuncBTS
HEaaN
Nvidia GeForce RTX 4090
0.02
0.1
0.6
0.49
60/137
-
PhantomFHE
NVIDIA H200
0.03
0.06
3.13
2.87
476
398
Ratio (PhantomFHE/HEaaN)
1.5×
0.6×
5.2×
5.8×
3.5−7.9×
-
Appendix
Table 17: Runtime (ms) of basic operations in CKKS with parameters: degree of polynomial ring = 216 , number of slots = 215 , multiplicative level before bootstrapping = 9 , security parameter = 128-bit. The result of HEaaN reported by [ 28 ] .
Block
Operation
Input size
Time (s)
Forward: Transformer Layer
×WQ,WK,WV
(128×768)×(768×768)×3
5.8
×A∗,×B∗ , ∗=Q,K,V
(128×768)×(768×2)×(2×768)×3
0.45
LoRA addition
((128×768)+(128×768))×3
0.001
Repack( C→R )
(128×64)×12×2
0.013
Kernel S
(128×64)×12×2
5.97
Kernel U (FuncBTS)
(128×128)×12
38.31
Appendix
Table 18: Breakdown fine-tuning time (seconds) over a batch of input with batch size = 16.
Operation
Batch Size 4
Batch Size 16
Batch Size 64
Total Time
Amortized
Total Time
Amortized
Total Time
Amortized
CPMM
0.26
0.065
0.97
0.061
3.11
0.049
CCMM-LoRA
0.018
0.0045
0.067
0.0042
0.169
0.0026
CCMM-kernel
0.88
0.22
3.42
0.21
10.2
0.16
CCMM-V
0.86
0.22
3.24
0.20
10.32
0.16
LayerNorm
1.02
0.26
1.90
0.12
6.02
0.094
Appendix
Table 19: Time costs (sec) of matrix operations and vector-wise function LayerNorm across multiple batch sizes.
Sub-operation
Batch Size 4
Batch Size 16
Batch Size 64
Forward pass
Matrix
17.10
67.79
216.90
Non-linear
4.88
9.56
28.80
(Func) Boot
73.80
295.05
1180.20
Backward pass
Matrix
41.50
164.04
524.87
Non-linear
1.02
1.91
6.02
(Func) Boot
23.20
92.45
369.60
Appendix
Table 20: Time costs (sec) in 2-layer BERT-style model across multiple batch sizes.
Batch Size 4
Batch Size 16
Batch Size 64
Mean of Absolute Noise
2.32×10−8
2.54×10−8
2.64×10−8
Max of Absolute Noise
1.45×10−6
1.60×10−6
1.68×10−6
Appendix
Table 21: Mean and max of absolute noise across different batch sizes.
Operation
[ 28 ]
Felid (Ours)
Reduction
Main Cause
Forward , Matrix
1429
67.79
21.1×
Packing + matrix algorithms
Forward , Non-linear
291
9.56
30.4×
Functional bootstrapping
Forward , (Func) Boot
708
295.05
2.4×
Reduced depth + fewer bootstrappings
Backward , Matrix
2377
164.04
14.5×
Packing + matrix algorithms
Backward , Non-linear
47
1.91
24.6×
Functional bootstrapping
Backward , (Func) Boot
355
92.45
3.8×
Reduced depth + fewer bootstrappings
Appendix
Table 22: Cumulative component-level breakdown of each operation, in batch size 16.
Number of layers
2
4
8
12
MRPC
Mean: 2.54×10−8 Max: 1.9×10−6
Mean: 3.14×10−8 Max: 2.9×10−6
Mean: 5.47×10−8 Max: 9.8×10−6
Mean: 3.03×10−7 Max: 8.6×10−5
RTE
Mean: 1.96×10−8 Max: 1.6×10−6
Mean: 2.63×10−8 Max: 1.4×10−6
Mean: 6.97×10−8 Max: 5.0×10−5
Mean: 2.63×10−7 Max: 9.3×10−5
STS-B
Mean: 5.51×10−7 Max: 5.1×10−5
Mean: 7.18×10−7 Max: 7.4×10−5
Mean: 7.48×10−7 Max: 7.5×10−5
Mean: 1.14×10−6 Max: 1.6×10−4
Appendix
Table 25: The mean and maximum of the absolute error during full training.
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 required to continue. Every nonlinearity must therefore be approximated by an iterative method; each iteration increasing the number of multiplications. A higher iteration count buys precision but exhausts the available depth more frequently and thus triggers more bootstraps, which dominate latency. 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. We further relate iteration count to quantization bit width and bound, at fixed weights, the gap between our objective and quantization-aware training. 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 encrypted baseline.
Alessandro Zirilli, Davide Marincione, Evgenios M. Kornaropoulos +2
Sapienza University of Rome · George Mason University · Paradigma
Fully homomorphic encryption (FHE) provides strong cryptographic guarantees for private inference, but deploying transformer models under FHE remains prohibitively expensive. A key bottleneck is that non-linear operations such as softmax, normalization, and activation must be replaced with polynomial approximations compatible with the CKKS scheme, and the multiplicative depth consumed by these approximations dominates inference cost. Recent frameworks have advanced approximation techniques, yet all rely on manually configured approximation hyperparameters (e.g., number of iterations, polynomial degree), applied uniformly across all layers. While convenient, this uniform-configuration approach is overly rigid: different layers can tolerate different levels of approximation error without degrading predictive accuracy, and uniform configurations cannot exploit this variability to reduce latency. Allowing each layer to adopt its own configuration, however, causes the search space to explode with model depth, reaching roughly 1084 configurations for BERT/ViT (12 layers) and 10225 for LLaMA3 (32 layers), rendering manual exploration practically impossible. We present ATLAS, an automated framework that configures per-layer approximation settings by formulating the problem as a multi-objective optimization over latency and predictive accuracy. The resulting problem is inherently difficult: 1) competing objectives over a large decision space (120 or 320 variables for BERT/ViT or LLaMA3); 2) expensive evaluation, as each configuration takes 70-1,000 seconds even in cleartext; and 3) sparse optimization signals, as 35-50% of candidate configurations yield numerically invalid solutions. ATLAS addresses these challenges through a two-stage optimization strategy that progressively relaxes layer-wise constraints, combined with surrogate models to accelerate evaluation.
Fully Homomorphic Encryption (FHE) enables privacy-preserving machine learning but incurs extreme computational and memory overhead. These costs come not only from expensive low-level primitives, including Number Theoretic Transform (NTT), rotation, and key-switching, but also from inefficient ciphertext packing at the application level. Existing packing strategies typically preserve either neighboring data elements or feature grouping, but not both, leading to wasted ciphertext slots, excessive rotations, and inflated ciphertext counts. We propose FEnc2, a unified and principled fragment-based encoding framework for CKKS-based private convolutional neural network inference. FEnc2 optimizes slot utilization, rotation complexity, and ciphertext density through two components: 1)Conv-aware Encoding, which analytically selects an optimal fragment size to decouple spatial dependencies and jointly minimize inner-outer rotations across layers, and 2)Arch-aware Ct Compression, which restores ciphertext density after feature- or channel-reduction layers. Together, these transformations reshape encrypted workload structure and reduce homomorphic operations by one to two orders of magnitude. With full memory capacity utilized, i.e., at maximum batch size, FEnc2 achieves end-to-end latency speedups over the state-of-the-art Orion of up to 228.83x on GPU and 226.06x on CPU for LeNet on MNIST, and up to 4.55x on GPU and 9.43x on CPU for MobileNet on ImageNet. FEnc2 is hardware-agnostic yet architecturally transformative: by optimizing encrypted tensor layout before execution, it reduces ciphertext count and workload pressure on hardware, complementing primitive-level optimizations such as NTT and keyswitch accelerators. These results show that application-level data layout is a first-order architectural design dimension for encrypted inference and an important enabler for next-generation FHE systems.
Ran Ran, Zhaoting Gong, Nuo Xu +3
North Carolina State University · University of Minnesota · University of California, Santa Cruz +1