CoolFace
Datasetpublic

Kevletesteur/quant-vs-api-parity-harness

πŸ”¬ quant-vs-api-parity-harness Is your local quant actually as good as the full-precision API? This toolkit answered that question for a 284B MoE compressed to 2.9 bpw β€” verdict: indistinguishable on the real serving path (90.8% token-identical, 240/240 paired-QA parity, deep-derivation parity). 🎯 But the real product is the method: it caught 9 bugs in our own instruments before they could lie to us β€” including one that had us convinced the quant had lost factual recall when… See the full description on the dataset page: https://huggingface.co/datasets/Kevletesteur/quant-vs-api-parity-harness.

sourceHugging Facemitupdated 1mo agoView on Hugging Face
0likes46downloads
Dataset Card

πŸ”¬ quant-vs-api-parity-harness

Is your local quant actually as good as the full-precision API? This toolkit answered that question for a 284B MoE compressed to 2.9 bpw β€” verdict: indistinguishable on the real serving path (90.8% token-identical, 240/240 paired-QA parity, deep-derivation parity). 🎯 But the real product is the method: it caught 9 bugs in our own instruments before they could lie to us β€” including one that had us convinced the quant had lost factual recall when it hadn't. πŸͺ€

Used to produce the results in DeepSeek-V4-Flash-0731-StrixHalo-Verified-GGUF. Model-agnostic in spirit: bring any llama.cpp server + any OpenAI-compatible reference API.

πŸš€ Install

bash
python3 -m venv venv && . venv/bin/activate
pip install sympy jinja2                 # that's all β€” stdlib otherwise
echo "sk-..." > deepseek_api_key.txt     # your reference-API key (chmod 600!)
# a llama.cpp server on 127.0.0.1:8080 serving the quant you want to test

🧭 The method, in the order that matters

1️⃣ Validate your instruments FIRST (scorers.py) β€” non-negotiable

bash
python3 scorers.py   # 67 synthetic cases β€” must print 67/67 before ANY model run

Answer extractors, SymPy equivalence oracle (with convention lists + decimal tolerance), degeneration detector, tool-call deep-equal. Each shipped with synthetic test cases: correct answers in hostile formats (LaTeX \pm, \boxed{}, thousand separators, mid-line), plausible wrongs, truncations, repetition loops. This step caught 2 real bugs in our own scorers on day one. If you skip it, your benchmark will eventually lie to you. πŸ›

2️⃣ Run the gates (G2-G6) β€” they decide what your data can mean

gatequestion it answerswhat we found
G2 reference/g2g3_drafter_reference.shis speculative decoding bit-exact on YOUR stack?❌ 0/10 β€” bench paired arms drafter-OFF
G3 (same script)is your server deterministic?βœ… 10/10
G4 g4g5g6_api.pywhat's the API's self-disagreement at temp 0?short tasks 7/7 identical; long derivations 6/7 different β†’ vote 3 runs
G5 (same)can you even prove template parity?often no (no published template) β†’ treat as documented confound, drop boundary tokens
G6 (same)real API context ceiling?⚠️ disable thinking for the probe or your reply budget dies in the reasoning channel

3️⃣ Measure, cheapest-strongest first

🧬 P1 β€” token-level teacher forcing (p1_*.py) β€” the best instrument here. Generate greedy reference texts via the API (with top_logprobs), then force that exact token sequence through your local model one token at a time (cache_prompt=true, n_probs=20 β†’ linear cost). Record top-1 agreement, the reference token's local rank, NLL. No judge, no regex β€” the oracle is the distribution itself. Bootstrap over TEXTS, never tokens (autocorrelation). Compare token ids, not strings.

πŸ“ T2 β€” multi-step derivations, SymPy oracle (t2_*.py) β€” the compounding-error regime. Parametric bank (truths computed, never typed β€” our own self-test caught a hand-typed constant that was wrong πŸ™ƒ), fixed FINAL: <expr> line, equivalence by simplify(candidate βˆ’ truth) == 0. Truncated β‰  wrong. McNemar on paired outcomes. Log reasoning-trace lengths both sides and report them first.

🎯 T1/T1b β€” paired exact-answer bank + calibration (t1_items.py, t1b_passe.py). 240 generated integer-answer items, two conditions (forced / UNSURE-allowed), answer-token logprob both sides β†’ AUROC(confidence β†’ correctness) and the metric that actually matters for routing: P(answers ∧ wrong).

⏱️ Speed (reference/nmax_depth_bench_reference.sh): warm-up excluded, medians of β‰₯3, report t/s AND ms/eval (under speculation, t/s is not machine speed), nested prompts + prompt cache to pay prefill once. Our headline finding: the speculative `n_max` optimum inverts with context depth (3 at short ctx β†’ 2 from ~16k).

πŸ₯‡ The cardinal rule (it cost us our biggest false finding)

Evaluate QUALITY only through the real serving path β€” `/v1/chat/completions`. Raw /completion with an auto-injected <think> can close the reasoning instantly at temp 0 (10-character traces!) and answer reflexively. We published an entire "the quant lost factual recall" conclusion, then replayed the failed items through the chat endpoint: 4/4 correct. The deficit was our benchmark's serving path, not the quant. Full story and eight more traps in [`NEGATIVE_RESULTS.md`](./NEGATIVE_RESULTS.md) β€” read it before you optimize anything. πŸͺ€

πŸ“ Files

filerole
scorers.pyextractors + oracles + 67 self-tests (run first, always)
g4g5g6_api.pyAPI noise floor Β· template probe Β· context ceiling
p1_gen_api.py / p1_force_local.py / p1_depouille.pyteacher forcing pipeline (resumable) + text-level bootstrap
t2_items.py / t2_passe.pyderivation bank (self-tested truths) + paired passes + McNemar
t1_items.py / t1b_passe.py240-item bank + two-condition calibration passes
reference/*.shspeed & drafter gates β€” reference implementations, adapt to your service manager
NEGATIVE_RESULTS.md🧨 what did NOT work, with numbers β€” the most useful file here

MIT. Benchmarked on AMD Strix Halo (gfx1151, ROCm 7.1, 115 GB unified) against the official DeepSeek API β€” but the method owes nothing to that hardware. Validate your instruments, equalize your serving paths, and let the distributions be the judge. πŸ”