Skip to content

docs(book): explain advanced Akita relation layouts - #349

Open
f7ed wants to merge 4 commits into
freya/akita-book-relation-in-foldfrom
freya/akita-book-advanced-relation
Open

docs(book): explain advanced Akita relation layouts#349
f7ed wants to merge 4 commits into
freya/akita-book-relation-in-foldfrom
freya/akita-book-advanced-relation

Conversation

@f7ed

@f7ed f7ed commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add an advanced relation-layout chapter on top of the four basic physical relation families
  • explain how multiple commitment groups retain group-local consistency, A, and B rows while sharing the level-owned D relation
  • document the canonical group row order, witness concatenation, shared quotient tail, and transition from a multi-group root to ordinary single-group recursion
  • add scoped follow-up sections and implementation sources for multiple witness chunks and mixed ring dimensions
  • link the advanced chapter from the basic Akita-fold chapter and book navigation

Scope

This is a stacked follow-up to #340. The base PR owns the one-group, one-chunk, common-dimension derivation; this PR owns the generalized physical layouts.

Testing

  • git diff --check
  • ./scripts/check-doc-guardrails.sh

Dependency

This PR targets freya/akita-book-relation-in-fold and should be reviewed after #340. Once #340 merges, it can be retargeted to the parent book branch.

@cursor

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Documentation-only changes to the book; no runtime, protocol, or security-sensitive code paths are modified.

Overview
Introduces Advanced relation layouts as a new proving-protocol chapter and registers it in SUMMARY.md right after the basic Akita-fold page.

The new page frames three layout axes on top of the four unchanged physical relation families, then fully documents multiple commitment groups: per-group folded responses and local consistency | A | B rows, a single level-owned D relation over concatenated opening digits, canonical row/RHS and witness concatenation with one shared quotient tail, and how the multi-group root collapses back to ordinary single-group recursion. Multiple witness chunks and different ring dimensions are stub sections with planned sources and links to opening-points layout.

Basic relations in an Akita fold now points readers to the advanced chapter instead of saying advanced layouts are out of scope, and the verifier section cross-links the generalized logical layout before the opening-points witness-order page.

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

@github-actions

github-actions Bot commented Aug 4, 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: 3

book-tooling

Book structure and guardrails

Code paths touched:

  • book/src/SUMMARY.md
  • book/src/how/proving/advanced-relation-layouts.md
  • book/src/how/proving/akita-fold.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.

@github-actions github-actions Bot added the no-spec PR has no spec file label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Benchmark Report

  • Latest run: 022ed79
  • Message: Merge branch 'freya/akita-book-relation-in-fold' into freya/akita-book-advanced-relation
  • Ref: freya/akita-book-advanced-relation
  • Workflow run: run 31113765737 attempt 1
  • Report generated: 2026-08-06T15:15:31Z.
  • Main baseline: f80c759 from the merge-base benchmarked on this runner.
  • Previous run: 3ecc076 from the previous PR update with a benchmark artifact.
  • 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 - D=128 direct 0.041 s
