witcert-kv-certificates

August 19, 2026 · View on GitHub

Artifacts, guards, and machine-checked proofs for the paper "WitCert: Sound Runtime Risk Observability and Gating for KV-Cache Quantization" — Fanzhe Wei, Li Liu, Ziyang Wang, Chenyu Wang, arXiv:2607.28699.

The four-paper series

PaperPaper linkArtifact
P1WitCert: Sound Runtime Risk Observability and Gating for KV-Cache QuantizationarXiv:2607.28699witcert-kv-certificatesthis repository
P2Runtime Observability for Heterogeneous Attention MemoryarXiv:2608.05863witprobe-attention-memory
P3Pricing the Risk of Runtime Compression: Anytime-Valid Admission and a Served-Output Law for Compressed Serving StatearXiv:2608.15810witcert-w-certified-precision
P4What to Protect When You Quantize a Mixture of Expertsnot yet publicnot yet public

These four papers are one line of work, not four topics. P1 asks whether compression is damaging the request being served right now, and answers it for the KV cache with a provably sound runtime meter and meter-driven gating. P2 carries the same question to the fact that a modern model's memory is no longer a plain KV cache — latent caches, learned sparse selectors and recurrent states each fail differently — and gives one observability contract for all four classes. Together they answer whether it can be measured. P3 asks what the measured risk is worth and how to spend it: the union budget those systems rely on exhausts on every long production request, and what replaces it is an anytime-valid ledger, a law carrying the certified witness to the served output, and the quantifier that makes the bound hold on a request never seen. P4 asks the converse — what that machinery should be pointed at — and prices the field's shared instinct that MoE routing invariance must be protected, finding it wrong in three independent ways.

Each paper stands alone: P3 and P4 inherit the typed-contract vocabulary of P1 and P2 but restate no result of theirs, and neither claims the other's.

Built for lowest-cost verification: every number in the paper regenerates from the frozen artifacts shipped here, and a claim guard fails the build on any mismatch.

One-command reproduction

pip install -r requirements.txt   # matplotlib + mpmath; L0 needs stdlib only
bash reproduce.sh                 # L0 numbers -> L1 figures -> L2 gates, single verdict at the end

Tested environment: Python 3.9.6 / matplotlib 3.9.4 on macOS and Linux; no GPU, no network access, no model weights required. The Lean layer is pinned by formal/lean-toolchain and run separately (see below).

30-second verification (no GPU, Python 3.9+ only)

python3 tools/make_canon.py          # regenerate the frozen-number canon from run artifacts
python3 tests/test_paper_claims.py   # every paper number must appear and match — or FAIL

ALL PAPER CLAIM CHECKS PASSED means every quantitative claim traces to a JSON artifact under experiments/out/ or experiments/out_siteB/.

Layered reproduction

LayerWhat it verifiesCommandNeedsTime
L0every paper number ↔ artifactpython3 tools/make_canon.py && python3 tests/test_paper_claims.pyPython 3.9< 1 min
L1figures regeneratepython3 tools/make_figs.py+ matplotlib< 1 min
L2certificate mathematics self-checkspython3 tests/test_certificates.py && python3 tests/test_independent_crosscheck.pyPython + mpmathminutes
L3all Lean theorems, zero sorry, standard axioms onlycd formal && bash check_all.shelan + Mathlib cache~30 min first run
L4serving-stack integration rerunsprivate patches + GPUssee boundary below

What is here / not here

Here: frozen artifacts for every cited number, the canon/claim/figure generators, the certificate self-check suites, and the complete Lean development (three standard axioms only).

Not here: the measurement-platform implementation and the serving-stack patches (they modify a third-party numeric path); their measured outputs are shipped, and the paper states this boundary explicitly.

Requirements

  • Python ≥ 3.9; L1 needs matplotlib; L2 needs mpmath
  • Lean 4 via elan for L3

License

Apache-2.0 (see LICENSE). Please cite arXiv:2607.28699; machine-readable metadata is in CITATION.cff.