[GH-ISSUE #1348] Foresight: fetching MoE experts before they're needed — measured on 2× 3090 (update: prefetch path built and correct, no decode gain yet; data, tools, help wanted) #545

Closed
opened 2026-11-04 01:43:56 +07:00 by bsakaguchi · 6 comments
Owner

Originally created by @q8atnight on GitHub (Oct 7, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/1348

Hi Niko and everyone, this is a data report and an invitation, not a PR. We spent a day measuring whether experts
could be brought into VRAM before a window asks for them, instead of the CPU computing the misses.

Short version:

  • Misses still cost up to 34 % of decode time on our 2× 3090 (95 % hit rate).
  • That share grows fast as VRAM shrinks: with the cache cut to a 24 GB card's share, the zero-miss headroom is ~+75 %
    (bus-limited there).
  • Two cheap predictors together catch roughly half of the misses, worth an estimated +12-13 % here and more on
    smaller cards.
  • The catch: the existing adapt swap path is too slow to deliver it, so it needs a low-latency prefetch path in the
    verify/pool/residency core.

Code and tools to reproduce everything are on a public branch (see "Try it / help" at the end).

Setup. 2× RTX 3090 (x8 Gen4 each, ~13.5 GB/s), Ryzen 3950X, 121 GB DDR4. unsloth UD-Q4_K_XL, v0.1.40.1,
--layer-split 24 --pipeline-windows 2, locked-RAM arena, 12,779 slots (~52 % of experts), --spec 4.
After tuning --pcie-frac 0.2 --spec-min-p 0.7 (+16 % decode vs 0.5/0.5 here; more PCIe share was monotonically
slower, −17…−32 % at 1.0), real agentic-coding chats run at ~95-110 t/s with a 94-96 % hit rate.

1. The price of a miss is linear and sizeable. Shrinking the cache via --vram-reserve-mib with
STRATA_DECODE_TIMING=1:

slots hit misses per layer-window ms per window t/s
12,779 95.3 % 0.89 15.5 97
9,712 90.3 % 1.83 18.0 84
6,363 81.0 % 3.53 22.8 68

That's +2.78 ms per window per extra miss per layer-window, i.e. ~0.058 ms per distinct missed expert, with a
zero-miss intercept of ~13.0 ms. On real coding windows (wider, T≈2.5) we see 1.57 misses per layer-window, so
"every miss arrives in time" would be worth up to +34 % decode on this box. At the 6,363-slot point (≈ the share
of experts a single 24 GB card holds) the same arithmetic gives **
+75 %** headroom (22.8 → ~13 ms). There, though,
the x8 bus can't carry every miss in time, so a real gain would be well below that ceiling.

2. Misses are predictable, two ways. Both were measured offline on real sessions: --dump-routing, plus a small
env-gated dump of each pool call's x_f rows (BF16) and ids. Recomputing W_L·x_f reproduces the engine's own top-10
at 99.92 %. The simulator below replays the routing through a mimic of the static profile plus your adapt rules; it
matches the engine's hit rate (~94 %) and also reproduces that changing --adapt-every / --adapt-swaps doesn't
move it.

  • Recency ring (cross-window): reserve 16 slots per layer (taken from the coldest residents) that hold experts
    that just missed, refreshed every window. This gives −24 % distinct misses if a copy lands by the next window. It is
    very lag-sensitive: −27 / −18 / −12 / −3.5 % at a landing delay of 1 / 2 / 3 / 5 windows. Making adapt itself more
    aggressive (usage ≥ 1, gain 0-1, every window) only reaches −3…−8 %. It has to be a separate recency tier.

  • Router-ahead, zero-shot (within a window, Fate-style): apply layer L+k's ffn_gate_inp to layer L's x_f.
    Token recall of the 10 routed experts:

    ahead @10 @24 @48
    1 layer 61 % 82 % 90 %
    2 layers 52 % 72 % 83 %
    3 layers 46 % 66 % 78 %

    Fetching only the best-ranked non-resident candidates within what an x8 link moves in 1-3 layers covers
    ~25-35 % of misses, mostly different ones from the ring's.

  • A small trained residual predictor (~200K params per layer) did not transfer across sessions (it helped layer 3,
    hurt layers 10-42), so we'd stay with the router-ahead zero-shot predictor.

Combined estimate: ~−45 % misses ≈ +12-13 % decode on this box.

3. We built the ring on the adapt path, and it didn't work. We built the ring inside the serve adapt() (an env
switch, off by default, 6/6 answers identical with it off). Live result: misses −2…−10 %, speed within noise. Our
reading: under --pipeline-windows 2, pl_adapt → adapt_fence → copy → pl_apply commit → exch_ev release
means one ring update per ~4 windows that lands 2-3 windows late. In the serial loop the ring does cut misses −21 %,
as simulated, but per-window adapting costs ~2.5 ms per window there, so decode drops 13 %.

What we think a working version needs:

  1. a small kernel in each layer's pre[l] graph that applies the next 1-3 routers to mixed_ rows and publishes
    top-k with the doorbell (the host is far too slow: ~430 M MAC per window);
  2. a per-card prefetch stream into a few reserved slots per layer, with copies issued the moment a layer's routing is
    known;
  3. residency updates that the host plan (host_res) and the GPU plan (d_res) see identically within a window.
    This is the part we're least sure how to do safely in your pipeline.

Questions:

  1. Is predictive prefetch something you'd want in Strata (opt-in, byte-identical when off)? Or does it collide with
    plans you already have for the expert tier?
  2. If yes, how would you approach point 3? Is there a safe point per layer where residency can change mid-window, or
    would you rather double-buffer d_res per window?
  3. Would the measurement tools help you or others? We have the x_f dump switch (~25 lines in drive_pool_multi),
    the trace-replay simulator and the gate scripts, and can open a small PR for the dump switch or share the branch.

Try it / help. Branch q8atnight/Strata:foresight, based on
v0.1.40.1 plus our layer-split ports. It has:

  • the dump switch (STRATA_FORESIGHT_DUMP);
  • the ring reference (STRATA_FORESIGHT_RING, measured no gain on the adapt path, kept for comparison);
  • tools/foresight/: router extraction, the trace-replay cache simulator, router-ahead scoring and the Scout trial,
    with a README.

Both switches are off by default and the build is gate-identical. The most useful contributions:

  • the same three numbers from other setups: price of a miss via --vram-reserve-mib + STRATA_DECODE_TIMING=1, hit
    rate, router-ahead coverage. Single 24 GB / 32 GB cards and AMD would tell us where this pays most;
  • ideas for the residency-consistency part.

All numbers here come from one box and one user's real agentic-coding sessions. We're happy to rerun anything on our
2× 3090.

Originally created by @q8atnight on GitHub (Oct 7, 2026). Original GitHub issue: https://github.com/Niko1221/Strata/issues/1348 Hi Niko and everyone, this is a data report and an invitation, not a PR. We spent a day measuring whether experts could be brought into VRAM *before* a window asks for them, instead of the CPU computing the misses. **Short version:** - Misses still cost **up to 34 % of decode time** on our 2× 3090 (95 % hit rate). - That share grows fast as VRAM shrinks: with the cache cut to a 24 GB card's share, the zero-miss headroom is **~+75 %** (bus-limited there). - Two cheap predictors together catch roughly half of the misses, worth an estimated **+12-13 %** here and more on smaller cards. - The catch: the existing adapt swap path is too slow to deliver it, so it needs a low-latency prefetch path in the verify/pool/residency core. Code and tools to reproduce everything are on a public branch (see "Try it / help" at the end). **Setup.** 2× RTX 3090 (x8 Gen4 each, ~13.5 GB/s), Ryzen 3950X, 121 GB DDR4. unsloth UD-Q4_K_XL, v0.1.40.1, `--layer-split 24 --pipeline-windows 2`, locked-RAM arena, 12,779 slots (~52 % of experts), `--spec 4`. After tuning `--pcie-frac 0.2 --spec-min-p 0.7` (+16 % decode vs 0.5/0.5 here; more PCIe share was monotonically *slower*, −17…−32 % at 1.0), real agentic-coding chats run at ~95-110 t/s with a 94-96 % hit rate. **1. The price of a miss is linear and sizeable.** Shrinking the cache via `--vram-reserve-mib` with `STRATA_DECODE_TIMING=1`: | slots | hit | misses per layer-window | ms per window | t/s | |---|---|---|---|---| | 12,779 | 95.3 % | 0.89 | 15.5 | 97 | | 9,712 | 90.3 % | 1.83 | 18.0 | 84 | | 6,363 | 81.0 % | 3.53 | 22.8 | 68 | That's +2.78 ms per window per extra miss per layer-window, i.e. ~0.058 ms per distinct missed expert, with a zero-miss intercept of ~13.0 ms. On real coding windows (wider, T≈2.5) we see ~1.57 misses per layer-window, so "every miss arrives in time" would be worth up to **+34 %** decode on this box. At the 6,363-slot point (≈ the share of experts a single 24 GB card holds) the same arithmetic gives **~+75 %** headroom (22.8 → ~13 ms). There, though, the x8 bus can't carry every miss in time, so a real gain would be well below that ceiling. **2. Misses are predictable, two ways.** Both were measured offline on real sessions: `--dump-routing`, plus a small env-gated dump of each pool call's `x_f` rows (BF16) and ids. Recomputing W_L·x_f reproduces the engine's own top-10 at 99.92 %. The simulator below replays the routing through a mimic of the static profile plus your adapt rules; it matches the engine's hit rate (~94 %) and also reproduces that changing `--adapt-every` / `--adapt-swaps` doesn't move it. - **Recency ring** (cross-window): reserve 16 slots per layer (taken from the coldest residents) that hold experts that just missed, refreshed every window. This gives −24 % distinct misses if a copy lands by the next window. It is very lag-sensitive: −27 / −18 / −12 / −3.5 % at a landing delay of 1 / 2 / 3 / 5 windows. Making adapt itself more aggressive (usage ≥ 1, gain 0-1, every window) only reaches −3…−8 %. It has to be a separate recency tier. - **Router-ahead, zero-shot** (within a window, Fate-style): apply layer L+k's `ffn_gate_inp` to layer L's `x_f`. Token recall of the 10 routed experts: | ahead | @10 | @24 | @48 | |---|---|---|---| | 1 layer | 61 % | 82 % | 90 % | | 2 layers | 52 % | 72 % | 83 % | | 3 layers | 46 % | 66 % | 78 % | Fetching only the best-ranked *non-resident* candidates within what an x8 link moves in 1-3 layers covers **~25-35 % of misses**, mostly different ones from the ring's. - A small trained residual predictor (~200K params per layer) did **not** transfer across sessions (it helped layer 3, hurt layers 10-42), so we'd stay with the router-ahead zero-shot predictor. Combined estimate: ~−45 % misses ≈ **+12-13 % decode** on this box. **3. We built the ring on the adapt path, and it didn't work.** We built the ring inside the serve `adapt()` (an env switch, off by default, 6/6 answers identical with it off). Live result: misses −2…−10 %, speed within noise. Our reading: under `--pipeline-windows 2`, `pl_adapt` → `adapt_fence` → copy → `pl_apply` commit → `exch_ev` release means one ring update per ~4 windows that lands 2-3 windows late. In the serial loop the ring does cut misses −21 %, as simulated, but per-window adapting costs ~2.5 ms per window there, so decode drops 13 %. **What we think a working version needs:** 1. a small kernel in each layer's `pre[l]` graph that applies the next 1-3 routers to `mixed_` rows and publishes top-k with the doorbell (the host is far too slow: ~430 M MAC per window); 2. a per-card prefetch stream into a few reserved slots per layer, with copies issued the moment a layer's routing is known; 3. residency updates that the host plan (`host_res`) and the GPU plan (`d_res`) see identically within a window. This is the part we're least sure how to do safely in your pipeline. **Questions:** 1. Is predictive prefetch something you'd want in Strata (opt-in, byte-identical when off)? Or does it collide with plans you already have for the expert tier? 2. If yes, how would you approach point 3? Is there a safe point per layer where residency can change mid-window, or would you rather double-buffer `d_res` per window? 3. Would the measurement tools help you or others? We have the `x_f` dump switch (~25 lines in `drive_pool_multi`), the trace-replay simulator and the gate scripts, and can open a small PR for the dump switch or share the branch. **Try it / help.** Branch [`q8atnight/Strata:foresight`](https://github.com/q8atnight/Strata/tree/foresight), based on v0.1.40.1 plus our layer-split ports. It has: - the dump switch (`STRATA_FORESIGHT_DUMP`); - the ring reference (`STRATA_FORESIGHT_RING`, measured no gain on the adapt path, kept for comparison); - `tools/foresight/`: router extraction, the trace-replay cache simulator, router-ahead scoring and the Scout trial, with a README. Both switches are off by default and the build is gate-identical. The most useful contributions: - the same three numbers from other setups: price of a miss via `--vram-reserve-mib` + `STRATA_DECODE_TIMING=1`, hit rate, router-ahead coverage. Single 24 GB / 32 GB cards and AMD would tell us where this pays most; - ideas for the residency-consistency part. All numbers here come from one box and one user's real agentic-coding sessions. We're happy to rerun anything on our 2× 3090.
Author
Owner

@q8atnight commented on GitHub (Oct 7, 2026):

Follow-up: we built the prefetch path ourselves. It's correct and it removes 21-39 % of the CPU misses, as our trace simulation predicted, but decode does not get faster on our box. Posting it so nobody repeats the same steps, and to correct the "+34 % headroom" in the title, which overstates the prize at our operating point.

What we built (branch q8atnight/Strata:foresight, all off by default, tools/foresight/README.md has the details):

  • a "swap space" of N VRAM slots per layer on each card, apart from the expert cache, refilled on its own copy stream with experts that just missed (STRATA_FS_SLOTS, _BUDGET, _ADMIT, _DEPTH);
  • at the pool's existing per-layer decision, an expert held in a landed slot becomes a plain kind-0 group whose P.ptr points at the slot. No kernel changes, and the host plan stays the single source of truth;
  • a slot is reused only after depth more finished windows since a plan last pointed at it.

Correctness. With the switches off, the deterministic gate gave 6/6 identical answers. With it on, STRATA_FS_VERIFY=1 (reads every landed slot back and compares it byte for byte) gave 19,633 ok, 0 mismatches.

Speed (2× 3090, UD-Q4_K_XL, layer split, --pipeline-windows 2, four prompts × 3 reps, a restart per setting):

setting t/s (geo-mean) CPU misses per layer-window ms per window
off (two passes) 98.6 / 98.0 0.842 / 0.841 15.41 / 15.31
16 slots (two passes) 96.4 / 95.0 0.643 / 0.664 15.95 / 16.07
8 / 24 / 32 slots 95.3 / 93.7 / 94.1 0.660 / 0.670 / 0.615 ~15.8-15.9
16 slots, budget 64 95.3 0.515 15.64

Why it doesn't pay, per STRATA_DECODE_TIMING:

  1. Below one miss per layer-window, the cost is per layer, not per expert. A layer that still hands one expert to the CPU waits for the CPU round trip either way. CPU-expert time per window fell only 2.90 → 2.27-2.78 ms. Our "+2.78 ms per miss per layer-window" came from shrinking the cache to 1-3.5 misses per layer-window and does not extrapolate down. So the "+34 % headroom" above is an upper bound, not the live prize.
  2. The copies slow the GPU side (10.3 → 10.6-10.8 ms per window). The refill traffic shares the x8 links with the per-layer handshake and KV streaming. The slots also take 7-13 % of the expert cache.

What we think a winning version needs: clear all of a layer's misses so its CPU round trip disappears, and schedule copies into bus-idle time. With a layer split, for example, use the other card's link while one card computes its half. Boxes with more misses per layer (single 24 GB cards) sit where the per-miss price did hold in our test, so it may look better there. That's untested, and measurements from such setups would be welcome.

<!-- gh-comment-id:6041194190 --> @q8atnight commented on GitHub (Oct 7, 2026): Follow-up: we built the prefetch path ourselves. It's correct and it removes 21-39 % of the CPU misses, as our trace simulation predicted, but decode does **not** get faster on our box. Posting it so nobody repeats the same steps, and to correct the "+34 % headroom" in the title, which overstates the prize at our operating point. **What we built** (branch [`q8atnight/Strata:foresight`](https://github.com/q8atnight/Strata/tree/foresight), all off by default, `tools/foresight/README.md` has the details): - a "swap space" of N VRAM slots per layer on each card, apart from the expert cache, refilled on its own copy stream with experts that just missed (`STRATA_FS_SLOTS`, `_BUDGET`, `_ADMIT`, `_DEPTH`); - at the pool's existing per-layer decision, an expert held in a landed slot becomes a plain kind-0 group whose `P.ptr` points at the slot. No kernel changes, and the host plan stays the single source of truth; - a slot is reused only after `depth` more finished windows since a plan last pointed at it. **Correctness.** With the switches off, the deterministic gate gave 6/6 identical answers. With it on, `STRATA_FS_VERIFY=1` (reads every landed slot back and compares it byte for byte) gave 19,633 ok, 0 mismatches. **Speed** (2× 3090, UD-Q4_K_XL, layer split, `--pipeline-windows 2`, four prompts × 3 reps, a restart per setting): | setting | t/s (geo-mean) | CPU misses per layer-window | ms per window | |---|---|---|---| | off (two passes) | 98.6 / 98.0 | 0.842 / 0.841 | 15.41 / 15.31 | | 16 slots (two passes) | 96.4 / 95.0 | 0.643 / 0.664 | 15.95 / 16.07 | | 8 / 24 / 32 slots | 95.3 / 93.7 / 94.1 | 0.660 / 0.670 / 0.615 | ~15.8-15.9 | | 16 slots, budget 64 | 95.3 | **0.515** | 15.64 | **Why it doesn't pay, per `STRATA_DECODE_TIMING`:** 1. **Below one miss per layer-window, the cost is per layer, not per expert.** A layer that still hands one expert to the CPU waits for the CPU round trip either way. CPU-expert time per window fell only 2.90 → 2.27-2.78 ms. Our "+2.78 ms per miss per layer-window" came from shrinking the cache to 1-3.5 misses per layer-window and does not extrapolate down. So the "+34 % headroom" above is an upper bound, not the live prize. 2. **The copies slow the GPU side** (10.3 → 10.6-10.8 ms per window). The refill traffic shares the x8 links with the per-layer handshake and KV streaming. The slots also take 7-13 % of the expert cache. **What we think a winning version needs:** clear *all* of a layer's misses so its CPU round trip disappears, and schedule copies into bus-idle time. With a layer split, for example, use the other card's link while one card computes its half. Boxes with more misses per layer (single 24 GB cards) sit where the per-miss price did hold in our test, so it may look better there. That's untested, and measurements from such setups would be welcome.
Author
Owner

@Niko1221 commented on GitHub (Oct 8, 2026):

Thanks @q8atnight for the swap space, the verify mode and the honest follow-up. The three swap-space commits are in 0.1.41 with your authorship kept, off by default (STRATA_FS_SLOTS).

Two things on top. The router look-ahead we already had (RouterLookahead, which only warmed file pages) now also feeds the slots: its next-layer predictions are copied into them (STRATA_FS_AHEAD, on whenever the swap space is on), so there is one prefetch design, not two. And the slot state sits behind a mutex now, since the pool thread and the look-ahead thread both use it.

Correctness: STRATA_FS_VERIFY=1 on an RTX 5070 (Q2_0, Windows) read back 2,324 landed slots, 0 bad.

Speed, 4 slots per layer, the cache giving up the VRAM they take, 6 interleaved pairs of whole engine runs, 200-token greedy answers, median decode tok/s of on / off (pairs faster): RTX 3060 + IQ3_XXS 0.95 with misses only (0/6), 0.91 with the look-ahead (0/6); Tesla P100 + IQ3_XXS 0.97 (2/6) and 1.00 (4/6), 16 slots 0.96 (0/6); RTX 5070 + Q2_0 0.98 (1/6). That is what you found: below about one miss per layer-window the CPU round trip stays and the smaller cache costs more than the slots return. So it stays opt-in. A single 24 GB card with several misses per layer-window is where it could pay, and we have none: if someone runs it there, the engine prints the counters (foresight swap: ... served from the swap space, ... copies) at the end of each request.

<!-- gh-comment-id:6059655133 --> @Niko1221 commented on GitHub (Oct 8, 2026): Thanks @q8atnight for the swap space, the verify mode and the honest follow-up. The three swap-space commits are in 0.1.41 with your authorship kept, off by default (`STRATA_FS_SLOTS`). Two things on top. The router look-ahead we already had (`RouterLookahead`, which only warmed file pages) now also feeds the slots: its next-layer predictions are copied into them (`STRATA_FS_AHEAD`, on whenever the swap space is on), so there is one prefetch design, not two. And the slot state sits behind a mutex now, since the pool thread and the look-ahead thread both use it. Correctness: `STRATA_FS_VERIFY=1` on an RTX 5070 (Q2_0, Windows) read back 2,324 landed slots, 0 bad. Speed, 4 slots per layer, the cache giving up the VRAM they take, 6 interleaved pairs of whole engine runs, 200-token greedy answers, median decode tok/s of on / off (pairs faster): RTX 3060 + IQ3_XXS 0.95 with misses only (0/6), 0.91 with the look-ahead (0/6); Tesla P100 + IQ3_XXS 0.97 (2/6) and 1.00 (4/6), 16 slots 0.96 (0/6); RTX 5070 + Q2_0 0.98 (1/6). That is what you found: below about one miss per layer-window the CPU round trip stays and the smaller cache costs more than the slots return. So it stays opt-in. A single 24 GB card with several misses per layer-window is where it could pay, and we have none: if someone runs it there, the engine prints the counters (`foresight swap: ... served from the swap space, ... copies`) at the end of each request.
Author
Owner

@q8atnight commented on GitHub (Oct 8, 2026):

Thanks for keeping the authorship, and for the RouterLookahead feed on top — one prefetch design is the right shape, and the mutex
was a real hole: we hit the same "two threads, one slot table" corner ourselves when the pool thread and our dump
recorder overlapped.

Your rows match ours exactly. Every rig you measured sits below one miss per layer-window, and that is precisely where our live box also
sits: the swap space is correct and the misses drop 21–39 %, but decode stays flat because the cost is per
layer-with-any-CPU-expert, not per miss. Your "single 24 GB card with several misses per layer-window" is a class we DO have: our
elastic pair (https://github.com/Niko1221/Strata/pull/1461) runs a whole IQ3_S engine on one 24 GB card with the experts from RAM,
which is a many-misses box by construction. We will run stock 0.1.41 there — STRATA_FS_SLOTS=4, STRATA_FS_VERIFY=1 once, your
end-of-request counters, interleaved on/off pairs at greedy 200 tokens — and post the rows here in our next maintenance window.

One question about STRATA_DBG_FEAT (the routing + hidden-state prefill hooks from 6c51a295): is that meant as the on-ramp for a
content-aware predictor — predicting from the hidden state what the next layer will route to, rather than the previous layer's output?
Our Part-2 study (the dump + Scout replay described in this issue's follow-up) found the recency-style
predictors cap around +5–7 % decode and a content-aware predictor is where the open +25 % sits; the trained Scout we
tried didn't transfer across sessions, but a hidden-state predictor trained per model rather than per session is a
different animal. If the hooks are headed there, we have the dump format, ~60 GB of recorded real sessions, and the
replay tooling on the foresight branch to share.

<!-- gh-comment-id:6063965584 --> @q8atnight commented on GitHub (Oct 8, 2026): Thanks for keeping the authorship, and for the `RouterLookahead` feed on top — one prefetch design is the right shape, and the mutex was a real hole: we hit the same "two threads, one slot table" corner ourselves when the pool thread and our dump recorder overlapped. Your rows match ours exactly. Every rig you measured sits below one miss per layer-window, and that is precisely where our live box also sits: the swap space is correct and the misses drop 21–39 %, but decode stays flat because the cost is per layer-with-any-CPU-expert, not per miss. Your "single 24 GB card with several misses per layer-window" is a class we DO have: our elastic pair (https://github.com/Niko1221/Strata/pull/1461) runs a whole IQ3_S engine on one 24 GB card with the experts from RAM, which is a many-misses box by construction. We will run stock 0.1.41 there — `STRATA_FS_SLOTS=4`, `STRATA_FS_VERIFY=1` once, your end-of-request counters, interleaved on/off pairs at greedy 200 tokens — and post the rows here in our next maintenance window. One question about `STRATA_DBG_FEAT` (the routing + hidden-state prefill hooks from `6c51a295`): is that meant as the on-ramp for a content-aware predictor — predicting from the hidden state what the next layer will route to, rather than the previous layer's output? Our Part-2 study (the dump + Scout replay described in this issue's follow-up) found the recency-style predictors cap around +5–7 % decode and a content-aware predictor is where the open +25 % sits; the trained Scout we tried didn't transfer across sessions, but a hidden-state predictor trained per model rather than per session is a different animal. If the hooks are headed there, we have the dump format, ~60 GB of recorded real sessions, and the replay tooling on the `foresight` branch to share.
Author
Owner

@q8atnight commented on GitHub (Oct 8, 2026):

Rows for the single-24 GB case, as promised. Stock v0.1.41 (fb58e0db, no patches), one RTX 3090 (24 GB, PCIe 4.0 x8), IQ3_S (GSQ-RCO), experts from pinned RAM, --expert-cache auto --spec 4 --mtp --kv int8 --pcie-frac 0, no vision. Greedy, 200 tokens, three prompts (short code, short prose, ~8K-token code context), 2 reps per prompt per engine start, whole-engine restarts for every arm, on/off interleaved. STRATA_DECODE_TIMING=1 for the miss counts.

This card is in the class you asked for: decode hit rate 84–87 %, 3.0–3.8 CPU experts per layer-window (3.8–4.9 entries), vs ~0.85 on our 2-card box.

4 slots per layer (look-ahead on, the default), 4 interleaved pairs, --vram-reserve-mib 1500:

pair off on on/off
1 94.1 88.8 0.944
2 92.5 87.8 0.950
3 94.3 89.7 0.951
4 95.0 89.7 0.944

Median 0.947, 0/4. Hit rate 86.6 → 88.2 %, CPU experts per layer-window 3.04 → 2.85, but per-layer host time 7.16 → 8.64 ms and ms/window 24.2 → 25.9.
Counters at the end of one on-arm (cumulative over its 9 requests): 11065 experts served from the swap space, 24645 copies (19298 from the router look-ahead), 8082 not landed yet, 150709 no free slot, 99361 over budget.

STRATA_FS_AHEAD=0 is a real kill switch (0 from the router look-ahead, 0 not landed yet) and it is the better setting here: 4 slots → 93.2 (≈ 0.99 of off, one start), more experts served from the slots (13,102 vs ~11,000) with fewer copies (22,298), "no free slot" 151K → 64K. So on this card the look-ahead's ~19K copies mostly crowd the 4 slots — 4 per layer is far too few for ~4 misses per window plus predictions.

More slots, look-ahead off (--vram-reserve-mib 3000 for all arms, so the main cache is 7,508 slots and misses are higher):

arm t/s hit CPU experts / layer-window
off 90.9, 90.0 84.0–84.8 % 3.41–3.63
4 slots, ahead 0 89.8 86.1 % 3.30
16 slots, ahead 0 89.2, 87.6 85.9–86.7 % 3.14–3.16

16 slots serve ~21K experts with ~10K "no free slot" (the slots are finally big enough), misses drop ~13 %, but decode still 0.97–0.98. Same picture as on our live box, just with more misses: the slots remove some of a layer's CPU experts, rarely all of them, so the per-layer CPU round trip stays and the copies cost a little on the GPU side.

STRATA_FS_VERIFY=1 (4 slots, look-ahead on): verified 8566 ok / 0 BAD. Decode drops to 80 t/s with verify on, as expected for the read-back.

One snag you may want to know: with --expert-cache auto and the default reserve, turning the slots on made the FIRST request fail with verify: instantiate: out of memory (the cache had filled the card to ~50 MiB free; the slots' VRAM is apparently not counted when the cache is sized). --vram-reserve-mib 1500 fixed it for 4 slots, 3000 for 16. A user flipping STRATA_FS_SLOTS on a full card hits that before any speed question.

Free RAM unchanged between arms (65.3–65.7 GB available). Prompt reads were from the conversation cache in these runs, so this says nothing about prefill.

So, short version: even at 3–4 misses per layer-window on a single 24 GB card, the swap space doesn't win in its current form (best 0.98–0.99 with the look-ahead off). If it is ever to pay, I think it has to clear whole layers of misses, not some of each — happy to run another variant on this card if you want to try one.

<!-- gh-comment-id:6066834582 --> @q8atnight commented on GitHub (Oct 8, 2026): Rows for the single-24 GB case, as promised. Stock v0.1.41 (`fb58e0db`, no patches), one RTX 3090 (24 GB, PCIe 4.0 x8), IQ3_S (GSQ-RCO), experts from pinned RAM, `--expert-cache auto --spec 4 --mtp --kv int8 --pcie-frac 0`, no vision. Greedy, 200 tokens, three prompts (short code, short prose, ~8K-token code context), 2 reps per prompt per engine start, whole-engine restarts for every arm, on/off interleaved. `STRATA_DECODE_TIMING=1` for the miss counts. **This card is in the class you asked for:** decode hit rate 84–87 %, **3.0–3.8 CPU experts per layer-window** (3.8–4.9 entries), vs ~0.85 on our 2-card box. **4 slots per layer (look-ahead on, the default), 4 interleaved pairs, `--vram-reserve-mib 1500`:** | pair | off | on | on/off | |---|---|---|---| | 1 | 94.1 | 88.8 | 0.944 | | 2 | 92.5 | 87.8 | 0.950 | | 3 | 94.3 | 89.7 | 0.951 | | 4 | 95.0 | 89.7 | 0.944 | Median **0.947, 0/4**. Hit rate 86.6 → 88.2 %, CPU experts per layer-window 3.04 → 2.85, but per-layer host time 7.16 → 8.64 ms and ms/window 24.2 → 25.9. Counters at the end of one on-arm (cumulative over its 9 requests): `11065 experts served from the swap space, 24645 copies (19298 from the router look-ahead), 8082 not landed yet, 150709 no free slot, 99361 over budget`. **`STRATA_FS_AHEAD=0` is a real kill switch** (`0 from the router look-ahead`, `0 not landed yet`) and it is the better setting here: 4 slots → 93.2 (≈ 0.99 of off, one start), more experts served from the slots (13,102 vs ~11,000) with fewer copies (22,298), "no free slot" 151K → 64K. So on this card the look-ahead's ~19K copies mostly crowd the 4 slots — 4 per layer is far too few for ~4 misses per window plus predictions. **More slots, look-ahead off** (`--vram-reserve-mib 3000` for all arms, so the main cache is 7,508 slots and misses are higher): | arm | t/s | hit | CPU experts / layer-window | |---|---|---|---| | off | 90.9, 90.0 | 84.0–84.8 % | 3.41–3.63 | | 4 slots, ahead 0 | 89.8 | 86.1 % | 3.30 | | 16 slots, ahead 0 | 89.2, 87.6 | 85.9–86.7 % | 3.14–3.16 | 16 slots serve ~21K experts with ~10K "no free slot" (the slots are finally big enough), misses drop ~13 %, but decode still 0.97–0.98. Same picture as on our live box, just with more misses: the slots remove some of a layer's CPU experts, rarely all of them, so the per-layer CPU round trip stays and the copies cost a little on the GPU side. **`STRATA_FS_VERIFY=1`** (4 slots, look-ahead on): `verified 8566 ok / 0 BAD`. Decode drops to 80 t/s with verify on, as expected for the read-back. **One snag you may want to know:** with `--expert-cache auto` and the default reserve, turning the slots on made the FIRST request fail with `verify: instantiate: out of memory` (the cache had filled the card to ~50 MiB free; the slots' VRAM is apparently not counted when the cache is sized). `--vram-reserve-mib 1500` fixed it for 4 slots, 3000 for 16. A user flipping `STRATA_FS_SLOTS` on a full card hits that before any speed question. Free RAM unchanged between arms (65.3–65.7 GB available). Prompt reads were from the conversation cache in these runs, so this says nothing about prefill. So, short version: even at 3–4 misses per layer-window on a single 24 GB card, the swap space doesn't win in its current form (best 0.98–0.99 with the look-ahead off). If it is ever to pay, I think it has to clear whole layers of misses, not some of each — happy to run another variant on this card if you want to try one.
Author
Owner

@MarsLuay commented on GitHub (Oct 13, 2026):

I measured the opt-in foresight swap path on my mixed RTX 3080 Ti 12 GB + Tesla V100 32 GB PCIe pair using Strata v0.1.43.1 CUDA 12. Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S; manual --layer-split 28 --trim-stage-weights; no conversation cache or pipeline windows; 10,065-token prompts; 128 greedy output tokens; two measured requests after warm-up.

Environment:

STRATA_FS_SLOTS=4
STRATA_FS_VERIFY=1
STRATA_DECODE_TIMING=1

The two foresight-on requests reported:

prompt: 1,450.9 / 1,486.5 tok/s (mean 1,468.7)
decode: 74.5 / 77.0 tok/s (mean 75.8)

The corresponding two-run K=28/no-foresight sample on the same release was 68.4 / 72.0 tok/s decode (mean 70.2), so this small sample was about +8%, but it is not a six-pair interleaved result.

Swap counters for the two long requests were:

119 experts served from swap, 412 copies, 0 from router look-ahead,
74 verified OK / 0 BAD
174 experts served from swap, 778 copies, 0 from router look-ahead,
123 verified OK / 0 BAD

Decode timing showed, respectively, 1.72 / 1.17 CPU experts per layer-window, 11.17 / 12.90 VRAM hits, and 0.33 / 0.29 PCIe reads. The V100 stage had about 27 GiB free for its cache, so this is not the same as the proposed single 24 GB card case; the result does show that the swap/verification path was correct on this mixed pair. No bad landed slots or request errors occurred.

<!-- gh-comment-id:6138300315 --> @MarsLuay commented on GitHub (Oct 13, 2026): I measured the opt-in foresight swap path on my mixed **RTX 3080 Ti 12 GB + Tesla V100 32 GB PCIe** pair using **Strata v0.1.43.1 CUDA 12**. Model: Qwen3.8-Flash-Next GSQ-RCO IQ3_S; manual `--layer-split 28 --trim-stage-weights`; no conversation cache or pipeline windows; 10,065-token prompts; 128 greedy output tokens; two measured requests after warm-up. Environment: ```text STRATA_FS_SLOTS=4 STRATA_FS_VERIFY=1 STRATA_DECODE_TIMING=1 ``` The two foresight-on requests reported: ```text prompt: 1,450.9 / 1,486.5 tok/s (mean 1,468.7) decode: 74.5 / 77.0 tok/s (mean 75.8) ``` The corresponding two-run K=28/no-foresight sample on the same release was **68.4 / 72.0 tok/s** decode (mean **70.2**), so this small sample was about **+8%**, but it is not a six-pair interleaved result. Swap counters for the two long requests were: ```text 119 experts served from swap, 412 copies, 0 from router look-ahead, 74 verified OK / 0 BAD 174 experts served from swap, 778 copies, 0 from router look-ahead, 123 verified OK / 0 BAD ``` Decode timing showed, respectively, **1.72 / 1.17 CPU experts per layer-window**, **11.17 / 12.90 VRAM hits**, and **0.33 / 0.29 PCIe reads**. The V100 stage had about 27 GiB free for its cache, so this is not the same as the proposed single 24 GB card case; the result does show that the swap/verification path was correct on this mixed pair. No bad landed slots or request errors occurred.
Author
Owner

@Niko1221 commented on GitHub (Oct 13, 2026):

Thanks for the report. To keep the tracker current we are closing issues older than three days: 0.1.44 is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1.

If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.

<!-- gh-comment-id:6156064507 --> @Niko1221 commented on GitHub (Oct 13, 2026): Thanks for the report. To keep the tracker current we are closing issues older than three days: [0.1.44](https://github.com/Niko1221/Strata/releases/tag/v0.1.44) is out with a long list of fixes, and many older reports are covered by it or by 0.1.43.1. If this still happens on 0.1.44, please leave a comment here with your engine log (and the version line it prints), and we will reopen it. A new issue that links this one works too.
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#545
No description provided.