Skip to content

refactor: adaptive ring dimension - #356

Merged
quangvdao merged 29 commits into
mainfrom
refactor/mixed-dimension
Aug 8, 2026
Merged

refactor: adaptive ring dimension#356
quangvdao merged 29 commits into
mainfrom
refactor/mixed-dimension

Conversation

@omibo

@omibo omibo commented Aug 6, 2026

Copy link
Copy Markdown

Adaptive ring dimensions for default fp128 schedules

Summary

This PR makes adaptive ring-dimension schedules the defaults for direct, scalar fp128 one-hot and dense commitments.

The public setup matrix remains a dimension-free flat field-element stream. Setup capacity is measured directly in base-field elements; there is no setup-generation or carrier ring dimension. The selected schedule is the sole owner of the per-level A/B/D dimensions.

Adaptive planning happens offline during catalog generation. Proving and verification resolve and validate the generated schedule row and never invoke the planner at runtime.

What changed

Declarative ring-dimension policy

CommitmentConfig describes schedule behavior with RingDimensionScheduleMode:

UniformDimension {
    ring_dimension,
}

AdaptiveDimension {
    num_search_levels,
    uniform_suffix_dimension,
    potential_a_dimensions,
    potential_b_dimensions,
    potential_d_dimensions,
}

uniform_ring_dimension is only the candidate used by uniform presets. It is not an adaptive setup carrier, and adaptive dimensions do not need to divide it.

Each adaptive dimension is instead validated directly against its protocol role:

  • A/B/D protocol-dispatch support
  • Role-specific SIS security-table coverage
  • Production fold-challenge support for A
  • A-to-role projection and per-level layout constraints

Bounded adaptive search

The default fp128::OneHot and fp128::Dense policies use:

Adaptive levels: L0 and L1
A candidates:    D64, D128, D256
B candidates:    D64, D128
D candidates:    D64, D128
Uniform suffix:  D64 from L2 through the terminal

Dimensions are component-wise non-increasing across the adaptive boundary. The currently audited implementation accepts exactly two adaptive levels; other adaptive depths are rejected by policy validation.

Complete schedules use the normative deterministic comparison key:

(physical setup field elements, exact modeled proof-payload bytes, canonical descriptor bytes)

There is no rank-first objective or preliminary dimension-path deduplication. Secure matrix ranks are feasibility and sizing inputs; all complete candidates are compared once using the canonical objective.

One canonical schedule implementation

The candidate representation and shared pricing/materialization operations now live in akita-schedules and are called directly by akita-planner and generated-row replay. This includes:

  • Candidate fold and terminal representations
  • Stage-3 payload pricing
  • Schedule materialization
  • Grouped segment sizing
  • Next-witness sizing

This removes parallel planner/runtime implementations and keeps generation, replay, setup accounting, and proof pricing on the same primitives.

Generated catalog identity and runtime replay

Generated catalog identity binds the complete schedule policy, including:

  • Adaptive depth and uniform suffix
  • Ordered A/B/D candidate domains
  • Cost and selection policy IDs
  • SIS policy/table identity
  • Challenge-hook coverage over every admitted A dimension
  • Dimensions used by emitted rows

Validation checks that emitted schedules use admitted dimensions, obey the adaptive-to-D64 cutover, match their exact proof/setup estimates, and expand to the same canonical descriptor produced by the planner. Missing runtime rows reject rather than falling back to planner execution.

fp128 preset and catalog cleanup

  • fp128::OneHot is the canonical adaptive direct one-hot preset.
  • fp128::Dense is the canonical adaptive direct dense preset.
  • Explicit uniform D64OneHot and D64Dense presets remain available as baselines.
  • D256OneHot remains a tableless experimental policy marker.
  • Redundant fixed-D128/D256 generated families and the old fp128_mixed_dim_onehot naming were removed.
  • The focused profiling feature was renamed from profile-onehot-fp128-d64 to profile-onehot-fp128.
  • The obsolete single-candidate best_onehot_schedule compatibility layer and its fabricated estimate breakdown were removed; callers use the standard generated-catalog path directly.

Scope and limitations

This PR implements adaptive planning for direct, scalar fp128 one-hot and dense schedules.

The following remain outside this cut:

  • Planner-native adaptive multi-group search
  • Adaptive direct multi-chunk/distributed planning
  • Adaptive recursive setup offloading
  • Adaptive fp32 and fp64 catalogs

Grouped paths can preserve already-committed profiles, but they do not perform planner-native mixed-D multi-group optimization. Recursive and multi-chunk fp128 configurations continue to use their existing uniform-D64 catalogs.

Compatibility

This is an intentional breaking configuration and generated-catalog change. Users of removed fp128 generated families or the old mixed-dimension naming should migrate to:

akita_config::proof_optimized::fp128::OneHot
akita_config::proof_optimized::fp128::Dense

Use the corresponding D64* preset when an explicitly uniform D64 policy is required.

Validation

