Inference with encrypted model

Hi, I wonder if it is possible to do inference where both model and input are encrypted (with same keys). For me it is not clear whether the encrypted inference of the linear models (e.g. logistic regression) also encrypts model or not by default.

Hello Seewoo5,

Currently, Concrete-ML focuses only on the inference phase with FHE.

Multiplication between two encrypted numbers is not yet supported in Concrete-ML, that’s why inputs are encrypted and model’s weights are not.

For the inference phase with FHE:

  • The model is trained on clear data (i.e., unencrypted, in floating point data). Then, the trained model is quantized, because FHE operates only over integers.
    CML supports almost all linear models, so you just need to import your counterpart model from concrete.ml.sklearn and set the n_bits parameter, which must be less than 8-bits ;
  • The quantized model is compiled, to see if it is FHE-compatible and determine the cryptographic parameters needed for key generation ;
  • Once the model is compiled into an FHE equivalent, you can perform inference in FHE.

We highly recommend you to see our advanced examples available at this link concrete-ml/docs/advanced_examples at main · zama-ai/concrete-ml · GitHub to better understand our development flow.

3 Likes

Thank you for the clarification!

2 Likes