git clone --recurse-submodules https://github.com/vio1etus/zkCNN_complete.git
sudo apt-get update
sudo apt-get install libgmp3-dev cmake gcc g++
This is the implementation of this paper, which is a GKR-based zero-knowledge proof for CNN reference, containing some common CNN models such as LeNet5, vgg11 and vgg16.
- C++14
- cmake >= 3.10
- GMP library
The input has two part which are data and weight in the matrix.
This part is the picture data, a vector reshaped from its original matrix by
where is the number of channel, is the height, is the width.
This part is the set of parameters in the neural network, which contains
-
where and are the number of output and input channels, is the sideness of the kernel (here we only support square kernel).
To run the code, make sure you clone with
git clone --recurse-submodules [email protected]:TAMUCrypto/zkCNN.git
since the polynomial commitment is included as a submodule.
The script to run LeNet5 model (please run the script in script/
directory).
./demo_lenet.sh
- The input data is in
data/lenet5.mnist.relu.max/
. - The experiment evaluation is
output/single/demo-result-lenet5.txt
. - The inference result is
output/single/lenet5.mnist.relu.max-1-infer.csv
.
The script to run vgg11 model (please run the script in script/
directory).
./demo_vgg.sh
- The input data is in
data/vgg11/
. - The experiment evaluation is
output/single/demo-result.txt
. - The inference result is
output/single/vgg11.cifar.relu-1-infer.csv
.
Here we implement a hyrax polynomial commitment based on BLS12-381 elliptic curve. It is a submodule and someone who is interested can refer to this repo hyrax-bls12-381.
-
zkCNN: Zero knowledge proofs for convolutional neural network predictions and accuracy. Liu, T., Xie, X., & Zhang, Y. (CCS 2021).
-
Doubly-efficient zksnarks without trusted setup. Wahby, R. S., Tzialla, I., Shelat, A., Thaler, J., & Walfish, M. (S&P 2018)