Coverage includes:

  • Adaptive policy and role-specific dimension validation
  • Rejection of unsupported adaptive depths
  • Physical setup-field and proof-payload objective ordering
  • Deterministic descriptor tie-breaking
  • Production frontier comparison with an unpruned L0/L1 reference traversal
  • Uniform D64 suffix enforcement
  • Planner/generated/runtime descriptor and estimate parity
  • Catalog identity drift and missing-row rejection
  • Honest dense and one-hot proving/verification
  • Wrong openings and commitment/proof tampering
  • Malformed dimensions and setup under-capacity
  • Adaptive-root test fixtures using the schedule-selected layout.d_a()
  • Preservation of existing uniform planner paths

The full CI-equivalent test graph passes locally: 1,254 tests across 50 binaries, along with all required Clippy configurations and repository preflight checks.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Documentation blast radius (advisory)

These regions may need doc/spec/book updates based on changed paths.
This is not a merge gate. See docs/documentation.md.

Changed files in this PR: 127

workspace-crates

Workspace membership and public crate surface

Code paths touched:

  • crates/akita-config/Cargo.toml
  • crates/akita-pcs/Cargo.toml
  • crates/akita-schedules/Cargo.toml
  • crates/akita-verifier/Cargo.toml

Consider updating:

  • README.md
  • docs/crate-graph.md
  • book/src/how/architecture.md

planner-schedule

Schedule tables, DP fallback, proof-size planning

Code paths touched:

  • crates/akita-config/Cargo.toml
  • crates/akita-config/src/lib.rs
  • crates/akita-config/src/precommitted_commitment.rs
  • crates/akita-config/src/proof_optimized.rs
  • crates/akita-config/src/proof_optimized/fp128.rs
  • crates/akita-config/src/proof_optimized/tests.rs
  • crates/akita-config/src/recursive_commitment.rs
  • crates/akita-config/src/setup_prefix_slots.rs
  • crates/akita-config/tests/basis_envelope.rs
  • crates/akita-config/tests/generated_tables.rs
  • crates/akita-config/tests/runtime_fallback.rs
  • crates/akita-config/tests/schedule_catalog_feature_off.rs
  • crates/akita-config/tests/schedule_catalog_miswire.rs
  • crates/akita-planner/README.md
  • crates/akita-planner/examples/mixed_dimension_search.rs
  • crates/akita-planner/src/emit/mod.rs
  • crates/akita-planner/src/generated_families.rs
  • crates/akita-planner/src/lib.rs
  • crates/akita-planner/src/planner.rs
  • crates/akita-planner/src/schedule_params.rs
  • crates/akita-planner/src/schedule_params/candidate.rs
  • crates/akita-planner/src/schedule_params/candidate/recursive.rs
  • crates/akita-planner/src/schedule_params/candidate/setup_prefix.rs
  • crates/akita-planner/src/schedule_params/mixed_search.rs
  • crates/akita-planner/src/schedule_params/suffix_dp.rs
  • crates/akita-planner/src/test/mixed_search.rs
  • crates/akita-planner/src/test/schedule_params.rs
  • crates/akita-planner/src/test/suffix_dp.rs
  • crates/akita-planner/src/test/unpruned_search.rs
  • crates/akita-schedules/Cargo.toml
  • crates/akita-schedules/src/candidate.rs
  • crates/akita-schedules/src/catalog_identity.rs
  • crates/akita-schedules/src/generated/expand.rs
  • crates/akita-schedules/src/generated/fp128_d128_dense.rs
  • crates/akita-schedules/src/generated/fp128_d128_dense_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_d128_onehot.rs
  • crates/akita-schedules/src/generated/fp128_d128_onehot_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_d256_onehot.rs
  • crates/akita-schedules/src/generated/fp128_d256_onehot_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_dense.rs
  • crates/akita-schedules/src/generated/fp128_dense_multi_chunk.rs
  • crates/akita-schedules/src/generated/fp128_dense_multi_chunk_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_dense_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_mixed_dim_onehot.rs
  • crates/akita-schedules/src/generated/fp128_mixed_dim_onehot_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w2r2.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w2r2_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w4r2.rs
  • crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w4r2_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot_recursive.rs
  • crates/akita-schedules/src/generated/fp128_onehot_recursive_multi_chunk_w8r2.rs
  • crates/akita-schedules/src/generated/fp128_onehot_recursive_multi_chunk_w8r2_precommitted.rs
  • crates/akita-schedules/src/generated/fp128_onehot_recursive_precommitted.rs
  • crates/akita-schedules/src/generated/fp32_d128_onehot.rs
  • crates/akita-schedules/src/generated/fp32_d256_onehot.rs
  • crates/akita-schedules/src/generated/fp64_d128_dense.rs
  • crates/akita-schedules/src/generated/fp64_d128_onehot.rs
  • crates/akita-schedules/src/generated/fp64_d256_onehot.rs
  • crates/akita-schedules/src/generated/mod.rs
  • crates/akita-schedules/src/generated/walk.rs
  • crates/akita-schedules/src/group_batch.rs
  • crates/akita-schedules/src/lib.rs
  • crates/akita-schedules/src/runtime.rs

Consider updating:

  • book/src/how/configuration.md
  • book/src/usage/profiling.md
  • specs/planner-*.md
  • specs/PRUNING.md

sis-security

SIS floors, norm bounds, challenge sampling

Code paths touched:

  • crates/akita-types/src/sis/ajtai_key.rs
  • crates/akita-types/src/sis/mod.rs

Consider updating:

  • book/src/how/security.md
  • book/src/foundations/lattices-sis.md
  • specs/akita-sis-*.md
  • specs/sis-euclidean-estimator.md
  • specs/fold-linf-rejection.md
  • docs/security-posture.md

prover-protocol

Prove pipeline, folds, sumcheck stages

Code paths touched:

  • crates/akita-prover/src/protocol/core/tests.rs
  • crates/akita-prover/src/protocol/sumcheck/relation_range_image/evaluation_trace/tests.rs

Consider updating:

  • book/src/how/proving/**
  • book/src/how/recursion.md
  • specs/packed-sumcheck.md
  • specs/setup-product-sumcheck.md
  • specs/terminal-fold-cutover.md
  • specs/protocol-field-geometry-cutover.md

verifier

Verifier replay and no-panic boundary

Code paths touched:

  • crates/akita-verifier/Cargo.toml
  • crates/akita-verifier/src/protocol/core/terminal_ntt.rs
  • crates/akita-verifier/src/protocol/evaluation_trace.rs
  • crates/akita-verifier/src/stages/stage3.rs

Consider updating:

  • book/src/how/verification.md
  • book/src/how/proving/fold-path.md
  • docs/verifier-contract.md
  • docs/verifier-panic-audit.md
  • specs/security-hardening.md
  • specs/protocol-field-geometry-cutover.md

commitment-setup

Setup expansion and Ajtai commitment

Code paths touched:

  • crates/akita-setup/src/lib.rs

Consider updating:

  • book/src/how/commitment.md
  • book/src/usage/commitment-api.md
  • specs/setup-*.md

pcs-umbrella

Public PCS API, examples, integration tests

Code paths touched:

  • crates/akita-pcs/Cargo.toml
  • crates/akita-pcs/benches/akita_e2e.rs
  • crates/akita-pcs/benches/root_kernels.rs
  • crates/akita-pcs/examples/profile/main.rs
  • crates/akita-pcs/examples/profile/modes.rs
  • crates/akita-pcs/examples/profile/workload.rs
  • crates/akita-pcs/examples/transcript_schedule.rs
  • crates/akita-pcs/src/scheme/tests/dense_group.rs
  • crates/akita-pcs/src/scheme/tests/mod.rs
  • crates/akita-pcs/src/scheme/tests/onehot.rs
  • crates/akita-pcs/tests/akita_e2e.rs
  • crates/akita-pcs/tests/batched_aggregated_e2e.rs
  • crates/akita-pcs/tests/common/mod.rs
  • crates/akita-pcs/tests/distributed_setup_offload_e2e.rs
  • crates/akita-pcs/tests/heterogeneous_prove_e2e.rs
  • crates/akita-pcs/tests/recursive_setup_e2e.rs
  • crates/akita-pcs/tests/setup.rs
  • crates/akita-pcs/tests/single_poly_e2e.rs
  • crates/akita-pcs/tests/support/mod.rs

Consider updating:

  • book/src/usage/**
  • README.md

ci-tooling

CI workflows and repo scripts

Code paths touched:

  • .github/workflows/ci.yml
  • .github/workflows/profile-bench.yml
  • scripts/check_profile_ci_features.sh
  • scripts/profile_bench_report.py
  • scripts/profile_trace_spans.py
  • scripts/tests/test_profile_bench_report.py

Consider updating:

  • docs/ci-test-timing.md
  • docs/documentation.md
  • specs/ci-test-timing.md

book-tooling

Book structure and guardrails

Code paths touched:

  • book/src/usage/feature-flags.md
  • book/src/usage/jolt-recursion.md
  • book/src/usage/profiling.md
  • book/src/usage/quickstart.md

Consider updating:

  • book/README.md
  • docs/documentation.md
  • specs/PRUNING.md

Per-PR checklist: spec Status / acceptance criteria; book owning page; AGENTS.md if contracts changed; archive spec after fold.

@omibo
omibo marked this pull request as ready for review August 6, 2026 18:14
RadNi
RadNi previously approved these changes Aug 6, 2026
@github-actions github-actions Bot added spec PR contains a spec implementation PR contains implementation of a spec labels Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

CI test timing

  • Report generated: 2026-08-08T03:06:22Z.
  • Source: 8e43931 on refactor/mixed-dimension.
  • Workflow run: 31235887660.
  • Main baseline: 064044c.
  • Previous run: 0e1edf2.

Run summary

Wall s Main wall s Main Δ Ratio Tests Skipped Failed Status
327.0 319.0 +2.5% 1.03x 1280 0 0 ok

Wall time spans 2 parallel nextest slice shards.

Slowest tests

Rank Duration s Test
1 29.0 akita-planner::schedule_params::tests::recursive_exact_cutover_proof_size_is_documented
2 24.8 akita-planner::schedule_params::tests::recursive_adaptive_search_selects_schedule_dimensions_and_setup_prefixes
3 13.4 akita-planner::schedule_params::tests::adaptive_frontier_matches_unpruned_l0_l1_search
4 11.6 akita-pcs::akita_e2e::adaptive_dense_generated_prove_verify_nv24
5 11.1 akita-pcs::single_poly_e2e::single_dense_nv24
6 7.1 akita-planner::schedule_params::tests::uniform_suffix_dp_matches_unpruned_exact_cutover_search
7 7.1 akita-pcs::scheme::tests::onehot::multi_group_root_allows_precommitted_arity_above_final_group
8 7.0 akita-pcs::batched_aggregated_e2e::non_zk_aggregated_cases::aggregated_dense_nv17_batch4
9 6.7 akita-pcs::batched_aggregated_e2e::aggregated_mixed_dense_and_onehot_under_dense_cfg
10 6.3 akita-pcs::setup::adaptive_dense::large_setup_batch_passes
11 5.7 akita-pcs::setup::adaptive_dense::same_size_passes
12 4.9 akita-planner::schedule_params::tests::adaptive_nv36_minimizes_setup_before_proof_bytes
13 3.9 akita-planner::schedule_params::tests::adaptive_root_domain_is_independent_of_uniform_config_dimension
14 3.6 akita-sis-estimator::search_mode_parity::parallel_exhaustive_matches_serial_exhaustive_smoke
15 3.4 akita-prover::kernels::linear::tests::chunking::q128_many_blocks_digits_chunk_instead_of_unsafe_block_parallel
16 3.4 akita-sis-estimator::search_mode_parity::exhaustive_search_is_at_least_as_good_as_local_minimum_smoke
17 3.2 akita-pcs::scheme::tests::batched::batched_verify_accepts_consistent_openings_and_rejects_bad_inputs
18 3.2 akita-prover::protocol::sumcheck::relation_range_image::tests::stage2_large_odd_dense_prefix_matches_padded_reference
19 2.8 akita-prover::protocol::sumcheck::relation_range_image::tests::stage2_large_odd_sparse_boolean_prefix_matches_padded_reference
20 2.5 akita-pcs::scheme::tests::heterogeneous_group::heterogeneous_polynomial_groups_round_trip_with_group_local_points

Regressions vs main

Δ s Baseline s Current s Test
26.8 2.2 29.0 akita-planner::schedule_params::tests::recursive_exact_cutover_proof_size_is_documented

New slow tests

No new tests ≥30s vs main baseline.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Benchmark Report

  • Latest run: 87b93b1
  • Message: Merge remote-tracking branch 'origin/main' into refactor/mixed-dimension
  • Ref: refactor/mixed-dimension
  • Workflow run: run 31235887661 attempt 1
  • Report generated: 2026-08-08T03:00:02Z.
  • Previous run: 9f9cab1 from the previous PR update with a benchmark artifact.
  • Main baseline: no reusable benchmark artifact found for main.
  • Binary: target/release/examples/profile.
  • Memory: maximum resident set size from /usr/bin/time on the benchmark process.
Status Workload Setup contribution Setup and preparation Setup vector size Prepared NTT cache size Verifier NTT cache size Commit Prove Verify Peak process RSS Proof size
ok Fp32 - nv28Onehot256 direct 0.045 s 36.0 MiB 144.0 MiB 1.2 MiB 0.095 s 1.517 s 34.4 ms 462.0 MiB 77,806 bytes
ok Fp64 - nv28Onehot256 direct 0.038 s 40.0 MiB 120.0 MiB 0.9 MiB 0.083 s 1.216 s 33.1 ms 554.4 MiB 83,615 bytes
ok Fp128 - nv24Dense direct 0.098 s 86.0 MiB 430.0 MiB 1.4 MiB 1.571 s 1.148 s 20.3 ms 1395.8 MiB 84,980 bytes
ok Fp128 - nv32Onehot256 direct 0.132 s 128.0 MiB 535.0 MiB 1.4 MiB 1.024 s 1.503 s 24.8 ms 1330.1 MiB 85,081 bytes
ok Fp128 - nv32Onehot256 - Batched4 - MultiGroup direct 0.240 s 430.0 MiB 1075.0 MiB 1.6 MiB 2.919 s 1.421 s 26.7 ms 2428.4 MiB 85,063 bytes
ok Fp128 - nv32Onehot256 - Batched4 - AdaptiveMultiGroup recursive 1.150 s 256.0 MiB 750.8 MiB 1.4 MiB 2.837 s 3.275 s 28.9 ms 2183.6 MiB 92,089 bytes
ok Fp128 - nv32Onehot256 - Batched4 - AdaptiveMultiGroupW8R2 recursive 0.939 s 172.7 MiB 1181.7 MiB 1.4 MiB 3.034 s 11.319 s 46.3 ms 3695.6 MiB 98,320 bytes
ok Fp128 - nv32Onehot256 - MultiChunkW2R2 direct 0.123 s 128.0 MiB 535.0 MiB 1.4 MiB 0.989 s 2.084 s 23.0 ms 1623.3 MiB 85,301 bytes
ok Fp128 - nv32Onehot256 - MultiChunkW4R2 direct 0.148 s 128.0 MiB 572.0 MiB 1.4 MiB 0.991 s 2.989 s 30.2 ms 2040.4 MiB 86,245 bytes
ok Fp128 - nv32Onehot256 - MultiChunkW8R2 direct 0.144 s 128.0 MiB 553.5 MiB 1.4 MiB 0.990 s 4.954 s 33.8 ms 2789.8 MiB 88,377 bytes

Terminal response component breakdown

Workload Folded response (z) Opening values (e) Inner-commitment values (t) Total terminal response
Fp32 - nv28Onehot256 21,378 bytes 3,072 bytes 24,576 bytes 49,026 bytes
Fp64 - nv28Onehot256 21,479 bytes 7,168 bytes 28,672 bytes 57,319 bytes
Fp128 - nv24Dense 21,860 bytes 7,168 bytes 28,672 bytes 57,700 bytes
Fp128 - nv32Onehot256 21,849 bytes 7,168 bytes 28,672 bytes 57,689 bytes
Fp128 - nv32Onehot256 - Batched4 - MultiGroup 21,831 bytes 7,168 bytes 28,672 bytes 57,671 bytes
Fp128 - nv32Onehot256 - Batched4 - AdaptiveMultiGroup 21,845 bytes 7,168 bytes 28,672 bytes 57,685 bytes
Fp128 - nv32Onehot256 - Batched4 - AdaptiveMultiGroupW8R2 21,868 bytes 7,168 bytes 28,672 bytes 57,708 bytes
Fp128 - nv32Onehot256 - MultiChunkW2R2 21,845 bytes 7,168 bytes 28,672 bytes 57,685 bytes
Fp128 - nv32Onehot256 - MultiChunkW4R2 21,861 bytes 7,168 bytes 28,672 bytes 57,701 bytes
Fp128 - nv32Onehot256 - MultiChunkW8R2 21,829 bytes 7,168 bytes 28,672 bytes 57,669 bytes

The z column includes its per-segment length prefixes and Golomb payload; e and t are raw field bytes. These three columns sum exactly to the serialized terminal response.

Detailed schedule and proof-size breakdowns by fold level are available in the uploaded report.md benchmark artifact.

omibo added 4 commits August 6, 2026 17:00
# Conflicts:
#	.github/workflows/profile-bench.yml
#	book/src/usage/profiling.md
#	crates/akita-config/Cargo.toml
#	crates/akita-config/src/lib.rs
#	crates/akita-config/src/precommitted_commitment.rs
#	crates/akita-config/src/recursive_commitment.rs
#	crates/akita-config/tests/generated_tables.rs
#	crates/akita-config/tests/runtime_fallback.rs
#	crates/akita-config/tests/schedule_catalog_miswire.rs
#	crates/akita-pcs/Cargo.toml
#	crates/akita-pcs/examples/profile/modes.rs
#	crates/akita-pcs/tests/support/mod.rs
#	crates/akita-planner/examples/mixed_dimension_search.rs
#	crates/akita-planner/src/emit/mod.rs
#	crates/akita-planner/src/generated_families.rs
#	crates/akita-planner/src/planner.rs
#	crates/akita-planner/src/schedule_params.rs
#	crates/akita-planner/src/test/schedule_params.rs
#	crates/akita-schedules/Cargo.toml
#	crates/akita-schedules/src/catalog_identity.rs
#	crates/akita-schedules/src/generated/fp128_d128_dense.rs
#	crates/akita-schedules/src/generated/fp128_d128_onehot.rs
#	crates/akita-schedules/src/generated/fp128_d256_onehot.rs
#	crates/akita-schedules/src/generated/fp128_d64_dense_multi_chunk.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_multi_chunk.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_multi_chunk_w2r2.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_multi_chunk_w4r2.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_recursive.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_recursive_multi_chunk_w8r2.rs
#	crates/akita-schedules/src/generated/fp128_d64_onehot_tensor.rs
#	crates/akita-schedules/src/generated/fp128_dense.rs
#	crates/akita-schedules/src/generated/fp128_mixed_dim_onehot.rs
#	crates/akita-schedules/src/generated/fp128_onehot.rs
#	crates/akita-schedules/src/generated/fp32_d128_onehot.rs
#	crates/akita-schedules/src/generated/fp32_d256_onehot.rs
#	crates/akita-schedules/src/generated/fp64_d128_dense.rs
#	crates/akita-schedules/src/generated/fp64_d128_onehot.rs
#	crates/akita-schedules/src/generated/fp64_d256_onehot.rs
#	crates/akita-schedules/src/generated/mod.rs
#	scripts/profile_bench_report.py
@quangvdao

Copy link
Copy Markdown

Omid, thank you for the work here. This is a nice direction: making the common fp128 direct one-hot and dense paths choose ring dimensions from the actual workload is much better than encoding a single dimension everywhere. I reviewed head 43967be6150fd6ecf93b794dfb519587fcf5f960 against base 4068d713849215d2035bd0599b72a7c06cf5bec4 (98 files, 17 commits). All 41 reported checks are green.

What this PR does

Suggested title:

feat(config)!: make adaptive fp128 one-hot and dense schedules the defaults

The PR makes adaptive ring-dimension schedules the default for the direct fp128 one-hot and dense presets. The flat public matrix remains dimension-free; the selected schedule chooses the protocol dimensions. For the adaptive search, A may use D64, D128, or D256, while B/D use the configured supported choices and the suffix settles to D64. The selected schedules are emitted into generated catalogs and consumed by the runtime configuration path. Recursive and multi-chunk adaptive search remain follow-up work.

flowchart LR
    S["Dimension-free flat public matrix"] --> W["Workload: shape, density, grouping"]
    W --> C["Enumerate legal A/B/D schedules"]
    C --> O["Apply security and sizing constraints"]
    O --> R["Rank candidates by the normative objective"]
    R --> G["Generated fp128 catalog"]
    G --> P["Prover and verifier use the selected schedule"]
Loading

Representative generated behavior:

Family Example Root First fold Suffix
fp128 one-hot nv36 A/B/D = 256/128/128 256/64/64 64/64/64
fp128 dense nv24 A/B/D = 256/64/64 256/64/64 64/64/64

The change also adds useful pieces that look worth keeping: RingDimensionScheduleMode, RingDimensionCandidate, projected collision-role pricing, explicit catalog identity, generated-table coverage, and end-to-end adaptive prove/verify tests.

Findings

Blocker — the adaptive policy reintroduces the removed setup-generation/carrier dimension

The flat-public-matrix cutover removed setup generation dimension entirely: setup capacity is measured in base-field elements, and the schedule is the sole owner of A/B/D dimensions. The mixed-dimension spec says explicitly that CommitmentConfig::D is now only the uniform candidate for presets that choose one, not a setup carrier.

However, validate_policy treats uniform_ring_dimension as setup_dimension and rejects adaptive candidate dimensions unless they divide it. The new fp128 comments consequently describe D256 setup generation, which is obsolete terminology and reflects a real validation constraint rather than only a comment typo.

An adaptive policy should validate each proposed scheduled dimension against the supported ring/security/challenge dispatch directly. It should not require all dimensions to divide a global Cfg::D. The comments should describe a dimension-free flat public matrix and adaptive scheduled dimensions, not D256 setup generation.

Blocker — the implemented objective disagrees with the active normative objective

The active mixed-dimension spec defines the comparison key as:

(max_setup_fields, exact_proof_bytes, canonical_descriptor)

The PR instead introduces MinAdaptiveARankDimensionThenSetupAndProof and compares A rank/dimension before setup and proof size in runtime.rs and schedule_params.rs.

That changes which schedule is canonical. Either restore the setup-first objective in code and generated catalogs, or update the normative spec and justify the protocol-wide policy change before making this the default.

Major — candidate deduplication can discard the winner under the PR's own rank-first objective

select_adaptive_candidate first deduplicates equal A-dimension paths using setup/proof/descriptor, then compares A rank/dimension. Consider two candidates with the same A-dimension path [256, 256]:

X: A ranks [2, 2], setup 100
Y: A ranks [1, 1], setup 101

The first pass keeps X because its setup is smaller, so the later rank-first comparison never sees Y. This contradicts MinAdaptiveARankDimensionThenSetupAndProof. Selection needs one canonical comparator applied consistently, or the dedup key must retain every field that can affect the final ordering. A focused regression test with equal dimensions but different candidate ranks would pin this down.

Major — suffix frontier pruning is not rank-sound for the accepted search-depth range

The policy accepts num_search_levels from 1 through 12, but insert_frontier groups states using first-fold data plus setup/proof characteristics. For three or more adaptive levels, two states can share that grouping while having different lower-rank deeper continuations; the cheaper partial state can evict the state that wins the final lexicographic rank objective.

The exhaustive-oracle coverage that would establish this invariant was removed for the adaptive case; the remaining unpruned comparison covers only uniform D64. Please either make the frontier key/order preserve the full future-relevant rank vector, restrict the supported adaptive depth to the proven case, or restore an exhaustive comparison over representative adaptive domains and depths.

Major — planner and schedules crates now contain parallel canonical implementations

The PR duplicates CandidateFoldStep/terminal representations, stage-3 payload pricing, materialize_candidate_schedule, grouped_segment_rings, and planned_next_witness_len across akita-planner and akita-schedules. These copies already differ: the planner version rejects multi-group and unsupported compression cases that the schedules version does not, and their result shapes differ.

This is exactly the kind of split-brain sizing/schedule logic that becomes hard to audit: generation can certify one implementation while runtime materializes or prices another. Please put the shared candidate model and pricing/materialization primitives behind one canonical implementation and have both paths call it directly.

Moderate — best_onehot_schedule is now misleading single-candidate compatibility machinery

best_onehot_schedule no longer chooses among schedules. It wraps one adaptive result through Fp128Preset, Fp128ScheduleSelection, and best_by_exact_bytes, then fabricates a FoldScheduleEstimate by assigning the full total to the root and zero to the remaining components. The associated spec text still describes a D64/default comparison.

Because this repository does not promise backward compatibility, deleting this dead selection layer and returning the adaptive result directly would be clearer and safer than preserving an API whose name and breakdown no longer match its behavior.

Additional notes

  • I did not find a new verifier panic, transcript-ordering, or serialization-consensus issue in this diff.
  • No changed Rust file crosses the repository's 1,000-line threshold from below.
  • The old profile-onehot-fp128-d64 feature name now enables the adaptive catalog, so renaming it would avoid a misleading operational interface.
  • Direct grouped rows can consume adaptive/precommitted catalog entries, but planner-native adaptive multi-group search is still deferred; the PR description should keep that boundary explicit.

The core feature is worthwhile and the test/benchmark coverage is substantial. The main thing I would settle before merging is one coherent contract for dimension ownership and candidate ordering, then make the planner, runtime, generated catalogs, and specs all use that same contract.

@omibo

omibo commented Aug 7, 2026

Copy link
Copy Markdown
Author

I agreed with the findings and addressed them in bbd5f9a14, with the CI fixture follow-up in daff3a1e0.

Point-by-point:

  1. Setup-generation/carrier dimension

    Agreed. I removed the requirement that adaptive dimensions divide uniform_ring_dimension. That field now applies only to presets using a uniform schedule.

    Adaptive A/B/D candidates are validated independently against:

    • Role-specific protocol dispatch support
    • SIS security-table coverage
    • Fold-challenge support for A

    I also updated the comments and spec to consistently describe the public setup matrix as dimension-free.

  2. Normative selection objective

    Agreed. I removed the rank-first objective and restored the specified ordering:

    (physical setup field elements, exact proof payload bytes, canonical descriptor bytes)
    

    The selection policy is now MinSetupMatrixFieldElementsThenProofPayload, and the generated fp128 catalogs were regenerated using this objective.

  3. Candidate deduplication

    Agreed. The separate dimension-path deduplication and rank-based selection were removed. Complete candidates now go through one canonical comparator, so a candidate cannot be discarded using a different ordering before final selection.

  4. Suffix frontier soundness

    Agreed. The implementation now accepts exactly the audited two adaptive levels, L0 and L1; other depths are rejected by policy validation. L2 onward remains uniformly D64.

    I also restored an adaptive unpruned reference traversal and added a regression comparing setup cost, proof bytes, and canonical descriptor bytes against the production frontier.

  5. Duplicated planner/runtime implementations

    Agreed. Candidate representations and the shared schedule construction/pricing operations now have one canonical implementation in akita-schedules, including:

    • Candidate fold and terminal representations
    • Stage-3 payload pricing
    • Schedule materialization
    • Grouped segment sizing
    • Next-witness sizing

    akita-planner calls these primitives directly. The canonical witness-sizing path also preserves the multi-group rejection and unsupported-compression handling that previously differed between the copies.

  6. best_onehot_schedule compatibility layer

    Agreed. I deleted best_onehot_schedule, Fp128Preset, Fp128ScheduleSelection, the single-candidate comparison wrapper, and the fabricated estimate breakdown. The adaptive generated catalog is now consumed directly through the standard configuration/runtime schedule path.

Additional notes:

  • Renamed profile-onehot-fp128-d64 to profile-onehot-fp128.
  • Updated the spec and profiling documentation to remove obsolete D256 setup-generation terminology.
  • Kept planner-native adaptive multi-group, recursive-setup, and multi-chunk search explicitly out of scope for this cut.
  • Regenerating the catalogs exposed stale E2E fixtures that still constructed polynomials using Cfg::D. Those now use the schedule-selected layout.d_a() and layout-dispatched opening evaluation.

Validation after these changes:

  • Full CI-equivalent test graph: 1,254 tests passed across 50 binaries
  • All three required Clippy configurations passed
  • Formatting, generated-table drift, dependency hygiene, line-limit checks, script tests, Machete, and typos all passed

Remove the obsolete setup generation dimension from live requirements. Document the current local B/D rank choice as a P0 limitation and keep full Cartesian optimization as the target.
@cursor

cursor Bot commented Aug 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Breaking preset, feature, and generated-catalog changes affect default proving/verification configuration and proof-size behavior; incorrect adaptive policy or catalog drift would be protocol-critical, though the PR adds extensive parity and identity guards.

Overview
Adaptive ring dimensions replace fixed-D fp128 production paths: CommitmentConfig now exposes RingDimensionScheduleMode (uniform vs bounded adaptive L0/L1 search with D64 suffix) instead of RING_DIMENSION_CANDIDATES, and default presets are fp128::OneHot / fp128::Dense with generated fp128_onehot / fp128_dense tables. Uniform D64OneHot / D64Dense remain for recursive, multi-chunk, and comparison use; shipped D128/D256/mixed-dim generated families and best_onehot_schedule / best_dense_schedule are removed.

Breaking surface area spans Cargo features (schedules-fp128-onehot, profile-onehot-fp128), CI/profile-bench case names, book quickstart/profiling docs, and tests/benches that now resolve schedules via runtime_schedule and use layout.d_a() for poly construction. Test helpers add opening_from_poly_for_layout for variable root ring degree; profile defaults move to AKITA_MODE=onehot_fp128 and AKITA_NUM_VARS=32.

Planner/catalog emission binds ring_dimension_schedule_mode in catalog identity; generated family lists and miswire tests target the new adaptive catalogs. Recursive/multi-chunk fp128 profiles stay on explicit D64 companions.

Reviewed by Cursor Bugbot for commit 8e243cb. Bugbot is set up for automated code reviews on this repo. Configure here.

@quangvdao

Copy link
Copy Markdown

Omid, thank you again for the work on this. The PR is a useful improvement, and I am comfortable treating the remaining B/D search issue as explicit follow-up work so this stack can keep moving.

Follow-up: apply the canonical objective to the full B/D domain

Production currently enumerates A dimensions, then collision_role_price selects B and D locally by minimum secure rank and dimension. The rank-one early exit can remove a B/D choice before the complete schedule comparator sees its setup and proof cost.

An independent full-domain probe found this concrete case for fp128 one-hot at nv=14:

Search Root A/B/D Setup fields Proof bytes
Current production search 256/64/64 65,536 73,764
Explicit Cartesian traversal 256/128/128 65,536 73,652

The explicit tuple wins by 112 proof bytes at the same setup cost. The current checked-in unpruned test varies A while holding B and D at D64, so it cannot detect this case.

I pushed 95dfaf449 to make the active spec honest about the current boundary. It now records full Cartesian B/D optimization as P0 follow-up work and removes the obsolete setup generation model from the live requirements.

The follow-up should:

  1. Enumerate each role-valid CommitmentRingDims tuple at L0 and L1.
  2. Remove the local B/D rank choice and rank-one early exit.
  3. Compare every complete candidate with the catalog objective.
  4. Add the nv=14 case and a full-domain traversal regression.

This note is intended to preserve the measured limitation and the next correction, not to hold up the current stacked PR.

Comment thread crates/akita-pcs/benches/akita_e2e.rs Outdated
Comment thread crates/akita-pcs/benches/root_kernels.rs

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 8e243cb. Configure here.

Comment thread crates/akita-pcs/benches/akita_e2e.rs
omibo and others added 8 commits August 7, 2026 12:11
* feat(schedules): support adaptive multi-chunk rings

* feat(schedules): support adaptive recursive rings

* fix(schedules): include adaptive recursive precommits

* chore(schedules): regenerate after planner rebase

* fix(planner): preserve fixed-D64 tie regression
…ense

Remove fixed-D64 fp128 preset types and fp128_d64 schedule families now
superseded by adaptive Dense/OneHot catalogs, including recursive setup
offloading and Jolt recursion pinning.

Co-authored-by: Cursor <cursoragent@cursor.com>
# Conflicts:
#	crates/akita-planner/src/schedule_params.rs
#	crates/akita-schedules/src/generated/fp128_d128_dense.rs
#	crates/akita-schedules/src/generated/fp128_d128_onehot.rs
#	crates/akita-schedules/src/generated/fp128_d256_onehot.rs
#	crates/akita-schedules/src/generated/fp128_dense.rs
#	crates/akita-schedules/src/generated/fp128_dense_multi_chunk.rs
#	crates/akita-schedules/src/generated/fp128_mixed_dim_onehot.rs
#	crates/akita-schedules/src/generated/fp128_onehot.rs
#	crates/akita-schedules/src/generated/fp128_onehot_multi_chunk.rs
#	crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_precommitted.rs
#	crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w2r2.rs
#	crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w4r2.rs
#	crates/akita-schedules/src/generated/fp128_onehot_multi_chunk_w4r2_precommitted.rs
#	crates/akita-schedules/src/generated/fp128_onehot_recursive.rs
#	crates/akita-schedules/src/generated/fp128_onehot_recursive_multi_chunk_w8r2.rs
#	crates/akita-schedules/src/generated/fp128_onehot_recursive_multi_chunk_w8r2_precommitted.rs
@quangvdao
quangvdao merged commit b5cb55f into main Aug 8, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

implementation PR contains implementation of a spec spec PR contains a spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants