This repository implements 4 FHE powereed Secure Inference frameworks on two neural networks on MNIST and CIFAR-10
- Install the concrete-ml python library
- install torch=2.3.1 and torchvision 0.18.1
- First train the desired model/dataset by set the variabele training=True in the file _.py and run it, note that training on AlexNet will takes around 30 mins on ncc.
- Run the desired model by setting training to false and running the same file.
- install the pyhelayers python library
- install requirements.txt
- Train the desired network/dataset/activation this is usually generate_.py in the respective folder.
- Run the desired network/dataset/activation this is usually encrypted_.py in the respective folder.
The REDsec code is incomplete due to unfortunate code deletion. Some results (3-FCNN) can still be run using the following steps:
- Install TFHE v1.1 with the packaged SPQLIOS-FMA FFT engine.
- Install REDCUFHE
- Run the slurm script run.sh, be sure to change the network to one present in nets file
- Install OpenFHE V1.0.4, the version number is very important.
- Train the model you want by running Model.py
- Using the generate weights jupyter notebook enocde the weights of your chosen model, the AlexNetSmallfc is currently encoded.
- Using the findingDeltas.py file find the ranges of values preceding relu activations in the chosen model, AlexNetSmallfc is currently encoded.
- Select the appropriate main.cpp file for your mode.
- replace the scale parameter in the convolution, fc and relu layers with the respective deltas found in finding deltas step.
- run run.sh to perform secure inference.