Practical and Private Hybrid ML Inference with Fully Homomorphic Encryption
Organizations: EPFL · Inria · IRMAR · Université de Rennes ·
Abstract
In contemporary cloud-based services, protecting users' sensitive data and ensuring the confidentiality of the server's model are critical. Fully homomorphic encryption (FHE) enables inference directly on encrypted inputs, but its practicality is hindered by expensive bootstrapping and inefficient approximations of non-linear activations. We introduce Safhire, a hybrid inference framework that executes linear layers under encryption on the server while offloading non- linearities to the client in plaintext. This design eliminates bootstrapping, supports exact activations, and significantly reduces computation cost. To safeguard model confidentiality despite client access to intermediate outputs, Safhire applies randomized shuffling, which obfuscates intermediate values and makes it practically impossible for a client to reconstruct the model. To further reduce inference latency, Safhire incorporates advanced optimizations such as fast ciphertext packing and partial extraction. Evaluations on multiple standard models and datasets show that Safhire achieves up to 7.6x and 7.4x lower inference latency than Orion and Concrete-ML, respectively, which are two state-of-the-art FHE baselines, with manageable communication overhead and comparable accuracy. These results underline the practicality of our hybrid FHE inference scheme.
Figures & tables
| Primitive | Why Safhire needs it | Where it is used in Safhire ’s workflow ( Figure 3 ) |
| LWE ( LWE ) and RLWE encryption ( Section 2.1 ) | Hides the client’s data from the server. An RLWE ciphertext carries up to values, which keeps communication low. Since the client decrypts after every layer, the noise is reset without bootstrapping. | Key generation; encryption, steps 2-4; decryption, step 12. |
| Homomorphic linear operations ( Section 2.1 ) | Let the server evaluate linear layers on ciphertexts, provided that the weights are integers, hence the quantized model. | Partial extraction, step 6, and linear layer, step 8. |
| Automorphisms and key switching ( Section 2.2 ) | Needed to evaluate traces homomorphically: an automorphism changes the key under which a ciphertext decrypts, and key switching restores it. | Keys generated at setup; fast packing, step 10; avoided in step 6 thanks to the powers computed by the client in step 3. |
| Trace ( Section 2.3 ) | Isolates one coefficient of an encrypted polynomial. Computed level by level along a tower of subfields, which reduces its cost. | Power computation, step 3; partial trace extraction, step 6; fast packing, step 10. |
| Packing ( Section 2.4 ) | Gathers the outputs of a layer, each carried by its own ciphertext, into a few RLWE ciphertexts before they are returned. | Fast packing, step 10, and transfer, step 11. |
| Key size | Trace extraction level ( ) | ||
| (Base) | |||
| 2.50 | 1.50 | 0.50 | |
| 3.25 | 1.25 | 0.25 | |
| 4.16 | 1.16 | 0.16 | |
| Approach | FHE scheme | Linear layers | Non-linear layers | Bootstrapping required | Client-server rounds | Offline phase | What the client learns | Client threat model |
| Full encryption | CKKS / BFV | Plaintext–ciphertext products with slot rotations | Polynomial approximations, server-side | Yes | 1 | No | Final output only | Malicious a |
| Full encryption (TFHE) | TFHE | Scalar MACs with plaintext weights | Exact, via programmable bootstrapping (lookup tables) | Yes | 1 | No | Final output only | Malicious a |
| HE + 2PC | HE + authenticated secret sharing | HE on authenticated shares | Garbled circuits with consistency checks | No | Yes | Final output only | Malicious a | |
| Client-aided FHE | CKKS / TFHE | Server-side under FHE | Client-side, in plaintext, exact | No | No | Intermediate pre-activations in the clear b | Not addressed b | |
| Safhire (ours) | RLWE | Scalar MACs with plaintext weights | Client-side, in plaintext, exact | No | No c | Shuffled pre-activations (see Section 5 ) | Malicious (crafted inputs) |
| Precision ( ) | Key size | RLWE Noise ( ) | ||||
| 8 bits | 512 | 3 | 512 | 3 | ||
| 12 bits | 3 | 2 | ||||
| 16 bits | 310 | 5 | 310 | 4 | ||
| Precision ( ) | ||||||||
| Model | Orion | Extraction level ( ) | 8 bit | 12 bit | 16 bit | |||
| Safhire | Speedup | Safhire | Speedup | Safhire | Speedup | |||
| ResNet-20 (CIFAR-10) | 866.5 s | 0 | 175.2 s | 4.9 | 277.1 s | 3.1 | 425.7 s | 2.0 |
| 1 | 135.6 s | 6.4 | 131.3 s | 6.6 | 247.4 s | 3.5 | ||
| 2 | 114.0 s | 7.6 | 252.8 s | 3.4 | 189.1 s | 4.6 | ||
| Dataset | Model | Concrete-ML | Orion (SiLU) | Safhire | |
| 16 bit | 12 bit | ||||
| CIFAR-10 | ResNet-20 | 91.46% | 91.70% | 90.00% | 89.63% |
| Tiny | ResNet-18 | 52.37% | 57.00% | 53.19% | 53.16% |
| ImageNet | ResNet-34 | 64.06% | N/A | 70.16% | 49.47% |
| Extraction level ( ) | |||||
| 0 | 1 | 2 | |||
| Client | 0.3 s | 0.4 s | 0.8 s | ||
| 8 bits | Server | 591.4 s | 465.6 s | 356.5 s | |
| Client | 0.3 s | 1.2 s | 5.7 s | ||
| 12 bits | Server | 888.8 s | 415.2 s | 371.6 s | |
| Client | 0.3 s | 1.8 s | 3.8 s | ||
| Precision ( ) | ||||||||||||
| Model | Concrete-ML | Extraction level ( ) | 8 bit | 12 bit | 16 bit | |||||||
| Time (s) | Data (GB) | Safhire (s) | Data (MB) | Speedup | Safhire (s) | Data (MB) | Speedup | Safhire (s) | Data (MB) | Speedup | ||
| ResNet-20 (CIFAR-10) | 86.8 | 1.8 | 0 | 60.9 | 18.0 | 1.4 | 109.7 | 27.2 | 0.8 | 147.4 | 22.7 | 0.6 |
| 1 | 35.6 | 22.7 | 2.4 | 22.2 | 44.6 | 3.9 | 36.9 | 35.3 | 2.4 | |||
| 2 | 19.7 | 41.7 | 4.4 | 16.0 | 169.9 | 5.4 | 20.5 | 102.5 | 4.2 | |||
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
| Param. | Description |
| A cleartext message | |
| LWE encryption of with key s | |
| RLWE encryption of polynomial with key s(X) | |
| Cyclotomic polynomial index; size of RLWE key | |
| s.t. is Euler’s totient function | |
| Exponent in |
Privacy-Preserving ML
Privacy-preserving machine learning develops methods to learn, share, and run models while limiting exposure of sensitive data.
See all 432 papers