Skip to content

Carry unslothai#116 (GLM-5-Next) composed onto the qwen4exp b10632 carry - #118

Merged
danielhanchen merged 3 commits into
glm5next-116-b10632-basefrom
glm5next-116-b10632
Aug 26, 2026
Merged

Carry unslothai#116 (GLM-5-Next) composed onto the qwen4exp b10632 carry#118
danielhanchen merged 3 commits into
glm5next-116-b10632-basefrom
glm5next-116-b10632

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Carries #116 (GLM-5-Next / GLM-5.3-Flash) so the nightly prebuild can pin it.

Based on qwen4exp-27742-b10632, the #114 carry, not on b10632 directly. That is deliberate and is the main thing to review here.

Why it is not pinned straight from #116

glm5next/public branches off fork master, so its head carries 77 fork CI paths (.github/ and scripts/unsloth/, including pr-set.json itself) that have no business in a release tree. This branch is b10632 with the PR's 42 paths applied and nothing else. Those 42 are byte-identical to the PR head, and the diff against b10632 is exactly those 42 paths, both asserted.

Why it sits on top of the qwen4exp carry

These two pins are not independent. Both add a sparse-attention indexer cache, and both declare the same filter_idx in create_memory. Merged side by side, the union declares it twice and the build stops; no resolver rule can fix that safely, and it is not something the nightly should be attempting unattended.

So the composition is resolved once, here: a single filter_idx declaration carrying each arch's own extra next to it, needs_mem_idx for qwen4exp and type_idx for glm5next. Everything else was a pure add/add union.

Consequence: dropping the qwen4exp pin no longer drops its code, because this carry contains it. Drop both together, or rebuild this carry against whatever remains.

Decoupling commit

One commit exists purely so the set composes, and changes no behaviour:

  • llama-model.cpp - declare filter_idx/type_idx above the other filters, off the line the inkling arch edits, and give GLM5NEXT its own else if rather than sharing the qwen condition that qwen4exp also appends to
  • llama-kv-cache.cpp - park the two context accessors with type_v rather than at the get_n_kv anchor inkling also appends to
  • tensor_mapping.py - put the GLM5NEXT map at the end of the dict rather than where qwen4exp's lands

The last two are pure reorderings, asserted as such: identical multiset of lines before and after.

Verification against b10632

  • all seven pins merge in list order; six clean, #70 via additive_merge.py
  • the merged tree compiles clean, 573/573 targets, with the preflight gate's config plus LLAMA_BUILD_TESTS=ON
  • test-llama-archs exits 0 with glm5next OK and qwen4exp OK, and inkling's documented skip intact
  • the two filter_idx declarations that remain in create_memory are different types in disjoint branches (llama_kv_cache:: and llama_memory_hybrid::); the compile is what settles that, and it passes
  • mirrored to refs/pins/3766b41229c20249fd4d83d7ba297499d50e9b80

Do not delete this branch while it is referenced by scripts/unsloth/pr-set.json.

The PR branches off fork master, so its head carries 77 fork CI paths
(.github/ and scripts/unsloth/, including pr-set.json itself) that have no
business in a release tree. This is b10632 with the PR's 42 paths applied and
nothing else.

Squashed rather than replayed: the PR head is a merge commit, and the 20
commits are on the PR for review. What matters for a pin is that the tree is
exact, which is checkable and checked: the diff against b10632 is exactly the
PR's 42 paths, and those 42 are byte-identical to the PR head.
Three changes, none of them behavioural:

  llama-model.cpp     declare filter_idx/type_idx above the other filters, off
                      the line the inkling arch edits, and give GLM5NEXT its
                      own else-if instead of sharing the qwen condition that
                      qwen4exp also appends to
  llama-kv-cache.cpp  park the two context accessors with type_v rather than
                      at the get_n_kv anchor inkling also appends to
  tensor_mapping.py   put the GLM5NEXT map at the end of the dict rather than
                      where qwen4exp's lands

The last two are pure reorderings, asserted as such (identical multiset of
lines). Without these the nightly hits conflicts additive_merge.py cannot prove
safe, and the whole build stops.
These two pins are not independent: both add a sparse-attention indexer cache
and both declare the same `filter_idx` in create_memory, so merging them
side by side would declare it twice. No resolver rule can fix that safely, and
the nightly would stop on it.

Building glm5next's carry on top of qwen4exp's makes the composition explicit
and resolved once, here, rather than attempted nightly. One declaration is
kept, with each arch's own extra alongside it: needs_mem_idx for qwen4exp,
type_idx for glm5next. Everything else was a pure add/add union.

Consequence worth knowing: dropping the qwen4exp pin no longer drops its code,
because this carry contains it. Drop both together, or rebuild this carry.
@danielhanchen
danielhanchen changed the base branch from qwen4exp-27742-b10632 to glm5next-116-b10632-base August 26, 2026 16:32
@danielhanchen
danielhanchen merged commit fa87d0e into glm5next-116-b10632-base Aug 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3766b41229

ℹ️ 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".

Comment thread src/models/glm5next.cpp
Comment on lines +448 to +450
const int64_t n_kv = kbuf->ne[2];
const int64_t n_stream = kbuf->ne[3];
const int64_t n_tps = n_tokens/n_stream;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Derive pooled streams from the packed inputs

When a non-unified server batch contains non-contiguous sequence streams, such as active sequence IDs 0 and 2, get_k() exposes the entire stream range (3 streams), while build_inp_kpool() deliberately packs pool_cells and masks using ubatch.n_seqs_unq (2 streams). Deriving n_stream from kbuf->ne[3] therefore makes n_tokens/n_stream truncate and triggers the assertion at line 456 during ordinary two-sequence decoding; if the division happens to be exact, the subsequent gathers still associate the packed pool maps with the wrong cache streams. Use the packed input/mask stream count and explicitly map those streams into the cache view.

Useful? React with 👍 / 👎.

Comment thread src/llama-vocab.cpp
Comment on lines +2261 to +2262
// cannot reach some vocab entries: " 王" (Ġçİĭ, 102322) needs (Ġ,çİĭ)=242943
// but (Ġ,ç)=27944 wins first, so it stops three tokens short. triggered by

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace Unicode in the tokenizer comment

This new comment includes a Chinese character and several non-ASCII tokenizer glyphs, contrary to the repository's explicit requirement that code avoid Unicode characters. Rewrite the example using ASCII descriptions or byte/code-point notation.

AGENTS.md reference: AGENTS.md:L73-L73

Useful? React with 👍 / 👎.

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.

2 participants