Skip to content

About

Independent research system for verifiable native-FP/FP8/MXFP4 LLM API inference (vLLM CUDA Graphs): unified dense+MoE circuit, Rust/WASM CPU verifier, 37 Lean 4 modules.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

FlashProve-Next

Version 2.0.0 · Research system by Liang Song · License Lean 4 · English · 简体中文

Independent personal research project by Liang Song; not affiliated with or endorsed by Anthropic. FlashProve is © Anthropic PBC.

What it is

Verifiable inference for production LLM APIs, while vLLM keeps serving native floating-point and block-quantized weights (bf16, fp8, mxfp4).

  • Commit. Once per model release, the provider hashes every tensor of the checkpoint into a salted Merkle root, model_id. The commitment does not wear out across requests.
  • Prove. In post_commit mode, each reply carries a 595-byte receipt (C_pre). The client then sends a random challenge, and a background GPU process proves the sampled units in a fixed 8 MiB FPN2 proof.
  • Verify. A CPU checks the proof with no weights and no GPU: 359–366 ms in Rust and 527–597 ms in WebAssembly (wasmtime) on the three unified-circuit proofs below (283–391 ms Rust and 485–631 ms WASM across all 24 honest proofs in the checked-in receipts). A real Qwen3-4B proof ships in the repository, so you can check one on a laptop; the WebAssembly verifier also runs in a browser on a bundled 8 MiB demo proof (try the offline verifier; node core/wasm/test_demo_bundle.mjs measures ~10 ms steady-state / ~33 ms first call).

Three checkpoints across two model families (Qwen3 dense BF16, Qwen3 FP8 MoE, and gpt-oss MXFP4 MoE) under one released circuit_root (9baa4dc2…). Unified three-model benchmark with the Python prover in this repository (prover_engine = "python", recorded per model; receipt), one RTX 6000D, development draw budget 8 + 8 + 8 (attention / FFN-MoE / output; attention and FFN each split 4 prompt + 4 decode), 128–256-token context profile (P256):

Model Precision / architecture Reconciled scalars Online C_pre kept Trace build + witness Prove stage Rust / WASM / Python verify
Qwen3-4B bf16 dense 4.02 B 57.8 % 3.9 s + 0.1 s 50.1 s 359 ms / 593 ms / 2.48 s
gpt-oss-20b mxfp4 MoE (32 experts, top-4, SWA, sinks) 11.96 B 59.5 % 10.0 s + 50.5 s 114.2 s 364 ms / 527 ms / 2.46 s
Qwen3-30B-A3B-FP8 fp8 block-scaled MoE (128 experts, top-8) 30.53 B 43.7 % 11.0 s + 30.7 s 92.8 s 366 ms / 597 ms / 2.46 s

Trace build (trace_build_s) rebuilds the full execution trace from the captured pages and checks that its root equals the online C_pre; witness (witness_s) assembles the statement and witness; prove stage (prove_s) is the prover alone. All three models share the same 7.6 MiB circuit descriptor and fixed 8 MiB container. As a sanity check for plaintext reuse, the three proofs share no aligned nonzero 64-byte block after the header; this is not evidence of zero knowledge. An earlier run on the same circuit (receipt) did not record its proving engine; its honest timings are superseded by the table above, and it remains the source of the MoE cheat results below. REVIEW.md maps every receipt to its circuit and revision.

What is proved: 100 % of the checkpoint is bound into model_id; at the positions and sublayer units selected by the client's challenge, the committed execution agrees with the committed integer image of the weights within fixed bands, from request tokens to visible reply. Weights, architecture, hidden system prompts, and hidden reasoning are masked. What is not proved: how each reply token was sampled. Localized cheats and some coarse-band quantizations can be missed under spot checking (including observed int4 escapes on Qwen3-4B FFN projections, below). Lean checks a formal model of the Relation-2 verifier (cross-checked against the detached Python verifier on 12 vector cases) and conditional soundness and masking reductions with explicit premises; it does not check that the Python circuit compiler encodes the model.

Protocol: commit, serve, challenge, prove, verify

Online serving throughput with proof capture

Try it on your machine (no GPU, no weights)

In a browser (10 seconds):

python3 -m http.server -d docs 8000    # open http://localhost:8000 to verify an 8 MiB FPN2 demo proof in WASM

A real Qwen3-4B proof from the command line (about one minute):

pip install numpy
cargo build --release --manifest-path core/Cargo.toml --bin fpn-verify
python3 demo/verify_real_llm_bundle.py   # prints "ALL REAL QWEN3-4B BUNDLE CHECKS PASSED!"
python3 demo/run_v1_relation2_demo.py    # reference fixture prints "ALL v1.0 RELATION-2 CHECKS PASSED!"

demo/real_llm_bundle/ holds an honest 8 MiB FPN2 proof of a Qwen3-4B (4.02 B bf16 scalars) request, produced by the Python prover on the released unified circuit, together with its 7.6 MiB circuit descriptor, public inputs, and statement (4.5 MiB compressed). The script recomputes circuit_root and stmt_digest from the raw bytes, verifies the proof with the Rust CLI, the detached Python verifier, and the shipped WebAssembly module (when Node.js 18 or later is installed), and checks that a one-byte proof tamper and a wrong stmt_digest pin are both rejected. On an Apple M1 laptop each check takes about 0.2–0.4 s in Rust and WebAssembly and about 2 s in Python. The browser demo and run_v1_relation2_demo.py exercise the same FPN2 wire format and pin checks on a 64-row reference circuit. Test suites, WASM rebuilds, Lean checks, and GPU drivers are in Getting started.

What a proof catches

The welded circuit and where each cheat breaks it

The main results run on the released unified circuit (9baa4dc2…): a 14-case dense cheating matrix on Qwen3-4B, with Qwen3-0.6B as the impersonator (receipt, Python prover), and the MoE cheats of the earlier unified three-model run. Each case is a single trial, so it shows that constraints fire rather than measuring a detection rate.

A provider tries to Benchmark Rejected by Rust / WASM / Python
answer with another model or checkpoint (Qwen3-0.6B claiming Qwen3-4B; same-shape checkpoint; cross-family impersonation) unified dense matrix + unified three-model 3 / 3
quantize one projection (k, v, o, up, down) to int4 in all layers of Qwen3-4B unified dense matrix 4 / 5: k, v, o, up rejected; down_proj accepted (see below)
skip the middle 50 % of layers, or evict 50 % of prompt KV unified dense matrix 2 / 2
swap the hidden system prompt, use a non-canonical cache scale, or inject RMSNorm padding unified dense matrix 3 / 3
edit request or reply tokens after proving unified dense matrix 2 / 2
quantize the back half of MoE experts to int4 (gpt-oss-20b, Qwen3-30B-A3B-FP8) unified three-model 2 / 2
halve active MoE experts (top-4 → top-2, top-8 → top-4) unified three-model 2 / 2
drop attention sinks (gpt-oss-20b) or tamper FP8 scale_inv block scales (30B) unified three-model 2 / 2
quantize one tail MoE expert (expert 127 of 128 on Qwen3-30B-A3B-FP8) unified three-model 2 / 8 challenges hit; the honest prover refused both; 1 forged proof tested and rejected
forge a strict JSON Schema reply live vLLM HTTP (earlier unified revision) 1 / 1

In total the unified dense matrix rejects 13 of 14 cases and the unified three-model run rejects all 7 MoE, FP8, and sink cheats plus the cross-family impersonation. On the earlier pre-unification dense circuit (9ac99547…), which captured dense gate/up outputs separately, the same 14 cases on Qwen3-0.6B were all rejected, including all five single-projection int4 cases (receipt); that circuit is no longer in the tree.

Read this as a spot check, and note the observed escapes. Embeddings are checked at every position; attention, FFN/MoE, and output units are sampled:

  • Observed int4 FFN escapes on Qwen3-4B. On the unified circuit, dense gate/up outputs are not captured separately and FFN values are checked against a coarse i14 band. In the unified dense matrix, int4 on down_proj produced a forgery accepted by all three verifiers at 8 FFN draws. A companion analysis on an earlier unified revision (receipt) recorded one accepted up_proj forgery: int4 on up_proj pushes only ~3.7 % of activation coordinates outside the band (σ ≈ 0.20 < 1/2), for an estimated miss probability of 16.51 % at 8 draws and 6.13 × 10^-9 at 84. The same analysis estimated only 2.2 × 10^-5 for down_proj at 8 draws, but it states that it does not model the residual tolerance on down_proj exactly; the observed escape shows that estimate does not hold, and the down_proj miss rate on the unified circuit is not yet characterized.
  • How many draws a localized defect faces. The 8 + 8 + 8 development budget gives attention and FFN only 4 prompt and 4 decode draws each. A defect confined to one of those strata faces m = 4 draws: at spoiled fraction σ = 50 % it escapes with probability (1/2)^4 = 6.25 % (table).
  • Conditional half-bad bound vs. NI timing. For an independently challenged (post_commit) fixed commitment where every draw landing on a bad unit rejects, 42 uniform draws per pool (84 + 84 + 42 across prompt/decode/output, Q = 128) give a calculated miss bound of ≤ 2^-42 per pool (≤ 2^-40 combined) whenever σ ≥ 1/2. Separately, the memory / NI / 4k benchmark measured a 42.4 s Qwen3-4B proof at that draw size in non-interactive (NI, challenge_mode = 0) mode, which does not protect against first-party grinding (that defense requires post_commit).
  • Sampling is not checked. A provider holding the weights can draft text with a cheaper model and run one honest forward pass of the committed model over it. See Known limits.

What stays hidden

Public and hidden data

Only standard API outputs, salted 32-byte anchors, and a public capacity profile are disclosed. Qwen3-4B (dense), gpt-oss-20b (MXFP4 MoE), and Qwen3-30B-A3B-FP8 (FP8 MoE) compile to the same circuit_root and fixed 8 MiB container, so the descriptor does not reveal which architecture produced a proof. Multi-turn hidden reasoning travels in a constant 8,192-byte encrypted state_blob. There is no machine-checked proof yet that the concrete prover transcript can be simulated end to end without secrets. See Zero knowledge.

What it costs (RTX 6000D, measured)

Metric Value Source
Live HTTP serving kept (Qwen3-4B, full CUDA graphs) 50.3 % (476.1 of 945.7 tok/s; 57.9 % in-process C_pre) live vLLM HTTP receipt
Online C_pre kept (gpt-oss-20b / Qwen3-30B-A3B-FP8) 59.5 % / 43.7 % (30B below the 50 % target; addressed in v2.1) unified three-model receipt
Added to each reply (post_commit) 595 B receipt (631 B stateless); 8,192 B state_blob multi-turn live vLLM HTTP receipt
Proving one request (8 MiB proof, prove stage, Python prover) 45.2–51.9 s (Qwen3-4B, live HTTP); 50.1 s / 114.2 s / 92.8 s (4B / 20B / 30B, unified three-model, after 4.0 s / 60.5 s / 41.7 s of trace build and witness); 37.4 s after 43.8 s of trace commitment (Qwen3-0.6B, 4k context) live HTTP, unified, memory / NI / 4k receipts
Host memory (different metrics and workloads) 24.1 GiB process-tree PSS (Qwen3-4B, B = 16); 23.7 / 41.6 / 38.0 GiB RSS (4B / 20B / 30B, unified three-model); 52.0 GiB RSS (4B, pre-unification dense cheating matrix) receipts above and dense cheating matrix
Prove stage vs. batch-amortized serving (Qwen3-4B, live HTTP) 334–383× (45.2–51.9 s vs. 1.083 s / 8 requests, calculated; witness preparation excluded) Performance

Prover VRAM figures in the receipts come from torch.cuda.max_memory_allocated() and count only the PyTorch allocator. Proving cost and 30B online C_pre overhead are the main practical bottlenecks in v2.0.

Verification time, wire sizes and proving cost

Comparison with FlashProve

FlashProve (Anthropic, technical report; protocol and Lean monograph FlashProve: Hash-Based Proofs of LLM Inference at 400 Billion Parameters, v0.16.0) is the closest prior system and the reference point for this work. The two systems answer different questions, and on several axes FlashProve is ahead.

FlashProve v0.16.0 FlashProve-Next v2.0
Model proved 400B-parameter integer MoE (Llama 4 Maverick shape), 1,024-token context up to 30.5 B scalars (Qwen3-4B, gpt-oss-20b, Qwen3-30B-A3B-FP8), 128–256-token profile; one 4k run on Qwen3-0.6B
Coverage every layer of the proved pass embeddings at every position; sampled attention, FFN/MoE and output units (8 + 8 + 8 here)
Reply tokens verified: exact greedy match, or a clipped-gap policy designed for floating-point vLLM serving (its docs state clipped-gap has not yet run live as one service on a trained model) not verified in v2.0
Serving engine proves the integer model; served tokens must match it or meet the clipped-gap limits live vLLM, full CUDA graphs, unmodified native bf16 / fp8 / mxfp4 checkpoints
Prover cost ~110 prefill tok/s on one H100; ~71–94× stock vLLM per-GPU prefill (C++/CUDA, calculated) 334–383× batch-amortized serving per request (Python prover, prove stage, RTX 6000D)
Verification ~21 s single-thread C++ on an ~18.8 MB proof 0.28–0.39 s Rust, 0.49–0.63 s WASM (also in a browser) on an 8 MiB proof
Formal guarantees machine-checked Lean soundness for its Lean verifier, plus completeness and zero knowledge for its compiled protocol Lean model of the Relation-2 verifier plus conditional soundness and masking reductions; compiler lowering tested, not proved
Weight commitment leaf tables are replaced after a fixed number of batches static; openings do not deplete it
Disclosed to the client architecture and dimensions are public architecture hidden behind one circuit for dense and MoE; hidden prompts and reasoning stay private

Where FlashProve-Next trails. Scale (30B against 400B), coverage (spot checks against every layer), reply-token selection (not verified in v2.0), proving cost (a Python prover at 334–383× against C++/CUDA at ~71–94×), and the strength of the formal result (conditional reductions with open premises against a soundness theorem about the verifier itself).

Where it differs. It proves alongside a live vLLM server running unmodified native checkpoints with full CUDA graphs; its weight commitment does not deplete; one circuit hides whether the model is dense or MoE, and hidden prompts and reasoning stay private; and a sub-second, dependency-free Rust or browser WebAssembly verifier checks each proof. These choices complement FlashProve rather than replace it. Spec 08 gives the longer comparison and separates measured v2.0 results from target design.

How much is machine-checked

Lean 4.29.1 checks 37 modules and 998 axiom-audited declarations (zero sorry, zero native_decide, standard axioms only): 903 declarations in 33 modules behind the deployed v2.0 system and 95 declarations in 4 standalone v2.1 protocol modules (StratifiedDaily, FoldGemmSoundness, L2SketchOrRelBox, VariantASampling). The deployed part covers sumcheck, LogUp, and spot-check bounds; upper-block Reed–Solomon and causal multi-round masking (MaskJoint); executable byte-to-typed refinement for Relations 1–5 (Fpn2Rel2–Fpn2Rel5), where the Relation-2 verifier is a formal model cross-checked against the detached Python verifier on 12 vector cases; and conditional soundness and simulator theorems (Fpn2EndToEnd). Lowering the Python circuit compiler to those predicates is tested by perturbation scans and constraint-deletion mutations, not proved in Lean. Read every claim beside its Lean source in lean/STATEMENTS.html.

What comes next (v2.1 roadmap)

v2.0 fixes a reproducible baseline. Planned v2.1 work targets four gaps disclosed in Known limits:

  1. Rust/CUDA prover + GPU batching to remove Python from the proving hot path and cut single-request proving latency.
  2. Fine-grid relative boxes + daily/audit security tiers to close the coarse-band int4/int8 escape and catch single-token / single-FP8-block edits in audit mode.
  3. Sampling-layer verification inside the welded circuit (reducing second-best token forgery without modifying the serving engine, plus a strict integer-head option).
  4. Online capture overhaul (zero-copy pinned page pools, zero-GIL notification, device-side streaming sponge checkpoints) targeting ≥ 85–90 % live serving throughput retention.

More

docs/index.html interactive offline WebAssembly verifier and project overview
guide/ short plain-language guides: how it works, what is proved, ZK, serving, performance, limits
paper/main.pdf technical report (PDF, figures built directly from JSON receipts)
lean/STATEMENTS.html, lean/THEOREM.md Lean statements, prose explanations, and explicit premises
specs/ target protocol designs (01–10) and deployed FPN2 wire format (11)
benchmarks/ JSON receipts behind every measured number
core/, core/wasm/, verifier/python/, prover/, serve/, integrations/vllm/ Rust verifier, WASM build, Python reference, prover, capture, vLLM server

License

Apache 2.0, see LICENSE and NOTICE. There has been no independent security audit. Do not rely on this code to protect weights that must stay secret.

About

Independent research system for verifiable native-FP/FP8/MXFP4 LLM API inference (vLLM CUDA Graphs): unified dense+MoE circuit, Rust/WASM CPU verifier, 37 Lean 4 modules.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages