mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #103] [MERGED] GLM trunk keep (opt-in, changes the answers): the model's own layers leave out their lowest-ranked off-card experts, as the draft block does - per layer (STRATA_GLM_TRUNK_KEEP / STRATA_GLM_TRUNK_KEEP_MAP) #339
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#339
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/103
Author: @sociolog
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @mw00
Base:
main← Head:pr-trunk-keep-v2📝 Commits (2)
039dbb5GLM trunk keep (opt-in, changes the answers): STRATA_GLM_TRUNK_KEEP= / STRATA_GLM_TRUNK_KEEP_MAP= - the model's own routes leave their lowest-ranked off-card experts out, as the draft block does; README row8eb7befREADME: the Maya-L row of STRATA_GLM_TRUNK_KEEP as its gain📊 Changes
3 files changed (+25 additions, -3 deletions)
View changed files
📝
README.md(+1 -0)📝
src/core/glm_fast_path.cu(+23 -2)📝
src/kernels/cuda/glm_fast.cu(+1 -1)📄 Description
What
The draft block already leaves out the experts it is missing from VRAM past
STRATA_GLM_MTP_KEEP. This applies thesame rule to the model's own (trunk) layers, as a switch for RAM-bound splits that would rather be faster than exact:
STRATA_GLM_TRUNK_KEEP=<n>(1-8): a trunk route leaves its experts that are not in VRAM out from route rank n on(the plan entry is null, as for the draft). Experts in VRAM are always computed. Unset (8) = bit-identical to today.
STRATA_GLM_TRUNK_KEEP_MAP=<one digit per layer>: the same, layer by layer (digit i = layer i's n; 8 = all; layerspast the string's end take
STRATA_GLM_TRUNK_KEEP). The draft layer keepsMTP_KEEPwhatever the map says.Why it pays: the lowest-ranked experts carry the least weight and are the coldest, so they are the ones most often off
the card. Why per layer: GLM-5.3's layers differ by an order of magnitude in how much they notice.
How much each layer notices
STRATA_GLM_SCOREon 1,135 held-out tokens, KL to the same model with nothing left out, measured with the CPU lane off(every expert on the GPU, so the rounding never changes and a repeat gives KL 0.000000). Keep 5 in one band of MoE
layers at a time:
The last third hardly notices; the first two thirds do, on both quants.
Measured
Ryzen 9 5900X + 128 GB DDR4, RTX 3090 + 3060 (x8 each), this on v1.0.31 or v1.0.32 (rows marked 32) - the same
math: v1.0.32 loading the cards one after another gives v1.0.31's scores to the last digit; loading them at once
gives the 3060 one more expert slot per layer, +2 % decode. Speed: warm 21K API test (a fresh 21K prompt, then 2,500
tokens at 21K depth), two runs each, default sampling. Quality: as above.
Maya-M (
RAM_RESIDENT=1,CPU_PLAN=012234567, prefetch on), against 20.0 tok/s with nothing left out:Once the 3060's half is light, the 3090's paces the pipelined decode; moving two layers to the 3060 (split 28) is
where the last step comes from. Cutting deeper on 30-44 (keep 3) gave no more speed.
Maya-L (
RAM_GB=96, 14 % of the experts on the SSD), against ~11.7 tok/s with nothing left out:On code (1,135 tokens of a Python file, same clean gate): Maya-M with the map 0.0165, Maya-L 0.0177 - the same as on
prose. For scale: Maya-M itself is KL 0.103 away from Maya-L on the prose, so the map moves each model by about a
sixth of the M-to-L gap.
Not included: leaving out only the SSD's experts
We also tried
STRATA_GLM_TRUNK_KEEP_DISK=<n>: leave out only the experts that would come from the disk, from rank non. It acts in the sensitive early layers too: on Maya-L with the map,
_DISK=4raises the KL from 0.017 to 0.040(code: 0.018 to 0.046;
_DISK=7: 0.027) and on v1.0.32 did not decode faster (map +_DISK=4at the auto split14.8 tok/s, the map alone at split 27 14.75 - five runs each; Maya-L's runs scatter +-5 %). Left out of this PR.
With #76
#76's kernel (and #96's, which builds on it) takes
skip_from < 8to mean "a draft route" and then also leaves outevery expert that is only on disk, whatever its rank. With this PR a trunk route can have
skip_from < 8too, soafter both, a kept trunk layer on a split with an SSD tier would drop its disk-only experts at every rank - not what
either PR means. An explicit flag for the draft route in
RouteArgs(orlayer == the draft layer) keeps both rulesapart. Happy to rebase onto #76 and add that, whichever lands first. Textually this PR adds no conflict with #76.
Checks
On this branch (one commit on v1.0.33), RTX 3090 + 3060, built for sm_75/86:
STRATA_GLM_SCOREon 1,135 held-out tokens: with the cards loaded one after another, Maya-Mscores exactly as a stock build (NLL 1.30094, KL 0.018989 to the stock reference, the same 114,052 CPU-lane
experts); with the CPU lane off, KL 0.000000 to the stock references on Maya-M and Maya-L;
TRUNK_KEEP_MAPas above gives the same scores as the build we measured it on (KL 0.017538 to the full Maya-M,cards loaded one after another).
adds no conflict to theirs.
🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.