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

Sum-check protocol #1304

Closed
wants to merge 16 commits into from
Closed

Sum-check protocol #1304

wants to merge 16 commits into from

Conversation

Al-Kindi-0
Copy link
Collaborator

Describe your changes

Implements the sum-check protocol for use in the virtual bus as in #1182 .

Checklist before requesting a review

  • Repo forked and branch created from next according to naming convention.
  • Commit messages and codestyle follow conventions.
  • Relevant issues are linked in the PR description.
  • Tests added for new functionality.
  • Documentation/comments updated according to changes.

@Al-Kindi-0 Al-Kindi-0 marked this pull request as draft March 28, 2024 15:39
Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :) The documentation is very well done!

Not a full review yet

processor/Cargo.toml Show resolved Hide resolved
processor/src/trace/virtual_bus/multilinear/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/multilinear/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/multilinear/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/multilinear/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/verifier/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/sum_check/prover/mod.rs Outdated Show resolved Hide resolved
processor/src/trace/virtual_bus/multilinear/mod.rs Outdated Show resolved Hide resolved
);

// fold each multi-linear using the round challenge
mls.iter_mut().for_each(|ml| ml.bind_assign(round_challenge));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: are there benefits to binding on each iteration, as opposed to keeping the initial multilinears as-is, and prepending the previous rounds challenges [r0, ..., rm] to the input? I'm not sure of the relative costs of binding vs running sumcheck_round on more variables.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the meaning of prepending the previous round challenges

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically, we'd leave the multilinears untouched, and call them e.g. as ml.evaluate([r0, ..., rm, x]), where r0, ... rm are the previous rounds' claims.

Basically, run the algorithm as described in the literature - keeping the r_is around, and no binding.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, and what are we comparing here exactly?

I'm not sure of the relative costs of binding vs running sumcheck_round on more variables.

@Al-Kindi-0
Copy link
Collaborator Author

I have addressed most of the feedback but for the ones related to the evaluation domain. The reason for this is that we will be moving to the coefficient in a subsequent PR and we can implement most of the feedback as part of that PR.

@plafer
Copy link
Contributor

plafer commented Apr 10, 2024

Should we just close in PR in favor of #1307?

@Al-Kindi-0
Copy link
Collaborator Author

The implementation has now moved to using the coefficient form for the round polynomial instead of the evaluation one. With this change, we avoid having to deal with evaluation domains.
Also, regarding CompositionPolyQueryBuilder, I had to revert back to the previous implementation which had the trait generic over the field. The reason been that for the following typical use case, the previous approach didn't work as (maybe there is a workaround I am not aware of)

/// A [`FinalQueryBuilder`] for the sum-check verifier used for the final sum-check.
#[derive(Default)]
struct GkrMergeQueryBuilder<E> {
    gkr_eval_point: Vec<E>,
    merge_rand: Vec<E>,
}

impl<E: FieldElement> CompositionPolyQueryBuilder<E> for GkrMergeQueryBuilder<E> {
    fn build_query(&self, openings_claim: &FinalOpeningClaim<E>, evaluation_point: &[E]) -> Vec<E> {
        let eq_at_gkr_eval_point = EqFunction::new(self.gkr_eval_point.clone());
        let mut rand_sumcheck = self.merge_rand.clone();
        rand_sumcheck.extend_from_slice(evaluation_point);
        let eq = eq_at_gkr_eval_point.evaluate(&rand_sumcheck);
        let mut query = openings_claim.openings.clone();
        query.push(eq);
        query
    }
}

As for closing this PR, I agree. I think that there no outstanding comments left here. The review for the change to coefficient form could be done in the other PR.

@plafer
Copy link
Contributor

plafer commented Apr 22, 2024

Closing; let's move all discussion to #1307

@plafer plafer closed this Apr 22, 2024
@plafer plafer reopened this Apr 22, 2024
@plafer
Copy link
Contributor

plafer commented Apr 22, 2024

Reopening - @Al-Kindi-0 could you merge your recent commits into #1307, and then close this one?

@Al-Kindi-0
Copy link
Collaborator Author

Reopening - @Al-Kindi-0 could you merge your recent commits into #1307, and then close this one?

Done! I will now close this.

@Al-Kindi-0 Al-Kindi-0 closed this Apr 25, 2024
@bobbinth bobbinth deleted the al-sum-check branch July 27, 2024 07:55
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.

3 participants