Skip to content

model: the qwen4exp MTP load refuses a self-contained draft by its own matrices before reading its layer - #962

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-own-mtp-selecting
Oct 29, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-q38-own-mtp-selecting

Conversation

@juliankang4

Copy link
Copy Markdown
Collaborator

Qwen3.8 MTP 로드가 자체 행렬을 가진 draft 파일을 거부할 때, 층을 읽다가 나오는 엉뚱한 문구 대신 진짜 이유와 shared 파일 이름을 알려 주도록 고치는 PR입니다.

What and why

The hub's self-contained MTP draft (mtp-Qwen3.8-Flash-Next-Q8_0.gguf) carries its own token_embd and output matrices, and the MTP load borrows the target's, so it can never load that file. Since hub revision efc50b7c the file also sets compress_ratios[48] to 4, a selecting MTP layer, and mtp_of refused that first. The user saw a message about the layer, which hid the reason that holds for every revision.

MtpInputs::read now checks the draft's own matrices before it reads the layer, so a self-contained file of any revision is refused by name with the shared file to use: tensor token_embd.weight: is in the draft file (token_embd.weight, output.weight); this load borrows the target's token_embd and output, which its card holds: a shared draft file (MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf). The same check that sat after mtp_of is removed, and the in-file layer refusal stays. docs/BUILD.md states that the load refuses these files, and docs/contrib/local-check.md pins the unshared draft that gate-qwen4exp-meta reads to revision 38bb39ee.

Release notes: Fixed: loading a self-contained Qwen3.8 MTP draft now says it carries its own matrices and names the shared draft to use.

Code shape

The review reads these first. A box left unticked needs one line of why.

  • No second copy. Logic two models (or two call sites) share has one common owner; I lifted it there instead of
    copying it (AGENTS.md "Common code first", docs/rust-quality.md R14). Where I found an existing copy, I
    named it below.
  • Model code holds only architecture facts. A model's own files carry only what its architecture forces
    (tensor shapes, the attention kind, the quant). A common owner gained no per-model branch, flag or trait method.
  • Dead code is gone. Nothing I made unused is left behind (functions, flags, gate clauses, docs).
  • No silent failure. Undefined input is a named error or panic, never a defined-looking output.
  • Comments state what is true now. No dates, issue numbers or how a bug was found (tools/check-comments.sh).
  • No relaxed gate. No band, tolerance or lint moved; a re-pin carries PIN(YYYY-MM-DD):
    and its reason.
  • cargo fmt and cargo clippy are clean on what I touched; the lint count did not go up.

Duplication found or removed (path:line), or "none": none.

What I ran

Unit tests, including the new the_load_refuses_a_self_contained_draft_by_its_matrices (pool 0 and pool 4 both name the own matrices and the shared file):

cargo test -j 4 -p bloomery-model --lib -- qwen35moe::mtp::tests
test result: ok. 24 passed; 0 failed; 0 ignored; 0 measured; 575 filtered out

The real bloomery-serve on a GB10 with the hub's current self-contained draft (revision 766911a6, sha256 58a47d6a..., compress_ratios [48] = 4), built from head 6039b994:

$ nvidia-smi --query-gpu=name,driver_version,memory.total --format=csv,noheader
NVIDIA GB10, 595.84, [N/A]
$ bloomery-serve --version
bloomery-serve 0.3.10 (commit 6039b994)
$ BLOOMERY_DRAFT=mtp BLOOMERY_MTP_DRAFT=MTP/mtp-Qwen3.8-Flash-Next-Q8_0.gguf bloomery-serve -m <Qwen3.8-Flash-Next-FP4-Local folder> --port 18094
bloomery-serve: tensor token_embd.weight: is in the draft file (token_embd.weight, output.weight); this load borrows the target's token_embd and output, which its card holds: a shared draft file (MTP/mtp-Qwen3.8-Flash-Next-shared-Q8_0.gguf)

The process exits with status 1. The file's sha256 checked out against the hub's value before the run.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

…n matrices before reading its layer

A self-contained draft (mtp-Qwen3.8-Flash-Next-Q8_0.gguf and its Q4_K_M and BF16 siblings) carries
its own token_embd and output, which the load refuses at every revision. From the hub's revision
efc50b7c on, the file also sets compress_ratios[48] to 4, so the reader refused it first as a
selecting MTP layer, a reason that hid the one every revision meets. The refusal now comes first
and names the shared draft the load reads; BUILD.md says so, and the meta gate and local-check
name the revision of the unshared file the gate reads.
@juliankang4
juliankang4 force-pushed the dgx-spark-q38-own-mtp-selecting branch from 1ff24e4 to f23fe37 Compare October 29, 2026 10:50

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: The matrix rejection precedes layer parsing, and unsupported drafts remain rejected.

Non-blocking

⚠ Complete the fix evidence: mtp.rs:1177. The PR reports a passing test run but no FAIL-first run or promoted diagnostic probe. Attach the failure with the old check order and the passing result; explain why the named startup error supplies the diagnostic layer. Recording this now keeps the regression proof with the fix.

Checked

Duplicates: 3 new functions checked; no duplicate owner found. Dryer reported 0 pairs.
Complexity: crapper flagged no functions; production code reorders validation.
Silent failure: 1 ignored Result followed; it only affects temporary-file cleanup, with no model value consumed.
Tests: reasoned mutation at place.rs:2314—move the matrix check after mtp_of; the pool-4 assertion fails. Removing the shared filename also fails the new assertion. Mutants were not executed.
Gates: no assertions, bands or thresholds changed; documentation now identifies the dense unshared fixture revision.
Adversarial: own matrices with pool 4 fail before layer parsing; shared selecting layers still fail in mtp_of; contradictory sharing metadata still fails in draft::borrows. The removed source guard was unreachable because mtp_of constructs only a file source.
Escape catalog: no C1–C4 pattern matched.

Notes

Static review only; tests were not executed. The GB10 startup log lacks a gate run and both tested commit hashes, so GPU evidence is false.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 7e8f5b6 into midagedev:main Oct 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation model The CPU engine and model files: crates/model, models, hf, gguf, tokenizer, jinja

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant