Trustless Zero-Knowledge Proofs · Unchanged Production Serving 不信服务商与硬件 · 不改现有线上推理引擎

FlashProve-Next: Verifiable Inference for Production LLM APIs FlashProve-Next:面向生产级大模型 API 的可验证推理

By Liang Song · Verify that an API response came from the real model configuration in model_id without replacing native floating-point serving with an integer surrogate and without revealing weights or hidden prompts. 作者:宋亮(Liang Song) · 在不把线上原生浮点引擎改成整数替身、也不泄露权重与隐藏提示词的前提下,让任何客户端都能在普通 CPU 上验证大模型 API 回复出自官方承诺的真实配置。

Release v1.0.0: Zero-Phase-2 folded ZK-Basefold + FracLogUp-GKR backend inside fixed 8 MiB FPNZK2 / FPN2 containers (incl. unique-decoding Q=128), zero-dependency Rust verifier (core/, ~10 ms on Apple M1) + detached Python reference, RTX 6000D receipts on unsliced Qwen3-0.6B, 36-layer Qwen3-4B, and live vLLM 0.33 Qwen3-30B-A3B-FP8, plus 28 Lean 4.29.1 modules (696 axiom-audited declarations, zero sorry). 版本 v1.0.0:统一零 Phase-2 折叠 ZK-Basefold + FracLogUp-GKR 引擎与定长 8 MiB FPNZK2 / FPN2 容器(含唯一译码 Q=128 实测)、零依赖 Rust 验证器(core/,M1 约 10 ms)与脱钩 Python 参考、RTX 6000D 上完整 Qwen3-0.6B / 36 层 Qwen3-4B / 真在线 vLLM 0.33 Qwen3-30B-A3B-FP8 公开回执,以及 28 个 Lean 4.29.1 模块(696 条审计声明,零 sorry)。
10.1 ms Rust / 10.7 s Py
Zero-dependency Rust verifies self-contained 8 MiB FPN2 (64-row demo, 10.1 ms); Python verifies full 12-round Qwen3-0.6B ExtSeed-153 FPNZK2 (10.73 s) 零依赖 Rust 验证自包含 8 MiB FPN2(64 行示例 10.1 ms);Python 验证完整 12 轮 Qwen3-0.6B ExtSeed-153 FPNZK2(10.73 s)
28 / 696
Lean 4.29.1 modules / declarations (zero sorry, zero native_decide, standard axioms only) Lean 4.29.1 模块 / 定理声明(零 sorry、禁 native_decide,仅标准三条公理)
0 / 3.81M
Honest false rejections across 5 dense & MoE models (1.85M GEMM/MoE blocks + 1.96M non-GEMM rows) 5 真实稠密与 MoE 模型全算子诚实零误拒(185 万 GEMM/MoE 块 + 196 万非 GEMM 行)
14/14 + 33/33
Honest & negative checks passed (real 28-layer perturbed/int4 weights + white-box forgery suites) 作弊矩阵与白盒防伪造全过(含真实 28 层改权重 / int4 降级与白盒伪造套件)

Two Laptop CPU Demos (No GPU, No Model Weights) 两套笔记本纯 CPU 演示(无需显卡,无需权重)

Start with the ~10 ms zero-dependency Rust FPN2 Relation-2 demo (exact 8 MiB container, 64-row reference circuit), then verify bundled Stage-1 Qwen3-0.6B vLLM 0.33 proofs (qwen3-0.6b-demo, 4 + 2 draws, CUDA_VISIBLE_DEVICES=""). 先用 ~10 ms 零依赖 Rust FPN2 关系 2 演示(精确 8 MiB 容器,64 行参考电路)验证底层验证器,再核验随仓附带的 Stage 1 真实 Qwen3-0.6B vLLM 0.33 样本包(qwen3-0.6b-demo,4 + 2 抽查)。

# Demo A: Zero-dependency Rust + detached Python FPN2 Relation-2 verifier (Apple M1 CPU)
$ pip install numpy && cargo build --release --manifest-path core/Cargo.toml --bin fpn-verify
$ python demo/run_v1_relation2_demo.py
Container size: 8,388,608 B (exact 8 MiB, Q=72)
[PASS] Honest proof (fpn2-llm-std-v1, Q=72) -> VERIFIED (Rust ~10 ms | Python ~110 ms)
[PASS] 8 adversarial checks (pins / padding / length / gate & range forgeries) -> REJECTED (exact parity)
[PASS] Re-proving randomization -> 0 shared 64-byte private blocks
# Demo B: Bundled Stage-1 Qwen3-0.6B vLLM 0.33 API proof bundles (CUDA_VISIBLE_DEVICES="")
$ pip install -e ".[tokenizers]" && python -m flashprove_next.build_ext
$ python demo/run_demo.py
==============================================================================
FlashProve-Next — Standalone CPU Verification Demo (CUDA_VISIBLE_DEVICES="")
Profile & tier : qwen3-0.6b-demo [demo_fast: M_C=4, M_G=2, T_pad=256]
[1/5] Honest Turn-0 Qwen3-0.6B reply (hidden system prompt + 95 hidden CoT tokens)
Proof size : 10.13 MiB | CPU verify: 4.79 s -> VERIFIED
[2/5] Honest Turn-1 multi-turn continuation (chaining verified anchor St_prev -> St_new)
Proof size : 10.14 MiB | CPU verify: 4.68 s -> VERIFIED
[3/5] Honest Qwen3-0.6B structured output (strict JSON Schema byte-DFA mask bound over F_{p^3})
Proof size : 10.33 MiB | CPU verify: 5.07 s -> VERIFIED
[4/5] Dishonest provider serving int4-quantized Qwen3-0.6B under the committed bf16 model_id
CPU verify : 3.09 s -> REJECTED: sumcheck round mismatch (cube 2^12)
[5/5] Security-downgrade, replay, and tampering checks (no opt-in / token / nonce / St_prev / schema)
All 5 checks -> REJECTED | ALL DEMO VERIFICATIONS PASSED in 20.7 s

How FlashProve-Next Differs from FlashProve 与 FlashProve 的设计对比

Anthropic's FlashProve demonstrated that zero-knowledge proofs can verify a closed-weight 400B MoE model without hardware enclaves. FlashProve proves exact full-layer execution of an integer surrogate, while FlashProve-Next makes different trade-offs targeted at native floating-point API serving. Anthropic 的 FlashProve 证明了不靠硬件飞地(TEE)也能验证 400B 闭源模型。FlashProve 证明确定性整数替身模型的逐层精确执行,而 FlashProve-Next 面向原生浮点在线服务做出了不同的设计取舍。

Dimension对比维度 FlashProve (2026-11) FlashProve-Next
Soundness guarantee可靠性保证 Exact full-layer execution of the committed 4-bit integer model已承诺 4-bit 整数替身模型的逐层精确执行 Cost-weighted spot-check threshold (σ = ρ = 0.5): NI-315 (≤ 2^-40, Q ≤ 2^64) or ExtSeed-153 (≤ 2^-20, Q_samp ≤ 2^30 with pre-recorded C_pre)原生浮点成本加权抽查阈值(σ = ρ = 0.5):非交互 NI-315(≤ 2^-40, Q ≤ 2^64)或外部种子 ExtSeed-153(≤ 2^-20, Q_samp ≤ 2^30)
What is committed承诺对象 A 4-bit deterministic integer surrogate model; native floating-point serving diverges from its exact-match policy4-bit 确定性整数替身模型;线上原生浮点推理会偏离其精确匹配策略 The actual deployed checkpoint (bf16/fp8/mxfp4), operator rounding bounds, hidden prompts & key线上实际加载的真实权重(bf16/fp8/mxfp4)、算子舍入规则、隐藏提示词与采样密钥
How serving runs线上推理方式 Greedy or fixed-seed integer execution across all layers仅限贪心或固定种子确定性整数逐层执行 Unchanged serving (native FP, random sampling, FlashAttention, CUDA Graph, continuous batching, prefix caching)零侵入现有引擎(原生浮点、随机采样、FlashAttention、CUDA Graph、连续批处理、前缀缓存照常跑)
What stays secret商业机密保护范围 Weights only; depth, width & MoE layout are public; no hidden prompts, CoT, or multi-turn state只藏权重;层数、宽度、MoE 结构公开;不支持隐藏提示词、隐藏思维链与多轮状态 Weights, hidden prompts, hidden CoT, activations & multi-turn state (v1.0.0 dense profiles fix coarse geometry; cross-architecture hiding in v2)权重、隐藏提示词、隐藏思维链、中间激活与多轮状态(v1.0.0 稠密档位按 profile 固定粗粒度几何,跨架构全隐藏归入 v2)
Commitment lifetime承诺寿命 Wears out after 688,127 batches and must be re-committed under an unlinked ID最多用 688,127 个批次就会耗尽作废,换新 ID 后无法公开关联 Does not wear out with the number of proofs (static RS encoding + in-circuit hidden column openings; soundness over Q ≤ 2^64 queries)出证次数不会耗尽承诺(静态编码一次 + 电路内秘密打开列;可靠性覆盖 Q ≤ 2^64 次查询)
Proving cost structure出证成本结构 Proves every layer of every token (≈71–93× per-GPU prefill time vs. 8×H100 FP8 vLLM)逐层全量重证每一步计算(单张 H100 耗时约为 8×H100 FP8 vLLM 预填充的 71–93 倍) Proves a fixed cost-weighted random sample (3 × 105 = 315 draws), decoupled from model depth按算力成本随机抽查固定数量样本(默认 315 次),开销与总层数脱钩
What a Verified Proof Guarantees: The provider holds a computation trace consistent with the real model configuration committed in model_id, that trace produced this visible reply for this request under the committed sampling rule (including hidden prompts and hidden chain of thought), and both the cost share of out-of-tolerance computation and the share of rule-violating tokens lie below public thresholds. 验证通过代表什么:服务商确实持有一条与 model_id 承诺的线上模型配置一致的计算轨迹;这条轨迹按规定的采样规则针对本次请求生成了用户看到的回复(包含其中隐藏的系统提示词与隐藏思维链);且轨迹中超出硬件浮点误差范围的计算量占比、违反采样规则的 token 占比都低于公开阈值。

How It Works in Three Steps 三步完成出证与验证

Online serving adds read-only boundary recording; proof generation runs asynchronously after the reply finishes streaming. 在线服务挂接只读记录钩子;零知识证明在回复流式结束后于后台异步完成。

1. COMMIT ONCE (MODEL DEPLOY) Real Weights (bf16 / fp8) Reed–Solomon rows + salted column tree Model Config & Secrets Rounding bounds, hidden prompts, sampling key Publish model_id + Setup Proof Reused across all replies; no wear-out 2. SERVE ONLINE (vLLM 0.33) Standard API Request + Client Nonce Multi-turn state · JSON Schema · Tool calls Normal Production Engine Native FP · FlashAttention · CUDA Graph · Prefix Cache Stream Reply + proof_id Background proving never blocks streaming 3. PROVE ASYNC & VERIFY ON CPU Folded ZK-Basefold + FracLogUp-GKR Spot-check 153 / 315 blocks (0 Phase-2) Fixed 8 MiB FPN2 / FPNZK2 container Zero-Knowledge Proof over 𝔽p3 Reveals nothing beyond standard API output Verify on CPU (~10 ms Rust | ~10.8 s Py) 1. 上线时承诺一次 真实线上权重(bf16 / fp8) 纠错码行编码 + 加盐列树 模型配置与私有参数 算子舍入合约、隐藏提示词、采样密钥 发布 model_id + 设置证明 跨所有回复复用,出证次数不耗尽承诺 2. 在线服务(vLLM 0.33) 标准 API 请求 + 客户端随机数 多轮加密状态 · JSON Schema · 工具调用 原样运行生产引擎 原生浮点 · FlashAttention · CUDA Graph · 前缀缓存 流式返回回复 + proof_id 后台出证绝不阻塞流式输出 3. 后台出证与纯 CPU 验证 折叠 ZK-Basefold + FracLogUp-GKR 按算力抽查 153 / 315 块(零 Phase-2) 严格定长 8 MiB FPN2 / FPNZK2 容器 𝔽p3 扩域零知识证明 不泄露标准 API 之外的任何信息 普通 CPU 验证(Rust ~10 ms | Py ~10.8 s)

Folded Zero-Phase-2 Backend (8 MiB)零 Phase-2 折叠后端(定长 8 MiB)

Batched folded ZK-Basefold + FracLogUp-GKR eliminates the Phase-2 circuit blow-up, compressing unsliced Qwen3-0.6B (ExtSeed-153, Q=128, 1.47B cells) and 36-layer Qwen3-4B into an exact 8 MiB container with ~10 ms Rust / 10.8 s Python verification. 批量折叠 ZK-Basefold 与 FracLogUp-GKR 彻底消除了 Phase-2 膨胀,将完整 Qwen3-0.6B(ExtSeed-153, Q=128, 14.7 亿格)与 36 层 Qwen3-4B 压进精确 8 MiB 容器,支持 Rust 约 10 ms 与 Python 10.8 s 验证。

Local Rounding-Contract Checks按硬件算子规则核验浮点误差

Each sampled block checks the engine's output against its own committed input using the operator's declared rounding bound, preventing cross-layer error blow-up while keeping R32 numerics overhead around 1.2%–2.7% on vLLM. 在每个被抽查算子块上从引擎记录的真实输入出发传播单步舍入上限,误差不跨层爆炸;开启满足合约的 R32 浮点配置仅耗 1.2%–2.7% vLLM 吞吐。

Private API & Schema Semantics完整商业 API 与结构化约束

Supports hidden system prompts, hidden <think> CoT, multi-turn AEAD state chains, tool witnesses, and minimal byte-DFA JSON Schema masks bound over 𝔽p3 in O(k_2 Q_pad) cells. 原生支持隐藏系统提示词、隐藏 <think> 思维链、跨轮加密状态链、工具调用见证,以及在 O(k_2 Q_pad) 格内绑定的最小字节自动机 JSON Schema 约束解码。

Phased Release Roadmap 分阶段发布路线

Each stage is published only after passing its formal, empirical, and white-box forgery checks. 每个阶段都在完成全部形式化、真卡实测与白盒防伪造核验后对外公开。

Stage 0 · Released (v0.2.0)Stage 0 · 已发布 (v0.2.0)

Theory, Lean 4 Proofs & Calibration完整理论、Lean 4 证明与真卡标定

Technical report, ten protocol specifications (01–10), standalone Lean 4.29.1 library, and GPU tolerance & cheat-detection benchmarks. 包含英文技术论文、10 份协议规范(01–10)、独立 Lean 4.29.1 证明库以及真实模型浮点与防作弊实测数据。

v1.0.0 · Releasedv1.0.0 · 已发布

Folded Zero-Phase-2 Backend, Rust FPN2 & 28 Lean Modules统一零 Phase-2 折叠后端、Rust FPN2 与 28 Lean 模块

Unified multi_gkr + multi_pcs folded prover (0 Phase-2 cells, fixed 8 MiB FPNZK2), zero-dependency Rust fpn-verify (~10 ms CPU), RTX 6000D dense/MoE validation (Qwen3-0.6B, Qwen3-4B, live vLLM Qwen3-30B-A3B-FP8), and 28 Lean 4 modules (696 declarations). 发布统一 multi_gkr + multi_pcs 折叠引擎(零 Phase-2、定长 8 MiB FPNZK2)、零依赖 Rust fpn-verify(~10 ms CPU)、RTX 6000D 稠密与 MoE 全线实测(Qwen3-0.6B、Qwen3-4B、真在线 vLLM Qwen3-30B-A3B-FP8)与 28 个 Lean 4 模块(696 条声明)。

v2 · Roadmapv2 · 后续路线

Single Rust CLI for Interactive Replies & Universal Architecture Hiding全回复交互轮入 Rust 单一 CLI 与跨架构全隐藏

Compile full 12-round interactive reply_zk circuits into a self-contained CircuitDesc for single-binary Rust verification, expand 5-in-1 shared-root topology hiding, and formalize Relation 2 / 6 in Lean 4. 将全回复 12 轮交互电路下沉为自包含 CircuitDesc 接入单一 Rust CLI,拓展五合一共享根全隐藏架构,并推进 Relation 2/6 的 Lean 4 形式化。

Lean 4 Formalization & Scope Lean 4 机器检验范围与边界

All 28 Lean 4.29.1 modules (696 declarations) build cleanly with zero sorry, zero native_decide, and only Lean's three standard axioms. 全库 28 个 Lean 4.29.1 模块(696 条定理声明)零 sorry、禁 native_decide,仅依赖 Lean 标准三条公理编译通过。

Machine-Checked in Lean 4 (28 Modules / 696 Decls)已由 Lean 4 机器证明(28 模块 / 696 声明)

Protocol Soundness, Executable FPN2 Verifiers & IR Gadgets协议可靠性、可执行 FPN2 验证器与 IR 算子翻译校验

19 protocol modules (219 declarations) cover round-by-round lifetime soundness (ProtocolBridge, RoundByRound), all 16 sample-count table cells (LifetimeSoundness), bucketed top-p sampling (BucketSampling), JSON-Schema vocabulary-mask binding (ConstrainedMask), causal multi-round masking (MaskJoint), and modern architecture identities. 9 additional FPN2 modules (477 declarations) formalize executable byte verifiers (VerifyBytes, Fpn2Rel3–5; 131/131 golden vectors), concrete Goldilocks 𝔽p3 soundness (Fpn2Soundness), six IR gadget families (Fpn2Gadgets), and ProtocolRBRSpec instantiation at verifyBytesRel4/5 (Fpn2EndToEnd). 19 个协议模块(219 条声明)覆盖全生命周期逐轮可靠性(ProtocolBridge、RoundByRound)、16 格抽查表、分桶采样、JSON Schema 词表掩码绑定、因果多轮盲化与多架构代数恒等式;9 个新增 FPN2 模块(477 条声明)形式化可执行字节级验证器(VerifyBytes、Fpn2Rel3–5,131/131 黄金向量)、具体 Goldilocks 𝔽p3 可靠性(Fpn2Soundness)、六大 IR 算子翻译校验(Fpn2Gadgets)及面向可执行验证器的端到端规约实例化(Fpn2EndToEnd)。

Stated Explicitly Outside Lean明确列在 Lean 之外的前提

Cryptographic Primitives & Real Floating-Point Bounds底层密码学假设与实数浮点误差推导

Basefold unique-decoding proximity soundness (A-PCS), mechanical extraction linking Python circuit-builder code to Lean's ProtocolRBRSpec / CompiledCS, multi-proof ROM/PRG hybrids, and real-valued floating-point error propagation formulas (backed by paper proofs, 392,928 hardware-tested blocks, and 33 white-box forgery & tamper checks) are documented explicitly in specs/07. Basefold 多项式承诺本身的邻近可靠性假设、Python 电路代码与 Lean 抽象约束系统的机械提取连接、多证明随机预言机归约,以及实数浮点误差传播公式(由论文数学证明、39 万块真卡实测与 33 项白盒伪造及篡改测试支撑)均在 specs/07 中逐条列明。

End-to-End Proving & Hardware Measurements 端到端出证与真实模型硬件实测

Public receipts under benchmarks/ spanning NVIDIA RTX 6000D 84 GB (v1.0.0 folded backend & Blackwell calibration), RTX 4070 Ti SUPER 16 GB (Stage 1 streaming baseline), and Apple M1 CPU (Rust fpn-verify). 全部实测 JSON 公开收录于 benchmarks/,覆盖 NVIDIA RTX 6000D 84 GB(v1.0.0 折叠后端与 Blackwell 标定)、RTX 4070 Ti SUPER 16 GB(Stage 1 流式基线)与 Apple M1 CPU(Rust fpn-verify)。

Benchmark测试项目 Model & Stack测试模型与环境 Measured Result实测结果 Honest Scope & Boundaries口径与诚实边界
v1.0 Folded Reply (ExtSeed-153, Q=128)v1.0 折叠全回复(ExtSeed-153, Q=128) Unsliced Qwen3-0.6B (RTX 6000D, 102+51, unique decoding ≤ 2^-106) 1.47B cells (0 Phase-2) · 8 MiB FPNZK2 · 450.2 s prove (569.8 s total) · 10.76 s CPU verify 99.7 GiB peak RSS / 55.0 GiB VRAM; ε ≤ 2^-20 at Q_samp ≤ 2^30; Python verifier (1.14 GiB RSS); Q=100 receipt also archived (461.1 s). Separate 8+4 matrix: 14/14 pass (incl. real 28L perturbed & int4 weights).峰值 99.7 GiB RAM / 55.0 GiB 显存;ε ≤ 2^-20(Q_samp ≤ 2^30);Python 验证器(1.14 GiB);另归档 Q=100 回执(461.1 s)。独立 8+4 矩阵 14/14 全过(含真实 28 层改权重与 int4 权重)。
v1.0 Folded 4B Reply (Dev 4+2)v1.0 4B 折叠全回复(开发档 4+2) Unsliced Qwen3-4B (4.02B, 36L, RTX 6000D, Q=100) 259.1M cells (0 Phase-2) · 8 MiB FPNZK2 · 160.3 s prove (273.0 s total) · 7.18 s CPU verify 655.4 s one-time weight commit; 0 gadget errors across 36 layers (58.2 GiB RSS / 47.8 GiB VRAM). Dev draw count 4+2 (production-draw 4B open).一次性 4B 权重承诺 655.4 s,36 层 0 算子报错(58.2 GiB RAM / 47.8 GiB 显存);开发抽查档 4+2(生产抽查档待补)。
Live vLLM 0.33 30B MoE Relation 6真在线 vLLM 0.33 30B MoE 关系 6 Qwen3-30B-A3B-FP8 (RTX 6000D) + Rust fpn-verify 45.1 s lazy precommit (135 MiB buffers, 192× less) · 1.49 s prove · 23.4 ms Rust verify 64/64 integer-faithful tiles, 0 B plaintext activations disclosed, all forgeries rejected. Component milestone: opens public weight tiles (16.8 MB).64/64 整数保真瓦片、0 B 明文激活披露、伪造全拒;组件级里程碑(打开公开权重瓦片 16.8 MB)。
Rust FPN2 Relation 2 & CalibrationRust FPN2 关系 2 与五模型标定 Apple M1 CPU (Q=72) · 5 Blackwell checkpoints (RTX 6000D) 10.1 ms Rust / 118.4 ms Python (8 MiB) · 0 / 3.81M honest false rejections · −1.15%..−13.14% async capture Relation 2 demo runs a 64-row reference circuit (lowering 12-round reply_zk into Rust is next work). Async capture (6 TIER_B cells vs numerics_r32, −1.15% single-stream b1,c256 to −13.14% b8,c8192, 0 extra syncs/overflows); fleet overhead ≤100% uses p_audit ≤ 1% deterrence.关系 2 Demo 验 64 行参考电路(12 轮下沉 Rust 属下一步);异步采集 6 格相对 numerics_r32(单流 b1,c256 −1.15% 至 b8,c8192 −13.14%,0 额外同步/溢出);全量集群开销 ≤100% 依赖 p_audit ≤ 1% 概率抽审威慑。
Stage 1 Streaming Baseline (NI-315)Stage 1 流式基线(NI-315) Unsliced Qwen3-0.6B (4070TiS 16 GB, 210+105) 5.25B cells · 21.0 GiB RSS (0 B spill) · 3,877.7 s GPU · 12.02 s CPU verify Non-interactive ε ≤ 2^-40 (Q ≤ 2^64), 1.51 B/cell streaming, includes 116 hidden CoT tokens + 8.67B-cell π_setup (59.9 s CPU verify).纯非交互 ε ≤ 2^-40(Q ≤ 2^64)、1.51 B/格 流式内存,含 116 隐藏 CoT token 与 86.7 亿格 π_setup(CPU 验 59.9 s)。