Repository navigation
Conversation
…grouped experts read it, routed arrays are freed TF_FLASHNEXT_SCALE_INDEX is now on by default on GPUs without tensor units. The loader indexes every 4-bit group-32 expert projection once at load, on up to eight threads. The routed gate, up and down projections, which only expert kernels read, release their stored scales and biases and keep the index and table in those slots; the shared projections keep theirs beside the index, since kernels outside the expert set read them direct. The prompt gathers (32, 64 and 128-row tiles and the fused gate/up) and the grouped expert kernels now read each group's pair through the index, as the per-row expert kernels already did: the same two values into the same sums, so replies keep their tokens. An index is keyed by its projection's codes buffer, and a kernel takes the indexed form only for a projection that has one. A tensor with more pairs than a 16-bit index holds turns the index off with a warning, as before. The indexed gathers and the indexed grouped launches register with the kernel contract as bit-preserving replacements of the direct reads, each with a planted control and launch records. Refs #2751
At widths other than 4/64, wide.moe ran each (row, pick) slot in its own threadgroup, so a window of R rows read each routed expert once per pick and the shared expert once per row. glm_moe_rows_u runs one threadgroup a unique expert (the route's uids, members and count) with a simdgroup per pick, and the shared expert with a simdgroup per row, so their weights come from memory once for every row that picked them. Each pick's sums are the same tf_rp_rows call, so the bits are too. Windows of 2+ rows take it; one row keeps the per-pick launch. tf-glm-rows-check: by unique expert == by pick at q8, q4 and q2 for 2, 4 and 16 rows (456,192 bit-equal values).
A checkpoint may store layers.45.shared_head.head (a lighter copy of lm_head, e.g. 4-bit beside an 8-bit backbone). On one Mac the loader loads it beside lm_head and the MTP drafts project through it; lm_head still produces every verified token, so replies are unchanged. Without the tensor nothing changes. 8-bit GLM-5.3-Flash with the 4-bit MTP layer and head, 6 bench prompts: 12/12 replies equal to the 8-bit alone; greedy 53.0 -> 53.2-53.5 tok/s, sampled 48.4 -> 50.1-50.3, 3.5 GB less memory.
…pt path GLM_PROMPT_NLL=ROWS reads each prompt in chunks of ROWS through the prompt kernels a reply's prompt runs, runs the head over every chunk row and scores row i on token i + 1 (checks.promptNll). GLM_PROMPT_NLL_OUT=PREFIX writes the per-token losses (f32) for paired comparisons; GLM_PROMPT_NLL_ONLY stops before the replies. A dev-tool per-token loss check, for comparing builds whose weights differ; over 99,999 tokens on the 8-bit GLM its standard error was 0.067%.
ashhart
force-pushed
the
lead/train-1117031739
branch
from
November 17, 2026 03:47
44ab15b to
95b530f
Compare
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.
CI for a landing train: #2805 #3631 #3632 #3633 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.