TL;DR
HETAL is a practical, privacy-preserving transfer learning framework that allows clients to outsource model fine-tuning to a server without ever revealing their raw data or extracted features. By introducing highly optimized homomorphic encryption (HE) techniques for matrix multiplication and softmax approximation, HETAL achieves encrypted training times of under an hour on standard benchmarks with virtually zero loss in model accuracy.
The Privacy Problem in Machine Learning as a Service
In the Machine Learning as a Service (MLaaS) paradigm, transfer learning is incredibly popular. A client typically uses a massive pre-trained model to extract features from their small, domain-specific dataset, and a server then fine-tunes a final classification layer on those features.
However, sending these extracted features to a server poses a massive privacy risk. Recent research shows that "feature inversion attacks" can easily reconstruct sensitive raw data—such as faces or private text—directly from embeddings.
While Homomorphic Encryption (HE), which allows computations directly on encrypted data, seems like the perfect fix, it is notoriously slow and memory-intensive. Previous HE-based solutions mostly focused on encrypted inference rather than training, forced the client to do the heavy lifting, or were limited to tiny datasets because the encrypted matrix multiplications and activation functions (like softmax) blew up the computational budget.
The HETAL Approach
HETAL strictly performs the training (fine-tuning) on the server side using the CKKS homomorphic encryption scheme, which supports arithmetic on encrypted real numbers. To make this computationally practical, the authors introduce three major innovations:
1. Wide-Range Softmax Approximation
Softmax is notoriously hard to compute in HE because it requires exponentials and division. Previous polynomial approximations only worked on narrow input ranges (e.g., $[-8, 8]$). The authors propose a new approximation using Domain Extension Polynomials (DEPs) and homomorphic normalization (subtracting the maximum value) to accurately approximate softmax over a massive $[-128, 128]$ range.
2. Optimized Encrypted Matrix Multiplication
Training requires computing gradients via matrix multiplications ($AB^\top$ and $A^\top B$). The authors developed two new algorithms, DiagABT and DiagATB. By using clever data packing (tiling), off-diagonal masking, and "complexification" (packing data into the real and imaginary parts of complex numbers), they drastically reduced the number of HE rotation operations, which are actually the hidden bottleneck in HE math.
3. Encrypted Early Stopping
HETAL introduces a secure validation-based early stopping mechanism. The server computes encrypted logits for a validation set and sends them to the client. The client decrypts them, calculates the loss, and tells the server whether to stop training, preventing overfitting without leaking the training data.
Key Insights
- Softmax inputs drift wildly during training: The authors discovered that as Nesterov's accelerated gradient (NAG) training progresses, the input values to the softmax function naturally grow from near zero to over 100. This explains why previous HE softmax approximations failed during training—they simply couldn't handle the expanding domain.
- Rotations are the real enemy in HE: While multiplying encrypted numbers is slow, rotating the slots within a ciphertext is often the true performance killer in HE matrix operations. By optimizing their algorithms to minimize rotations, they unlocked massive speedups.
- Early stopping is viable in HE: By keeping the client in the loop just enough to evaluate validation loss on decrypted logits, HETAL avoids the need to pre-guess the optimal number of training epochs, saving immense amounts of wasted encrypted compute time.
Experimental Results
The authors evaluated HETAL on five well-known benchmark datasets spanning vision and NLP: MNIST, CIFAR-10, Face Mask Detection, DermaMNIST, and SNIPS. They used standard pre-trained models as feature extractors: ViT (Vision Transformer, Base and Large) for images and MPNet for text.
- Speed: Total encrypted training times ranged from 567 to 3442 seconds (under an hour) across all five datasets.
- Accuracy: The encrypted models achieved almost the exact same accuracy as standard, unencrypted training. The maximum accuracy drop observed was a negligible 0.51%.
- Matrix Math Speedup: The proposed
DiagABTandDiagATBmatrix multiplication algorithms were 1.8x to 323x faster than prior state-of-the-art HE matrix multiplication methods, reducing the operation from taking up to 90% of the compute time to a manageable fraction. - Softmax Precision: The new softmax approximation maintained a maximum error of just 0.0037–0.0224 across the $[-128, 128]$ domain, vastly outperforming previous methods that failed entirely on large inputs.
Limitations and Future Work
While highly practical, encrypted training is still fundamentally slower than plaintext training (e.g., ~57 minutes vs. ~3 minutes for MNIST). Furthermore, the protocol assumes the client software (which extracts and encrypts features) is trustworthy. If a malicious server provides backdoored client software, privacy is compromised. The authors suggest making the client software open-source for public verification.
Looking forward, the authors suggest applying HETAL to other sensitive domains, such as speech classification. Additionally, the highly optimized matrix multiplication and wide-range softmax approximation algorithms can be repurposed to speed up encrypted inference for deep neural networks that rely heavily on softmax activations.
Summary updated