5.0 KiB
5.0 KiB
name, description
| name | description |
|---|---|
| quant-pipeline-adversarial-review | Review or audit the serverAppConfigs quantization campaign pipeline (convert-calib-kldref-score plus corpus builder/rechunker/pusher, fp8 stacker) for defects that silently waste GPU-hours or produce a number that is not the claimed number. |
Adversarial review of the quant campaign pipeline
Friction-earned 2026-10-29 across scripts/convert-qwen38-w5nl64.sh,
run-qwen38-bf16.sh, make-calib-corpus.py, rechunk-kld-corpus.py,
calib-push.py, stack-qwen38-official-fp8.py. Every class below was a real
defect in that tree. Review code, not vibes: quote the line, name the cost.
Files in scope (one campaign = this set)
| Stage | File | Owns |
|---|---|---|
| corpus | make-calib-corpus.py |
calib + kld JSONL, manifest |
| corpus | rechunk-kld-corpus.py |
windows that fit the container's KV window |
| convert | convert-<model>.sh |
plan → artifact per arm |
| tape | run-qwen38-bf16.sh |
the rig's argv, mount, trap, gates |
| drive | calib-push.py |
prefill traffic into the tap |
| fp8 path | stack-qwen38-official-fp8.py |
expert stacking + PLE merge |
Defect classes to hunt, in cost order
- Claimed identity that is only a length check. A tool that writes TEXT back
out (
tok.decode(window)) and asserts only counts is not proving token identity — decode→encode can merge/split. Fix: re-encode each window and compare id lists; refuse on mismatch. Same shape: an assertion on "N tokens in, N tokens out" that counts windows rather than re-encoded text. - A loop that cannot finish and cannot notice. Drivers that re-push a corpus
--max-roundstimes without measuring the sink. Compare the tap/output dir's byte total per round and abort on zero growth; abort on zero successes; abort on zero prompts. Without this the loss is silent for hours. set -uargument holes.--flag) VAR="$2"; shift 2dies with "unbound variable" when the flag is last. Guard[ "$#" -ge 2 ]in every such arm.- Restore paths that leave the GPU holder alive.
--rmonly fires when podman itself exits, so a killed run leaves conmon holding the cards whilesystemctl is-activesaysactive.restore()MUSTpodman rm -f "$C"before starting production. Prove withpodman psafter akill. - Gates that run after the expensive phase. A leftover container name, an existing output, a non-writable tap dir, an unset figure — check them before the plan/boot, not when podman/sed fails mid-run.
- Zero-exit with no artifact. After
rc=0, assert the output file exists beforestat/arithmetic on it. assertin a verifier.python -Odeletes it silently. Useraise.- Warning where the code's own assumption breaks. e.g. a 128-lane pack fed an HD that is not a multiple of 128 — warning + continue writes a wrong table.
- Re-tokenization in loops. A pool cycled 40× re-tokenizing each fragment per pass; and a manifest recomputing a total by re-encoding the whole corpus. Cache counts once, accumulate during generation.
- Substring tests standing in for key tests.
"content" in linebeforejson.loads(line)["content"]crashes on any list-shaped.json. - Path guards compared as strings.
A/../A/xdefeats an equality check; addrealpath -mon both sides. - Shellcheck's honest false positive: single-quoted
$CALIBpassed to a converter that expands it from the container env is correct (SC2016). Say so in the PR; do not "fix" it.
Procedure
- Inventory:
wc -lthe scripts + recipes; read each completely (ranges, not whole files, but every line). Recipes carry the numbers scripts assert. - Read the tests that pin the argv (
tests/qwen38_reference.bats'sSHAPEfixture,tests/qwen38_campaign.bats) — they are the contract you must not break, and the first place a stale number hides. - Mechanical gates:
python3 -m py_compile scripts/*.py bash -n scripts/<each>.sh shellcheck -S warning scripts/<each>.sh # never pass .py to it ./tests/run.sh - Fix the real ones only; keep diffs surgical; re-run the suite after the batch.
- Smoke the changed path for real — smoke beats the suite:
Import-level helpers can be exercised with
# run a local script on the server's data via the corpus venv, no checkout needed ssh dankserver '/home/dank/venvs/radcorpus/bin/python - --corpus <corpus> --out /tmp/<x> --force' \ < scripts/rechunk-kld-corpus.pyimportlib.util.spec_from_file_location(e.g. a newtap_bytes(): empty→0, one file→its size, absent→0). - Stacked PRs: a review commit goes on its own branch off the open one; a diff that includes the parent commit is a stacked PR, not a mistake — say which PR merges first in the body.
Report
One table of defect → cost → fix. Name the failure the defect produced in practice (hours wasted, wrong number), because that is what makes it reviewable.