ZKFly: CUDA-Accelerated Nova for Private Sparse-Graph Execution
ZKFly binds a canonical sparse connectome to a Poseidon root and proves a chain of private weighted CSR evaluations with Nova. The public state is two field elements: a vector commitment and a fixed topology root. The implementation uses HyperKZG, GPU multi-scalar multiplication (MSM), and CUDA arithmetic for Nova's R1CS operations. Its main optimization vertically concatenates the three matrices \((A,B,C)\) and replaces three same-vector sparse products by one checked device batch. On a V100, a verified 1,024-step, 14,826-constraint fixture falls from 612.609 \mathrms to 329.535 \mathrms (\(1.859\times\)); fusion alone removes 4,092 synchronizations and 4,092 allocations relative to the resident-buffer version. For the 166,700-neuron, 25,582,938-edge artifact, we report exact execution measurements and circuit lower bounds, not an unmeasured full-network proof time.
1.Relation#
Let a canonical square CSR graph be
Columns inside every row are sorted and unique. For private \(x\in\mathbb{F}^N,w\in\mathbb{F}^M\), one step constrains
The data artifact also carries signed synapse counts \(c_e\) and uses
for its deterministic floating-point execution oracle. In the proof relation, \(w\) is an arbitrary private field witness: no training or normalization rule is claimed.
1.1Canonical roots#
Seven little-endian u32 values are packed per BN254 field. With
\(\mathsf{pack}_7\), the topology stream is
For rate \(\rho=11\), \(a_0=0\), zero-padded chunks \(q_i\in\mathbb{F}^{11}\), and domain \(D_T=\texttt{zkfly/poseidon/topology/v1}\),
The width-13, \(x^5\) Circom parameterization is fixed in host, circuit, and CUDA code. Input and output vectors use the same fold shape under a distinct domain \(D_F=\texttt{zkfly/poseidon/forward/v1}\); write the result as \(\mathsf{Com}_F(\cdot)\) [1].
- 1Require \(N\), CSR arrays \(p[0..N]\), \(j[0..M)\)
- 2Ensure \(R_G\)
- 3assert \crefeq:csr and sorted-unique columns
- 4(s\gets(L,N,N+1,M)\|\mathsfpack_7(p)\|\mathsfpack_7(j)\)
- 5(a\gets0\)
- 6For\(q\gets\mathsf{chunks}_{11}(s)\)
- 7(a\gets\mathsfPoseidon_D_T(a,q\|0^11-|q|)\)
- 8Return \(a\)
1.2Recursive state#
For step \(t\), Nova carries
The witness is \((x_t,w_t)\) and the circuit enforces
Consecutive witnesses satisfy \(\mathsf{Com}_F(x_{t+1})=\mathsf{Com}_F(y_t)\). Nova folds the resulting relaxed R1CS instances [2]. The primary commitment backend is HyperKZG, derived from the Gemini/KZG polynomial-commitment line [3, 4]; MSM is dispatched to Blitzar.
2.CUDA arithmetic boundary#
For R1CS matrices \(A,B,C\in\mathbb{F}^{m\times d}\) and packed \(z\in\mathbb{F}^d\), Nova repeatedly requests
The compatibility interface has a three-product default; the CUDA override constructs
- 1Require CSR \(A,B,C\) with \(m\) rows; packed \(z\); field \((b_F,q_F)\)
- 2Ensure \(Az,Bz,Cz\)
- 3(K_X\gets(X.p,X.j,X.v,b_F,q_F)\) for \(X\in\{A,B,C\}\)
- 4(K\gets(K_A,K_B,K_C,m)\)
- 5if \(K\notin\mathcal C\) then
- 6(\bar p\gets A.p\|\bigl(\operatornamennz(A)+B.p[1:]\bigr)\)
- 7(\phantom\bar p\gets\|\bigl(\operatornamennz(A)+\operatornamennz(B)+C.p[1:]\bigr)\)
- 8(\bar j\gets A.j\|B.j\|C.j\); \(\bar v\gets A.v\|B.v\|C.v\)
- 9(\mathcal C[K]\gets\mathsfUpload(\bar p,\bar j,\bar v,\mathsfalloc(3m))\)
- 10(z_D\gets\mathsfUpload(\mathsfMontgomery(z))\)
- 11(o_D\gets\mathsfSpMV(\mathcal C[K],z_D)\)// one launch
- 12(o\gets\mathsfDownloadAndSync(o_D)\)// one boundary
- 13Return \((o[0:m],o[m:2m],o[2m:3m])\)
Cache identity.
No digest key is used:
The bounded FIFO retains at most 8 fused CSR batches; reusable arithmetic outputs are keyed by exact field-element length.
Equivalence.
For \(0\leq r<m\), the first, second, and third row intervals of \(\bar M\) are exactly rows \(r\) of \(A,B,C\), while all column indices remain unchanged. Therefore \crefeq:vstack holds entrywise. Equality in \crefeq:key implies byte-identical canonical CSR input, field width, and modulus; hence a cache hit selects the same device matrix. A regression test checks offset shifting and ordering; every timed recursive proof is verified against its public root and endpoint commitments.
3.Operation model#
Let \(n\geq1\) be recursive steps and \(k=n-1\). Each non-base Nova fold performs two R1CS evaluations. Thus
Resident, unfused execution has
while fused execution has
Here \(S,B,A\) are synchronizations, physical arithmetic batches, and device buffer allocations. At \(n=1024\), fusion removes \(4k=4,092\) synchronizations and allocations.
4.Measurements#
Platform.
Tesla V100-SXM3-32GB (SM 7.0), CUDA 12.6.85, driver 580.159.03. Compiler:
rustc 1.96.0-nightly; cuda-oxide 0.2.0. Profiling uses a single
serialized CUDA context and reusable Nova parameters. Setup is excluded from
prove/verify columns.
| \(n\) | exclusive (s) | resident (s) | fused (s) | \(v3\) verify (s) |
|---|---|---|---|---|
| 1 | 0.067 | 0.064 | 0.064 | 0.301 |
| 8 | 3.793 | 2.363 | 2.206 | 0.126 |
| 64 | 36.814 | 22.241 | 20.388 | 0.127 |
| 1024 | 612.609 | 373.514 | 329.535 | 0.127 |
| operation | logical calls | physical batches | time (s) |
|---|---|---|---|
| \(A/B/C\) SpMV | 6,138 | 2,046 | 77.657 |
| vector linear combination | 4,092 | 4,092 | 86.097 |
| cross term | 2,046 | 2,046 | 67.736 |
| MSM | 2,047 | 2,047 | 36.268 |
| MSM scalars | 30,347,798 | ||
| CSR cache | 6,138 hit / 0 miss | ||
| output cache | 6,138 hit / 0 miss | ||
| allocations / synchronizations | 18,414 / 8,184 | ||
4.1Full artifact: execution, then capacity#
The source connectome reports 166,700 neurons [5]. The derived deterministic artifact has
and topology root
| CUDA executor | kernel (ms) | end-to-end (ms) | Gedge/s |
|---|---|---|---|
| resident row/thread | 13.575 | 13.722 | 1.864 |
| edge products + row reduce | 4.630 | 4.770 | 5.363 |
The implemented estimator uses a conservative lower bound \(C_H=2,174\) constraints per width-13 Poseidon permutation. Therefore
One topology registration plus \(T\) forward ticks has
| quantity | measured fixture | full artifact |
|---|---|---|
| neurons / edges | 3 / 4 | 166,700 / 25,582,938 |
| primary constraints | 14,826 | \(\geq\)91,643,578 |
| constraint ratio | \(1\times\) | \(\geq\)6,181.27\(\times\) |
| Poseidon vector chunks | 1 | 15,155 |
| Powers-of-Tau scale | \(2^{15}\) available | \(\geq2^{27}\) projected |
| recursive proof | verified | not run |
| wall-clock proof time | measured | not claimed |
5.Result boundary#
\begintabularx\columnwidth@lX@ proved: & \(z_0\xRightarrow[\mathcal R_G^n]{\mathrm{Nova}}z_n\);\\ measured: & \(n\leq1024\), \(C=14{,}826\), HyperKZG + GPU-MSM + CUDA;\\ estimated: & \(C_T,C_F,W_F\) for \crefeq:scale;\\ not claimed: & full-artifact or distributed proof, training, weight commitment, or 4.770 \mathrmms proof.\\ \endtabularx Nova's recursive chain is sequential in the current implementation. Graph tiles, Poseidon chunks, and MSMs admit parallel sub-work, but no distributed proof aggregation protocol is implemented or measured. A full forward proof also requires a larger commitment key, a memory study, and an end-to-end run; the small-circuit timing in \creftab:proof-profile is not extrapolated.
Receipt integrity.
The fused standard and smoke receipts have SHA-256 prefixes/suffixes
72859e53...7e6c6716 and 0930b641...c30b26, respectively.
The profile schema records logical SpMV calls separately from physical batches;
all standard cases and the 12-neuron, two-commitment-chunk regression verified.
References#
- [1]Lorenzo Grassi and Dmitry Khovratovich and Christian Rechberger and Arnab Roy and Markus Schofnegger, “Poseidon: A New Hash Function for Zero-Knowledge Proof Systems,” 30th USENIX Security Symposium, pp. 519–535, 2021, https://www.usenix.org/conference/usenixsecurity21/presentation/grassi.
- [2]Abhiram Kothapalli and Srinath Setty and Ioanna Tzialla, “Nova: Recursive Zero-Knowledge Arguments from Folding Schemes,” Cryptology ePrint Archive, Paper 2021/370, 2021, https://eprint.iacr.org/2021/370.
- [3]Jonathan Bootle and Alessandro Chiesa and Yuncong Hu and Michele Orr\`u, “Gemini: Elastic SNARKs for Diverse Environments,” Cryptology ePrint Archive, Paper 2022/420, 2022, https://eprint.iacr.org/2022/420.
- [4]Aniket Kate and Gregory M. Zaverucha and Ian Goldberg, “Constant-Size Commitments to Polynomials and Their Applications,” Advances in Cryptology – ASIACRYPT 2010, pp. 177–194, 2010, DOI: 10.1007/978-3-642-17373-8_11.
- [5]Stuart Berg and Isabella R. Beckett and Marta Costa and Philipp Schlegel and Michal Januszewski and Elizabeth C. Marin and Aljoscha Nern and Stephan Preibisch and Wei Qiu and Shin-ya Takemura and others, “Sexual dimorphism in the complete Drosophila male central nervous system connectome,” Cell, 2026, DOI: 10.1016/j.cell.2026.08.015.