- Install OpenFHE-development
- Install OpenFHE-python
- the code shown below is highly unoptimized and is meant to be used for educational purposes.
There are a total of four exercises:
-
Implementing encrypted inference using the code in
exe_encrypted_inference.py
. Here, you will load in weights from a pre-trained model (generated from efficient_regression/logreg_reference.ipynb), repeat the weight vector, do the dot-product, and decrypt. Seesol_encrypted_inference.py
for an example solution. -
implementing a naive linear regression using the starter code in the naive_regression folder. Work off of
exe_lin_reg.py
in this top-level folder and seesol_lin_reg.py
for one possible solution. -
Implementing an optimized logistic regression using the starter code in the efficient_regression folder. Work off of the
exe_log_reg.py
in this top-level folder and seesol_log_reg.py
for a possible implementation. You may find it useful to reference the plaintext implementation inlogreg_reference.ipynb
which shows how it is implemented in raw numpy. -
Implementing an optimized Nesterov-accelerated gradient logistic regression in the efficient_regression folder. Work off of the
exe_nag_log_reg.py
and seesol_nag_log_reg.py
for a possible implementation. You may find it useful to reference the plaintext implementation inlogreg_reference.ipynb
which shows how it is implemented in raw numpy.
Some tips for working with FHE problems:
- start with a small-ish ring dimension
- turn off the security setting (via
HEStd_NotSet
) - create a reference numpy implementation
- Try to do as much as possible in plaintext-space before finally working with ciphertexts
- ciphertext refreshing speeds up iteration, so start with that for prototyping then move to bootstrapping