Repository navigation
feat(akita): add multi-chunk one-hot profiles - #1976
Conversation
Akita main (includes LayerZero-Labs/akita#37): akita-transcript on spongefish 0.7.4 rev ef974134 (u64 squeeze counters, pointer-width independent challenges). One workspace spongefish source; jolt-poly joins the a16z/jolt path patch because akita now depends on it via git.
akita db5efa20 (akita#37) replaces the typed batched proof and its transcript with Spongefish argument bytes keyed by a session label, moves the CPU prover behind an owning CpuBackend with CommitmentHandles, and verifies through AkitaVerifier. Bridge Jolt's statement-bound challenge into the session bytes, commit via CpuBackend::import_source/commit, keep the retained source in the handle instead of a second copy in the hint, cache prepared AkitaVerifiers per flavor, and port TracePackedOneHot to the akita_pcs::custom_source contracts. The proof-shape guard goes away with the structured proof layer; only the commitment payload guard remains.
The akita_prover groups commit through CpuBackend::commit and prove to Spongefish argument bytes; sources are imported once outside the timed region. akita-prover and akita-transcript are no longer direct dependencies of jolt-dory.
cargo metadata per sub-workspace; no wholesale update.
akita#37 changed the planner policy identity (cost model NativeNoncePayloadAndSetupEnvelopeV2, selection objectives V5/V6), so the checked-in .aks envelopes no longer pass the policy-digest check. Rows: k16 46 (37 changed), k256 64 (38 changed), dense 42 (40 changed); no rows added or removed, and the direct/offloaded cutover is unchanged.
An Akita CommitmentHandle proves only on the CpuBackend that committed it, and advice / committed-program objects are committed on their own transparent setups' dense backends. Import each precommitted handle into the trace one-hot backend before the grouped batched_prove; Akita recomputes the dense commitment from the retained source and checks it against the shared public matrix. The trailing-garbage fold_paths test now expects Akita's own EOF rejection (VerificationFailed) since the adapter no longer deserializes the proof.
a16z#1941 rewrote the K<D commit accumulate on digit windows and added a streamed-vs-materialized commit test built on akita-internal hooks (compile_commitment_request, ComputeBackendSetup::prepare_setup, commit_resolved_inner_host) that db5efa20 keeps crate-private or dropped. commit_packed now takes the expanded setup directly, and the test's oracle is the single-digit inner map over Akita's canonical one-hot table.
… bridged_akita_session
1ac07d1 to
519d2d0
Compare
… independent challenges)
519d2d0 to
9580f22
Compare
quangvdao
left a comment
There was a problem hiding this comment.
Reviewed at df4ad5c3d. I found no soundness, transcript-binding or prover/verifier-disagreement problem, and the chunk layout and canonical-range enforcement look right. Tampering with the verifier setup (swapping the profile, or re-encoding a chunked setup as the legacy variant) is rejected with a family-token mismatch. cargo nextest run -p jolt-akita and the akita_e2e binary in jolt-prover pass.
One functional gap I think should be settled before merge, then smaller items.
1. Four and Eight cannot be set up with an advice group (ran it)
With ProverConfig.one_hot_chunk_profile = Four or Eight, the jolt-prover advice guest fails at preprocessing:
Akita preprocessing: Openings(InvalidSetup("Invalid or missing setup file: Unsupported proof
schedule: no multi-group schedule in the audited fold domain for num_vars=22"))
The same guest passes with Two (advice_e2e_akita_two_chunks), and non-advice guests prove and verify under all three chunked profiles. It is a clean error, not a bad proof.
Calling GroupedScheduleParams::extend_catalog directly over advice arity 11..=22 and every supported final arity:
| Profile | Advice 14 (fixture default) | Advice 15–17 | Advice 18 | Advice 19–22 |
|---|---|---|---|---|
| Single | OK | OK | OK | OK |
| Two, K16 | OK | OK | OK | OK, except final arity 31, 32 with both advice groups at 21–22 |
| Two, K256 | fails at final arity 20 | fails at final arity 20 | OK | OK |
| Four | fails at every final arity | fails at final 18–21 | OK | fails at every final arity |
| Eight | fails at every final arity | fails at final 19–21 | OK | fails at every final arity |
plan_row (crates/jolt-akita/src/schedule_registry.rs:173-223) only falls back to a full plan_schedule for the single full-width producer shape, so a chunked main row with a precommitted group has no fallback. I did not trace why the Akita planner finds nothing; that only arity 18 works throughout suggests the adapted-schedule search is pinned to a shape, not that the parameters are infeasible.
Either make grouped provisioning work for the chunked profiles, or reject the combination up front in provision_groups_for_config with a message naming the profile and group arity. A grouped test per profile would pin whichever you choose. If #51 in the stack changes this picture, gating here is enough.
2. Range check is not profile-aware (ran it)
schedule_registry.rs:369-381 checks against K16_NUM_VARS/K256_NUM_VARS (min 12) for every profile, while chunked catalogs start at MULTI_CHUNK_MIN_NUM_VARS = 16. K16 with Two at num_vars 12, or Eight at 15, passes the check and then fails later with "setup matrix sizing found no admitted schedules for max_num_vars=N", which does not point at the profile.
3. Single-chunk path: digit expansion now always copies (by reading, unmeasured)
crates/jolt-akita/src/trace_onehot/decomposition.rs:779-787: the old code moved the buffer when num_digits == 1; the new code always allocates and copies. Same file, l.724-736: the Compact fallback calls add_rotated per contribution instead of accumulating locally first. The dense single-chunk hot path is otherwise kept by the dst.len() == 1 fast path.
4. AkitaSetupParams positional encoding changed (by reading)
crates/jolt-akita/src/adapters.rs:348: one_hot_chunk_profile is inserted mid-struct with #[serde(default)], which does not help bincode. Old prover-side params will not decode; same for the six new fields on AkitaScheduleArtifacts (l.52). The Single verifier setup encoding is preserved. Moving the field to the end, or noting the break, would do.
Smaller
crates/jolt-akita/src/configs.rs:219,228: W8R2 is built fromChunkedWitnessCfg::d64_production()while W2R2/W4R2 usefrom_profile. If Akita changes its production alias, W8R2 changes silently and the checked-in catalog stops matching.ProverConfig.one_hot_chunk_profileis read only at preprocessing and is alwaysSinglefromderive_from_rows; a different value at prove time is silently ignored.specs/akita-multi-chunk-witnesses.mdstill links #1896 and describes a nine-artifact bundle; its checked box for grouped provisioning is the claim item 1 contradicts.
Test gaps
- No grouped + chunked test in
jolt-akita. - No e2e for
FourorEight; the streamed chunked commit path is covered end to end only forTwo. - No negative test for a verifier setup whose profile disagrees with the catalog (it does reject).
- No single-chunk benchmark comparison.
Not run on my side: clippy, the feature matrix, benchmarks, catalog regeneration.
Acentelles
left a comment
There was a problem hiding this comment.
Reviewed at df4ad5c3d. Requesting changes for the Four/Eight default-advice setup failure. This confirms item 1 in the existing review and adds a root cause: the chunked response exceeds the dense producer's frozen A bound, so expanding Jolt's planner fallback alone cannot fix this case.
The existing advice guest fails preprocessing under both profiles with no multi-group schedule in the audited fold domain for num_vars=22. A direct setup with K16, final arity 22 and GroupedScheduleParams::new(Some(14), Some(14), vec![], 22) reproduces it. Two passes the stock advice test; separate muldiv probes prove and verify under Four and Eight.
At the pinned Akita revision:
materialize_precommitted_group_for_open_basisusespolicy.chunks_at_level(0)to size the independently committed dense advice group's response.- The dense honest-fold policy retains whole-group digit sizing, while the SIS response-difference envelope scales with the chunk count.
- The planner rejects candidates whose required bound exceeds the certificate already frozen into the single-chunk dense producer, before suffix search.
For advice arity 14 at K16/final arity 22, the production sizing helpers give:
| Profile | Smallest required A bound across packing candidates | Frozen producer A bound |
|---|---|---|
| Two | 427,818,804 | 427,818,804 |
| Four | 1,275,068,340 | 427,818,804 |
| Eight | 1,275,068,340 | 427,818,804 |
Unrestricted akita_planner::find_schedule also rejects the Four/K16/final-22 case with one advice-14 producer. Advice arity 18 has a different inner decomposition basis and can save a fold digit, explaining its successful cases. This diagnosis is specific to the demonstrated Four/Eight failures; the secondary K256/Two failures need separate tracing.
Please either provision compatible dense producer parameters, or explicitly gate unsupported profile/group shapes with an error naming the profile and advice arity. Preserve the certificate admission check, add grouped setup coverage for each profile, and update the spec's grouped-support claim to match the supported combinations.
The remaining findings are nonblocking:
- Setup range:
schedule_registry.rs:368-382accepts the single-chunk minimum of 12, whereas chunked catalogs start at 16. K16/Two/12 and K16/Eight/15 reproduce late sizing or missing-row errors. Share the profile-specific range between catalog emission and setup validation. - Bincode compatibility: reproduced legacy
AkitaSetupParamsdecoding failure (UnexpectedVariant) and legacyAkitaScheduleArtifactsfailure (UnexpectedEnd). Moving the profile field to the end does not restore compatibility:serde(default)does not supply absent positional bincode fields, and the artifact bundle independently changed. Document the break/regeneration path, or provide versioned decoding if persisted recipes are supported.AkitaVerifierSetupcompatibility is preserved;scheme.rs::tests::legacy_single_setup_keeps_its_transcriptpasses its frozen-preamble and bincode checks. - Single-chunk cost: the unconditional allocation/copy at
trace_onehot/decomposition.rs:779-787is confirmed by reading. Keep the buffer move whennum_chunks == 1 && num_digits == 1. The Compact fallback also loses local accumulation; neither cost was benchmarked. - Profile selection: pin W8R2 explicitly with
from_profile(MultiChunkProfileId::W8R2)instead ofd64_production(). Separately, preprocessing asSinglethen proving with configEightstill proves and verifies asSingle; document the configuration field's setup-only lifecycle or reject the mismatch. - Regression coverage: the chunked differential test selects its rotation mode from the environment. Explicitly loop over dense/sparse/compact so all three remain covered at every tested ring dimension. The serial chunked path is already covered. A Single baseline alongside chunked proof-size/prover/verifier measurements would also make the tradeoff assessable.
Validation on this head: cargo fmt --check; both cargo clippy --all --features host -q --all-targets -- -D warnings and the host,zk lane; jolt-akita nextest 87/87; akita_e2e 9/9; FS inventory with fs-audit 1/1; and the trace one-hot suite with each forced rotation mode 16/16 per mode, all pass. A bincode-transported Two verifier setup verifies normally and rejects profile swaps or legacy-variant re-encoding with a family-token mismatch. No soundness or transcript-binding defect was found in the reviewed paths. Benchmarks and full catalog regeneration were not run.
Certify bounded and full-width dense producers for the maximum eight-chunk response budget and regenerate their catalogs. Remove profile-specific producer replanning so advice commitments can be created once and reused across all supported trace chunk profiles. Cover producer certificate admission, commitment reuse, and committed-program proofs across Single, Two, Four, and Eight.
|
Following up on item 3 (single-chunk performance) in the review. Decision: restore buffer reuse for single-chunk, single-digit expansion; keep direct Compact accumulation. The expansion currently allocates and copies even when For the Compact fallback, we compared direct destination updates with the previous strategy of accumulating into a local
These are standalone microbenchmarks using synthetic inputs and the production Compact rotation routine, compiled with The buffer-reuse patch is implemented locally and has not yet been pushed to this PR. Its expanded |
Rename the chunk-profile API and reject prove-time profile mismatches. Reuse the single-chunk, single-digit buffer, reject tampered verifier setups in existing round trips, and document cache compatibility, migration, and benchmark findings. Validation: targeted Akita tests, the Akita e2e suite, Fiat-Shamir inventory, both workspace Clippy modes, formatting, and diff checks passed.
|
@quangvdao Thanks for the detailed review. The follow-up addresses the functional and validation gaps and documents the remaining single-chunk performance concern. The PR currently points to
The smaller items are addressed too:
There are additional migration changes: the selector is now AkitaChunkProfile / akita_chunk_profile, and the nondefault profile's transcript label changed. Earlier chunked proofs must be regenerated. Both dense producer catalogs were regenerated for the fixed eight-chunk response budget, independently of the trace profile; deployment directories need the updated dense catalogs. For the latest narrow follow-up, all four focused Nextest tests, the 24-case boundary diagnostic, formatting, diff checks, and both workspace Clippy modes (host and host,zk) passed. The four focused Nextest tests, formatting, and diff checks were also rerun after the final documentation corrections and passed. I did not rerun the full e2e/feature matrix or the 39,984-request matrix after tightening the diagnostic classification. The full provisioning matrix is reproducible with: cargo run --release -p jolt-akita --bin check_grouped_schedules -- \
crates/jolt-akita/schedules /tmp/jolt-grouped-schedules.csv fullUse boundary instead of full for the 24 cutover cases. |
|
@Acentelles Thanks for tracing the dense producer bound. Your diagnosis is right: expanding the planner fallback alone cannot make an incompatible frozen producer certificate admissible. The follow-up is now pushed at
Validation after merging the base:
The full feature matrix, the 39,984-request provisioning matrix, catalog regeneration, and full-profile performance benchmarks were not rerun after this merge. The earlier provisioning report and its migration details are recorded in the previous reply. |
Acentelles
left a comment
There was a problem hiding this comment.
Re-checked at a007b8efc, thanks. Everything from my review is addressed:
- The default advice-14 producer now fits the unchanged certificate (427,818,804). Required A at K16/final 22 is 79,691,700 for
Fourand 159,383,476 forEight. Unrestricted planning and the original advice guest pass under both. - Ranges are shared and profile-aware.
- The bincode break is documented.
- Stage 0 rejects a profile mismatch.
- W8R2 is explicit.
- All rotation modes are covered.
- Gates on this head: fmt, both clippy lanes,
jolt-akita85,akita_e2e13, fs-audit 1,check_grouped_schedules … boundary24/24.
One tradeoff worth stating in the description. Fixing the dense producers at the W8R2 budget also changes the default Single path, because advice and committed-program commitments use the new producer geometry. Same guests, same box (M3 Max, 4 threads), six balanced old/new pairs against df4ad5c3d, Single profile:
| Fixture | Prove ms old → new | Change |
|---|---|---|
| no advice (control) | 216.1 → 216.5 | +1.0% (noise) |
| advice | 285.8 → 307.3 | +7.8% |
| committed program | 584.2 → 623.3 | +6.4% |
| advice + committed program | 658.6 → 717.1 | +8.7% |
Trusted-advice commitment is about 20% slower; program commitment about 8% slower. Commitment bytes are unchanged (166) and proof bytes move by at most 225. These are small shapes and a whole-head comparison, so they are indicative only. If cross-profile commitment reuse is worth this, a sentence plus these numbers in the PR description is enough. Otherwise, certifying producers for the 8-chunk envelope without making the standalone dense schedule 8-chunk (or choosing the producer catalog by profile) would keep Single unchanged.
|
Thanks for checking and quantifying this. Using W8R2 for the dense producers across all trace profiles is deliberate: it keeps producer selection independent of the consuming trace profile, simplifies the logic, and conservatively covers the maximum supported chunk count while allowing cross-profile commitment reuse. We accept the resulting Single performance tradeoff and will document your indicative measurements in the PR description. This choice changes the standalone producer geometry, so we should not claim that Single performance is unchanged. |
|
Follow-up on the single-chunk performance concern: the inefficiency in trace The optimization restores batched accumulation and coefficient-buffer reuse within one shared kernel for 1, 2, 4, and 8 chunks, adapted to the native layout where each chunk receives the same cycle range from every polynomial. It introduces no single-chunk special case. Against the saved pre- These are isolated kernel measurements, including the native layout change, rather than end-to-end prover timings. Short traces still incur additional chunk-output and aggregation costs. This addresses the trace |
Ports main's work onto the NARG transcript: - Spartan and HyperKZG (#1880) run on jolt-transcript: HyperKZG's fold commitments, evaluation rows, and KZG witnesses, and Spartan's statement, outer evaluations, and witness evaluation, are exchanged through one Channel-generic schedule per crate that both roles call. Their tests tamper with the decoded argument string; the zero-challenge test needs an injectable transcript and is dropped. - Akita's setup absorb keeps main's one-hot chunk-profile binding (#1976) and binds the full setup shape again as typed public messages, before the catalog digest. - The packed trace view implements Akita's evaluate_and_fold_batch (#169). - Tests main pruned (#1998) are dropped where this branch only ported them, and kept where this branch replaced them with argument-string tests. - The Fiat-Shamir inventory is re-blessed for the new sites.
Conflict resolutions: - Akita pin: main pins akita d98400c5 (LayerZero-Labs/akita#175); this branch pins the recursion companion 22530c7b (akita main 2607265b plus LayerZero-Labs/akita#186-#190). markos/recursion-integration now merges d98400c5 into the companion (f2fbf8be; akita-config's schedule-artifact test file was the only conflict, both sides' tests kept) and adds 868045fd, which keeps #175's new optional fold fields in binary encodings so the companion's postcard catalog view decodes again. Both sides' pins move to 868045fd. - jolt-akita: main's multi-chunk one-hot families (#1976) and native trace batch (#2012) are taken as is; they subsume this branch's akita-params import moves. The prepared verifier is ported onto OneHotFamily: AkitaOneHotBackendScheme gains from_verifier_view and verifier_for_selection, the chunked schedule-artifact variants carry PreparedBytes, and AkitaVerifierSetup reads a flavor's catalog from its prepared view or its artifact in one place (catalog_source). - main's legacy_single_setup_keeps_its_transcript pinned bincode compatibility of single-profile verifier setups. This branch's prepared field and optional payload bytes change that encoding, so the test keeps its transcript pin and variant check (single_profile_setup_keeps_its_transcript) and drops the byte-equality assertions. - jolt-claims lattice strategy: main's native-batch v8 layout digest, hashed with the shared Blake2b256. - CI: main's job name with this branch's 90-minute timeout. - Fiat-Shamir inventories re-blessed; fs_obligations keeps this branch's absorb-method list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Port the multi-chunk one-hot witness feature from #1896 onto #1948's updated Akita API. This PR targets #1948's branch so its diff contains the multi-chunk feature without repeating the Akita version bump.
Dense producer performance tradeoff
Dense advice and committed-program producers deliberately use the fixed W8R2 response geometry across all trace profiles, including
Single. This keeps producer selection independent of the consuming trace profile, simplifies the logic, conservatively covers the maximum supported chunk count, and permits cross-profile commitment reuse. We accept that this changes the standalone producer geometry and can slow the defaultSinglepath.Reviewer measurements compared
df4ad5c3dwitha007b8efcusing the same guests on an M3 Max with four threads, six balanced old/new pairs, and theSingleprofile:Trusted-advice commitment was approximately 20% slower and program commitment approximately 8% slower. Commitment size stayed at 166 bytes; proof size changed by at most 225 bytes. These are indicative small-fixture, whole-head comparisons, rather than an isolated measurement of the producer geometry change.
Validation
cargo nextest run -p jolt-akita --cargo-quiet --no-fail-fast(80 passed)cargo nextest run -p jolt-prover --features akita,prover-fixtures --cargo-quiet(28 passed)cargo nextest run -p jolt-prover --features akita,prover-fixtures -E 'binary(akita_e2e)' --cargo-quiet(9 passed)cargo nextest run -p jolt-verifier --features akita,prover-fixtures --test-threads 1 --cargo-quiet(91 passed, 9 skipped)cargo clippy --all --features host -q --all-targets -- -D warningscargo clippy --all --features host,zk -q --all-targets -- -D warningscargo fmt --checkgit diff --check