Repository navigation
MTP fixes - #390
Open
danielhanchen wants to merge 47 commits into
Open
MTP fixes#390danielhanchen wants to merge 47 commits into
danielhanchen wants to merge 47 commits into
Conversation
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Decode per-layer NVFP4 and MXFP8 schemes, validate companions, and use stored scale shapes with a warning for the declared MXFP8 [32,32] grid. Reorder packed w13 rows and their scale rows together. Keep normal GGUF outtype selection and 3D expert tensors. Stream 128 rows per expert through LazyChunkedTensor. Real w13 (384x4608x4608) needs a 2.25 MiB F32 chunk instead of a 30.375 GiB expanded layer. Real-shaped sparse probes peak below 5.8 MiB of Python/NumPy chunk allocations, plus 5.2 MiB of callback metadata: budget about 16 MiB per projection including mapped pages, excluding runtime, other tensors and OS cache. Full-model chunk metadata is roughly 370 MiB. Packed synthetic GGUF weights match the independent pinned vLLM decode bit-for-bit. CPU prefill/decode logits remain within 3.1e-6 absolute error, with 100% argmax agreement. Float fixtures, original-name conversion and CPU architecture checks pass. Real checkpoint conversion remains untested. Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Fable
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Codex
Assisted-by: Fable
Assisted-by: Fable
A looped model runs the layers [loop.core_start, loop.core_end) num_loops times. The GGUF has one block per layer visit, so every visit keeps its own KV cache and recurrent state, while the weights stay per physical layer. The loader validates the layout, the generic scale pass runs over the physical layers, every visit then shares its layer's weights, and the graph node budget scales with the pass count. Inkling 2 uses it for its looped variant (Inkling2LoopForConditionalGeneration): later passes restart from the prelude state and mix in the previous pass through low-rank message controllers.
# Conflicts: # conversion/inkling2.py
The Inkling-2-Small checkpoint ships hf_quant_config.json for the target weights next to the BF16 mtp.safetensors. The base prepare_tensors picks it up and dequant_model then fails with an empty quant method, so --dspark could not convert the released folder.
The DSpark taps of a looped Inkling 2 trunk are layer visits, so the final normed hidden state is tap num_hidden_layers + (num_passes - 1) * core length instead of num_hidden_layers.
Original checkpoints ship hf_quant_config.json for the trunk experts, which the generic dequant step rejects. The mtp.safetensors tensors are BF16.
llama-quantize cannot store the 8-wide dspark_fuse.weight as Q8_0 and falls back to F16, and the CUDA soft_max then aborts on the F16 input (GGML_ASSERT(src0->type == GGML_TYPE_F32)). Keep the tensor unquantized, and cast it before the soft_max so drafts quantized before this fix still load.
Register Inkling2LoopForConditionalGeneration with its own calls instead of editing the shared register lines, so the change stays additive next to other edits around the Inkling 2 converters.
# Conflicts: # conversion/inkling2.py
The skip of the target quant config now comes from the Inkling-2-Small fixes.
…ed check Map num_hidden_layers to the visit count before the tap check instead of rewriting the check, so the pin set keeps the ggml-org#32218 lines unchanged.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
danielhanchen
changed the base branch from
base/mtp-c921130ab
to
base/upstream-184862801
November 20, 2026 19:40
This was referenced Nov 20, 2026
This branch has not been deployed
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.
Fixes for the DSpark (MTP) draft from ggml-org#32218, including the looped Inkling-2-Small architecture (#389).
llama-quantizekeeps the DSpark fuse weights F32. Before, they fell back to F16 and the soft_max asserted on CUDA.The diff is based on the upstream merge base, so it also shows ggml-org#32218 and #389. The new code is 3 files, additions only.
Tests: