Skip to content

Generate GKR product forests with lazy L2/L4/L8 storage #107

Done

Description

@wu-s-john

The target constructs bit-affine leaves and retains every grand-product level. Its reduction path explicitly leaves lazy lower layers as a TODO.

This issue owns lazy forest construction and on-demand regeneration of omitted lower layers, with eager execution retained as the correctness oracle and fallback.

Sources

The target repository's existing relation, field encoding, coordinate order, and transcript contracts are authoritative. The current target implementation determines compatibility; the PoC implementation is reference-only and must be re-derived against those contracts.

In scope

  • Define L2/L4/L8 storage schedules against the target's actual variable/column order, including minimum valid depths and final leaf handoff.
  • Share public bit-affine case tables across trees; retain only necessary upper products and reconstruct each requested lower layer from packed witness bits.
  • Keep roots, sumcheck messages, closing pairs and terminal claims unchanged. A schedule is prover-local metadata and must not influence Fiat–Shamir challenges.

Out of scope: arity-four proofs, new GKR relations, transcript changes, hardware kernels, and automatic platform tuning (#116).

Potential impact

For N leaves, the PoC's dominant tree-storage terms are about 8N/4N/2N bytes versus about 32N eager bytes. These are buffer estimates, not total RSS or speedups; shared lookup tables, scratch and reconstruction work remain. L8 may trade latency for memory.

Done when

  • Differentially compare every reconstructed layer, root and final evaluation with eager execution across tall, shallow, singleton and padded shapes.
  • For fixed inputs/transcript seeds, all supported schedules produce byte-identical proofs and terminal claims. Tampered roots, layer messages, closing pairs and terminal openings still reject.
  • Reject unsupported schedule/depth combinations and overflowed geometry; no private value selects the schedule.
  • Measure peak live tree/scratch/table bytes, RSS and prove time for forced schedules with matched field, shape, witness, compiler and worker count.

Dependencies and coordination

Coordinate with #52, #8. The GKR tracker #52 tracks the wider programme; this issue owns only the scoped implementation above.

Activity

  1. added
    enhancement
    difficulty: hard
    gkr
    lazy-tables
    memory
    optimization-port
    urgency: high
    on Sep 24, 2026
  2. zkfriendly commented on Nov 24, 2026

    @zkfriendly
    Collaborator

    Status update (main 34addac): partially implemented by #146 (f433296). Layers 0–2 are now lazy via 16-entry nibble lookup tables (LutLayers in crates/gkr/src/lib.rs), materializing only from layer 3 up (the eager leaves and TODO in crates/prover/src/reduce.rs are gone). Remaining scope: selectable L2/L4/L8 schedules and an eager fallback.

  3. zkfriendly commented on Nov 24, 2026

    @zkfriendly
    Collaborator

    Closing as substantially completed by #146 (f433296): LutLayers (crates/gkr/src/lib.rs) already keeps layers 0–2 lazy via 16-entry nibble lookup tables and builds from layer 3 up. Configurable L2/L4 schedules and an eager fallback are not needed on current workloads; reopen if a shape ever regresses with the fixed lazy schedule.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: hardenhancementgkrlazy-tablesmemoryoptimization-porturgency: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions