Skip to content
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

Performance Optimizations #26

Merged
merged 9 commits into from
Jun 5, 2023
Merged

Performance Optimizations #26

merged 9 commits into from
Jun 5, 2023

Conversation

georgwiese
Copy link
Member

@georgwiese georgwiese commented Jun 5, 2023

This PR gets rid of 2 table lookups and 1 gate in the GreaterThanChip by range-checking using the existing gadget, as suggested in #14.

This increases the required value for k from 12 to 14 for the MNIST-Tiny model, but has no effect on the "real-world" models. For those models, proofs are ~13% faster and the size of the verifier is now small enough to fit into an Ethereum smart contract! 🥳

I also tested switching to the V1 floor planner. Unfortunatey, it has a ~30% proving-time overhead and only reduces k for the MNIST-Tiny model (to 13). So, I undid this change (but keeping the proper implementation of Circuit::without_witness() needed for the V1 floor planner). Once zcash/halo2#547 is resolved, proof-time synthesis of should not be necessary anymore and we can move to the V1 planner.

The benchmarks show an increase of proving time for MINST-Tiny (because of the higher value of k) and a decrease in proving time otherwise:

benches/key_generation_mnist_tiny
                        time:   [2.3072 s 2.3643 s 2.4244 s]
                        change: [+150.63% +159.31% +168.44%] (p = 0.00 < 0.05)
                        Performance has regressed.
benches/proof_generation_mnist_tiny
                        time:   [3.6469 s 3.6879 s 3.7302 s]
                        change: [+126.81% +134.23% +142.59%] (p = 0.00 < 0.05)
                        Performance has regressed.
benches/verification_mnist_tiny
                        time:   [13.714 ms 14.260 ms 14.699 ms]
                        change: [-2.8173% +3.7090% +11.500%] (p = 0.34 > 0.05)
                        No change in performance detected.
benches/proof_generation_mnist_small
                        time:   [6.7773 s 6.8724 s 6.9471 s]
                        change: [-15.671% -13.926% -12.071%] (p = 0.00 < 0.05)
                        Performance has improved.
benches/verification_mnist_small
                        time:   [13.835 ms 14.369 ms 15.008 ms]
                        change: [-9.8799% -3.8734% +2.3501%] (p = 0.27 > 0.05)
                        No change in performance detected.
benches/proof_generation_mnist_medium
                        time:   [6.9457 s 7.0208 s 7.0903 s]
                        change: [-15.176% -13.268% -11.329%] (p = 0.00 < 0.05)
                        Performance has improved.
benches/verification_mnist_medium
                        time:   [13.778 ms 14.315 ms 15.028 ms]
                        change: [-8.8268% -4.0115% +1.3125%] (p = 0.17 > 0.05)
                        No change in performance detected.

@georgwiese georgwiese marked this pull request as ready for review June 5, 2023 12:42
@georgwiese georgwiese merged commit c6c43d9 into main Jun 5, 2023
@georgwiese georgwiese deleted the performance4 branch June 5, 2023 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant