Skip to content

[sumcheck] modify batched sumcheck final opening point alignment #867

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

Closed
hero78119 opened this issue Mar 19, 2025 · 0 comments · Fixed by #870
Closed

[sumcheck] modify batched sumcheck final opening point alignment #867

hero78119 opened this issue Mar 19, 2025 · 0 comments · Fixed by #870
Assignees

Comments

@hero78119
Copy link
Collaborator

hero78119 commented Mar 19, 2025

This issue was initiative along with reviewing PR #864 , the first scenario we kick of the batched of sumcheck in different number of variables.

Basically due to the invesigation for why num_thread > 1 not work in this test case https://github.com/scroll-tech/ceno/blob/master/sumcheck/src/test.rs#L29-L30

In current design, batched sumcheck with different num_vars are implemented by times a scalar, see docs in code comment

ceno/sumcheck/src/prover.rs

Lines 414 to 425 in a0b719d

// Step 2: generate sum for the partial evaluated polynomial:
// f(r_1, ... r_m,, x_{m+1}... x_n)
//
// To deal with different num_vars, we exploit a fact that for each product which num_vars < max_num_vars,
// for it evaluation value we need to times 2^(max_num_vars - num_vars)
// E.g. Giving multivariate poly f(X) = f_1(X1) + f_2(X), X1 \in {F}^{n'}, X \in {F}^{n}, |X1| := n', |X| = n, n' <= n
// For i round univariate poly, f^i(x)
// f^i[0] = \sum_b f(r, 0, b), b \in {0, 1}^{n-i-1}, r \in {F}^{n-i-1} chanllenge get from prev rounds
// = \sum_b f_1(r, 0, b1) + f_2(r, 0, b), |b| >= |b1|, |b| - |b1| = n - n'
// = 2^(|b| - |b1|) * \sum_b1 f_1(r, 0, b1) + \sum_b f_2(r, 0, b)
// same applied on f^i[1]
// It imply that, for every evals in f_1, to compute univariate poly, we just need to times a factor 2^(|b| - |b1|) for it evaluation value

The methodology works by starting binding variable on all polys, so some poly with smaller num_var will be ended earlier.
In another word, giving the final opening point $\vec{r}$ , the final reduce opening point for each polynomial will be $\vec{r}$[..num_var_i], so are aligned on "prefix"

However, batch different num of variable in prefix alignment, doesn't fit in devirgo style sumcheck, due to we break down sumcheck into 2 phase. In first phase, we break down evaluation into #threads section, and all polynomial bind as "constant" right at the last round of phase 1. This prefix-alignment works well when all poly are in same num_var. However, when poly are in different number of variable, some poly with less num_var in prefix alignment will be end much earlier, which break the rule for all polynomial should be end together in phase 1.

To address the issue, we need to modify the sumcheck design to be right alignment. Thus, giving same opening point $\vec{r}$, each poly will be $\vec{r}$[r.len() - num_var_i..], where we call right alignment. With that, poly with less num_var will start to bind lately, and they can end together at the last round of phase 1 sumcheck.

cc @Jiangkm3

@hero78119 hero78119 self-assigned this Mar 19, 2025
@hero78119 hero78119 moved this to In Progress in Ceno - Base VM Mar 19, 2025
github-merge-queue bot pushed a commit that referenced this issue Mar 20, 2025
github-merge-queue bot pushed a commit that referenced this issue Mar 21, 2025
To close #867 

New design only apply on prover, as verifier logic remains unchanged

### benchmark 
original e2e benchmark result remain no change, which is expected
```
fibonacci_max_steps_1048576/prove_fibonacci/fibonacci_max_steps_1048576
                        time:   [3.9061 s 3.9327 s 3.9608 s]
                        change: [-2.0470% -1.2697% -0.4292%] (p = 0.01 < 0.05)
                        Change within noise threshold.
```
@github-project-automation github-project-automation bot moved this from In Progress to Done in Ceno - Base VM Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant