fix: handle partial-live frontload phase2 mles#53
Merged
Conversation
kunxian-xia
reviewed
May 8, 2026
kunxian-xia
approved these changes
May 9, 2026
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.
Problem
Frontload two-phase sumcheck still missed one valid
NormalMLE shape:The previous implementation handled:
k <= Lk == NIt did not handle the middle case:
Example from the regression:
Here one worker-bit canonical variable is already bound in phase 1 (
x3), while one remains live in phase 2 (x4). Treating this as either fully exhausted or fully live produces incorrect phase-2 polynomial construction.A related API issue was that frontload two-phase final evaluations could expose proof-internal tail factors. Consumers such as Ceno expect raw canonical MLE openings:
not:
Approach
Keep the full
2^wworker split, and encapsulate the partial-live logic only inbuild_phase2_poly.At the phase boundary each worker has a folded scalar:
build_phase2_polynow handles three canonical cases:k <= Lphase2_mle[0] = sum_b s_bL < k < Nk == Nphase2_mle[b] = s_bFor the partial-live case:
Then normal frontload phase 2 evaluates:
So the verifier remains canonical:
No verifier-side knowledge of worker layout is introduced.
Side Note: Raw Final-Eval Contract
get_mle_flatten_final_evaluations()now exposes raw canonical MLE openings for frontload:It excludes all true frontload tail factors. This lets consumers reconstruct the sumcheck subclaim with the same canonical frontload tail rule used by the verifier.
Implementation details:
k < L.frontload::evaluate(poly, point)helper was removed to avoid hiding raw-vs-tail behavior.frontload::evaluate(poly, point, raw_mle_evals)now explicitly reconstructs the full canonical frontload polynomial from raw MLE openings plus tail factors.Testing
cargo fmt --checkcargo test -p sumcheck12 passed; 0 failedcargo test -p sumcheck --lib -- test_frontload_2phase_mle_category_combinations --nocaptureRegression coverage:
normal_live_in_phase2_with_tail(k=5whenN=6) totest_frontload_2phase_mle_category_combinations.log_num_workers = 0..=3, i.e.num_threads = 1,2,4,8.frontload::evaluate(poly, point, raw_mle_evals)reconstructssubclaim.expected_evaluationfrom those raw openings.Benchmark / Performance Impact
Command:
cargo bench -p sumcheck --bench devirgo_sumcheck -- 'mixed_sum_nv_22_16_2/(frontload_compact_a_plus_b_plus_c|suffix_phase2_a_plus_b_plus_c)|mixed_product_sum_nv_22_16_2/(frontload_compact_product_sum|suffix_phase2_product_sum)'Before = previous local refactor commit
6c74b7d.After = partial-live fix commit
83d0108/ current PR branch state with the same proof-generation path.mixed_sum_nv_22_16_2/frontloadmixed_product_sum_nv_22_16_2/frontloadCurrent frontload vs suffix:
mixed_sum_nv_22_16_2mixed_product_sum_nv_22_16_2The final-eval normalization/API change is postprocessing and does not alter proof round construction. Frontload remains faster than suffix in the measured mixed sum/product cases.
Risk / Rollout
Normalsoundnessnormal_live_in_phase2_with_tailregression coversL < k < N.num_threads = 1,2,4,8.subclaim.expected_evaluationonly after applying canonical tails.prove_suffix.Rollback is to route affected callers back to
prove_suffixor revert this PR.Copilot Reviewer Directive (keep this section)
When Copilot reviews this PR, apply
.github/copilot-instructions.mdstrictly.[severity] path:line (symbol)format.PR metadata: descriptionas a finding.