This repository contains the implementation of the paper HE-SecureNet: Private, Efficient and Usable Homomorphic Encryption-based Model Training by Thomas Schneider, Huan-Chih Wang, and Hossein Yalame.
The paper was accepted at the Workshop on Privacy in the Electronic Society (WPES), held in conjunction with ACM CCS 2025, and is available here.
- cmake - CMake helper files.
- dataset - Breast Cancer and MNIST datasets.
- examples - Private C++ training codes.
- model_a: Logistic Regression on the Breast Cancer Dataset
- model_b: MLP on the MNIST Dataset
- model_c: CNN on the MNIST Dataset
- model_d: LeNet-5 on the MNIST Dataset
- licenses - Licensing information of the utilized libraries.
- onnx - ONNX graph files.
- parser - Our private training code generator.
- pegasus - The Pegasus backend
- python - Python scripts to generate corresponding ONNX model graph file.
- thirdparty - The thirdparty libraries for Pegasus.
- C++ compiler that supports at least C++14 standard
- Cmake >= 3.10
- GMP
- OpenMP
- MNIST Reader
- Python Packages
- numpy 1.26.4
- onnx 1.16.2
- onnxruntime 1.18.0
- scipy 1.14.1
- tensosflow 2.19.0
- tf2onnx 1.16.1
After cloning or downloading this repository, there are two ways to build HE-SecureNet.
cd HE-SecureNet
# Install Python packages
pip3 install -r requirements.txt
# Download the MNIST dataset
cd dataset
git clone https://github.com/wichtounet/mnist.git
cd ../
# Build HE-SecureNet
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DSEAL_THROW_ON_TRANSPARENT_CIPHERTEXT=OFF
make -j8
In the HE-SecureNet directory, run docker build -t he-securenet . to build the docker image.
The following steps demonstrate how to use HE-SecureNet, including:
- Generating the ONNX file using TensorFlow
- Creating the private C++ training code with HE-SecureNet’s ONNX parser
- Executing private model training
We provide an example of training the MLP model, which denoted as "model_b" in this repo.
- Navigate to
pythonfolder and runpython3 model_b.pyto generate the ONNX graph file. - The ONNX file is created in the
onnxfolder.
- Navigate to
parserfolder and runpython3 parser.py model_bto get the C++ training code. - The private training code is stored in the
examplesfolder.
- Navigate to
buildfolder and runmake -j8to generate executable binary file. - Run
./model_b_exeto start training the model in the ciphertext domain.
@inproceedings{HESecureNET,
title={{HE-SecureNet: An Efficient and Usable Framework for Model Training via Homomorphic Encryption}},
author={ Schneider, Thomas and Wang, Huan-Chih, and Yalame, Hossein},
booktitle={WPES},
year={2025}
}