Skip to content

Add KZH-k multilinear polynomial commitments - #171

Merged
weikengchen merged 10 commits into
arkworks-rs:masterfrom
h-hafezi:feature/kzh-pcs
Sep 28, 2026
Merged

weikengchen merged 10 commits into
arkworks-rs:masterfrom
h-hafezi:feature/kzh-pcs

Conversation

@h-hafezi

@h-hafezi h-hafezi commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR adds KZH-k, a non-hiding pairing-based multilinear polynomial
commitment family parameterized by the const generic K.

The implementation follows KZH-Fold and uses the generic-opening auxiliary
commitments described by IronDict. It uses arkworks' native little-endian MLE
layout throughout and calls MultilinearExtension::fix_variables for partial
evaluation.

Highlights

  • Implements the native PolynomialCommitment interface for dense and sparse
    arkworks multilinear extensions.
  • Supports balanced rectangular tensor decompositions when the number of
    variables is not divisible by K.
  • Stores in the commitment state only the auxiliary tables whose cached
    contraction needs fewer group-scalar terms than recommitting the partially
    evaluated polynomial in a single-polynomial opening (at most the first
    floor(K/2) layers, as in IronDict's generic opening). Tables that only
    serve free Boolean openings are not computed.
  • Supports same-point batching, the framework's default multi-point and
    linear-combination APIs, and prepared verifier keys.
  • Validates family markers, tensor dimensions, keys, commitments, states,
    proofs, labels, and point dimensions at operation boundaries.
  • Includes commit/open/check tests for dense, sparse, and unevenly partitioned
    polynomials, a wrong-evaluation rejection test, unit tests for block
    splitting and auxiliary-table selection, and a Criterion benchmark
    (benches/kzh_times.rs) for K = 2, 3, 4, 6 at 12, 16, and 20 variables
    that also prints serialized parameter, key, state, and proof sizes.

Costs

The counts below are for N = 2^n evaluations and one polynomial. They come
from the implementation's own planner (auxiliary_prefix_lengths and
opening_work_plan in kzh/utils.rs), printed by a local, uncommitted probe
for K = 2, 3, 4, 6 and n = 12, 13, 16, 17, 20. They count MSM scalar terms, pairings, and proof
elements; they are not runtime measurements, and this PR makes no wall-clock
claims.

  • Commit: at most (1 + floor(K/2)) * N MSM scalar terms, i.e. one N-term
    MSM for the commitment plus N terms per stored auxiliary table (2N for
    K = 2, 3, 3N for K = 4, 4N for K = 6 in every case above).
  • Opening at a non-Boolean point: O(N) field operations plus
    O(N^(ceil(K/2)/K)) group-scalar terms, which is O(sqrt(N)) for even K
    and zero for K = 2. For odd K this is above the O(sqrt(N)) quoted in
    the papers' cost summaries (K = 3, n = 20: 8192 terms, i.e.
    8 * sqrt(N)). A same-point batch of b > 1 polynomials contracts b
    cached tables per cached layer, or recommits the layer when that is cheaper,
    so it needs more group work than a single-polynomial opening.
  • Proof and verification: K - 1 layers of G1 elements plus the last block's
    field elements, i.e. O(K * N^(1/K)) elements; verification performs K - 1
    multi-pairings over those layers and K block-sized MSMs.

This PR intentionally does not add hiding commitments, strict degree bounds,
a Boolean-specialized opening API, or an R1CS verification gadget.

The most important files to review are:

  • poly-commit/src/kzh/mod.rs
  • poly-commit/src/kzh/data_structures.rs
  • poly-commit/src/kzh/utils.rs
  • poly-commit/src/kzh/tests.rs

No existing GitHub issue currently tracks this addition; the construction,
scope, costs, setup assumptions, and compatibility choices are described here
and in the module documentation.

Validation

Local runs on 79c0620 (macOS aarch64), mirroring .github/workflows/ci.yml
on stable and nightly with RUSTFLAGS=-Dwarnings:

  • cargo fmt --all -- --check
  • cargo check --examples --all, cargo check --examples --all-features --all
    (stable), and cargo check --all-features --examples --all --benches
    (nightly)
  • cargo test --release: 118 library tests, including the 5 KZH tests, and
    4 doctests passed
  • cargo build and cargo check --workspace --no-default-features --target aarch64-unknown-none --exclude ark-pcs-bench-templates

Additional KZH checks:

  • cargo test --release -p ark-poly-commit --no-default-features --features std kzh:: (serial auxiliary-table path) and RAYON_NUM_THREADS=2 cargo test --release -p ark-poly-commit kzh:: (row-parallel path): 5 passed each
  • cargo bench -p ark-poly-commit --bench kzh_times -- --test: all 80
    benchmark functions of the K x n matrix ran once (no timings recorded)
  • RUSTDOCFLAGS=-Dwarnings cargo doc -p ark-poly-commit --no-deps --all-features: no KZH diagnostics; the 30 remaining broken-link errors
    also occur on master

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work. (Design and scope are explained above.)
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

Edited during maintainer review (@weikengchen, with Claude Code): updated the test and validation sections for the trimmed test suite, and restated costs as operation counts from the implementation's planner.

@h-hafezi
h-hafezi requested a review from a team as a code owner August 26, 2026 01:16
@h-hafezi
h-hafezi requested review from WizardOfMenlo, mmagician and weikengchen and removed request for a team August 26, 2026 01:16
@weikengchen

Copy link
Copy Markdown
Member

Thanks for the PR. I am currently reviewing :)

Keep paper citations and implementation differences; leave
asymptotics to the papers rather than restating them in the crate.
Replace the ~2500-line KZH test suite with multilinear_pc-style
smoke coverage: dense/sparse and uneven-partition commit/open/check
plus one wrong-evaluation rejection. The shared crate harness always
sets hiding bounds, which KZH rejects, so it is not applicable.
Cost sweeps, oracle reconstructions, malformed-input and
serialization encyclopedias are removed; the two small unit tests in
kzh/utils.rs stay.
@h-hafezi

Copy link
Copy Markdown
Contributor Author

Hi Weikeng, I was wondering if I could follow up on this thread.

@weikengchen

Copy link
Copy Markdown
Member

(no worries I was just a bit busy lately, but I don't think there is any blocker in merging)

weikengchen and others added 2 commits September 29, 2026 00:29
For odd K the middle block's proof layer needs about N^(ceil(K/2)/K)
group-scalar terms whether cached or recommitted, so generic openings
do not meet the O(N^(1/2)) quoted by the papers; record that instead of
claiming the papers' costs. Also stop asserting that large MSMs
saturate the Rayon pool: ark-ec 0.5 parallelizes an MSM only across
its bucket windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The module has outer docs in lib.rs, so rustdoc resolves the combined
docs from the crate root, where `MultilinearExtension` is not in scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the module docs about the implementation; protocol details and
costs are left to the papers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@weikengchen
weikengchen added this pull request to the merge queue Sep 28, 2026
Merged via the queue into arkworks-rs:master with commit 1eaec50 Sep 28, 2026
4 checks passed
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.

2 participants