Skip to content

Conversation

@kunxian-xia
Copy link
Collaborator

Summary

Issue

The protocol previously implemented works like this.

  1. Each matrix is mixed with random challenges to produce a codeword f(g^i) = dot_product(m.row[i], rand_coeffs).
  2. The ith row and i+n/2th row are packed (stored) in one row (or in one leaf in the merkle tree commitment scheme).
  3. The the codeword with max height is the first to be folded using the well known FRI fold formula. But this codeword is not committed.
  4. In order to let the verifier to be able to recover the 1st evaluation in the commit phase, the verifier opens the base/input mmcs to get m.row[i] and m.row[i+n/2], mixed them with random challenges, get f(g^i) = dot_product(m.row[i], rand_coeffs) and f(-g^i) = dot_product(m.row[i+n/2], rand_coeffs). Then the verifier will fold them into a new evaluation.

When the matrix to be opened is super wide (like 1000 columns), then the above implementation will be very costly especially in the recursion verifier.

Solution

We add a new ext mmcs ext to store f(g^i) in addition to the original base/input mmcs to store m.rows().

The verifier proceeds like this.

  1. open base/input mmcs to get m.row(i).
  2. mix that row with random challenges to get f(g^i).
  3. open extension mmcs ext to get f(-g^i) (aka. sibling value).
  4. fold f(g^i) and f(-g^i).

Copy link
Collaborator

@hero78119 hero78119 left a comment

Choose a reason for hiding this comment

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

Awesome work and clean up bunch of complex condition with less code 👍👍👍 💯 💯 💯

@kunxian-xia kunxian-xia merged commit 4f5a2b9 into main Jan 21, 2026
2 checks passed
@kunxian-xia kunxian-xia deleted the feat/no-concat branch January 21, 2026 08:20
github-merge-queue bot pushed a commit to scroll-tech/ceno that referenced this pull request Jan 22, 2026
## Summary

This is a reflection of optimization
scroll-tech/gkr-backend#24 in gkr-backend to the
recursion crate.

The key idea is to reduce the number of `mmcs_verify_batch` invocated
for the integrity of input opened values.

- The number of rows in the `FriReducedOpeningAir` is reduced by half.
- The number of rows in the `NativePoseidon2Air` for `VERIFY_BATCH` is
reduced by half.

### Performance
The number of cells in the recursion prover before and after this PR is
depicted here.

The cmd to run the test is 
```
RUST_BACKTRACE=1 RUST_LOG=info,openvm_cuda_common=warn \
  cargo run --release --features "gpu,bench-metrics"  --package ceno_recursion --bin e2e_aggregate \
  -- --platform=ceno --max-cycle-per-shard=1600 \
  examples/target/riscv32im-ceno-zkvm-elf/release/examples/keccak_syscall 2>&1 | tee keccak.log
```

| chip | before | after |
| - | - | - |
| total_trace_cells | 703_991_274 | 613_158_378 |
| NativePoseidon2 | 123_469_824 |  61_734_912 |
| FriReducedOpening | 58_195_968 |  29_097_984 |
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.

3 participants