Skip to content

model: Inkling-2-Mini - looped arch - #32695

Draft
danielhanchen wants to merge 2 commits into
ggml-org:masterfrom
danielhanchen:repeating-layers
Draft

danielhanchen wants to merge 2 commits into
ggml-org:masterfrom
danielhanchen:repeating-layers

Conversation

@danielhanchen

Copy link
Copy Markdown
Contributor

Overview

Adds support for https://huggingface.co/thinkingmachines/Inkling-2-Mini - uses a looped architecture and this PR adds looped support

Requirements

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.
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.
@danielhanchen danielhanchen mentioned this pull request Nov 20, 2026
@github-actions github-actions Bot added model Model specific testing Everything test related conversion labels Nov 20, 2026
@salmanarshad321

Copy link
Copy Markdown

Same failure on Inkling-2-Mini-UD-Q8_K_XL.gguf (sha256 dfb04bf3…527e9a41, 22,867,451,616 bytes), verified against the HF ETag.
Reproduced with three builds: your prebuilt b12540-mix-c4017f9 (linux-arm64-cuda13), branch base/inkling2-attn-chunk-378, and ggml-org PR #32694.
./llama-server -m Inkling-2-Mini-UD-Q8_K_XL.gguf → error loading model: check_tensor_dims: tensor 'blk.24.attn_q.weight' not found.
Parsing the file: general.architecture = inkling2, inkling2.block_count = 48, 734 tensors, but only blk.0–blk.23 exist. Metadata says 48 logical layers; the file packs 24 physical blocks.
ggml-org's Inkling-2-Mini-Q8_0.gguf (inkling2_loop, block_count = 24) loads fine in the same binary — so the fix is on the conversion side (write block_count = 24 + num_loops), or teach the inkling2 loader to expand the loop.
Separately: PR #32695's loader builds 714 tensors where the file has 734.

@danielhanchen

Copy link
Copy Markdown
Contributor Author

Mainline has merged Inkling-2-mini, but using our quants will get 130 perplexity (7.6 is the correct one) - folks will need #32704 if using https://huggingface.co/unsloth/Inkling-2-Mini-GGUF/tree/main/Mainline_Support

@grigio

grigio commented Nov 21, 2026

Copy link
Copy Markdown

Will you add the vulkan support? it improves a lot the performance danielhanchen#10

@forkineye

Copy link
Copy Markdown

Built this for SYCL and ran into this:

└─▪ ./build/bin/llama-server -dev SYCL1 -hf unsloth/Inkling-2-Mini-GGUF:UD-Q4_K_XL --spec-type draft-dspark --spec-draft-n-max 3 --n-gpu-layers-draft 99 --jinja --ctx-size 32768 --n-gpu-layers 99 --parallel 1 --temp 1.0 --top-p 1.0 --top-k 0 --min-p 0.0 --host 0.0.0.0 --port 8888
0.00.676.307 I srv  llama_server: initializing ...
0.00.944.904 I cmn  common_param: common_params_print_info: verbosity = 3 (adjust with the `-lv N` CLI arg)
0.00.947.657 W srv  server_setup: security: no API key is set and CORS allows all origins (see https://github.com/ggml-org/llama.cpp/pull/25655)   
0.00.956.645 I srv    load_model: loading model 'unsloth/Inkling-2-Mini-GGUF:UD-Q4_K_XL'
0.02.070.612 E llama_model_load: error loading model: done_getting_tensors: wrong number of tensors; expected 734, got 714
0.02.070.644 E llama_model_load_from_file_impl: failed to load model
0.02.070.746 E common_fit_params: encountered an error while trying to fit params to free device memory: failed to load model
0.02.845.428 W load: special_eos_id is not in special_eog_ids - the tokenizer config may be incorrect
0.03.135.605 E llama_model_load: error loading model: done_getting_tensors: wrong number of tensors; expected 734, got 714
0.03.135.637 E llama_model_load_from_file_impl: failed to load model
0.03.135.645 E cmn  common_init_: failed to load model '/models/huggingface/hub/models--unsloth--Inkling-2-Mini-GGUF/snapshots/ae9327c5fbc7333116ba32eee78bb5d2bbefae4f/Inkling-2-Mini-UD-Q4_K_XL.gguf'
0.03.135.665 E srv    load_model: failed to load model, '/models/huggingface/hub/models--unsloth--Inkling-2-Mini-GGUF/snapshots/ae9327c5fbc7333116ba32eee78bb5d2bbefae4f/Inkling-2-Mini-UD-Q4_K_XL.gguf'
0.03.135.673 I srv    operator(): operator(): cleaning up before exit...
0.03.141.855 E srv  server_run_i: exiting due to model loading error

ethgr0wth added a commit to aiassistsecure/llama.cpp that referenced this pull request Nov 21, 2026
@createthis

createthis commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

@danielhanchen you have conflicts, looks like with this implementation: 29b52d3

@createthis

Copy link
Copy Markdown
Contributor

No idea if this is useful to anyone, but I took the NVFP4 conversion code from this PR and broke it out into its own PR: #32786

ethgr0wth added a commit to aiassistsecure/llama.cpp that referenced this pull request Nov 22, 2026
Brings in the merged Inkling 2 implementation: PR ggml-org#32217 (text + vision, mmproj converter), PR ggml-org#32694 (inkling2_loop arch), PR ggml-org#32704 (loop scale fix). The draft PR ggml-org#32695 code merged in 862fdcb is superseded by upstream's merged implementation on every Inkling file. Mark's patches preserved: imagine-v9 tokenizer fix (conversion/base.py, content-merged with upstream), Muse Glimmer chat template (common/chat.cpp, common/parsers/muse-glimmer.cpp).
benhadad added a commit to benhadad/PolyStrata that referenced this pull request Nov 25, 2026
…s in files, for comparing with llama.cpp

--dump-layers prints a checksum of every stage.  --dump-tensors DIR does the same and also writes the values:
DIR/p<position>_<name>-<visit>.bin for each stage of each token (<name> as llama.cpp's graph names it: Qcur,
Kcur, Vcur, Rcur, kqv_out, ffn_inp, l_out, result_norm without a visit, plus our own l_in, ffn_in and
ffn_moe_out) and DIR/p<position>_logits.bin for the logits of the last token of a call.  The format is the one
llama.cpp's cb_eval dumper writes: int64 ne[4], then float32 values.  Dump mode runs one token at a time with
the card path off, so it does not cover the card-routed prefill.

Tested on the Arc Pro B70 against a CPU llama.cpp (PR ggml-org/llama.cpp#32695 plus a local patch for the
per-expert gate_up scales) on a real 19-token prompt and 4 decode steps, one run: the same greedy tokens at all
5 steps, logit KL 0.00004 to 0.0004, mean cosine 0.9986 to 0.9996 per tensor over the 48 visits, final norm cosine
at least 0.9985.  The comparison script and the reference harness are not in this repository.  llama.cpp counts
the visits in execution order, this dump by cache slot (slot_of()); the comparison script maps one to the other.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FA86cq7ktJuaewMKKonxr7

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conversion model Model specific testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants