This is the implementation of zkGPT, which is a SNARK for LLM inference. This project partially references code from the work of zkCNN and Lasso. Current implementation only supports GPT-2.
- C++14
- cmake >= 3.10
- GMP library
To ensure smooth execution, we recommend using a server with the following specifications:
- Operating System (OS): Linux (e.g., Ubuntu 18.04 or later)
- Processor (CPU): Multi-core CPU, preferably with 16 cores or more
- Memory (RAM): at least 200GB
To run the code, make sure you clone with
git clone --recurse-submodules [email protected]:security-Anonymous/zkGPT.gitsince the mcl library is included as a submodule.
sudo apt install libgmp-dev
The script to run LLM inference proving.
./llm.shThe circuit initiation phase may take minutes because brute-forcely computing plaintext matrix multiplication using CPU single thread. We will optimize this part in future. Note this part will not become bottleneck in real world, due to it can be computed extremely efficiently on GPU.