mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #1668] [CLOSED] Fewer missed experts in decode: STRATA_ROUTE_TAIL_SKIP=R and STRATA_ROUTE_PRIOR=lambda (decode x1.33 on a 12 GB card, opt-in, change the output) #3596
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#3596
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/Niko1221/Strata/pull/1668
Author: @LeGeRyChEeSe
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:pr/route-tail-prior📝 Commits (3)
607c113STRATA_ROUTE_PRIOR=lambda: cache-conditioned routing in verify windows (opt-in, changes the output)9c39220STRATA_ROUTE_TAIL_SKIP=R: missed experts routed only at rank >= R are neither copied nor computed6f4860etools/agent_turns_bench.py: decode A/B on coding-agent turns over this repository, per-turn ratios📊 Changes
8 files changed (+363 additions, -2 deletions)
View changed files
📝
CMakeLists.txt(+1 -0)📝
include/strata/core/expert_source.hpp(+4 -0)➕
include/strata/kernels/route_prior.hpp(+15 -0)📝
src/core/expert_source.cpp(+39 -2)📝
src/core/verify.cpp(+6 -0)➕
src/kernels/cuda/route_prior.cu(+79 -0)📝
src/program/generate.cpp(+3 -0)➕
tools/agent_turns_bench.py(+216 -0)📄 Description
Title
Issue: related:
STRATA_ROUTE_RESIDENT(5df35dc, experimental) attacks the same misses by another rule; the numbersbelow compare all three. The prior follows "Mixture of Cache-Conditional Experts" (arXiv 2412.00099), used here
without any training. No issue or PR found for either rule (searched 2026-10-09: tail, rank, skip, prior,
cache-conditional, missed experts).
Summary
Why it matters: on a card that cannot hold every expert, the decode time that is not GPU compute goes to the
missed experts: their copy over PCIe and the CPU pool's rows. Two opt-in switches cut those misses, each on its own
variable. Both are off by default, and the default path is unchanged.
STRATA_ROUTE_TAIL_SKIP=R: a missed expert (not in VRAM, nor on a helper or peer GPU) that every token ofthe verify window routes at rank R or lower in weight is neither copied nor computed. Its contribution is zero, and
the other experts keep the router's weights (no renormalisation). An expert that any token ranks above R is served
as before, so the window's strongest choices are never dropped.
STRATA_ROUTE_PRIOR=lambda: each token's top-10 is picked again withlambdaadded to the logit of everyexpert resident in this card's cache. The weights stay the router's probabilities (softmax over the 512 unbiased
logits), renormalised over the 10 picked. Unlike
STRATA_ROUTE_RESIDENT, which swaps a missed rank-6-9 expert forthe best resident one within a margin, every rank can move, by an amount the logits decide.
RTX 4070 SUPER 12 GB, IQ2_XS, 23 coding-agent turns (2.5K-103K tokens), median of the per-turn decode ratios:
STRATA_ROUTE_TAIL_SKIP=7STRATA_ROUTE_TAIL_SKIP=7+STRATA_ROUTE_PRIOR=0.5Measured again on top of HC-REQ8 - a local requantization of the hyper-connection projections at load, the approach
of #1262 (not part of this PR), which gives this card a 314-slot larger expert cache - against that base:
STRATA_ROUTE_TAIL_SKIP=7STRATA_ROUTE_PRIOR=0.5STRATA_ROUTE_RESIDENT=1, for comparisonWith HC-REQ8 and both switches, the median decode of these turns goes from 64.0 to 90.5 tok/s against the
default (x1.38, 23/23 faster). Prompt reads are unchanged: both rules act only in the decode windows.
What changed
src/core/expert_source.cpp,include/strata/core/expert_source.hpp(tail skip):expert_pool_dispatch_multi, after the distinct experts are counted, the skipped ones getkind = -2;any_cpuand the prefetch list count onlykind == -1;ExpertDispatch.src/program/generate.cpp: one cumulative log line per request,route tail skip: N missed experts skipped (M entries) since the start.src/kernels/cuda/route_prior.cu,include/strata/kernels/route_prior.hpp(new): one warp per token, 16 logitsper lane, the same warp idiom as
native_router.cu.src/core/verify.cpp: the prior is applied after the router and beforeSTRATA_ROUTE_RESIDENTand the plan, whenthe variable is set, NE == 512 and K == 10.
CMakeLists.txt: the new kernel is added tostrata_kernels.tools/agent_turns_bench.py(new): the workload below as a reusable A/B, in the manner ofab_engine.py; itprints the median of the per-turn decode ratios and the turns each arm won.
Extra Notes
fb58e0d) plus this change. RTX 4070 SUPER 12 GB (PCIe 4.0 x16), Ryzen 5 5600X,64 GB DDR4, Windows 11, driver 617.14, CUDA 13.1, IQ2_XS native pack,
--spec 4 --mtp,--kv int8 --kv-resident 32768,--vram-reserve-mib 1000.mirrored (for example A B C D D C B A). T = 1, top-p 0.95, 256 new tokens per turn.
tools/agent_turns_bench.py, added by this PR: five simulated coding-agent sessions over thisrepository's own files (system prompt, four tools, real files as tool results, at most 2000 lines per read), 23
turns from ~2.5K to ~100K tokens.
python tools/agent_turns_bench.py strata-iq2_xs.json base: skip:STRATA_ROUTE_TAIL_SKIP=7.positions on 3 public prompts (6K / 18K / 27K tokens),
STRATA_LOGPOS, adaptive tier frozen:STRATA_ROUTE_TAIL_SKIP=7STRATA_ROUTE_TAIL_SKIP=7+STRATA_ROUTE_PRIOR=0.5STRATA_ROUTE_RESIDENT=1The tail skip moves the output least, for the same speed as
STRATA_ROUTE_RESIDENT=1. The prior adds speed andmoves it more.
HumanEval (164, greedy, thinking off) does not separate the arms:
STRATA_ROUTE_RESIDENT=1The problems that flip are the same handful (HumanEval/75, 108, 130, 132, 140, 147) in every arm, the controls
included. Greedy decoding on this engine is not repeatable across runs once the expert placement changes (GPU and
CPU experts round differently), so at n = 164 the KL is the finer measure.
on 0.1.39, with a larger KL. 7 and 0.5 are the values measured here.
native_router.cu; the SYCL tree is untouched.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.