FlashProve × Bend 2 Verify that an LLM's tokens came from a committed integer model, on a CPU, without the weights. Results · Quick start · How it works · Assurance · Repository · Development A FlashProve proof (H821 format) attests that a window of output tokens came from a committed integer language model, either as the exact top token at every covered position or within a caller-chosen logit-gap bound. You hand…
A FlashProve proof (H821 format) attests that a window of output tokens came from a committed integer language model, either as the exact top token at every covered position or within a caller-chosen logit-gap bound. You hand verify-bend the public configuration, verification key, token window, proof bytes, trusted commitment ID and policy. It checks the proof on a CPU without seeing any model weights, then answers YES, WITHIN LIMITS or NO: <check>.
Upstream FlashProve ships two CPU verifiers: a single-threaded Lean executable (OnBytes, 56.7 s on an M4 Max and 92.7 s on a 16-core Xeon for the full-size proof) and an unverified C++ verifier (cp_verify -j 1, 7.95 s on an M4 Max and 18.50 s on a 16-core Xeon). Bend 2 is a dependently typed language that compiles directly to parallel C. This repository implements one standalone verifier in Bend 2: Bend’s independent Lean kernel (BendTT) rechecks all 151 standalone modules, PROOF.bend proves 25 arithmetic and canonical-decoding laws stated in LAWS.bend with zero axioms, and the same source compiles to a parallel native binary.
Apple M4 Max
16-core Xeon 8480CL
Formal checks
Runtime
7.11 s (16 workers) 7.98× faster than Lean 10.4% faster than cp_verify -j 1
16.23 / 16.63 s (16 workers) 5.71× faster than Lean 10.1% faster than cp_verify -j 1
151 modules · 25 laws Rechecked by BendTT Lean v4.34.0, zero axioms
Standalone CPU binary Bend 2 to parallel C 0 weights, PATH=""
Important 重要
Early research verifier covering the four published H821 configurations over synthetic weights (two model sizes, the larger at Llama 4 Maverick dimensions, each under exact-match and clipped-gap). At verification time it loads offline-exported chain plans digest-bound to each configuration (profiles/); in-Bend plan derivation is implemented and tested against cp_verify (make plan-chains-check, make plan-first-derived) and is not yet wired into src/standalone.bend.
Machine-checked laws cover the arithmetic kernels and canonical word decoding, with a one-line manual inspection link from parameterized _at/_spec definitions to runtime literal radices.
The bits=128 field is a per-round error accounting target crediting proof of work and assuming upstream commitment binding (ePrint 2025/2055, Theorem 4.6), separate from an end-to-end security proof for the compiled binary.
No formal proof yet shows that Bend acceptance implies FlashProve’s Lean acceptance for every supported input.
The headline workload is full-size, a synthetic-weight model with Llama 4 Maverick dimensions. Its request carries 24 prompt tokens, 1,000 reply tokens (24..1023) and one proposed next token (ID 52599), so YES checks 1,001 exact-match predictions. Each timed call starts a fresh process from launch to exit and checks 23.85 MiB of proof material: example.proof (17.91 MiB), key.bin (3.14 MiB) and leaf/0.bin (2.81 MiB). Inference and proving happen beforehand. Fixture details
Every latency figure below is the median of three alternating pairs after one verified warmup per binary with files in cache, and every RSS cell is the maximum peak RSS across those three runs. Both hosts ran standalone digest d1f53309 (2026-12-01 quiet reruns), prior to the 48-bit Nat saturation clamp in src/weight_layout.bend (current digest b47502ec, unchanged on the four admitted layouts and re-verified with make perf-gate at 1.47× C++ CPU time on the M4 Max). On d1f53309, make perf-gate measured 1.37× C++ CPU time on the M4 Max and 1.82× on a single Xeon core (ceiling 2.59×). M4 rerun · Xeon rerun · Measurement protocol
Bend vs. Lean OnBytes (full-size proof)
Lean OnBytes is single-threaded. In the 16-worker rows it received the same 16 cores as Bend, so the 1-worker rows compare single-thread speed while the 16-worker rows compare parallel Bend against single-thread Lean.
CPU
Bend workers
Bend
Bend peak RSS
Lean OnBytes (1 thread)
Lean peak RSS
Bend vs. Lean
Apple M4 Max
1
15.60 s
1.88 GiB
56.67 s
4.91 GiB
3.63× faster
Apple M4 Max
16
7.11 s
3.80 GiB
56.70 s
4.91 GiB
7.98× faster
Intel Xeon Platinum 8480CL
1
34.48 s
1.88 GiB
94.78 s
4.96 GiB
2.75× faster
Intel Xeon Platinum 8480CL
16
16.23 s
3.76 GiB
92.73 s
4.96 GiB
5.71× faster
Bend vs. C++ cp_verify
Each row reports one paired experiment on the same host and core allocation. -j 1 caps only C++'s request stage, so without a one-core pin cp_verify -j 1 uses more than one core (9.6 s CPU in 8.0 s wall on M4 Max; 20.8 s CPU in 18.5 s wall on 16 Xeon cores).
CPU and allocation
Fixture
Bend workers
Bend
C++ cp_verify -j 1
Bend vs. C++
Bend RSS
C++ RSS
M4 Max, unpinned
accepted-proof
1
1.61 s
0.67 s
2.38× slower
0.18 GiB
0.19 GiB
M4 Max, unpinned
full-size
1
15.54 s
7.99 s
1.95× slower
1.88 GiB
3.92 GiB
M4 Max, unpinned
full-size
16
7.12 s
7.95 s
0.90× (10.4% faster)
3.80 GiB
3.92 GiB
Xeon 8480CL, 1 core each
accepted-proof
1
3.34 s
1.84 s
1.82× slower
0.18 GiB
0.15 GiB
Xeon 8480CL, 1 core each
full-size
1
34.44 s
21.12 s
1.63× slower
1.88 GiB
3.29 GiB
Xeon 8480CL, same 16 cores
full-size
16
16.63 s
18.50 s
0.90× (10.1% faster)
3.73 GiB
3.28 GiB
At 16 workers, Bend beats cp_verify -j 1 on full-size on both hosts, meeting the single-thread C++ latency target (REQ-PERF-4). When C++ also uses 16 request-stage threads (cp_verify -j 16), C++ stays faster on M4 Max (6.35 s vs. 9.52 s on an earlier matched build); on Xeon, cp_verify -j 16 did not speed up past -j 1 (21.13 s). On the small proof (accepted-proof), 16 Bend workers stay behind cp_verify -j 1 on both hosts (1.39 s vs. 0.64 s on M4 Max; 3.36 s vs. 1.12 s on Xeon). M4 pairings · Xeon 1-core · Xeon 16-core · Multi-threaded C++ run
Parallel scaling and peak memory
Parallel throughput plateaus around 8 workers on both CPUs because the Fiat-Shamir transcript serializes stage transitions while local algebraic checks fan out across workers. On M4 Max, wall time stays flat from 8 to 16 workers (7.22 s, 7.22 s and 7.19 s at 8, 12 and 16 workers); on Xeon it bottoms out at 8 workers (14.78 s, then 15.42 s at 12 and 15.63 s at 16). Running 16 workers roughly doubles Bend’s peak RSS (1.88 GiB at 1 worker vs. 3.73 to 3.80 GiB at 16).
Quick start
You need macOS or Linux with Git, make, Clang, curl and Python 3.11 or newer. Building the upstream C++ reference (make oracle) on Linux also requires g++ 13 or newer. Rechecking proofs with Bend’s independent Lean kernel (make kernel-check) runs on Darwin-arm64 and Linux-x86_64 and requires zstd or Python 3.14+'s built-in compression.zstd.
The first build downloads the pinned Bend 2.0.40 toolchain into .toolchain/, fetches the pinned FlashProve checkout into .upstream/ and verifies its fixture hashes, unpacks the four public plan bundles and generates the lookup tables under build/, then compiles build/verify-bend:
In a terminal, stderr logs each stage before it starts, and stdout carries the closing commitment, proof of work, result-v1 and verdict lines. On a refusal (exit status 1), the stage line immediately above NO: <check> on stderr names the stage and file that failed:
stage: public, files: CONFIG, REQUEST, Y, DIR
stage: key, file: IVK/key.bin
stage: leaf, file: PROOF
stage: leaf, file: IVK/leaf/0.bin
stage: request, file: PROOF
commitment: 49 closeness rounds of the one-time files rest on another source than the bound within a third of the distance; the table has a record: the binding of the weights rests on the theorem on codes (ePrint 2025/2055, Theorem 4.6), taken as given
proof of work: up to 32 bits counted in 38 rounds; with it the least round has 128.00 bits, without it 96.23 bits
result-v1 status=0 claim=exact-match id=79a5a2bc7a469b40df73dedf40abeb740671e8ae8077738bd3743897aeb22183 bits=128 work=32 work-rounds=38 least-round=128.00 least-round-without-work=96.23 commitment-assumed-rounds=49 record=1 r=60 e=64 T=64 tokens=61..63 y=yes policy=exact-match C=256 theta=256 cap=0 s=16 sh=8 sT=4 F=24 above-clip=0 leaf=0 stages=key,leaf,request dw=8 build=b47502ec85d252b14a99ca72b1aef9eb59a0c34b54f52ba778bc4e1a9edc73b8
YES
In result-v1, tokens=61..63 y=yes means the proof covers the request’s last three tokens and the proposed next token (ID 199). Expected output
Flag
Effect
-id HEX
Required. Expected 64-hex-character model commitment ID.
-policy SPEC
Caller policy (clipped-gap,C,theta,cap,s,sh). Required for clipped-gap proofs covering request tokens.
-data DIR
Directory holding plans/ and tables/ (default: build).
-j N
Bend worker count (-j 1 for serial execution, -j 16 for 16 workers).
-timing
Print worker count and per-stage wall milliseconds on stderr without changing stdout.
Clipped-gap proofs
Floating-point inference and the committed integer model can rank close tokens differently. FlashProve’s clipped-gap policy scores each covered reply token by how far its logit falls below the best integer logit (with a tie rule), clips each cost to C, caps the average clipped cost at theta and caps how many costs may exceed C at cap. A covered next token (y) must still rank first.
In accepted-proof-clipped-gap, 4 of the 32 covered reply tokens are not the top choice, and the proof passes under the fixture’s policy:
Here tokens=16..47 y=no covers the reply inside the request and claims no next token. Cost definition
Using it for real
Get the commitment ID from a source you trust before sending the prompt, and pick any clipped-gap parameters without looking at the proof. After the call exits with status 0, confirm that id, claim, policy, tokens and y in result-v1 match what you asked for. Verification contract
How it works
Plain-text pipeline summary
Inputs: CONFIG, IVK, REQUEST, Y, PROOF, -id <trusted HEX>, [-policy ...]
Public data (-data build): 4 config-bound plan bundles, 4 public lookup tables
Stage 0 · Public Hash CONFIG to select 1 of 4 H821 configs; verify the 4 LUT
digests, request range [r, e) and caller policy.
Stage 1 · Key Check IVK/key.bin anchor commitment and proof; rebuild the
commitment ID and require an exact match with caller -id.
Stage 2 · Leaf Read leaf index k from PROOF header; check IVK/leaf/<k>.bin
and its algebraic link to the anchor.
Stage 3 · Request Replay Fiat-Shamir transcript (BLAKE2b); check FF, attention
and output-head equations, weight-table claims and exact-match
or clipped-gap token bounds.
Exit 0: commitment, proof of work, result-v1, and YES or WITHIN LIMITS (stdout)
Exit 1: stage line and NO: <check> (stderr)
The entire verification pipeline is ordinary Bend code starting at src/standalone.bend. Bend lowers it to C, and Clang compiles that C at -O3. The C entry point, src/native/verify_main.c (45 lines), clears BENDRTS and forwards only -j into the scheduler so caller paths and policy strings stay outside Bend’s runtime flags. No external binary runs during verification (PATH="" in conformance tests).
What is proven, tested and open
Layer
Established
Mechanism
Outside the boundary
Arithmetic kernels
Exact Gl.carry / Gl.borrow; canonicality and congruence mod p = 2^64 - 2^32 + 1 of Gl.reduce_at, wide_spec, mul_spec, sum3_spec and Gl.double; congruence (for canonical b1, b2) and canonicality of e3_spec in F_p[X]/(X^3 - 2).
25 laws in LAWS.bend and PROOF.bend across 21 proofs/ files (0 axioms), checked on every commit (make laws) and by BendTT (make kernel-check).
Bend 2.0.40 expands closed naturals in unary, so Gl.reduce, Gl.wide, Gl.mul, Ex.sum3 and E3.mul link to _at/_spec defs through one-line wrappers checked by reading. Proofs use Peano Nat, while native Bend uses 48-bit Nat (bounds checked manually). Ex.add, Sumcheck helpers and ff_stack.inverse have no laws.
Canonical decoding and byte packing
Ch.field_candidate(hi, lo) is nonzero iff hi * 2^32 + lo < p (field_check); all four canonical Goldilocks word-decoding paths in src/ (transcript.bend, opening_bytes.bend, commitment.bend / round_io.bend, record_seeds.bend) call it. bytes_words and bytes_roundtrip prove 4-byte little-endian packing for H.u32s and H.le.
bytes_words covers a 4-byte list only (by reflexivity), not streaming H.u32s over arbitrary slices or Header.le32.
Type and linearity checking
All 164 src/*.bend modules pass Bend’s checker (make check); all 151 transitive modules of src/standalone.bend plus PROOF.bend pass BendTT (make kernel-check, Lean v4.34.0) on both macOS-arm64 and Linux-x86_64.
bend --check-only on every PR and push; bend --verdict in make kernel-check and the manual extended workflow.
Types establish shapes and linear resource discipline, separate from protocol soundness. 13 in-progress planner modules in src/ sit outside standalone.bend. Bend-to-C codegen, Clang -O3 and verify_main.c sit in the TCB.
Conformance, fuzzing and mutation testing
Whole-call agreement with cp_verify and Lean OnBytes on all four published fixtures and a fresh H100 next-token proof (d1f53309); 123 altered sets (23 record sets, a cross-commitment leaf, 10 + 10 altered copies, 79 item changes); 91/91 worker-parity checks (1 vs. 16 workers); fixed-transcript tests (make request-claims-test); 256 seeded differential fuzz cases (make fuzz); 7/7 CI strict mutation checks killed plus a 10-site delta sweep (1 killed, 9 shadowed or self-check sites surviving).
The 40,000-case differential fuzz campaign (0 disagreements) ran on earlier build fabcb2b (report). Of 412 "NO: " literals in src/*.bend, 190 are covered by 185 mutated Header.require sites; 167 IO.die and 55 K.need/need sites remain outside the harness.
End-to-end soundness
Open.
None yet.
No formal proof yet shows that Bend acceptance implies FlashProve’s Lean acceptance for every supported input.
164 Bend modules (151 transitive standalone verifier modules starting at standalone.bend, plus 13 in-progress planner and catalog modules) and the 45-line C driver verify_main.c.
Kernel microbenchmarks and the BLAKE2b kernel generator.
Development
make help # list all 60 documented targets
make smoke # ~36 s warm: docs-check, generated-check, laws, both small proofs, one altered bit
make ci # local conformance suite (Actions runs its six groups in parallel)
make laws # check all 25 arithmetic and decoding laws in PROOF.bend
make kernel-check # recheck PROOF.bend and the 151 standalone modules with BendTT (Lean v4.34.0)
make standalone-full # all four published proofs plus public-input refusals
make standalone-extended # 123 altered sets (including a cross-commitment leaf) against cp_verify
make fuzz # random byte mutations on both small fixtures, Bend vs. C++
Citation metadata lives in CITATION.cff (CFF 1.2.0).
BibTeX (v0.1.1)
@software{abdelstark_flashprove_bend_verifier_2026,
author = {AbdelStark},
title = {flashprove-bend-verifier: A standalone CPU verifier for FlashProve inference proofs in Bend 2},
version = {0.1.1},
year = {2026},
url = {https://github.com/AbdelStark/flashprove-bend-verifier},
license = {Apache-2.0}
}
评论