-1.18% vs main
36.0 MiB
+0.00% vs main
144.0 MiB
+0.00% vs main
1.2 MiB
+0.00% vs main
0.093 s
-12.57% vs main
1.544 s
-0.42% vs main
34.2 ms
+1.74% vs main
461.5 MiB
-0.42% vs main
77,834 bytes
+0.00% vs main
ok Fp64 - nv28Onehot256 - D=128 direct 0.037 s
+3.00% vs main
40.0 MiB
+0.00% vs main
120.0 MiB
+0.00% vs main
0.9 MiB
+0.00% vs main
0.083 s
+16.15% vs main
1.095 s
-0.90% vs main
32.0 ms
-2.72% vs main
559.9 MiB
+0.50% vs main
83,596 bytes
+0.00% vs main
ok Fp128 - nv24Dense - D=64 direct 0.152 s
-0.15% vs main
215.0 MiB
+0.00% vs main
537.5 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
1.844 s
-0.52% vs main
1.316 s
+0.22% vs main
18.0 ms
+2.46% vs main
1568.4 MiB
+1.11% vs main
83,562 bytes
+0.00% vs main
ok Fp128 - nv26Onehot256 - D=64 - Tensor direct 0.701 s
-0.33% vs main
1024.0 MiB
+0.00% vs main
2560.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
0.155 s
+1.79% vs main
1.327 s
-1.17% vs main
38.3 ms
+0.11% vs main
4136.5 MiB
-0.04% vs main
85,080 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - D=64 direct 0.210 s
+0.05% vs main
320.0 MiB
+0.00% vs main
800.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
1.248 s
-0.51% vs main
1.223 s
+1.02% vs main
24.6 ms
+2.12% vs main
1694.5 MiB
+0.01% vs main
84,972 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - D_a=256D_b=128D_d=128 - MixedD256ToD64 direct 0.140 s
+0.05% vs main
128.0 MiB
+0.00% vs main
608.5 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
0.980 s
-0.81% vs main
1.321 s
+0.26% vs main
20.1 ms
+2.75% vs main
1409.3 MiB
-0.08% vs main
85,080 bytes
+0.00% vs main
ok Fp128 - nv30Onehot256 - Batched4 - D=64 direct 0.211 s
-0.16% vs main
320.0 MiB
+0.00% vs main
800.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
1.179 s
-0.47% vs main
1.215 s
-0.51% vs main
25.2 ms
+4.67% vs main
1700.5 MiB
+0.22% vs main
84,970 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroup direct 0.429 s
-0.12% vs main
1032.0 MiB
+0.00% vs main
1075.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
3.140 s
-0.15% vs main
1.645 s
-1.78% vs main
29.3 ms
+0.53% vs main
3029.7 MiB
-0.38% vs main
85,093 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroup recursive 3.916 s
+0.15% vs main
1032.0 MiB
+0.00% vs main
1075.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
3.144 s
+0.01% vs main
3.427 s
-0.15% vs main
26.0 ms
-0.15% vs main
3774.9 MiB
-0.18% vs main
89,873 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroupW8R2 recursive 1.732 s
+0.09% vs main
430.0 MiB
+0.00% vs main
1075.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
3.137 s
-0.08% vs main
10.187 s
-0.54% vs main
36.4 ms
+3.33% vs main
3573.9 MiB
+0.01% vs main
95,904 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - D=64 - MultiChunkW2R2 direct 0.207 s
+0.14% vs main
320.0 MiB
+0.00% vs main
800.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
1.229 s
+0.40% vs main
1.552 s
+0.75% vs main
25.0 ms
+0.77% vs main
1847.1 MiB
+0.26% vs main
85,331 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - D=64 - MultiChunkW4R2 direct 0.221 s
-0.87% vs main
344.0 MiB
+0.00% vs main
860.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
0.427 s
+0.11% vs main
1.813 s
-0.54% vs main
28.4 ms
+0.88% vs main
2021.4 MiB
-0.11% vs main
85,946 bytes
+0.00% vs main
ok Fp128 - nv32Onehot256 - D=64 - MultiChunkW8R2 direct 0.222 s
+0.13% vs main
344.0 MiB
+0.00% vs main
860.0 MiB
+0.00% vs main
1.4 MiB
+0.00% vs main
0.427 s
-0.46% vs main
2.552 s
+0.35% vs main
30.4 ms
-0.84% vs main
2262.9 MiB
+0.27% vs main
86,215 bytes
+0.00% vs main

Negative deltas are improvements for time, memory, and proof size.

Terminal response component breakdown

Workload Folded response (z) Opening values (e) Inner-commitment values (t) Total terminal response
Fp32 - nv28Onehot256 - D=128 21,406 bytes 3,072 bytes 24,576 bytes 49,054 bytes
Fp64 - nv28Onehot256 - D=128 21,460 bytes 7,168 bytes 28,672 bytes 57,300 bytes
Fp128 - nv24Dense - D=64 21,854 bytes 7,168 bytes 28,672 bytes 57,694 bytes
Fp128 - nv26Onehot256 - D=64 - Tensor 21,848 bytes 7,168 bytes 28,672 bytes 57,688 bytes
Fp128 - nv32Onehot256 - D=64 21,852 bytes 7,168 bytes 28,672 bytes 57,692 bytes
Fp128 - nv32Onehot256 - D_a=256D_b=128D_d=128 - MixedD256ToD64 21,848 bytes 7,168 bytes 28,672 bytes 57,688 bytes
Fp128 - nv30Onehot256 - Batched4 - D=64 21,850 bytes 7,168 bytes 28,672 bytes 57,690 bytes
Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroup 21,861 bytes 7,168 bytes 28,672 bytes 57,701 bytes
Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroup 21,825 bytes 7,168 bytes 28,672 bytes 57,665 bytes
Fp128 - nv32Onehot256 - Batched4 - D=64 - MultiGroupW8R2 21,868 bytes 7,168 bytes 28,672 bytes 57,708 bytes
Fp128 - nv32Onehot256 - D=64 - MultiChunkW2R2 21,875 bytes 7,168 bytes 28,672 bytes 57,715 bytes
Fp128 - nv32Onehot256 - D=64 - MultiChunkW4R2 21,850 bytes 7,168 bytes 28,672 bytes 57,690 bytes
Fp128 - nv32Onehot256 - D=64 - MultiChunkW8R2 21,831 bytes 7,168 bytes 28,672 bytes 57,671 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.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

CI test timing

  • Report generated: 2026-08-06T15:15:21Z.
  • Source: 5dc8b01 on freya/akita-book-advanced-relation.
  • Workflow run: 31113768705.
  • Main baseline: c9ca8e9.
  • Previous run: 9ef83c9.

Run summary

Wall s Main wall s Main Δ Ratio Tests Skipped Failed Status
310.0 302.0 +2.6% 1.03x 1278 0 0 ok

Wall time spans 2 parallel nextest slice shards.

Slowest tests

Rank Duration s Test
1 12.2 akita-planner::schedule_params::tests::pruned_mixed_search_matches_unpruned_traversal_and_is_canonical
2 9.3 akita-pcs::akita_e2e::dense_d64_snap_regen_prove_verify_nv24
3 7.0 akita-planner::schedule_params::tests::mixed_nv36_benchmark_policy_selects_minimum_setup_schedule
4 6.3 akita-prover::kernels::linear::tests::chunking::q128_many_blocks_digits_chunk_instead_of_unsafe_block_parallel
5 5.8 akita-planner::schedule_params::tests::uniform_suffix_dp_matches_unpruned_exact_cutover_search
6 5.0 akita-pcs::single_poly_e2e::single_dense_nv18
7 4.8 akita-sis-estimator::search_mode_parity::parallel_exhaustive_matches_serial_exhaustive_smoke
8 4.4 akita-pcs::setup::d128_dense::same_size_passes
9 4.4 akita-pcs::batched_aggregated_e2e::aggregated_mixed_dense_and_onehot_under_dense_cfg
10 4.4 akita-pcs::scheme::tests::onehot::multi_group_root_allows_precommitted_arity_above_final_group
11 4.4 akita-sis-estimator::search_mode_parity::exhaustive_search_is_at_least_as_good_as_local_minimum_smoke
12 4.0 akita-pcs::setup::d128_dense::large_setup_batch_passes
13 3.7 akita-pcs::batched_aggregated_e2e::non_zk_aggregated_cases::aggregated_onehot_nv20_batch4
14 3.5 akita-pcs::setup::d64_dense::large_setup_nv_passes
15 3.3 akita-pcs::setup::d128_dense::large_setup_nv_passes
16 3.1 akita-pcs::setup::d128_dense::small_setup_nv_panics
17 3.1 akita-pcs::heterogeneous_prove_e2e::heterogeneous_delegating_clusters_batched_prove_and_verify
18 2.8 akita-planner::schedule_params::tests::recursive_exact_cutover_proof_size_is_documented
19 2.8 akita-prover::protocol::sumcheck::relation_range_image::tests::stage2_large_odd_dense_prefix_matches_padded_reference
20 2.8 akita-pcs::fold_linf::fold_recursive_handle_tamper_rejected

Regressions vs main

No per-test regressions above the threshold.

New slow tests

No new tests ≥30s vs main baseline.

@quangvdao quangvdao 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.

Freya, thank you for the thoughtful stacked follow-up. The final-group-first ordering, group-local consistency/A/B structure, level-shared D relation, and transition back to a single recursive witness are all valuable explanations. I also appreciate that the chunk and mixed-dimension sections are clearly marked as scoped stubs rather than presented as finished derivations.

I am requesting changes on the advanced chapter for three code-level mismatches:

  1. Groups do not share one root opening point. Claims within a group share a point, but each PolynomialGroupClaims owns its complete point. Different groups may have distinct values and arities; the heterogeneous-group end-to-end test proves and verifies exactly that case. Please revise the shared-root-point statement and carry group-local points through the explanation.
  2. The stated multi-group RHS and witness are the raw-mode realization, not the production root layout. A production root is compressed: ordinary B/D targets are private intermediate images, F/H compression rows are appended, only terminal p_F/p_H payloads are public, and WitnessLayout contains compression digits, alignment ranges, and compression quotient rows. Please label the existing equations as the raw or semantic layout and add the compressed multi-group physical layout inherited from #340.
  3. The source list cites crates/akita-verifier/src/protocol/ring_switch/mixed_relation.rs, which was deleted. The current verifier implementation is in relation_evaluation.rs and prepared_relation_point.rs. Please update the citation and fix scripts/check-book-source-paths.sh so this class of missing path fails CI; the current rg output includes the Markdown filename prefix, which the script mistakes for the cited path.

The existing opening-points-layout.md page also describes only a simple ordinary quotient tail. Once #340 corrects that foundational page and folds/archives the compression and Stage 2 specs, please rebase this PR and make the advanced chapter use the corrected mode-aware terminology. The spec lifecycle work belongs in #340, so it does not need to be duplicated here.

The structure and exposition are promising. These are targeted corrections needed so readers can safely treat the new chapter as a description of the shipped protocol.

@quangvdao

Copy link
Copy Markdown

Coordination note from PR #371: this PR remains the owner of advanced logical relation layouts. PR #371 now documents verifier replay, exact unequal chunk ranges, mixed setup roles, compact trace and setup evaluation, and terminal checks. When this stack is updated, please keep the logical multi-group exposition here, but use a distinct complete opening point for each group, describe the compressed F and H production rows, and replace equal-size or padding assumptions with the exact ranges [floor(cB/C), floor((c+1)B/C)). The multi-chunk and mixed-dimension sections should link to the verifier chapters from #371 for execution details instead of introducing a second verifier layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-spec PR has no spec file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants