Skip to content

About

Air-gapped post-quantum zkML inference prover & silent quantization-substitution verifier: Goldilocks F_p NTT, Thaler MatMul Sumcheck, Habock LogUp ReLU, cross-runtime TS/Python stdlib proof parity & Python/Rust/Solidity verifier compiler

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ProofTensor

Air-Gapped Post-Quantum zkML Inference Prover, Goldilocks Sumcheck/LogUp Circuit Compiler & Silent Quantization-Substitution Verifier


Overview

Untrusted inference providers routinely substitute lower-precision quantized weights (INT4 for FP16), inject unverified low-rank adapters, or approximate non-linear activations while billing for full-precision committed weights. ProofTensor compiles quantized neural forward passes (.safetensors / .npy) into deterministic arithmetic transcripts over the 64-bit Goldilocks prime field and verifies execution integrity using hash-based post-quantum primitives—requiring zero elliptic curves, zero pairings, and zero trusted setup.

Every cryptographic proof generated in TypeScript (BigInt) is 100% bit-for-bit identical to the zero-dependency Python 3 standard-library CLI (int), sharing the exact SHA-256 Merkle commitment root and Fiat-Shamir sponge digest.


Cryptographic & Mathematical Formulation

1. Goldilocks Prime Field & Radix-2 NTT

All witness values use signed Q10 fixed-point quantization ($\text{scale} = 2^{10} = 1024$, negative $x \mapsto p + x$) over the Goldilocks field $\mathbb{F}_p$:

$$p = 2^{64} - 2^{32} + 1 = 18446744069414584321 \quad (\texttt{0xFFFFFFFF00000001}), \qquad g = 7$$

Since $2^{32} \mid (p - 1)$, exact Radix-2 Cooley-Tukey Number Theoretic Transforms operate over $\omega_N = g^{(p-1)/N} \bmod p$ with exact inversion $\text{INTT}(\text{NTT}(w)) = w$. Flattened weight matrices $w \in \mathbb{F}_p^M$ are committed alongside their NTT spectrum in a domain-separated binary SHA-256 Merkle tree (0x00 leaf prefix, 0x01 internal node prefix).

2. Thaler MatMul Sumcheck & 3-Fold Post-Quantum Soundness Amplification

For each linear layer $y = W \cdot x$ ($W \in \mathbb{F}_p^{N \times N}$, $N = 2^\mu$), the verifier squeezes row challenge $r \in \mathbb{F}_p^\mu$ from the Fiat-Shamir sponge and reduces the multilinear claim:

$$\tilde{y}(r) = \sum_{b \in {0,1}^\mu} \tilde{W}(r, b),\tilde{x}(b) \pmod p$$

Across $\mu$ rounds, the prover emits degree-2 univariate polynomials $g_k(t)$ encoded as $[g_k(0), g_k(1), g_k(2)]$. At round $k$, the verifier checks $g_k(0) + g_k(1) \equiv C_{k-1} \pmod p$, derives $\rho_k$ via Fiat-Shamir rejection sampling over $[1, p-1]$, evaluates $C_k = g_k(\rho_k)$ via exact Lagrange interpolation over ${0,1,2}$, and checks the final claim $C_\mu \equiv \tilde{W}(r, \rho)\tilde{x}(\rho) \pmod p$ against the committed weight Merkle root.

Running $k = 3$ independent Fiat-Shamir folds yields total soundness error:

$$\varepsilon = \left(\frac{2\mu}{p}\right)^3 < 2^{-160}$$

For $\mu = 4$, $\varepsilon = (8 / p)^3 \approx 2^{-183.00}$, exceeding the 128-bit post-quantum security threshold.

3. Haböck LogUp Lookup Argument for Non-Linear ReLU

Quantized pre/post-activation pairs $(a_i, h_i) \in [-2048, 2047]^2$ are verified against the canonical ReLU table $T = {(t, \max(0, t)) : t \in [-2048, 2047]}$ ($|T| = 4096$) via Fiat-Shamir challenge $\gamma \in \mathbb{F}_p^\times$:

$$\sum_{i=0}^{N-1} \frac{1}{\gamma + \text{pack}(a_i, h_i)} \equiv \sum_{t \in T} \frac{m_t}{\gamma + \text{pack}(t, \max(0, t))} \pmod p$$


Deterministic Presets & Fault Localization

Preset Scenario Verdict Exact Fault Localization
01 Verified FP16 Proof VERIFIED_SOUND All 24 Sumcheck rounds, Merkle paths & LogUp pass (< 2^-183)
02 Silent INT4 Substitution SOUNDNESS_REJECTED Layer 0 · SUMCHECK_ROUND · Round 0 (4-bit quantization divergence)
03 1-ULP Weight Drift SOUNDNESS_REJECTED Layer 0 · FINAL_ORACLE · Round 3 (W1[5,11] + 1 caught at oracle)
04 Rank-1 Adapter Drift SOUNDNESS_REJECTED Layer 1 · SUMCHECK_ROUND · Round 2 (uncommitted LoRA splice)
05 ReLU Lookup Mismatch SOUNDNESS_REJECTED Layer 0 · LOGUP_RELU ($\text{LHS} \not\equiv \text{RHS} \pmod p$)

Canonical Cross-Runtime Reference Digests (examples/model-fp16.safetensors)

  • weightCommitmentRoot: 7925b93c97f9d6894c457779a221b43f69684e5e8890b399db2cc0ced99091e6
  • finalTranscriptHash: ed97c25d477a53c2615c57f13054261b0bc26f65c35f09ee8cc908c4df574297

Zero-Dependency Python 3 Stdlib CLI Quickstart

cli/prooftensor.py uses only the Python 3 standard library (struct, hashlib, json, math, argparse, sys) and exits 0 on VERIFIED_SOUND or 1 on SOUNDNESS_REJECTED.

# Run full FP16 + 4-drift verification matrix
python3 cli/prooftensor.py --demo

# Prove binary .safetensors or .npy weights into a self-contained .ptzk.json artifact
python3 cli/prooftensor.py --prove examples/model-fp16.safetensors --out /tmp/proof.ptzk.json

# Verify proof against an expected 64-char SHA-256 weight commitment root
python3 cli/prooftensor.py --verify examples/valid-proof.ptzk.json \
  --commitment 7925b93c97f9d6894c457779a221b43f69684e5e8890b399db2cc0ced99091e6

# Simulate untrusted provider drift (exits 1 with exact failing stage & round)
python3 cli/prooftensor.py --simulate-drift int4 --json

# Export standalone bound verifiers (py | rs | sol | rego)
python3 cli/prooftensor.py --export-verifier sol

Local Build & Verification

npm install
npx tsc --noEmit
npm test
python3 -m unittest discover -s cli -v
npm run parity
npm run build:standalone
npm run build

License & Commercial Inquiries

Released under the MIT License.

For enterprise hardware-accelerated Goldilocks/AVX-512 provers, custom operator lookup tables, sovereign air-gapped deployment packages, commercial licensing, or acquisition inquiries, contact ZASA4 via GitHub (github.com/ZASA4).

About

Air-gapped post-quantum zkML inference prover & silent quantization-substitution verifier: Goldilocks F_p NTT, Thaler MatMul Sumcheck, Habock LogUp ReLU, cross-runtime TS/Python stdlib proof parity & Python/Rust/Solidity verifier compiler

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages