Aletheia
04.12.2026
By Ayush
[02]  Part 2 of 3
[A]  All posts

How to prove a model with ZisK

To prove a model ran, you write the model as a program and let ZisK prove the program. The idea is that simple; the craft is in five decisions. We'll walk through them with three models of growing size: Andrej Karpathy's stories260K and stories15M, and Qwen3-4B.

Three words you'll see

Guest: the program ZisK runs and proves; here, the model. Witness: the full record of everything the guest did, which the proof is built from. Precompile: an operation ZisK proves with a dedicated, much cheaper circuit, such as a hash or a dot product.

A language model, in one paragraph

A language model reads text as tokens, small pieces of words. stories15M knows 32,000 of them. For each token it runs the same stack of layers, 6 for stories15M and 36 for Qwen3-4B. Each layer looks back over the story so far (attention), then transforms what it found (a feed-forward step). At the end, it scores every token it knows and picks the best one. That token joins the text, and it goes again.

token→look up its numbers
repeat 6 times
look back at the storyattention
transformfeed-forward
score all 32,000 tokens→pick the best→add it, go again
the heavy part is matrix multiplication, everywhere above
stories15M
6 layers, 32,000 tokens
core/src/model.rs

1. Write the model as a program

ZisK runs ordinary RISC-V programs, the kind a Rust compiler produces, and proves every instruction. So the model is just its forward pass in Rust, following Karpathy's reference code step by step. There's no circuit to design for each model: a new model is new code.

The guest also decides when to stop. Ours writes until a token ends a sentence (with . ! or ?), or the reply reaches 48 tokens, and always picks the highest-scoring token, so the same input always gives the same output.

2. Pin the weights

If the proof doesn't fix the weights, a prover could quietly run a different model. There are two ways to fix them.

Hashing 30 MB on every proof costs real time, and the hash you pick matters a lot. ZisK has a precompile for each of these three; we measured them on the same proof:

Proofs per hour, by hash function

same 30 MB, same first turn, taller is better
stories15M
weights hashed in the proof
Source: our runs

Poseidon2 is often the default in proof systems, because other proofs can check it cheaply. For a big blob of bytes it was the slowest by far. We use SHA-256.

3. Keep the math real

A common way to make models cheaper to prove is to change them: shrink the numbers to 8 or 4 bits, or replace hard functions with lookup tables. Then the proof is about a different model. We keep the model's own arithmetic. The weights are in BF16, a 16-bit format models often ship in, and every multiplication against the weights goes through ZisK's dot_bf16 precompile:

2.5×0.8
−1.0×0.3
…
multiply pairs
→
add every product exactly
nothing rounded yet
→
round once
one 32-bit result
what dot_bf16 does
inputs: BF16 numbers
ZisK precompile

Because every product is added exactly and rounded only once, the answer doesn't depend on the order of the additions. Everything else (normalising, attention, the activation function) is plain 32-bit math, proven step by step.

BF16 isn't bit-identical to Karpathy's 32-bit original, so we measured the gap. Both read the same 59-token story, and at every position we compared the next-token scores:

Same next token as the 32-bit original

stories15M, one square per position
same next token: 59 of 59
worst score error: 0.16
KL divergence ≤ 0.0003
Source: our runs

4. Carry the memory between proofs

A model remembers what it has read: for each earlier token it keeps a few hundred numbers, the KV cache. Re-proving the whole conversation every turn would be wasteful, so each proof takes the cache as an input, fingerprints it, and publishes the fingerprint of the new one. The checker makes sure each proof starts from the memory the previous one ended with. The proofs link up:

Sentence 1
story0000 → 5585
memorydf3f → 5428
=
Sentence 2
story5585 → 31ba
memory5428 → da52
=
Sentence 3
story31ba → 807d
memoryda52 → 556b
a real three-sentence story
each 'after' = the next 'before'
Source: our runs

These are real fingerprints from a three-sentence story. Change one word of sentence 1 and its "after" changes, so sentence 2's proof no longer starts where sentence 1's ended.

Memory isn't free. Each new token looks back over all the earlier ones, so later sentences cost more: our three took 157, 235 and 360 seconds to prove.

5. When the model is too big for one proof

Qwen3-4B has 4 billion parameters and 36 layers, in BF16. That's about 8 GB of weights, far more than one guest can take, so a request is split along the model's own structure:

embedding
1 job
→
36 layers, one job each
→
5 vocabulary ranges
→
best of 5
the next token
Qwen3-4B, BF16
42 jobs for one request
Source: our harness

One job looks up your tokens, one job runs each of the 36 layers, and five jobs each score a fifth of the 151,936-token vocabulary and report their best. The best of the five is the next token. Every job fingerprints the numbers it receives and hands on, so the pieces have to fit together exactly. Some jobs are still too big for one proof: layer 1's matrix work is split further, into 240 slices.

Qwen3-4B, layer 1: 240 slices

where proving stands
provenstill to prove
the embedding is also proven
each slice ~9 minutes
Source: our harness

Where it stands: the whole model runs end to end inside ZisK, the embedding and the first two slices of layer 1 are proven, and the rest is next. On short inputs, our reference harness matches Hugging Face's model exactly; on long ones, the chosen tokens still match but some scores drift. Finding why is part of the work.

The three examples

stories260Kstories15MQwen3-4B
Weights pinned bybuilding them inhashing them each proofhashing, per job
One proof coversone tokenone token to a sentencepart of one layer
Statusproven end to endproven end to endruns end to end; first proofs done

Next: what all this costs, and where the time goes.