The Intel® HE transformer for nGraph™ is a Homomorphic Encryption (HE) backend to the Intel® nGraph Compiler, Intel's graph compiler for Artificial Neural Networks.
Homomorphic encryption is a form of encryption that allows computation on encrypted data, and is an attractive remedy to increasing concerns about data privacy in the field of machine learning. For more information, see our paper.
This project is meant as a proof-of-concept to demonstrate the feasibility of HE on local machines. The goal is to measure performance of various HE schemes for deep learning. This is not intended to be a production-ready product, but rather a research tool.
Currently, we support the CKKS encryption scheme, implemented by the Simple Encrypted Arithmetic Library (SEAL) from Microsoft Research.
Additionally, we integrate with the Intel® nGraph™ Compiler and runtime engine for TensorFlow to allow users to run inference on trained neural networks through Tensorflow.
The examples folder contains a deep learning example which depends on the Intel® nGraph™ Compiler and runtime engine for TensorFlow.
- Operating system: Ubuntu 16.04, Ubuntu 18.04.
- CMake >= 3.10
- Compiler: g++ version >= 6.0, clang >= 5.0
- OpenMP is strongly suggested, though not strictly necessary. You may experience slow runtimes without OpenMP
- python3 and pip3
- virtualenv v16.1.0
- bazel v0.25.2
- nGraph - v0.23.0-rc.6
- nGraph-tf - v0.16.0-rc3
- SEAL - v3.3.1
- TensorFlow - v1.14.0
- Boost 1.69
wget https://github.com/bazelbuild/bazel/releases/download/0.25.2/bazel-0.25.2-installer-linux-x86_64.sh
bash bazel-0.25.2-installer-linux-x86_64.sh --user
Add and source the bin path to your ~/.bashrc
file to call bazel
export PATH=$PATH:~/bin
source ~/.bashrc
Before building, make sure you deactivate any active virtual environments (i.e. run deactivate
)
git clone https://github.com/NervanaSystems/he-transformer.git
cd he-transformer
export HE_TRANSFORMER=$(pwd)
mkdir build
cd $HE_TRANSFORMER/build
cmake .. -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7
make install
source external/venv-tf-py3/bin/activate
To build an experimental client-server model with python bindings, see the python folder. Note: This feature is experimental. For best experience, you should skip this step.
Ensure the virtual environment is active, i.e. run source $HE_TRANSFORMER/build/external/venv-tf-py3/bin/activate
cd $HE_TRANSFORMER/build
# To run single HE_SEAL unit-test
./test/unit-test --gtest_filter="HE_SEAL.add_2_3"
# To run all C++ unit-tests
./test/unit-test
Ensure the virtual environment is active, i.e. run source $HE_TRANSFORMER/build/external/venv-tf-py3/bin/activate
cd $HE_TRANSFORMER/examples
# Run with CPU
python ax.py
# To run CKKS unit-test
NGRAPH_TF_BACKEND=HE_SEAL python ax.py
For a deep learning example, see examples/MNIST/Cryptonets/.
Please run maint/apply-code-format.sh
before submitting a pull request.