bfp-quant: the bfp4 GPTQ pipeline, packer/unpacker and publish procedure (#62) #80
No reviewers
Labels
No labels
cards:go
hermes-approved
human-approved
human-approved
iter
0
iter
1
iter
2
iter
3
prio:high
prio:low
prio:med
priority/high
state
blocked
state
doing
state
done
state
review
state
todo
x280
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitpartner/tt-stack!80
Loading…
Reference in a new issue
No description provided.
Delete branch "bfp-quant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The bfp4 GPTQ pipeline: quantizer, packer/unpacker, the FP8-teacher accuracy gate, the
on-card gate and the publish procedure.
tools/bfp-quant/: bit-exact emulation of the tt-metal hostbfp4_b/bfp8_bpacker(with a C++ harness to prove it), RTN and GPTQ/LDLQ onto the bfp grid, the snapped-checkpoint
writer, the
bfp4-packed-v1format (G2 at 20.56 GB instead of 68 GB, unpacking bit-exact),the calibration-Hessian collector and the arm verifier.
nix/bfp-quant.nix+nix run .#bfp-quant; the tt-metal rev is read out offlake.lockas text so evaluating the app never fetches tt-metal.
bench/bfpq/harness and the P0/P1 records, including the four-arm battery(P / G1 / G2 / R2 plus the FP8 teacher) under
bench/runs/bfpq-p1-arms/..claude/skills/bfp-quant/SKILL.mdwith the publish procedure.Gates already recorded (LEDGER
R-2026-09-25-gptq-g2, already on master): GPTQ all-bf4(G2) is non-inferior to production against the FP8 teacher; RTN all-bf4 (R2) is the one arm
trending worse. The packed checkpoint passes the on-card gate — 980/980 device tensors
sha256-identical, 44/44 probes token-identical.
Master merged in first, no conflicts. Verified after the merge:
docs/still 11 files, noroot
CLAUDE.md,AGENTS.mdis the lean rewrite,QWEN36_PREFILLED_SLOTS_FIXstill inqwen36_vllm.py, and nothing PR #68 deleted came back — the 96 files added versus master areall new tooling and records. Locally green:
nixfmt --check,check-cited-records.py,nix flake check, and the 41 ttx unit tests.Refs #62, #72.
🤖 Generated with Claude Code
Because a bfp block is 16 output channels at one input index, GPTQ's column-at-a-time error feedback composes with the block structure without any coupling: a column's shared exponents are fixed when that column is rounded, using the packer's own arithmetic, and the rounded block keeps its max exponent, so the packer later re-derives the same exponent. Optional per-block exponent search {e, e+1} stays exact because values on a coarser grid are also on the grid the packer will pick. Neither claim is trusted: every output goes through check_on_grid (fail closed). MEASURED, synthetic only (bench/runs/bfp-quant-synthetic-20260924T094254Z.jsonl): GPTQ beats RTN on the H-weighted proxy for every synthetic layer. The 16-23x gain comes from a steep synthetic spectrum with outlier channels and is NOT a prediction for Qwen; real Hessians are the P0 blocker. GPTQ with H = I reduces exactly to RTN (unit test). `quantize` writes bf16 safetensors for the selected tensors (untouched shards symlinked), a manifest with per-tensor sha256 and a suggested distinct tensor_cache suffix (a stale cache silently serves old weights). MEASURED (bench/runs/bfp-packer-emulation-20260924T093819Z.jsonl): a snapped 9B gate/up checkpoint is a fixed point of the REAL packer (--expect-snapped); the unsnapped down_proj fails the same gate, as it must. `nix run .#bfp-quant -- {test,verify-packer,synthetic,proxy,quantize}`; the tt-metal rev is read from flake.lock as text so the app never fetches the tt-metal input. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>Can't compute calibration Hessians without a large-RAM or CUDA box, so this maps where plain RTN error sits, using the H = I proxy (relative MSE against the FP8 weights dequantised the way production does). This cannot rank LDLQ, because GPTQ with H = I is RTN. MEASURED (bench/runs/bfp-proxy-hfree-20260924T092920Z.jsonl), layers 0-3, 30, 31, 62, 63 plus embed and lm_head: - RTN bfp4 relMSE is 1.31-1.47e-2 in every group; RTN bfp8 is 5.5-6.4e-5 (about 235x lower). - 8-10% of bfp4 blocks saturate at the block max. - The {e, e+1} per-block exponent search gains <= 0.1%, so it is not worth having. - Every processed tensor passed check_on_grid. The spread across groups is small because bfp4 is essentially a constant-relative-precision format. Which groups can drop to bf4 therefore has to come from activation-weighted (Hessian) error and the P1 KL gate, not from weight statistics. Not measured: bf4-from-bf16 vs bf4-from-FP8 needs the bf16 checkpoint, which no cluster host holds. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>agent-gateway closeout (merged): cleared
agent:*labels.Hermes kanban card (if any) is left for Hermes to archive/complete.