DEV Community

Vahana
Vahana

Posted on

Receipts: verify an LLM's answer on a different machine, bit for bit

Someone sends you an LLM answer and says "Qwen3-30B wrote this, temperature 0.7, seed 5." How would you check that?

With most inference stacks you can't, not exactly. Rerun the same prompt on your own machine and you get different floating-point logits, because your GPU adds numbers in a different order than theirs. With greedy decoding the text often matches for a while and then drifts. With sampling, the seed feeds a random generator whose output depends on the library version. The best you can do is "looks similar".

Vahana's defining property is that it doesn't have that problem: the same model and prompt give bit-identical logits on any CPU or GPU, under any batching. This post is about the feature built on top of that property: receipts. You run a model with --receipt, you get a small JSON file, and anyone with the same weights can check it on their own hardware, bit for bit, with no tolerance.

Generate an answer with Qwen3-30B on a 4 GB laptop GPU, then verify it bit for bit on the same laptop's CPU

Two commands

vahana run    models/OLMoE-1B-7B-0924 --prompt "The capital of France is" --max-tokens 16 --receipt answer.json
vahana verify answer.json --model models/OLMoE-1B-7B-0924 --device cpu
Enter fullscreen mode Exit fullscreen mode

The first command generates and writes answer.json. The second can run on a different machine, a different OS, a different CPU instruction set or a GPU from a different generation. It prints PASS or FAIL.

The server does the same: add "receipt": true to a /v1/completions or /v1/chat/completions request to vahana serve and the response carries a vahana_receipt object (in the last chunk when streaming).

What is in a receipt

