Repository navigation
[Other] setup: a --custom-gguf Qwen4 file without the MTP block drafts from its mtp-*.gguf sidecar - #481
Closed
Rustandi wants to merge 1 commit into
Closed
[Other] setup: a --custom-gguf Qwen4 file without the MTP block drafts from its mtp-*.gguf sidecar#481Rustandi wants to merge 1 commit into
Rustandi wants to merge 1 commit into
Conversation
…s from its mtp-*.gguf sidecar Setup assumed every Qwen4 GGUF carries its draft block (blk.40), as Unsloth's files do. A single-file GGUF converted with llama.cpp's --no-mtp has 40 blocks and its MTP head in a file of its own, mtp-<name>-<quant>.gguf. Setup printed "embedded MTP layer" for it and never passed the sidecar to the engine. With --custom-gguf, setup now reads the file's header. Without a draft block it takes the mtp-*.gguf of the same architecture beside the model (one named after this model first, then the model's own quantization, Q8_0, the smallest) and writes --draft-model to the run config. With no sidecar it warns that the model runs without drafting. A normal install never calls the lookup; its run config is unchanged.
Rustandi
marked this pull request as ready for review
December 5, 2026 12:45
Collaborator
|
Integrated on |
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.
Problem and result
Setup assumes every Qwen4 GGUF carries its draft block (
blk.40,nextn_predict_layers = 1), as Unsloth's files do.A single-file GGUF converted with llama.cpp's
--no-mtphas 40 blocks and keeps its MTP head in a file of its own,mtp-<name>-<quant>.gguf.Before:
--custom-ggufon such a file printsdrafter: embedded MTP layer (native strata-poly)and writes a run configwith no
--draft-model. The sidecar beside the model is never passed to the engine.After: setup reads the file's header. When the file has no draft block, it looks for an
mtp-*.ggufof the samearchitecture in the same folder, prints
drafter: MTP sidecar <file> (--draft-model)and writes--draft-model <file>to the run config. With no sidecar it installs the model and warns that it runs without drafting.
Related discussion
None. I searched open and closed issues and pull requests for
sidecar,draft-model qwen4,custom-gguf,no-mtpand found no thread on this. PR 430 uses a Q8_0 sidecar through a different route (
--mtp, a repackaged drafterruntime) and does not change
--custom-gguf.Approach
qwen4_mtp_sidecar()interminal/setup.pyreturns whether the file carries the block and, if not, the sidecar.A sidecar is taken only if its header has the same architecture and the tensor
blk.<n>.nextn.eh_proj.weightfor the block after the model's last one.
Q8_0, then the smallest.
--mtp off/--no-draftand--drafter dflash2behave as before.--custom-gguf. A normal install never calls it and its run config is unchanged. A customfile in Unsloth's layout gets one more header read and the same message and arguments as before.
strata-polyalready reads a.ggufgiven to--draft-model.docs/models/qwen4.mdunder "Bring your own GGUF".Validation
Revision:
df2c3ff30(v0.2.20-poly.10) plus this change. Windows 11, Python 3.14.7.Passed:
python terminal/tools/test_setup_qwen4.py: 10 tests, OK. Two are new: sidecar choice, and a full custom install(run config with the sidecar,
--mtp off, and the no-sidecar warning).python terminal/tools/test_setup_choices.py: 66 tests, OK.python terminal/tools/test_setup_custom_gguf.py: 21 tests, OK.python tools/check --only docs: passed, 6 of 6.Qwen4-35B-A3B-Uncensored-Q4_K_M.gguf(36.0 GB) withmtp-Qwen4-35B-A3B-Uncensored-Q4_K_M.gguf(1.29 GB),installed with
--custom-gguf. The engine started with--draft-model <sidecar>and loaded in 5.5 s with 5,985 of10,496 routed experts in VRAM. From the server log:
Failed:
python terminal/tools/test_setup_amd.py(77 tests) reported one failure in the first of six runs and passed theother five. I did not capture the failing test's name and could not reproduce it. That file does not call the new
function.
Not run:
--no-drafton the same card. This pull request makes no speed claim: the numbers above onlyshow that the engine loads the sidecar and accepts its drafts.
python tools/check --only py-tools: pytest is not installed in this environment. The test files above were rundirectly instead.
Limits
attention.compress_ratiosfrom the model file only, so thesidecar's draft block would run dense attention rather than its own sparse setting. The acceptance rates above
(65% to 77%, up to a 126,585-token prompt) are with that behaviour.
has_mtplooks for--mtpin the engine's arguments and at the engine'sown report. A sidecar passed with
--draft-modelmay not count as MTP there, so a request with no sampling fieldsmay get the model card's sampling where an embedded-MTP install stays greedy. This change does not touch the server.
setup refuse it instead if you prefer.