SonicBoom

Reproducible generation: seed, fingerprint, replay

SonicBoom’s serving layer can make a sampled reply repeatable: the same request body and the same seed, on the same machine and build, produce the same bytes. This document defines the fields that say so, the scope the guarantee covers, and the optional local replay store.

The implementation is the Guile serving layer (bindings/guile/scheme/sonicboom/serve/); the guarantee is about the engine below it, so it holds for --backend real and, for protocol tests, --backend mock.

1. The seed

Sampling is keyed by (seed, absolute position, history). A request with temperature > 0 samples; temperature 0 is greedy (argmax).

The same seed under a different request, or a different seed under the same request, is not promised to differ: with a peaky distribution the draw can be the same. Reproducibility is the guarantee; variety is a property of the distribution.

2. The sonicboom object

Every chat completion — streamed or not, greedy or sampled — carries a top-level sonicboom object:

"sonicboom": {
  "fingerprint": {
    "engine": "v0.0.6-187-gd44a66e",
    "commit": "d44a66e81216",
    "numerics": "standard",
    "gpu": "NVIDIA GeForce RTX 3050",
    "driver": "595.84",
    "tune": "e234db4c87d28a43",
    "model": "sha256:8f3c1d0a9b7e2f41",
    "id": "03d4602d080e8a6e"
  },
  "replay_id": "rp-4bd0f1a2c3d4e5f6",
  "guarantee": "bit-identical",
  "timing": {
    "prompt_tokens": 2048,
    "reused_tokens": 1792,
    "ttft_ms": 412.837,
    "prefill_tok_s": 895.412,
    "decode_tokens": 64,
    "decode_tok_s": 41.203,
    "total_ms": 1948.551
  }
}

2.1 Fingerprint: the scope of the guarantee

A fingerprint names exactly the inputs outside the request that can change the bytes. The record is:

field meaning
engine libsonicboom’s git_tag (or unknown)
commit the library build’s git_commit, first 12 hex digits
numerics the resolved numerics profile, strict or standard
gpu nvidia-smi’s GPU name (none when unreadable)
driver nvidia-smi’s driver version (none when unreadable)
tune boom_tune_digest(): FNV-1a 64 over the library’s tuning tables — the tuner’s per-op choice files, the reduction-acceptance verdicts and the JIT candidate cache — in a fixed order, 16 hex
model sha256: + the first 16 hex of the GGUF’s SHA-256; for a model with no file (the mock backend) none:<model-id>
id FNV-1a 64 over the canonical text of the other fields, 16 hex

Two servers give the same id exactly when they agree on every field. The guarantee is: the same request body and seed, on a server with the same fingerprint id, produce the same reply bytes — across requests, across a restart, and across two server processes. It does not cross a change in engine build, numerics profile, GPU or driver, tune tables, or model file.

The tune digest covers tables, not bookkeeping: the append-only runtime logs (decisions.jsonl, fattn-reports.jsonl) and compiled-kernel artifacts are outside it, so two servers that resolve the same choices agree even though their logs differ. It is fixed at the library’s first call in the process, so the serving layer asks for it before the reply it describes.

A cold tune root is outside that agreement: a tuner that has not yet measured a shape class times its candidates against whatever else is running, and two servers that tune the same class concurrently can keep different tables — and then different bytes. Their fingerprints differ in tune, which is the report of exactly that. For output compared across processes, warm the tune root once (or pin SONICBOOM_TUNE_DIR to a directory already warmed) so both processes read the same tables; tools/repro-conformance’s peer check requires matching fingerprints for this reason.

The tune root is $SONICBOOM_TUNE_DIR, else $XDG_CACHE_HOME/sonicboom/tune, else $HOME/.cache/sonicboom/tune. The model hash is sha256sum of the whole file, cached in the process and in $TMPDIR (keys: basename, size, mtime) so a second server does not re-read a multi-gigabyte GGUF. The server part of the record is computed once per process.

The fingerprint is a serving-layer report: it is not part of the C ABI, and no Layer 2 header exposes it.

What the request itself contributes is ordinary: the messages, the rendered chat template, the sampling parameters, max_tokens, stop strings and constraints. The same fingerprint with a different request or seed is a different sample.

3. Streaming (SSE)

With "stream": true:

So a client can take the seed from the first chunk and ignore the rest, and a relay can attach the object to the finished reply from the last.

4. The replay store

--replay-store DIR (off by default) makes replies regenerable. While it is on, the server writes one JSON file per completed chat reply, DIR/<replay_id>.json:

{"replay_id": "rp-…", "seed": 2871560934, "model": "qwen2.5-7b",
 "time": 1795418553, "fingerprint": "03d4602d080e8a6e",
 "request": { … the request body, with the deciding seed added … }}

The stored body is the client’s request as decoded, with the seed field set to the seed that actually drew the reply (seed is left absent for greedy). The server keeps the last replay_id it wrote per reply; nothing else is added, no completion text is stored, and the file lives only under DIR.

4.1 Regenerate

curl -s -X POST http://127.0.0.1:8000/sonicboom/replay/rp-4bd0f1a2c3d4e5f6

The server loads the record, re-admits the stored body through the normal queue, runs the engine, and returns a normal (non-streamed) completion with the stored replay_id, the stored seed and the current sonicboom object. guarantee is "bit-identical" when the current fingerprint id equals the stored one, "fingerprint-mismatch" otherwise. An unknown id, a bad id, or a server without a replay store answers 404 replay_not_found. The stored model must still be served under the same model id.

4.2 History

GET /sonicboom/history returns a minimal HTML page: the most recent 100 stored replies, newest first, with time, model, seed (or “greedy”) and two actions per row — replay (POSTs the replay endpoint and prints the JSON below) and copy seed. It reads only the files in the replay directory; a server started without --replay-store has no store to describe, so the endpoint answers 404 replay_store_disabled.

5. Privacy

The replay store exists to keep prompts and replies locally; it is opt-in because it does. Specifically:

6. What is tested

7. Chat clients

The clients SonicBoom ships print the seed on every turn, so a person using one can always ask for the same reply again. The line is the last line of a turn, dim on a terminal:

seed 2871560934 · reproducible
greedy · reproducible

There is no HTML demo page in this tree; the history page (§4.2) is the only page the server serves.