Here are the fields of a real receipt from the repo, experiments/v12_receipts/receipt_qwen3_30b_w4a16_laptop_sampled.json, made on my Windows laptop's RTX 3050 Ti:

  • format: vahana-receipt/1
  • model: type qwen3_moe, and a fingerprint: a SHA-256 over the weight files' names, sizes and safetensors headers (4 files, 16,693,079,328 bytes)
  • prompt_ids: the prompt as token ids
  • decoding: vahana-exact-sampler/1, temperature 0.7, top-p 0.9, seed 5, at most 32 new tokens
  • output_ids: the 32 tokens that came out
  • logits: dtype float32, 32 rows, one short SHA-256 digest per step, plus a chain hash over all of them
  • produced_on: what made it (Vahana version, torch, transformers, cuda, avx2, the GPU's name)
  • receipt_id: a hash over the canonical JSON of the whole thing

Note what is not in it: the logits themselves. A Qwen3 logits row has more than 151,000 entries (its end-of-sequence id alone is 151645), so 32 rows of fp32 would be at least 19 MB. The receipt only stores digests, so a checker has to recompute the logits from the weights. That is the point.

How verification works

vahana verify loads the weights, recomputes every step's fp32 logits, hashes them, and compares against the receipt. It passes only if every step's digest and every token match. There is no tolerance and no spot-checking.

Two details make this practical.

1. One forward pass instead of a full decode. For attention models, the checker does one teacher-forced pass over prompt + answer instead of generating token by token. That only works if prefill logits are bit-identical to decode logits, which is not something you get for free. It was a pre-registered bar in experiments/v12_receipts/README.md, measured on tiny models of seven families on the laptop CPU and GPU, 8 steps each. Six families (Mixtral, Qwen3-MoE, OLMoE, DeepSeek-V3, gpt-oss, GLM-4-MoE) matched on 8 of 8 steps on both devices. The seventh, the hybrid Qwen3.5, matched only on step 0: its Gated DeltaNet layers compute prefill in chunks and decode recurrently, and those round differently. So hybrids are verified by replaying the decode instead (mode: replay), which is slower but still exact.

2. A sampler that is the same everywhere. Sampled answers are checkable only if the seed gives the same token on every machine. Vahana 1.0 used torch.multinomial, whose results depend on torch's implementation. Since 1.2 the sampler uses only IEEE basic operations (an exp built from + - * / and ldexp, relative error below 1e-14), sequential sums, a stable sort, and an inverse-CDF draw at a 53-bit uniform taken from SHA-256(seed, step, row). Given the recomputed logits, a verifier re-derives every sampled token.

Results from the repo

All numbers below are from experiments/v12_receipts/README.md. Producer: my laptop (Windows, Ryzen 7 4800H with AVX2, RTX 3050 Ti 4 GB). Checker: an H100 NVL server (Linux, EPYC 9354 with AVX-512).

  • OLMoE-1B-7B, greedy, 48 tokens, made on the laptop GPU: PASS on the laptop CPU (6.9 s) and laptop GPU (7.6 s), PASS on the H100 server's CPU (0.73 s) and GPU (0.23 s).
  • OLMoE-1B-7B, sampled (T=0.8, top-p 0.95, seed 11), 40 tokens, made on the laptop GPU: PASS on the laptop CPU (7.5 s) and GPU (8.0 s), PASS on the H100 CPU (0.67 s) and GPU (0.39 s).
  • Qwen3-30B-A3B, exact 4-bit, sampled (T=0.7, top-p 0.9, seed 5), 32 tokens, made on the laptop GPU: PASS on the laptop GPU (15.6 s), PASS on the H100 CPU (1.81 s) and GPU (1.24 s).
  • Qwen3.5-35B-A3B (hybrid), greedy, 16 tokens, made on the H100 GPU: PASS on the H100 GPU (4.5 s) and, by replay, on its CPU (16.6 s).

Tampering, on the OLMoE greedy receipt, checked on the H100 CPU: changing output token 10 and recomputing the receipt id gives FAIL, with logits and tokens mismatching at step 10. Editing the seed without recomputing the id gives FAIL on the integrity check.

For served answers, experiments/d1_serve_receipts/README.md adds two results. Eight concurrent requests in the continuous-batching engine (mixed lengths, greedy and sampled) all returned receipts that pass, and each one's logits chain equals the same request run alone. And Qwen3-30B 4-bit served from the laptop's RTX 3050 Ti answered 4 concurrent requests whose receipts all verified on the same laptop's CPU, in 11.25 s, 12.18 s, 7.58 s and 5.16 s.

Is checking cheaper than generating?

Partly, and the repo is honest about how much. vahana bench runs a 512-token prompt, decodes 64 tokens, then verifies that run's receipt (same README):

  • OLMoE on the H100: 64 tokens decoded in 0.43 s, verified in 0.24 s.
  • Qwen3-30B 4-bit on the H100: decoded in 1.1 s, verified in 0.96 s.
  • OLMoE on the laptop GPU: decoded in 9.3 s, verified in 11.7 s.

The check re-reads the 512-token prompt, so its cost is close to time-to-first-token plus a short prefill over the answer. On the H100 that is cheaper than decoding. On the laptop, where prefill was CPU-bound in that version, verifying cost more than decoding.

Checking without the model

Since 1.5.0 the format has a written spec, docs/receipt-spec.md, and a standalone checker, src/vahana/receipt_check.py: 334 lines, Python standard library only. Without the weights it can't check logits, but it does check the format, the receipt id and the stopping rule. I ran it today on the three laptop receipts in experiments/v12_receipts/ (plain Python, no Vahana installed): all three PASS, about half a second per call including interpreter start. Then I copied the Qwen3-30B receipt and changed the seed from 5 to 6:

vahana check: FAIL
  format        ok
  intact        MISMATCH
  stops         ok
  weights_named named
  (logits and tokens not checked: pass --logits, or run `vahana verify --model` with the weights)
Enter fullscreen mode Exit fullscreen mode

You can copy that one file into any project. Any engine that produces the same logits can issue and check these receipts too.

What a receipt does not prove

  • It is not signed. It shows that these weights compute this output for this prompt and these settings, not who ran it.
  • The default fingerprint covers file names, sizes and safetensors headers, not every weight byte. Changed weight values are still caught, because the recomputed logits change.
  • It says nothing about whether the answer is any good.

Why it matters

Today, "model X produced this output" is a claim you take on trust. With bit-exact inference it becomes something you can check: an eval result, an agent's action log, a dataset of generations, a sampled RL rollout. The producer can use a cheap GPU and the checker a CPU, or the other way round.

Try it: https://github.com/vahana-ai/Vahana

pip install vahana
Enter fullscreen mode Exit fullscreen mode

If you make a receipt on one machine and verify it on another, I'd like to hear what hardware you used, and especially about any FAIL: please open an issue on GitHub.

Top comments (0)