An Integer-only, Lightweight Privacy-preserving Machine Learning Framework with Hybrid Homomorphic Encryption (HHE). Built with SEAL, PASTA and PocketNN.
Source code for GuardML: Efficient Privacy-Preserving Machine Learning Services Through Hybrid Homomorphic Encryption (SAC '24) and A Pervasive, Efficient and Private Future: Realizing Privacy-Preserving Machine Learning Through Hybrid Homomorphic Encryption (DASC 2024)
The image datasets used in this project are copied from their original website and are stored in data/
- MNIST dataset: MNIST dataset is from the MNIST website
- Fashion-MNIST dataset: Fashion-MNIST dataset is from its github repository.
We use the processed ECG dataset from this work which is originally the MIT-BIH 1.0 from Physionet.
├── configs # hold the configuration parameters needed to run experiments
├── data # hold the datasets
├── images # hold the images in `README.md`
├── libs # hold the libraries needed
├── notebooks # hold the notebooks to train float neural nets on plaintext data
├── src # hold the source code
└── main.cpp # comment out the functions in `main` to run different protocols / experiments
├── tests # hold some unit tests
└── weights # hold the trained weights and biases
cpp==11.3.0
CMAKE>=3.25.1
SEAL==4.0.0
The PASTA library for HHE is built upon Microsoft's SEAL library. In this repo, SEAL is already installed in libs/seal
. If you want to install it somewhere else, please refer to the SEAL's repo.
Before compiling the application, you can take a look at src/config.cpp
and change the configurations to your own settings. Notes:
- The
debugging
variable should be set tofalse
if you are not debugging the application and totrue
if you want to debug (I used VSCode to debug so it might cause problems if you are not using VSCode). - When
dry_run
istrue
, we only run a few data examples set bydry_run_num_samples
. Otherwise it runs the whole dataset. save_weight_path
andsave_bias_path
defines the paths that the trained weights and bias will be saved. It also defines the paths that the trained weights and bias will be loaded from in the inference protocols.
To compile and run, run bash start.sh
, which essentially does the following:
- Run
cmake -S . -B build -DCMAKE_PREFIX_PATH=libs/seal
. Here,-DCMAKE_PREFIX_PATH
specifies the path to the installed SEAL library. - Then build with
cmake --build build
- Run the compiled binary, for example
./build/PocketHHE