Repository navigation
Conversation
added 2 commits
October 4, 2026 13:42
…point The engine only admits MQ4 routed experts, so an engine-built teacher cancels expert quantization out of every KLD measurement. kld_teacher.py runs the pinned upstream operators (BF16 weights, F32 activations) on a local copy of the pinned Qwen3.8-Flash-Next checkpoint, layer-major over every chunk of an HFKLDR v3 reference so each checkpoint byte is read once, and writes raw F32 logits for the scored window. The checkpoint directory is refused unless its index and config match the pinned revision. PLE n-gram rows are discovered in a first pass and then streamed shard by shard: the NAS backing the checkpoint serves ~250 random reads/s, so row-by-row lookups took 36 min versus 15 min streamed. Measured on gfx1151 (wikitext2 slice, 32 x 512, window [256, 511)): teacher PPL 5.4541; ~62 min per reference, NFS-bandwidth bound.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
qwen4_kld.rson beta documentsreference_oracle/kld_teacher.pyas the source-precision teacher whose logitsqwen4_kld importturns into a reference, but the script never landed. This adds it.Why
The engine admits Qwen4 routed experts only as MQ4, so an engine-built teacher (e.g. a BF16-trunk HFQM) cancels expert quantization out of every KLD measurement. This teacher runs the pinned upstream operators (
upstream.PinnedQwen4Operators, BF16 weights, F32 activations) on a local copy of the pinned checkpoint.What
crates/hipfire-arch-qwen4/reference_oracle/kld_teacher.py: layer-major over every chunk of an existing HFKLDR v3 reference (each checkpoint byte read once per run); writes raw F32 logits[chunk][scored position][vocab], the layoutqwen4_kld importreads.importkeeps owning top-k, teacher NLL, the plausibility gate and the HFKLDR format.MODEL_INDEX_SHA256,MODEL_CONFIG_SHA256).Evidence
Measured on gfx1151 (WikiText-2 slice, 32 × 512, window [256, 511)): teacher PPL 5.4541, ~62 min per reference, NFS-bandwidth bound. After the rebase onto beta:
py_compilepasses and everyupstream/quality/schemasymbol it imports exists on beta. Not re-run end-to-end after the rebase.Usage