Repository navigation
faster table sumcheck - #652
Merged
Merged
Conversation
Each table's constraint is a quadratic polynomial in its columns, for example P = 3a + 5b + a*c + a*d. Each round, the sumcheck folds the table (halves its rows, mixing pairs with the round's challenge) and evaluates P on the folded rows. It used to fold every column (a, b, c, d, ...) and evaluate P row by row. Now P is first rewritten with the products grouped by a shared column: P = L + a*R, with L = 3a + 5b and R = c + d. Folding is linear, so folding L gives the same result as folding a and b and then combining them. The sumcheck therefore folds just the three columns L, a and R, built once from the original columns when the table joins. On real tables that is a handful of columns instead of dozens, so each round reads and writes far less memory. At the end, each original column is evaluated once to give its claim. The proof is unchanged, byte for byte. This removes the old base-field path (ColVal, eval_constraint_k, RowForm) and the primitives only it used. Adapted from gattaca-com/leanVM's keccak-opt branch, without their bus rewrite, which was slower on the M4. Proving time and peak memory vs main (aggregate --xmss 900 / recursion --n 2 --xmss-per-leaf 900): M4 Max -1.6% / -4.0% 6.31 -> 5.78 GiB Zen 4 -6.2% / -5.1% 5.00 -> 4.51 GiB Zen 5 -4.8% / -3.2% 5.07 -> 4.60 GiB Zen 4, AVX2 -2.6% / -2.8% 4.92 -> 4.51 GiB Co-Authored-By: alexX512 <alexey@gattaca.com> Co-Authored-By: vladimir-ea <85992906+vladimir-ea@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Faster table sumcheck
Each table's constraint is a quadratic polynomial in its columns, for example
P = 3a + 5b + a·c + a·d. Each round, the sumcheck folds the table (halves its rows, mixing pairs with the round's challenge) and evaluatesPon the folded rows. It used to fold every column and evaluateProw by row.Now
Pis first rewritten with its products grouped by a shared column:P = L + a·R, withL = 3a + 5bandR = c + d. Folding is linear, so foldingLgives the same result as foldingaandband then combining them. The sumcheck therefore folds justL,aandR, built once from the original columns when the table joins. On real tables that's a handful of columns instead of dozens, so each round moves far less memory. At the end, each original column is evaluated once to give its claim.The proof is unchanged, byte for byte. Only the prover changes, and the three verifiers are untouched.
Also in this PR
ColVal,eval_constraint_k,RowForm) and the primitives only it used.Table::constraint) instead of a closure.Adapted from gattaca-com/leanVM's
keccak-optbranch, without their bus rewrite (for now).Benchmarks
Proving time and peak memory against main, paired A/B. Aggregate is
--xmss 900, recursion is--n 2 --xmss-per-leaf 900.🤖 Generated with Claude Code