gguf-repro-harness / protocol.md
CyberNative's picture
Upload folder using huggingface_hub
a37a9bc verified
|
Raw History Blame Contribute Delete
7.78 kB
# RE-1 protocol — Reproducible GGUF quantization + evaluation harness
Frozen at: **2026-09-17**, git tag `re1-freeze` (source digests: `frozen-sources.sha256`)
Owner: CyberNative AI research agents
Executor run 1: operator A. Executor run 2: operator B (mechanical execution from this document only)
Reviewer for public release: an independent company review recorded before publication
Risk tier: **1** (pinned public models and datasets, recorded licenses, no network during a run, $0 cost, bounded CPU compute)
Status: pilot complete; this document freezes the main run
## Question
Can we produce a reproducible GGUF quantization + evaluation pipeline for a <= 8B open model,
on existing capacity, with fixed seeds and published commands, such that a second run
reproduces the measured quality/memory/latency deltas within +/-2%?
## Hypothesis
Two independent executions of the same frozen commands, in fresh containers from the same
pinned image, reproduce every reported quantity within +/-2% on both pinned models. The
quality metrics (perplexity, HellaSwag) are expected to be bit-identical because the
computation is deterministic at fixed thread count; memory and load time are expected to be
close; throughput is expected to be the noisiest quantity on a shared CPU host.
## Prior evidence
- Our HF artifacts are the only assets with outside pull (Colibri Q5 ~337 downloads/30d;
Qwen3.6 pilot dataset 212/30d); we hold no executed evidence of quantization or evaluation
quality. `experiments/quantized-tool-calling/` was frozen but never executed (Docker build
blocked, CUDA linkage); it is not evidence for or against this question.
- llama.cpp's own perplexity tool is the upstream convention for quant-vs-F16 quality
(`tools/perplexity/README.md`: "the perplexity of base models is used primarily to judge
the quality loss from e.g. quantized models vs. FP16", Wikitext-2 test set convention).
- Competing explanations for a failed +/-2%: nondeterministic kernels; thread-count
sensitivity; page-cache state affecting load time; host contention affecting throughput;
or a genuinely non-reproducible pipeline. The design separates these by measuring each
quantity per arm and comparing arm values as well as deltas.
## Inputs (all pinned, all verified by SHA-256 before the run)
| Input | Revision | SHA-256 | License |
| --- | --- | --- | --- |
| `Qwen/Qwen2.5-0.5B-Instruct` | `7ae557604adf67be50417f59c2c2f167def9a775` | safetensors `fdf756fa7fcbe7404d5c60e26bff1a0c8b8aa1f72ced49e7dd0210fe288fb7fe` | Apache-2.0 |
| `HuggingFaceTB/SmolLM2-360M-Instruct` | `a10cc1512eabd3dde888204e902eca88bddb4951` | safetensors `e6bffe7435d7ddc10fd3b9a9efd429dafbacb1cb17015fb5562664e7532bf86e` | Apache-2.0 |
| Wikitext-2 raw test (`ggml-org/ci` canonical llama.cpp file) | zip pinned by hash | `wikitext-2-raw/wiki.test.raw` `173c87a53759e0201f33e0ccf978e510c2042d7f2cb78229d9a50d79b9e7dd08` | CC BY-SA 3.0 |
| HellaSwag validation text (`klosax/hellaswag_text_data`) | main at freeze | `d572539320eb2050e858ca34b495bbe2103e3b3f1391a9c3bcdf215b0bb93bd1` | MIT (dataset) |
Exclusions: no other data. No personal data. Model files are downloaded once, before the
frozen runs, into the evidence store; the runs themselves are offline.
## Environment
- Image: `ghcr.io/ggml-org/llama.cpp:full@sha256:5faf86f95747fbb40014a8b28c505d8ec0da3d983d4d368a6650bc056f252688`
(llama.cpp build 10991, commit `930e2fa59`).
- CPU only, no GPU; `-t 8` fixed threads; container `--cpus 12 --memory 12g`; `--user` mapped
to the evidence owner; host is the shared CyberNative workstation (16 cores, load varies).
- Each run is a fresh container: `scripts/run_one.sh r1` / `scripts/run_one.sh r2`, run by
different operators (A, then B).
## Pipeline per run
For each model, in this order, all commands captured as raw logs:
1. `python3 /app/convert_hf_to_gguf.py --outfile <model>-f16.gguf --outtype f16 <snapshot>`
2. `/app/llama-quantize <model>-f16.gguf <model>-q4_k_m.gguf Q4_K_M 8`
3. `llama-perplexity -m <arm> -f wiki.test.raw -c 512 --chunks 128 -t 8 --seed 1051 -lv 4`
(perplexity over the first 128 chunks; `-lv 4` also emits the internal `load time`)
4. `llama-perplexity -m <arm> -f hellaswag_val_full.txt --hellaswag --hellaswag-tasks 200 -c 1024 -t 8 --seed 1051 -lv 4`
(built-in HellaSwag `acc_norm` over the first 200 tasks after the tool's fixed mt19937(1)
shuffle; length-normalized ending logprobs)
5. Throughput, alternating arms inside one time window, 5 replicates each:
`llama-bench -m <arm> -p 512 -n 128 -r 1 -t 8 -o json`, order f16, q4_k_m, f16, q4_k_m, ...
The per-replicate `q4/f16` ratio is the drift-controlled latency delta.
6. Peak RSS of each `llama-perplexity` process from `getrusage(RUSAGE_CHILDREN).ru_maxrss`
(one child per measurement process); wall time and raw logs for every command.
## Quantities and frozen tolerance
For every quantity below, with run-1 value `Q1` and run-2 value `Q2`:
- non-delta quantity: `|Q2 - Q1| / |Q1| <= 0.02`
- delta quantity (denominator is the run-1 **F16 baseline** for the same metric):
`|D2 - D1| / |B1| <= 0.02`
- throughput ratio: `|R2 - R1| / |R1| <= 0.02`
Quantities per model: F16/Q4 file bytes and their delta; PPL per arm and delta; HellaSwag
`acc_norm` per arm and delta; PPL-run peak RSS per arm and delta; PPL-run load time per arm
and delta; pp512 and tg128 throughput per arm and the q4/f16 ratios. A missing quantity is a
failure, never a pass. The analysis script (`harness/analyze.py`) refuses to decide on a
missing key and writes the decision plus every relative deviation to `analysis.json`/`.md`.
## Decision rule (frozen before the main run)
- **Capability proven** — every quantity passes on both models: publish the artifact bundle
and feed the commercial team.
- **Capability gap** — any quantity fails: record the failing quantities and the evidence;
state what would be needed (e.g. exclusive CPU for throughput); do not extend the deadline
without a new decision. A partial pass is reported as a partial pass, naming exactly what
reproduced and what did not.
## Resource limits and abort conditions
- $0 new cash. CPU only; no GPU; no network during a run.
- Ceiling: 12 wall-hours and 12 CPU-hours per run (container `--cpus 12`). Observed pilot
scale: ~45-60 minutes per run.
- Abort the run if: an input hash differs; any command exits nonzero or times out; the run
exceeds the wall ceiling. A failed run stays on disk with `run_status.json` = failed.
- Do not touch the running container except to stop it after the wall ceiling; the runner
writes one terminal receipt (`run_status.json`) and every wake reads that file.
## Known limitations (fixed before the main run)
- Two models of 0.36B and 0.5B parameters, not the full <= 8B range; this tests pipeline
reproducibility, not quantization quality at scale.
- CPU-only, one llama.cpp build, one quantization recipe (Q4_K_M, no imatrix), one PPL chunk
budget (128 x 512 tokens) and one HellaSwag subset (200 of 10042 tasks).
- Throughput is measured on a shared host; the ratio is drift-controlled but absolute
throughput is not comparable to a quiet machine.
- Same-harness repeats are repeat execution, not independent scientific reproduction. Run 2
is a second execution by a different operator; the claim is "same commands reproduce",
not "independent reproduction" in the ACM sense.
- Load time is warm-cache (each run converts and quantizes immediately before evaluating).
- PPL is not comparable across models; only within a model between arms.
## Deviations log
- 2026-09-17: pilot only (2/3/8-chunk PPL, 3/8-task HellaSwag, llama-bench r=2) used to pin
log formats and confirm determinism. No main-run number existed at freeze time.