Batched sumcheck
There is a standard technique for batching multiple sumcheck instances together to reduce verifier cost and proof size.
Consider a batch of two sumchecks:
- Sumcheck A is over variables, and has degree
- Sumcheck B is over variables, and has degree
If we were to prove them serially, we would have one proof of size and one proof of size (and the same asymptotics for verifier cost). If we instead prove them in parallel (i.e. as a batched sumcheck), we would instead have a single proof of size .
For details, refer to Jim Posen's "Perspectives on Sumcheck batching".
Our implementation of batched sumcheck is uses the SumcheckInstance
trait to represent individual instances, and the BatchedSumcheck
enum to house the batch prove
/verify
functions.
"Bespoke" batching
In some cases, we opt to implement a "bespoke" batched sumcheck prover rather than using the BatchedSumcheck
pattern.
For example, the read-checking and raf-evaluation sumchecks for the instruction execution Shout instance are batched in a bespoke fashion, as are the read-checking and write-checking sumchecks in both Twist instances (RAM and registers)
The reason for doing so is prover efficiency: consider two sumchecks:
The batched sumcheck expression is:
for some random .
Using the BatchedSumcheck
trait, the prover message for each round would be computed by:
- Computing the prover message for , which is some univariate polynomial .
- Computing the prover message for , which is some univariate polynomial .
- Computing the linear combination .
As a general rule of thumb, the number of field multiplications required to compute the sumcheck prover message in round (using the standard linear-time sumcehck algorithm) is , where is the number of multiplications appearing in the summand expression.
So with the BatchedSumcheck
pattern, the prover must perform field multiplications for both steps 1 and 2, for a total of multiplications.
If we instead leverage the shared terms in the batched sumcheck expression, we can reduce the total number of multiplications.
We can rearrange the terms of the batched sumcheck expression:
By factoring out the shared , we can directly compute using only multiplications.