[GH-ISSUE #4978] [Engine] routing-neutral residency: the 12 GB card wants the prior's page-in saving without its routing change (prefetch-only / VRAM-tier pinning / cost-aware --resident-experts) #2293

Open
opened 2026-11-04 01:58:14 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @satwareAG-ironMike on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/4978

Area

[Engine] (speed, kernels, models, the server and API)

What do you want to do?

Keep the residency saving that STRATA_ROUTE_PRIOR buys on a 12 GB card without changing which experts run - i.e. a residency mechanism that is quality-neutral by construction, and a --resident-experts that knows when it cannot pay for itself.

Context: we enforce STRATA_ROUTE_PRIOR=0 per your own 0.2.8 retraction (#4402: the prior adds KL 0.0126 against the 0.0012 run-to-run floor; your agent-task check reads 4.5/10 ON vs 5.6/10 OFF), so we measure the stock routing path on RTX 3060 12 GB + 62 GiB RAM, Qwen3.8-Flash-Next IQ3_XXS, full 128K. On stock routing the short-context decode is 59.45 t/s (clean median); with the prior ON the same A/B/A gives 78.2 (+32% at the short tier, +15% deep). We are not asking for the prior back - we are asking for its page-in saving without its routing change. Nothing else moved it: spec/MTP draft acceptance is already 85-95%, prefill chunk levers (--prefill auto:32768, STRATA_PF_SWITCH_MIN_T, explicit 16384 = -28.57%, the explicit chunk starves the expert cache to 1583 slots) are no-wins or losses, clocks are at +850 memclk / 170 W.

What do you do today instead?

--resident-experts, measured as a full clean A/B/A on this card (all three legs basis-clean, expert-cache 1200 = our largest S7-safe value, facts 10/10 in every leg):

  • decode 49.55 -> 45.75 -> 50.65 t/s = -8.68%
  • cold prefill 1062.95 -> 972.90 -> 1077.00 t/s = -9.07%

Mechanism reading: the mode raises engine RSS 42.5 -> 51.4 GiB (~+8 GiB pinned) out of the same 62 GiB host RAM that the 39.97 GiB expert set and the 93 GB PLE n-gram table stream through (--ple-io direct, boot probe 115808 rows/s "fine"). Host-side pinning starves the streaming tier and both paths slow ~9% - a silent regression, no startup line says the mode cannot pay for itself on this RAM budget.

Proposed behavior

Any one of these would let a 12 GB card keep prior-class decode at stock quality; 1 is our preference:

  1. Profile-driven prefetch only: routing stays exactly as STRATA_ROUTE_PRIOR=0, but the expert profile (expert-profile.bin) additionally drives ordering - pre-stage the experts the next layer is predicted to need into the existing expert-cache slots (eviction order, not router selection). No selection change, so no KL by construction.
  2. VRAM-tier residency: an option to pin the top-K profiled experts inside the expert-cache budget with eviction protection, instead of pinning host pages. The residency then costs cache slots - which are already sized against the card - rather than RSS the host does not have.
  3. Cost-aware --resident-experts: cap the pinned pool by MemAvailable headroom and exclude the PLE streaming working set from pinning; when the math does not fit, print one startup line ("residency disabled: pinned pool would exceed the streaming tier's headroom") and stay off. On our box that line alone would have replaced a measured -9%.

How this differs from the residency/prior neighbours: #4812 (graded profile bias) and #4936 (prompt tokens routed to resident experts only) both still move router selection, so both carry a KL cost the enforced PRIOR=0 condition rejects; #1922 removes RouterLookahead overhead, which is a different cost. The proposal here changes placement and timing only - selection stays the model's own.

Environment

Strata serve v0.2.9 (c62d5e3a) · engine 0.1.52 · RTX 3060 12 GB + 62 GiB RAM · cachyOS · Qwen3.8-Flash-Next GSQ RCO IQ3_XXS · 128K context · single card, --kv k8v4 --vram-reserve-mib 960 --vram-elastic --spec 4 --mtp (stock routing, prior explicitly off)

Happy to re-run any candidate on this exact card/model with our A/B/A harness (contamination-rule clean medians, facts/needle/standard-v1 gates in-leg) and report numbers.

Originally created by @satwareAG-ironMike on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/4978 ### Area [Engine] (speed, kernels, models, the server and API) ### What do you want to do? Keep the residency saving that `STRATA_ROUTE_PRIOR` buys on a 12 GB card **without changing which experts run** - i.e. a residency mechanism that is quality-neutral by construction, and a `--resident-experts` that knows when it cannot pay for itself. Context: we enforce `STRATA_ROUTE_PRIOR=0` per your own 0.2.8 retraction (#4402: the prior adds KL 0.0126 against the 0.0012 run-to-run floor; your agent-task check reads 4.5/10 ON vs 5.6/10 OFF), so we measure the stock routing path on RTX 3060 12 GB + 62 GiB RAM, Qwen3.8-Flash-Next IQ3_XXS, full 128K. On stock routing the short-context decode is 59.45 t/s (clean median); with the prior ON the same A/B/A gives 78.2 (+32% at the short tier, +15% deep). We are *not* asking for the prior back - we are asking for its page-in saving without its routing change. Nothing else moved it: spec/MTP draft acceptance is already 85-95%, prefill chunk levers (`--prefill auto:32768`, `STRATA_PF_SWITCH_MIN_T`, explicit `16384` = **-28.57%**, the explicit chunk starves the expert cache to 1583 slots) are no-wins or losses, clocks are at +850 memclk / 170 W. ### What do you do today instead? `--resident-experts`, measured as a full clean A/B/A on this card (all three legs basis-clean, expert-cache 1200 = our largest S7-safe value, facts 10/10 in every leg): - decode 49.55 -> **45.75** -> 50.65 t/s = **-8.68%** - cold prefill 1062.95 -> **972.90** -> 1077.00 t/s = **-9.07%** Mechanism reading: the mode raises engine RSS 42.5 -> 51.4 GiB (~+8 GiB pinned) out of the same 62 GiB host RAM that the 39.97 GiB expert set and the 93 GB PLE n-gram table stream through (`--ple-io direct`, boot probe 115808 rows/s "fine"). Host-side pinning starves the streaming tier and **both paths slow ~9%** - a silent regression, no startup line says the mode cannot pay for itself on this RAM budget. ### Proposed behavior Any one of these would let a 12 GB card keep prior-class decode at stock quality; 1 is our preference: 1. **Profile-driven prefetch only**: routing stays exactly as `STRATA_ROUTE_PRIOR=0`, but the expert profile (`expert-profile.bin`) additionally drives *ordering* - pre-stage the experts the next layer is predicted to need into the existing expert-cache slots (eviction order, not router selection). No selection change, so no KL by construction. 2. **VRAM-tier residency**: an option to pin the top-K profiled experts *inside the expert-cache budget* with eviction protection, instead of pinning host pages. The residency then costs cache slots - which are already sized against the card - rather than RSS the host does not have. 3. **Cost-aware `--resident-experts`**: cap the pinned pool by `MemAvailable` headroom and exclude the PLE streaming working set from pinning; when the math does not fit, print one startup line ("residency disabled: pinned pool would exceed the streaming tier's headroom") and stay off. On our box that line alone would have replaced a measured -9%. How this differs from the residency/prior neighbours: #4812 (graded profile bias) and #4936 (prompt tokens routed to resident experts only) both still move router selection, so both carry a KL cost the enforced `PRIOR=0` condition rejects; #1922 removes RouterLookahead overhead, which is a different cost. The proposal here changes **placement and timing only** - selection stays the model's own. ### Environment Strata serve v0.2.9 (`c62d5e3a`) · engine 0.1.52 · RTX 3060 12 GB + 62 GiB RAM · cachyOS · Qwen3.8-Flash-Next GSQ RCO IQ3_XXS · 128K context · single card, `--kv k8v4 --vram-reserve-mib 960 --vram-elastic --spec 4 --mtp` (stock routing, prior explicitly off) Happy to re-run any candidate on this exact card/model with our A/B/A harness (contamination-rule clean medians, facts/needle/standard-v1 gates in-leg) and report numbers.
Author
Owner

@sangharshadhyeta commented on GitHub (Nov 3, 2026):

Your measurement (-9% when pinning ~8 GiB out of 62 GiB) matches what I saw: pinning too much host RAM takes it away from the streaming tier. Two things that helped me on a 12 GB card with 30 GB RAM:

  • Page-lock the RAM tier in segments, not all at once, and give a segment back when free memory runs low. This is what STRATA_PIN_SEGS does in my fork: +9% on my PC.
  • Do the prefetch before pinning: a learned look-ahead (trained on routing traces) stages the next layers' experts into VRAM slots. It only changes timing, not which experts the router picks. It guessed 85-88% of the needed experts one layer ahead vs 77-79% for the plain router.

Caveat: my fork's default decode also uses stand-in experts, which do change selection (with a re-check), so it is not quality-neutral out of the box. I have not measured it against your KL limit with stand-ins off.

<!-- gh-comment-id:6607981199 --> @sangharshadhyeta commented on GitHub (Nov 3, 2026): Your measurement (-9% when pinning ~8 GiB out of 62 GiB) matches what I saw: pinning too much host RAM takes it away from the streaming tier. Two things that helped me on a 12 GB card with 30 GB RAM: - Page-lock the RAM tier in segments, not all at once, and give a segment back when free memory runs low. This is what STRATA_PIN_SEGS does in my fork: +9% on my PC. - Do the prefetch before pinning: a learned look-ahead (trained on routing traces) stages the next layers' experts into VRAM slots. It only changes timing, not which experts the router picks. It guessed 85-88% of the needed experts one layer ahead vs 77-79% for the plain router. Caveat: my fork's default decode also uses stand-in experts, which do change selection (with a re-check), so it is not quality-neutral out of the box. I have not measured it against your KL limit with stand-ins off. - Sangharsh. I keep a fork for this kind of PC: https://github.com/sangharshadhyeta/Strata-HotRod (docs/HOTROD-DETAILS.md has the measurements)
Author
Owner

@coryjett commented on GitHub (Nov 5, 2026):

A task-level quality data point for the prior, from 24 GB cards, where its page-in saving is smallest.

Setup

  • 2 x RTX 3090 on Linux, Qwen3.8-Flash-Next IQ3_S, Strata 0.2.9 (engine 0.1.55), layer split. About 99.6% of expert lookups hit the card's cache without the prior.
  • GPQA-Diamond with lm-eval gpqa_diamond_cot_zeroshot: 198 questions, reasoning_effort=high, temperature 0.6, top_p 0.95, thinking budget 16384, flexible-extract.
  • Two legs on the same day, one run each: STRATA_ROUTE_PRIOR=0.5 first, then our production config without the prior. Nothing else changed.

Result

score correct
STRATA_ROUTE_PRIOR=0.5 0.899 ± 0.022 178 / 198
prior off 0.859 ± 0.025 170 / 198
  • Paired by question: 167 right in both, 11 right only with the prior, 3 right only without it.
  • Exact McNemar test: p = 0.057.
  • At temperature 0.6 with one run per leg, I read this as "no sign of a loss" rather than "the prior helps". A second seed would be needed to say more.

Speed on the same box

  • With thinking off, decode is about 11% faster with the prior: 137.8 → 152.6 tok/s on short prompts.
  • Generation after a 32K prompt is about 10% faster: 112.5 → 124.0 tok/s.
  • With thinking on, decode is unchanged, as are the GPQA wall times: 3 h 32 min vs 3 h 31 min.
  • The cache hit rate goes from 99.62% to 99.96%, and 0.5 kept all of 1.0's gain here.

So on this setup, the KL cost you quote from #4402 did not show up as a GPQA loss. That does not answer the 12 GB case: there the prior swaps far more experts. I'm only posting it as one point on the curve.

<!-- gh-comment-id:6660380066 --> @coryjett commented on GitHub (Nov 5, 2026): A task-level quality data point for the prior, from 24 GB cards, where its page-in saving is smallest. **Setup** - 2 x RTX 3090 on Linux, Qwen3.8-Flash-Next IQ3_S, Strata 0.2.9 (engine 0.1.55), layer split. About 99.6% of expert lookups hit the card's cache without the prior. - GPQA-Diamond with lm-eval `gpqa_diamond_cot_zeroshot`: 198 questions, `reasoning_effort=high`, temperature 0.6, top_p 0.95, thinking budget 16384, flexible-extract. - Two legs on the same day, one run each: `STRATA_ROUTE_PRIOR=0.5` first, then our production config without the prior. Nothing else changed. **Result** | | score | correct | |---|---|---| | `STRATA_ROUTE_PRIOR=0.5` | 0.899 ± 0.022 | 178 / 198 | | prior off | 0.859 ± 0.025 | 170 / 198 | - Paired by question: 167 right in both, 11 right only with the prior, 3 right only without it. - Exact McNemar test: p = 0.057. - At temperature 0.6 with one run per leg, I read this as "no sign of a loss" rather than "the prior helps". A second seed would be needed to say more. **Speed on the same box** - With thinking off, decode is about 11% faster with the prior: 137.8 → 152.6 tok/s on short prompts. - Generation after a 32K prompt is about 10% faster: 112.5 → 124.0 tok/s. - With thinking on, decode is unchanged, as are the GPQA wall times: 3 h 32 min vs 3 h 31 min. - The cache hit rate goes from 99.62% to 99.96%, and 0.5 kept all of 1.0's gain here. So on this setup, the KL cost you quote from #4402 did not show up as a GPQA loss. That does not answer the 12 GB case: there the prior swaps far more experts. I'm only posting it as one point on the curve.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2293
No description provided.