mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #389] [CLOSED] GLM expert tiers: the count memory, a prompt's weight in it, and the pool's tail spread across the layers, opt-in (MAYA_GLM_COUNT_HALF, MAYA_GLM_PROMPT_COUNTS, MAYA_GLM_LEND_SPREAD) #507
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#507
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/389
Author: @somnergy
Created: 10/22/2026
Status: ❌ Closed
Base:
main← Head:pr/glm-tier-policy📝 Commits (3)
210f71dGLM expert tiers: the aged counts' halving period and a prompt's weight in them, opt-in (MAYA_GLM_COUNT_HALF, MAYA_GLM_PROMPT_COUNTS)674584cGLM expert tiers: the pool's tail slot by slot across the layers, opt-in (MAYA_GLM_LEND_SPREAD)790a908tools/glm_multi_replay.py: a scripted multi-conversation workload for A/B runs of tier and scheduler settings📊 Changes
10 files changed (+929 additions, -29 deletions)
View changed files
📝
CMakeLists.txt(+3 -2)📝
docs/SETTINGS.md(+3 -0)📝
include/strata/core/glm_model.hpp(+2 -0)➕
include/strata/core/tier_policy.hpp(+115 -0)📝
src/core/glm_fast_path.cu(+41 -9)📝
src/core/glm_fast_state.hpp(+9 -3)📝
src/core/glm_prefill.cu(+11 -15)➕
tests/core/tier_policy_test.cpp(+120 -0)➕
tools/glm_multi_replay.py(+456 -0)➕
tools/test_glm_multi_replay.py(+169 -0)📄 Description
Summary
Where part of the experts live in RAM, the decode's VRAM tier evicts, refills and swaps by aged route counts. Three opt-in settings (each unset keeps today's rule), plus a benchmark to decide whether they are worth keeping:
MAYA_GLM_COUNT_HALF=<events>: the counts halve every 32768 count events, a few seconds of a batched decode; this sets the period (e.g.432000, ~30 s).MAYA_GLM_PROMPT_COUNTS=<w>(0-1): a prompt chunk adds T x 8 events a layer, so one read halves every count several times; this weights a prompt's routing in the counts.MAYA_GLM_LEND_SPREAD=1: a read borrows the front of the pool's tail region, which, laid out layer by layer, is the whole tail of the first MoE layers; spread, a read takes a slot or two of every layer.tools/glm_multi_replay.py: a reproducible multi-conversation workload for A/B runs (below).The rules are pure functions in
strata/core/tier_policy.hpp, CPU-tested.Why
Measured under several concurrent Claude Code sessions (agentic coding: long multi-turn conversations, subagents, tool calls, auto-mode safety checks) through the Anthropic Messages API with
--parallel 8, with Maya-L (~85% of experts in VRAM):Measured
Hardware: 2x NVIDIA RTX PRO 5000 Blackwell 72 GB, each on PCIe 5.0 x8 from its own CPU root port (no fast P2P); Intel Core Ultra 9 285K (8 P + 16 E cores, no AVX-512), the engine on all 24 cores; 96 GB DDR5; driver 615.71.09, CUDA 13.4. Model: Maya-L (IQ3_S / IQ4_XS experts), ~85% of the experts in VRAM, the rest pinned in RAM, CPU lane on; 8 conversations at most.
Two live A/B pairs, back to back, 35-45 minutes each after a 12-minute warm-up. t1 = off; t2 =
LEND_SPREAD=1,COUNT_HALF=432000,PROMPT_COUNTS=0.1:The VRAM hit rose in both pairs (+0.3 and +1.1 points). Decode did not show a clear gain: pair 1 (same CPU-lane split) moved -6% to +2% by context; pair 2's larger numbers came with a different CPU-lane split picked at start (which alone cuts PCIe fetches: a t1 start with that split fetched 0.36 a token) and lighter contexts. A replay of 26 minutes of live routes put the longer count memory as the best eviction-side rule (+0.2 points); the replay does not model the early-layer decay
LEND_SPREADaims at, and no route log was taken with t2.The benchmark that should decide
tools/glm_multi_replay.py runreplays a fixed workload against a running server, fixed by--seed: 8 conversations sharing 30K / 8K / 4K-token system prompts; turns that append mostly short new text (95% under 8K tokens, a few up to 64K) with 2-20 s think times; 40 short checks an hour on one 30K system prompt; two cold bursts where half the clients start over; compaction past--max-context. The history is scripted (the model's answers are not fed back) and requests are greedy with the end tokens banned, so every run sends the same prompts and writes the same tokens. It records each request's read and decode times and VRAM hit (/metrics?requests=all), the tiers every 10 s, and, with--route-log, the VRAM hit of layer bands over the run.compareprints mean +- sd per configuration and marks differences beyond twice their standard error.Protocol: experts partly in RAM; the same config but the settings; the CPU-lane split pinned (
MAYA_GLM_CPU_PLAN); a fresh engine and empty slot folder per run; configurations alternated, 3 runs each, 30 minutes per run. The settings stay only if VRAM hit and decode per request improve beyond the run-to-run spread. Not run yet.Recommendation
For now: with experts partly in RAM and several conversations, the three settings together raised the VRAM hit by 0.3-1.1 points without a decode gain shown; leave them off by default until the benchmark above shows a real one. With every expert in VRAM there are no misses to save; streamed from RAM and one GPU were not measured.
Exactness
Not bitwise against the settings off: they change which experts sit in VRAM at a given moment, and with it which ones the CPU lane computes (another rounding) and the order a prompt chunk sums expert outputs in - the same kind of difference as between any two runs, since the tiers depend on timing. With the CPU lane off, decode arithmetic does not depend on where an expert sits.
How it was verified
tests/core/tier_policy_test.cpp(CPU): the parse and ranges; the defaults match the old halving loops; the weighted prompt counts; both tail layouts tile the region exactly, and a spread loan is even across the layers.tools/test_glm_multi_replay.py(no GPU, part of the CI's tools tests): the workload's determinism, the texts and requests, the summary's bins, the route-log bands, the comparison, and a short run against a fake server.tier_policy_testpasses on the box above;tools/check_hip_compat.pyis clean.LEND_SPREAD's code (by reading, the two are independent).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.