Verifiable inference for production LLM APIs. By Liang Song.
English · 简体中文 · Project Homepage · Reviewer Guide · Paper (PDF) · Specs (01–11)
When you call a closed-weight LLM API, you have no cryptographic proof of what ran behind the endpoint: whether the server routed your request to a smaller model under load, quantized a bf16 checkpoint to int4, skipped layers, truncated context, or shortened a hidden system prompt to save reasoning tokens.
FlashProve-Next attaches a verifiable zero-knowledge-masked proof to an API response under two constraints:
- Keep production serving intact. No fixed-point surrogate model and no deterministic-integer rewrite. Inference runs in native floating point (
bf16/fp8/mxfp4withfp32GEMM reductions), with temperature/top-$p$ sampling, FlashAttention, CUDA Graphs, continuous batching, and prefix caching. Proving runs asynchronously after streaming finishes. - Protect serving secrets. The proof hides model weights, hidden system prompts, hidden chain-of-thought (
CoT) text, intermediate activations, and multi-turn encrypted state. Inv1.0.0, dense full-reply profiles still expose coarse geometry (layer/width tier); cross-architecture hidden-table privacy is deferred tov2.
Verify an exact 8,388,608 B zero-padded FPN2 container (fpn2-llm-std-v1, Q = 72, 64-row reference circuit) using both the zero-dependency #![forbid(unsafe_code)] Rust CLI (core/) and the detached pure-Python reference (verifier/python/, AST-tested for zero prover imports):
pip install numpy # needed by the Python harness; Rust fpn-verify has zero dependencies
cargo build --release --manifest-path core/Cargo.toml --bin fpn-verify
python demo/run_v1_relation2_demo.pyOn an unloaded Apple M1 CPU, the honest 8 MiB container verifies in ~10 ms (warm Rust CLI) and ~110 ms (Python), while all 8 negative checks (E_CIRCUIT_UNPINNED, E_CIRCUIT_PINNED, E_STMT_UNPINNED, E_STMT_PINNED, E_PADDING, E_LENGTH, gate forgery E_SUMCHECK, range forgery E_GKR_ROOT) reject identically across both verifiers and re-proving shares 0 aligned 64-byte private blocks.
Verify bundled proofs (Stage 1 FPNZK1 gzip format, ~10.1 MiB each) generated by unsliced Qwen/Qwen3-0.6B (L = 28, d = 1024, V = 151,936) on live vLLM 0.33 (CUDA_VISIBLE_DEVICES="" is enforced automatically; ~30–145 s total on Apple M1 depending on CPU load):
pip install -e ".[tokenizers]"
python -m flashprove_next.build_ext # optional C++ Goldilocks speedup; pure NumPy works too
python demo/run_demo.pyChecks 3 honest replies (VERIFIED: hidden system prompt + hidden <think> CoT, Turn-1 multi-turn St_prev -> St_new chain, strict JSON-Schema constrained decoding) and 6 attacks (REJECTED: live int4-quantized server, missing --allow-reduced-security, altered reply token, replayed nonce, tampered St_prev, injected schema). Bundled proofs use the compact qwen3-0.6b-demo profile (4 + 2 draws); production profiles use NI-315 (210 + 105) or ExtSeed-153 (102 + 51).
One boundary is worth stating upfront: in v1.0.0, the zero-dependency Rust binary verifies self-contained FPN2 containers (Relations 1–6), whereas full 12-round interactive LLM replies (FPNZK2) still run through the Python verifier.
| Format | What It Proves | Prover | Verifier | Lean 4 Coverage |
|---|---|---|---|---|
FPN2 (binary, fixed size) |
Self-contained Relations 1–6: Relation 2 (8 MiB 64-row demo), Relation 4 AIR, Relations 5–6 (32×1024 tiles, incl. live vLLM 30B MoE) |
prover/fpn_prover/backend/ |
Zero-dep Rust core/ (fpn-verify, 10–24 ms) & detached Python verifier/python/ |
Executable verifiers for Rel 1, 3–5 (131/131 golden vectors) + conditional Fpn2EndToEnd (THEOREM.md §2.4); Rel 2 & 6 open |
FPNZK2 (8 MiB transitional zero-padded JSON) |
Full 12-round interactive replies (Qwen3-0.6B ExtSeed-153, Qwen3-4B dev 4+2, 14/14 cheating matrix) |
flashprove_next/reply_zk.py → folded_engine.py (ZK-masked; simulator open) |
Isolated Python CPU verifier verifier/fpn_verify.py (10.8 s 0.6B / 7.2 s 4B; shares Python stack) |
Protocol-level RBR, sampling, mask, and blinding modules only; no executable Lean verifier yet |
FPNZK1 (Stage 1 gzip) |
Historical v0.3.0 NI-315 (149.8 MB) & bundled laptop demo (demo/run_demo.py) |
Legacy flashprove_next/zk_flat.py (--backend legacy) |
Isolated Python CPU verifier verifier/fpn_verify.py |
Protocol-level RBR, sampling, mask, and blinding modules only |
Anthropic's FlashProve showed that closed-weight 400B MoE inference can be proved without hardware enclaves by proving exact full-layer execution of a deterministic 4-bit integer surrogate. FlashProve-Next targets a different point in the design space: keeping native floating-point production serving unchanged.
| Dimension | FlashProve (2026-11) | FlashProve-Next |
|---|---|---|
| Guarantee | Exact full-layer execution of a committed 4-bit integer surrogate | Cost-weighted spot-check threshold (NI-315 (ExtSeed-153 (C_pre) |
| Committed model | Deterministic 4-bit integer surrogate | Deployed bf16/fp8/mxfp4 weights, per-operator rounding bounds, hidden prompts, and sampling key |
| Serving stack | Greedy or fixed-seed integer execution across all layers | Native FP (fp32 GEMM reductions), random temperature/top-$p$ sampling, FlashAttention, CUDA Graph, continuous batching, prefix caching |
| Privacy | Weights only; architecture public; no hidden prompts, CoT, or multi-turn state | Weights, hidden prompts, hidden CoT, activations, and multi-turn state (v1.0.0 dense reply_zk fixes coarse geometry per profile; cross-architecture hiding in v2) |
| Commitment lifetime | Exhausts after 688,127 batches | Non-depleting static RS commitment opened inside proofs (HCO, specs/09) |
| Proving structure | Proves every layer of every token | Proves a fixed cost-weighted sample (315 or 153 draws), independent of depth |
-
Non-depleting static RS commitment (
HCO,specs/09). Weights, radius matrices, hidden prompts, and the sampling key are committed once intomodel_idwith a one-time setup proof$\pi_{\rm setup}$ . Later proofs open touched GEMM tiles inside the circuit with fresh blinding, so the commitment does not wear out. -
Single-hop local rounding contracts & lineage billing (
specs/06). If a surrogate diverges from native FP on even a small fraction of honest requests, the bit "could the server produce a proof?" leaks hidden activations (paper/flashprove-next.pdf§9.4). Checking each sampled operator against a local reference from the engine's own committed inputs keeps rounding bounds at single-operator scale, while consumer-lineage billing (Rule CA) closes zero-operand layer skipping. -
Sort-free bucketed sampling &
$\mathbb F_{p^3}$ constrained decoding (BucketSampling.lean,ConstrainedMask.lean). Replaces full-vocabulary sorting with 32-token buckets and a witness-free top-$p$ sandwich (sure/poss), and binds compiled JSON-Schema byte-DFA masks over a 151,936-token vocabulary in$O(k_2 Q_{\rm pad})$ cells via multilinear Schwartz–Zippel ($\le 2^{-186}$ ). -
Zero-Phase-2 folded backend (
multi_gkr+multi_pcs+folded_engine). Replaces Stage 1's2.36B-cell Phase-2 LogUp inverse commitments with batched ZK-masked FracLogUp-GKR (using independent$(0, d_L)/(0, d_R)$ layer-0 denominator blinders) and multi-size layer-injected rate-$1/8$ coset-4 folded ZK-Basefold.
Every number below corresponds to a checked-in JSON receipt under benchmarks/ with runnable drivers under bench/ and benchmarks/prover/.
| Benchmark | Hardware | Cells (Ph-2) |
Container | GPU Prove / Total | Peak RAM / VRAM | CPU Verify | Receipt |
|---|---|---|---|---|---|---|---|
Qwen3-0.6B ExtSeed-153 (Q=128, unique decoding |
RTX 6000D 84 GB | 1.47G (0) |
8 MiB FPNZK2
|
450.2 / 569.8 s |
99.7 / 55.0 GiB |
10.76 s (Py) |
qwen3_06b_extseed153_q128 |
Qwen3-0.6B ExtSeed-153 (Q=100, A-PCS-fold) |
RTX 6000D 84 GB | 1.47G (0) |
8 MiB FPNZK2
|
461.1 / 571.0 s |
100.1 / 54.3 GiB |
10.73 s (Py) |
qwen3_06b_extseed153_v1 |
Qwen3-0.6B 8+4 cheating matrix (Q=100, 1 honest + 13 attacks) |
RTX 6000D 84 GB | — |
8 MiB FPNZK2
|
14 / 14 pass |
— | exact reject codes | qwen3_06b_cheating_matrix |
Qwen3-4B 36L, 4.02B (dev 4+2, Q=100) |
RTX 6000D 84 GB | 259M (0) |
8 MiB FPNZK2
|
160.3 / 273.0 s |
58.2 / 47.8 GiB |
7.18 s (Py) |
qwen3_4b_mc4_mg2_v1 |
Qwen3-0.6B Stage 1 NI-315 (1.51 B/cell streaming, 116 hidden CoT) |
RTX 4070 Ti S 16 GB | 5.25G (2.36G) |
149.8 MB FPNZK1
|
3,752 / 3,878 s |
21.0 / 11.3 GiB |
12.02 s (Py) |
qwen3_06b_reply_315 |
Qwen3-0.6B Stage 1 setup proof |
RTX 4070 Ti S 16 GB | 8.67G |
353.0 MB |
3,623.7 s |
12.2 / 4.2 GiB |
59.91 s (Py) |
qwen3_06b_mcsetup |
Notes on the table:
- The
14/14matrix includes fresh 28-layer PyTorch forward passes on 196 perturbed linear weights and 196 group-32int4-quantized linear weights verified against the committedbf16model, alongside skipped layers, truncated KV, tampered hidden prompt/reply/St_prev, missing/swappedC_pre/c_ext, non-zero padding, downgradedQ = 4, and mismatched4 MiBvs8 MiBFPNZK2envelope size. - Both
ExtSeed-153runs hit their token cap before</think>(n_reason = 0); hidden CoT (n_reason = 116) is exercised in Stage 1qwen3_06b_reply_315.jsonanddemo/run_demo.py. - Single-stream
Qwen3-0.6B ExtSeed-153total prover time (569.8 s) is ~103×single-stream inference (5.54 s). Keeping fleet-wide proving cost within<= 100%of serving relies on probabilistic audit deterrence (p_audit <= 1%, specified inspecs/02-soundness.md§10).
-
5-model Blackwell calibration (
0honest false rejections):0 / 1,846,272GEMM + MoE expert blocks (863,232GEMM +983,040MoE) plus0 / 73,728honest router tokens acrossQwen3-4B,Llama-3.2-1B-Instruct,Qwen3.5-0.8B,Qwen3-30B-A3B-FP8, andgpt-oss-20b(frontier_calibrate; single-token router swap detection is11.5%/38.0%due to zero-margin top-$k$ ties), and0 / 1.96Mnon-GEMM rows across RMSNorm, GQA softmax, SWA + learned sinks, and chunk-64 WY Gated DeltaNet (non_gemm_calibrate). Earlier Adabf16calibration (0 / 392,928blocks,97.3%–100%8-mode cheat cost, 4k–32k sparse-attention tail bounds) is inbenchmarks/certified/. -
Live
vLLM 0.33Qwen3-30B-A3B-FP8&Qwen3-0.6Bzero-plaintext Relation 6 (live_vllm_rel6_zk_v1): Ephemeral AES-256-CTR lazy chunk commitments (x_commit.py) reduce retained chunk buffers by192×(25.9 GiB -> 135.0 MiBon 30B MoE,0.0 MiBincrease in recorded peak RSSVmHWM) and cut precommit time to45.1 s, proving 64 real tiles (64/64integer-faithful) in1.49 swith23.4 msRustfpn-verify(VERIFIED),0 Bplaintext activations disclosed, and all forgeries rejected. (Scope: Relation 6 opens16.8 MBof public weight tiles and does not bindXto the GPU capture orYto the served output; it is a component milestone rather than a closed-weight full-reply proof.) -
Zero-sync async
vLLMcapture & 20-turn incremental state: EnforcingR32numerics costs1.2%–2.7%vLLMthroughput (vllm_serving_overhead). Zero-sync async CUDA-graph taps (serve/fpn_serve/) achieve0extra synchronizations and0overflows across all 6Qwen3-4BTIER_Bcells vsnumerics_r32:-1.15%(b1, c256),-3.80%(b4, c256),-7.23%(b8, c256),-4.90%(b1, c8192),-11.25%(b4, c8192), and-13.14%(b8, c8192) (async_capture_qwen3_4b). On a 20-turn growingvLLMsession (Qwen3-0.6B,18,506tokens,95.8%prefix hit),PageStorecuts capture volume by10.5×and incrementalSt_ihashes turn 20 in0.75–0.92 s(28–34×vs single-thread /9.9–13.6×vs multi-thread;agentic_20turn).
Verified on Lean 4.29.1 + Mathlib via lean/check.sh with native_decide forbidden and only the three standard axioms (propext, Classical.choice, Quot.sound):
-
19 protocol modules (219 audited declarations): round-by-round lifetime soundness composition (
RoundByRound,LifetimeSoundness,ProtocolBridge), all 16 sample-count table cells, multi-column LogUp, bucketed top-$p$ sampling (BucketSampling),$\mathbb F_{p^3}$ constrained-mask binding (ConstrainedMask), causal multi-round masking (MaskJoint), and algebraic identities for MoE, MLA, linear attention, and speculative decoding. -
9
FPN2modules (477 audited declarations): Mathlib-free executable byte verifiers (VerifyBytes,Fpn2Rel3–5, matching all131/131golden vectors +26/26multi-tile cases), concrete Goldilocks$\mathbb F_{p^3}$ soundness (Fpn2Soundness), constraint-to-integer proofs for 6 IR gadget families (Fpn2Gadgets), and conditionalProtocolRBRSpecinstantiation atverifyBytesRel4/5(Fpn2EndToEnd, seelean/THEOREM.md§2.4 for exactCryptoAssumptionsandDeltacaveats).
- Rust single-binary verification of full replies: lower
reply_zk's 12 interactive commit rounds into a self-containedCircuitDesc. - Folded-prover host RAM & 4B+ production draws: restore
~1.5 B/cellstreaming to bring100 GiBfolded RSS back toward Stage 1's21 GiB, and run production draws on 4B and 30B+ closed-weight models. - Formalization & ZK proofs: complete Johnson-regime RBR for multi-size injection (
A-PCS-fold; bypassed atQ >= 128), write a transcript-wide ZK simulator for the folded backend, add Lean verifiers for Relations 2 and 6, and mechanically connect Python circuit synthesis toCompiledCS. - Cross-architecture hiding: replace per-profile dense geometry with uniform hidden-table slots across Dense GQA, Sparse MoE, MLA, SWA, and linear attention.
| Release | Highlights | Status |
|---|---|---|
Stage 0 (v0.2.0) |
Paper, specs 01–10, 18 Lean 4 modules, Ada bf16 tolerance & cheat benchmarks |
Released |
Stage 1 (v0.3.0) |
Streaming 1.51 B/cell), Qwen3-0.6B setup + NI-315 proofs, laptop CPU demo, vLLM 0.33 CUDA-graph plugin, 19th Lean module |
Released |
v1.0.0 |
Zero-Phase-2 folded backend (8 MiB FPNZK2, Q=128 unique decoding), zero-dep Rust fpn-core/fpn-verify + detached Python reference (specs/11, Rel 1–6), 28 Lean 4 modules (696 audited decls), RTX 6000D Qwen3-0.6B/4B/30B-A3B-FP8 receipts & 5-model calibration |
Current |
v2 |
Single-binary Rust verification for 12-round replies, streaming folded host RAM, cross-architecture hidden tables, Lean Rel 2/6 | Planned |
FlashProve-Next/
├── README.md, README.zh-CN.md # English & Chinese overviews
├── REVIEW.md # Reviewer guide, trusted base & claim-to-evidence map
├── CHANGELOG.md, CITATION.cff # Release notes & citation metadata
├── core/ # Zero-dep, no-unsafe Rust `fpn-core` + `fpn-verify` CLI (FPN2 Rel 1–6)
├── verifier/ # Detached Python `fpn_verify_ref` (FPN2) & `fpn_verify.py` (FPNZK1/2)
├── prover/, serve/ # Folded ZK backends (`multi_gkr`/`multi_pcs`/`folded_engine`) & async vLLM capture
├── flashprove_next/ # Reply circuit builder, gadgets, sampling & FPNZK1/FPNZK2 bundle verifier
├── integrations/vllm/ # Non-invasive vLLM 0.33 loader plugin, CUDA-graph capture & prover daemon
├── demo/ # Offline laptop CPU demos (`run_v1_relation2_demo.py`, `run_demo.py`)
├── lean/ # Lean 4.29.1 + Mathlib formalization (28 modules, 696 audited decls, 0 sorry)
├── paper/ # Technical report (Markdown, LaTeX, compiled PDF)
├── specs/ # Eleven specifications (01–11) & golden test vectors
├── bench/, benchmarks/ # Runnable GPU benchmark drivers (`bench/`) & public JSON receipts (`benchmarks/`)
├── tests/ # CPU CI suite, 4 unit shards & perturbation/mutation/wbforge audits
└── docs/ # Bilingual project portal + PDF download
# 1. Zero-dep Rust FPN2 Relation-2 CPU demo (8 MiB, Q=72, 64-row reference circuit)
pip install numpy
cargo build --release --manifest-path core/Cargo.toml --bin fpn-verify
python demo/run_v1_relation2_demo.py
# 2. Real Qwen3-0.6B Stage-1 proof bundles & fast CPU checks
pip install -e ".[tokenizers]"
python -m flashprove_next.build_ext
python demo/run_demo.py
FPN_CI_FAST=1 python -m tests.test_fast_cpu
# 3. Verify all 28 Lean 4.29.1 modules (696 axiom-audited decls, 0 sorry, standard axioms only)
(cd lean && lake exe cache get && bash check.sh)
# 4. Rebuild Technical Report PDF (0 errors / warnings)
python3 paper/md2tex.py paper/flashprove-next.md paper/flashprove-next.tex
(cd paper && tectonic flashprove-next.tex)
# 5. Full Rust verifier tests, detached Python verifier tests, and golden vector regeneration
cargo test --manifest-path core/Cargo.toml --release
PYTHONPATH=verifier/python python -m unittest discover -s verifier/python/tests
python specs/vectors/generate.py --check