Certified, sealed, proof-carrying hallucination gating for context-grounded language models, calibration-free, training-free, ships compatible with OpenAI black box deployments.
Each claim is judged twice by a strict entailment verifier, with and without its cited evidence, and released only if its credibility collapses without the evidence. The release is sealed to one bit per claim, the gate arithmetic is provable in zero knowledge against committed verifier confidences, execution is attestable, and verifier quality is a pre-registered, monitored measurement.
Pure standard library at runtime. cryptography is an optional extra for
the dev attestation signer.
pip install -e . # library + `zkground` CLI
pip install -e .[attest] # + mock attestation provider (dev/test)
pip install -e .[test] && pytest
claims.txt, one claim per line, citations inline:
The deal closed at £42M on 12 March 2026 [S1].
Dana Obi will join as CEO [S2].
spans.json:
{"S1": "The acquisition closed at £42M on 12 March 2026.",
"S2": "Kestrel founder Dana Obi will join as CTO."}Run (endpoint is any OpenAI-compatible server):
export OPENAI_API_KEY=...
zkground --endpoint https://api.openai.com/v1 --model gpt-4.1-mini \
run --claims claims.txt --spans spans.json --attest mock --out out/
out/release.json is the entire public payload. Everything else in out/
is marked PRIVATE and stays with the operator. Consumer-side checks:
zkground verify out/release.json # L1 simulatability audit
zkground witness out/witness.PRIVATE.json # L2 reference check (operator side)
zkground attest-verify out/release.json # L3 binding + signature
On challenge, open exactly one claim:
zkground open --openings out/openings.PRIVATE.json --claim 0 > opening.json
zkground verify-opening out/release.json opening.json --spans disclosed.json --reexecute
L4 audit and certificate:
zkground audit --items audit.jsonl --prereg prereg.json --judge-id gpt-4.1-mini@2026-06
zkground fields --cert audit_certificate.json --channel near_miss --ev-len 900
Feed the printed gate_param_fields back into run --cert-fields, and the
release carries its own measured exchange rate, committed into the
attestation binding.
| setting | flag | env |
|---|---|---|
| base URL | --endpoint |
ZKGROUND_ENDPOINT |
| model | --model |
ZKGROUND_MODEL |
| API key | --api-key-env NAME |
value read from $NAME (default OPENAI_API_KEY) |
The verifier can be any chat-completions server returning logprobs with
top_logprobs: a hosted frontier model, a local NLI-class server, or a pool.
Pin the exact model snapshot in --judge-id for audits; challenge
reproducibility is conditional on it.
| layer | guarantee | condition |
|---|---|---|
| L1 sealed release | the payload is reproducible by a simulator from public inputs; corpus disclosure beyond the answer is at most 1 bit/claim | unconditional; audited per release |
| L2 proof-carrying gate | released bits are exactly the integer predicate of the committed, hidden verifier confidences (bit == predicate(committed) is an identity via fail-closed rounding and the sentinel rule) |
cryptographic; check_witness is the executable spec, proofs/gate_circuit.circom the Groth16 circuit |
| L3 attested execution | the committed confidences were produced by measured code calling the pinned verifier; binding covers the full release, hence also the L4 certificate id in gate_params |
TEE vendor root of trust |
| L4 verifier quality | g = ln(TPR/FPR) per negative type and length bin, bootstrap CIs, prior-free threshold pi*, drift SPRT | empirical, pre-registered, monitored; never proven |
src/zkground/
verifier.py judgment channel: prompt, masking, conservative intervals
gate.py L2: quantization, predicate, GateLedger, check_witness
release.py L1: parsing, ZKRelease, provenance ledger, audit, run_gate
attest.py L3: binding, providers (mock / nitro / tdx), verification
audit.py L4: pre-registration, typed audit, certificate, SPRT
commit.py shared salted Merkle primitives
cli.py entry point
proofs/ gate_circuit.circom + CIRCUIT_SPEC.md (the L2 proving side)
tests/ offline end-to-end via the transport seam
Claims are judged one per call; there is no grouped scoring. The prior
arm replaces cited span text with [CITED_EVIDENCE_REMOVED]; both arms
always run, so every claim costs two calls. Groth16 needs a
one-time per-circuit ceremony; the predicate uses no lookups, so PLONK or
Halo2 are drop-in alternatives (see proofs/CIRCUIT_SPEC.md §8).