-
Notifications
You must be signed in to change notification settings - Fork 513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define a stable serialization format for halo2::plonk::ProvingKey
#443
Comments
Because Halo 2 doesn't have a trusted setup (and the generators are computed by deterministically hashing to the curve), the only thing necessary to reproduce the proving key is the code of the circuit. Since that's necessary for proving anyway, I don't think there's an advantage to reading and writing proving keys from/to disk. The same argument would not apply to verification: you can verify a proof with just the verifying key, without needing the code for the circuit. |
That's not quite true: the verification key depends on the circuit configuration (which defines e.g. the number of columns). Note that the We could in theory rework the |
I think this only considers the scenario a prover keeps running. If we save the generated proving key, when we restart a prover, we can reuse the proving key to prove for different witnesses. |
In proving systems like Groth16, it was necessary to read the proving key from disk because there was information stored within it that we couldn't derive on-the-fly. For Halo 2, reading the proving key from disk would solely be a potential performance optimisation, if it takes less time to read the proving key from disk than to re-compute it. I recently added key generation benchmarks to
So for circuits even a few sizes bigger than the Orchard circuit (which uses @HAOYUatHZ do you have specific performance numbers for computing proving keys for your circuit sizes / compositions, vs parsing them? |
We are working on https://github.com/appliedzkp/zkevm-circuits. But this is not urgent anyway. In fact, we are facing another problem: |
@daira pointed out that:
is the exact use case for a CI workflow of a very large circuit. So we will likely need to figure out some serialization workflow, but it probably won't need to be used much in production I suspect. |
IHMO k=20 corresponds to 5 min (according to the numbers you listed above), which is still a considerable time. |
Yes, but this time will be reduced by improved compute (and e.g. GPU support), which applications using these large circuits will favour anyway for proving. So if the application is going to be running for at least several weeks to a month, then a few minutes delay at startup (where the application is doing the equivalent work of creating a few proofs) is likely a fine trade-off. |
I see. |
Sorry, I didn't mean to imply this issue should be closed. We still will need to address this for at a minimum CI purposes, and whatever solution is arrived at for that should also be made to work for production. |
great to know! thanks! |
I'm getting these benchmarks:
When program loads a large number of circuits, this will cause significant slowdown if we cannot save the proving key. |
read
& write
for halo2::plonk::ProvingKey
halo2::plonk::ProvingKey
|
On an old laptop, just for the ProvingKey, I'm getting this speed (k = 11):
|
Any progress on this? There scenarios where you would like to send the prover key to another process. So I do have need on this feature. |
We only have for
read
&write
forhalo2::plonk::VerifyingKey
but not forhalo2::plonk::ProvingKey
.Doesn't it make sense to store it to and restore it from a file?
The text was updated successfully, but these errors were encountered: