Skip to content

model : inkling2_loop also loads the earlier looped inkling2 layout - #395

Open
danielhanchen wants to merge 2 commits into
base/upstream-29b52d398from
inkling2-loop-legacy-layout
Open

danielhanchen wants to merge 2 commits into
base/upstream-29b52d398from
inkling2-loop-legacy-layout

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Loads the earlier looped Inkling 2 GGUF layout (general.architecture = inkling2 with inkling2.loop.core_start, core_end, num_loops, gate_rank, one block per layer visit) with the inkling2_loop model, so files in either layout run the same graph and no re-download is needed.

  • llama_model_create: an inkling2 file carrying the full loop signature is built as inkling2_loop in legacy mode. Non-looped inkling2 files are unchanged.
  • Hyperparameters: the per-visit arrays are folded to the physical layers, then the normal slot expansion runs.
  • Tensors: the loop-control tensors are read under the earlier names into the same fields; the two global message queries are read once.
  • Graph: each core layer's message query is assembled from row views of the two global queries, in the same row order the inkling2_loop converter uses.
  • test-llama-archs: adds a legacy looped config.

Tests (b12600 + ggml-org#32704 + ggml-org#32218 + this):

  • test-llama-archs: all configs pass on CPU and CUDA.
  • A root UD-IQ1_S file and the same weights rewritten to the inkling2_loop layout give identical logits: wikitext-2, 20 chunks of 512, mean KLD 0, top-1 100%.
  • Root UD-Q4_K_XL / UD-Q8_K_XL against the earlier looped implementation, same build style: mean KLD 0.00076 / 0.00055, top-1 98.7% / 99.0%.
  • Before this change the same build fails to load a root file (blk.24.attn_q.weight not found).

An inkling2 file with inkling2.num_loops stores one block per visit, the
loop keys under inkling2.loop.core_start/core_end and inkling2.num_loops,
the controls as blk.N.loop_{attn,k,v,mlp}_{down,gain,forget}, and the
message queries of all core layers in loop_res_query and
loop_kv_res_query. Load it as inkling2_loop: fold the per-visit
parameters back to the physical layers, read the controls under their
old names, and build each core layer's message query in the graph from
the two global queries. Non-looped inkling2 files are unchanged.

test-llama-archs: add a looped inkling2 config.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T07:04:33.274239Z dd330cc Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: dd330cc002

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant