zkonduit / ezkl

ezkl is an engine for doing inference for deep learning models and other computational graphs in a zk-snark (ZKML). Use it from Python, Javascript, or the command line.
https://docs.ezkl.xyz/
934 stars 133 forks source link

Unsuccessful proof generation for the nanoGPT example #617

Closed weikengchen closed 11 months ago

weikengchen commented 11 months ago

I am testing EZKL with the example of nanoGPT: https://github.com/zkonduit/ezkl/tree/main/examples/onnx/nanoGPT

ezkl table -M network.onnx 
ezkl gen-settings -M network.onnx
ezkl calibrate-settings -M network.onnx -D input.json --target resources
ezkl get-srs -S settings.json
ezkl compile-circuit -M network.onnx -S settings.json --compiled-circuit network.ezkl
ezkl setup -M network.ezkl --srs-path=kzg.srs --vk-path=vk.key --pk-path=pk.key
ezkl gen-witness -D input.json -M network.ezkl
ezkl prove -M network.ezkl --witness witness.json --pk-path=pk.key --proof-path=model.proof --srs-path=kzg.srs

The proof generation is unsuccessful.

Describe the bug

The full transcript of the proof generation is as follows. The error is "value is OOR of lookup".

[*] [0s, ezkl] - 
 |  
 |          ███████╗███████╗██╗  ██╗██╗
 |          ██╔════╝╚══███╔╝██║ ██╔╝██║
 |          █████╗    ███╔╝ █████╔╝ ██║
 |          ██╔══╝   ███╔╝  ██╔═██╗ ██║
 |          ███████╗███████╗██║  ██╗███████╗
 |          ╚══════╝╚══════╝╚═╝  ╚═╝╚══════╝
 |  
 |          -----------------------------------------------------------
 |          Easy Zero Knowledge Linear Algebra.
 |          -----------------------------------------------------------
 |  
 |          
[*] [0s, ezkl] - command: 
 |   {
 |    "command": {
 |      "Prove": {
 |        "check_mode": "SAFE",
 |        "compiled_circuit": "network.ezkl",
 |        "pk_path": "pk.key",
 |        "proof_path": "model.proof",
 |        "proof_type": "Single",
 |        "srs_path": "kzg.srs",
 |        "witness": "witness.json"
 |      }
 |    }
 |  }
[*] [0s, ezkl::pfsys::srs] - loading srs from "kzg.srs"
[*] [2s, ezkl::execute] - downsizing params to 24 logrows
[*] [2s, ezkl::pfsys] - loading proving key from "pk.key"
[*] [2s, ezkl::graph::vars] - number of blinding factors: 5
[*] [2s, ezkl::graph::model] - configuring model
[*] [2s, ezkl::graph] - circuit size: 
 |   {
 |    "num_advice_columns": 6,
 |    "num_challenges": 0,
 |    "num_fixed": 13,
 |    "num_instances": 1,
 |    "num_selectors": 42
 |  }
[*] [207s, ezkl::pfsys] - proof started...
[*] [207s, ezkl::graph::vars] - number of blinding factors: 5
[*] [207s, ezkl::graph::model] - configuring model
[*] [207s, ezkl::graph] - circuit size: 
 |   {
 |    "num_advice_columns": 6,
 |    "num_challenges": 0,
 |    "num_fixed": 13,
 |    "num_instances": 1,
 |    "num_selectors": 42
 |  }
[W] [214s, ezkl::circuit::modules::planner] - spawning module 2
[*] [214s, ezkl::graph::model] - model layout...
[*] [427s, ezkl::graph::model] - model uses 8796449 rows (coord=17592898, constants=69)
[E] [449s, halo2_proofs::plonk::mv_lookup::prover] - value is OOR of lookup
[E] [454s, ezkl] - failed: General synthesis error
Error: Synthesis

Expected behaviors

I expect the proof generation to go through.

Steps to reproduce the bug

See above for the command-line code.

Device and Operating System

OS: Ubuntu Version: 22.04 Processor: Intel Memory: 500GB

This is a cloud instance.

Additional Information

alexander-camuto commented 11 months ago

Hello @weikengchen thanks for surfacing this -- can you quickly confirm if this is built from latest commit / what commit this is occurring for ?

alexander-camuto commented 11 months ago

Was able to reproduce on latest commit. Have a patch inbound -- thank you again for flagging :)